1 //------------------------------------------------------------------------------
2 // emCursor.h
3 //
4 // Copyright (C) 2005-2012 Oliver Hamann.
5 //
6 // Homepage: http://eaglemode.sourceforge.net/
7 //
8 // This program is free software: you can redistribute it and/or modify it under
9 // the terms of the GNU General Public License version 3 as published by the
10 // Free Software Foundation.
11 //
12 // This program is distributed in the hope that it will be useful, but WITHOUT
13 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 // FOR A PARTICULAR PURPOSE. See the GNU General Public License version 3 for
15 // more details.
16 //
17 // You should have received a copy of the GNU General Public License version 3
18 // along with this program. If not, see <http://www.gnu.org/licenses/>.
19 //------------------------------------------------------------------------------
20 
21 #ifndef emCursor_h
22 #define emCursor_h
23 
24 #ifndef emStd2_h
25 #include <emCore/emStd2.h>
26 #endif
27 
28 
29 //==============================================================================
30 //================================== emCursor ==================================
31 //==============================================================================
32 
33 class emCursor {
34 
35 public:
36 
37 	// Class for a mouse cursor.
38 
39 	//??? Allow custom cursors (e.g. construct from an image and
40 	//??? hot spot coordinates, or from a file).
41 
42 	enum {
43 		// Possible values for the cursor id.
44 		NORMAL                   = 0,
45 		INVISIBLE                = 1,
46 		WAIT                     = 2,
47 		CROSSHAIR                = 3,
48 		TEXT                     = 4,
49 		HAND                     = 5,
50 		LEFT_RIGHT_ARROW         = 6,
51 		UP_DOWN_ARROW            = 7,
52 		LEFT_RIGHT_UP_DOWN_ARROW = 8
53 	};
54 
55 	emCursor();
56 		// Construct a normal cursor.
57 
58 	emCursor(int cursorId);
59 		// Construct from a cursor id.
60 
61 	emCursor(const emCursor & cursor);
62 		// Copy constructor.
63 
64 	emCursor & operator = (const emCursor & cursor);
65 	emCursor & operator = (int cursorId);
66 		// Copy operators.
67 
68 	operator int () const;
69 	int Get() const;
70 		// Get the cursor id.
71 
72 	const char * ToString() const;
73 		// Convert to string representation.
74 
75 private:
76 
77 	int CursorId;
78 };
79 
emCursor()80 inline emCursor::emCursor()
81 {
82 	CursorId=NORMAL;
83 }
84 
emCursor(int cursorId)85 inline emCursor::emCursor(int cursorId)
86 {
87 	CursorId=cursorId;
88 }
89 
emCursor(const emCursor & cursor)90 inline emCursor::emCursor(const emCursor & cursor)
91 {
92 	CursorId=cursor.CursorId;
93 }
94 
95 inline emCursor & emCursor::operator = (const emCursor & cursor)
96 {
97 	CursorId=cursor.CursorId;
98 	return *this;
99 }
100 
101 inline emCursor & emCursor::operator = (int cursorId)
102 {
103 	CursorId=cursorId;
104 	return *this;
105 }
106 
107 inline emCursor::operator int () const
108 {
109 	return CursorId;
110 }
111 
Get()112 inline int emCursor::Get() const
113 {
114 	return CursorId;
115 }
116 
117 
118 #endif
119