aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/irrlicht-1.8/include/ICursorControl.h
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/irrlicht-1.8/include/ICursorControl.h')
-rw-r--r--libraries/irrlicht-1.8/include/ICursorControl.h384
1 files changed, 192 insertions, 192 deletions
diff --git a/libraries/irrlicht-1.8/include/ICursorControl.h b/libraries/irrlicht-1.8/include/ICursorControl.h
index 83c6245..c52f81f 100644
--- a/libraries/irrlicht-1.8/include/ICursorControl.h
+++ b/libraries/irrlicht-1.8/include/ICursorControl.h
@@ -1,192 +1,192 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt 1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine". 2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h 3// For conditions of distribution and use, see copyright notice in irrlicht.h
4 4
5#ifndef __I_CURSOR_CONTROL_H_INCLUDED__ 5#ifndef __I_CURSOR_CONTROL_H_INCLUDED__
6#define __I_CURSOR_CONTROL_H_INCLUDED__ 6#define __I_CURSOR_CONTROL_H_INCLUDED__
7 7
8#include "IReferenceCounted.h" 8#include "IReferenceCounted.h"
9#include "position2d.h" 9#include "position2d.h"
10#include "rect.h" 10#include "rect.h"
11 11
12namespace irr 12namespace irr
13{ 13{
14namespace gui 14namespace gui
15{ 15{
16 16
17 class IGUISpriteBank; 17 class IGUISpriteBank;
18 18
19 //! Default icons for cursors 19 //! Default icons for cursors
20 enum ECURSOR_ICON 20 enum ECURSOR_ICON
21 { 21 {
22 // Following cursors might be system specific, or might use an Irrlicht icon-set. No guarantees so far. 22 // Following cursors might be system specific, or might use an Irrlicht icon-set. No guarantees so far.
23 ECI_NORMAL, // arrow 23 ECI_NORMAL, // arrow
24 ECI_CROSS, // Crosshair 24 ECI_CROSS, // Crosshair
25 ECI_HAND, // Hand 25 ECI_HAND, // Hand
26 ECI_HELP, // Arrow and question mark 26 ECI_HELP, // Arrow and question mark
27 ECI_IBEAM, // typical text-selection cursor 27 ECI_IBEAM, // typical text-selection cursor
28 ECI_NO, // should not click icon 28 ECI_NO, // should not click icon
29 ECI_WAIT, // hourclass 29 ECI_WAIT, // hourclass
30 ECI_SIZEALL, // arrow in all directions 30 ECI_SIZEALL, // arrow in all directions
31 ECI_SIZENESW, // resizes in direction north-east or south-west 31 ECI_SIZENESW, // resizes in direction north-east or south-west
32 ECI_SIZENWSE, // resizes in direction north-west or south-east 32 ECI_SIZENWSE, // resizes in direction north-west or south-east
33 ECI_SIZENS, // resizes in direction north or south 33 ECI_SIZENS, // resizes in direction north or south
34 ECI_SIZEWE, // resizes in direction west or east 34 ECI_SIZEWE, // resizes in direction west or east
35 ECI_UP, // up-arrow 35 ECI_UP, // up-arrow
36 36
37 // Implementer note: Should we add system specific cursors, which use guaranteed the system icons, 37 // Implementer note: Should we add system specific cursors, which use guaranteed the system icons,
38 // then I would recommend using a naming scheme like ECI_W32_CROSS, ECI_X11_CROSSHAIR and adding those 38 // then I would recommend using a naming scheme like ECI_W32_CROSS, ECI_X11_CROSSHAIR and adding those
39 // additionally. 39 // additionally.
40 40
41 ECI_COUNT // maximal of defined cursors. Note that higher values can be created at runtime 41 ECI_COUNT // maximal of defined cursors. Note that higher values can be created at runtime
42 }; 42 };
43 43
44 //! Names for ECURSOR_ICON 44 //! Names for ECURSOR_ICON
45 const c8* const GUICursorIconNames[ECI_COUNT+1] = 45 const c8* const GUICursorIconNames[ECI_COUNT+1] =
46 { 46 {
47 "normal", 47 "normal",
48 "cross", 48 "cross",
49 "hand", 49 "hand",
50 "help", 50 "help",
51 "ibeam", 51 "ibeam",
52 "no", 52 "no",
53 "wait", 53 "wait",
54 "sizeall", 54 "sizeall",
55 "sizenesw", 55 "sizenesw",
56 "sizenwse", 56 "sizenwse",
57 "sizens", 57 "sizens",
58 "sizewe", 58 "sizewe",
59 "sizeup", 59 "sizeup",
60 0 60 0
61 }; 61 };
62 62
63 //! structure used to set sprites as cursors. 63 //! structure used to set sprites as cursors.
64 struct SCursorSprite 64 struct SCursorSprite
65 { 65 {
66 SCursorSprite() 66 SCursorSprite()
67 : SpriteBank(0), SpriteId(-1) 67 : SpriteBank(0), SpriteId(-1)
68 { 68 {
69 } 69 }
70 70
71 SCursorSprite( gui::IGUISpriteBank * spriteBank, s32 spriteId, const core::position2d<s32> &hotspot=core::position2d<s32>(0,0) ) 71 SCursorSprite( gui::IGUISpriteBank * spriteBank, s32 spriteId, const core::position2d<s32> &hotspot=core::position2d<s32>(0,0) )
72 : SpriteBank(spriteBank), SpriteId(spriteId), HotSpot(hotspot) 72 : SpriteBank(spriteBank), SpriteId(spriteId), HotSpot(hotspot)
73 { 73 {
74 } 74 }
75 75
76 gui::IGUISpriteBank * SpriteBank; 76 gui::IGUISpriteBank * SpriteBank;
77 s32 SpriteId; 77 s32 SpriteId;
78 core::position2d<s32> HotSpot; 78 core::position2d<s32> HotSpot;
79 }; 79 };
80 80
81 //! platform specific behavior flags for the cursor 81 //! platform specific behavior flags for the cursor
82 enum ECURSOR_PLATFORM_BEHAVIOR 82 enum ECURSOR_PLATFORM_BEHAVIOR
83 { 83 {
84 //! default - no platform specific behavior 84 //! default - no platform specific behavior
85 ECPB_NONE = 0, 85 ECPB_NONE = 0,
86 86
87 //! On X11 try caching cursor updates as XQueryPointer calls can be expensive. 87 //! On X11 try caching cursor updates as XQueryPointer calls can be expensive.
88 /** Update cursor positions only when the irrlicht timer has been updated or the timer is stopped. 88 /** Update cursor positions only when the irrlicht timer has been updated or the timer is stopped.
89 This means you usually get one cursor update per device->run() which will be fine in most cases. 89 This means you usually get one cursor update per device->run() which will be fine in most cases.
90 See this forum-thread for a more detailed explanation: 90 See this forum-thread for a more detailed explanation:
91 http://irrlicht.sourceforge.net/forum/viewtopic.php?f=7&t=45525 91 http://irrlicht.sourceforge.net/forum/viewtopic.php?f=7&t=45525
92 */ 92 */
93 ECPB_X11_CACHE_UPDATES = 1 93 ECPB_X11_CACHE_UPDATES = 1
94 }; 94 };
95 95
96 //! Interface to manipulate the mouse cursor. 96 //! Interface to manipulate the mouse cursor.
97 class ICursorControl : public virtual IReferenceCounted 97 class ICursorControl : public virtual IReferenceCounted
98 { 98 {
99 public: 99 public:
100 100
101 //! Changes the visible state of the mouse cursor. 101 //! Changes the visible state of the mouse cursor.
102 /** \param visible: The new visible state. If true, the cursor will be visible, 102 /** \param visible: The new visible state. If true, the cursor will be visible,
103 if false, it will be invisible. */ 103 if false, it will be invisible. */
104 virtual void setVisible(bool visible) = 0; 104 virtual void setVisible(bool visible) = 0;
105 105
106 //! Returns if the cursor is currently visible. 106 //! Returns if the cursor is currently visible.
107 /** \return True if the cursor is visible, false if not. */ 107 /** \return True if the cursor is visible, false if not. */
108 virtual bool isVisible() const = 0; 108 virtual bool isVisible() const = 0;
109 109
110 //! Sets the new position of the cursor. 110 //! Sets the new position of the cursor.
111 /** The position must be 111 /** The position must be
112 between (0.0f, 0.0f) and (1.0f, 1.0f), where (0.0f, 0.0f) is 112 between (0.0f, 0.0f) and (1.0f, 1.0f), where (0.0f, 0.0f) is
113 the top left corner and (1.0f, 1.0f) is the bottom right corner of the 113 the top left corner and (1.0f, 1.0f) is the bottom right corner of the
114 render window. 114 render window.
115 \param pos New position of the cursor. */ 115 \param pos New position of the cursor. */
116 virtual void setPosition(const core::position2d<f32> &pos) = 0; 116 virtual void setPosition(const core::position2d<f32> &pos) = 0;
117 117
118 //! Sets the new position of the cursor. 118 //! Sets the new position of the cursor.
119 /** The position must be 119 /** The position must be
120 between (0.0f, 0.0f) and (1.0f, 1.0f), where (0.0f, 0.0f) is 120 between (0.0f, 0.0f) and (1.0f, 1.0f), where (0.0f, 0.0f) is
121 the top left corner and (1.0f, 1.0f) is the bottom right corner of the 121 the top left corner and (1.0f, 1.0f) is the bottom right corner of the
122 render window. 122 render window.
123 \param x New x-coord of the cursor. 123 \param x New x-coord of the cursor.
124 \param y New x-coord of the cursor. */ 124 \param y New x-coord of the cursor. */
125 virtual void setPosition(f32 x, f32 y) = 0; 125 virtual void setPosition(f32 x, f32 y) = 0;
126 126
127 //! Sets the new position of the cursor. 127 //! Sets the new position of the cursor.
128 /** \param pos: New position of the cursor. The coordinates are pixel units. */ 128 /** \param pos: New position of the cursor. The coordinates are pixel units. */
129 virtual void setPosition(const core::position2d<s32> &pos) = 0; 129 virtual void setPosition(const core::position2d<s32> &pos) = 0;
130 130
131 //! Sets the new position of the cursor. 131 //! Sets the new position of the cursor.
132 /** \param x New x-coord of the cursor. The coordinates are pixel units. 132 /** \param x New x-coord of the cursor. The coordinates are pixel units.
133 \param y New y-coord of the cursor. The coordinates are pixel units. */ 133 \param y New y-coord of the cursor. The coordinates are pixel units. */
134 virtual void setPosition(s32 x, s32 y) = 0; 134 virtual void setPosition(s32 x, s32 y) = 0;
135 135
136 //! Returns the current position of the mouse cursor. 136 //! Returns the current position of the mouse cursor.
137 /** \return Returns the current position of the cursor. The returned position 137 /** \return Returns the current position of the cursor. The returned position
138 is the position of the mouse cursor in pixel units. */ 138 is the position of the mouse cursor in pixel units. */
139 virtual const core::position2d<s32>& getPosition() = 0; 139 virtual const core::position2d<s32>& getPosition() = 0;
140 140
141 //! Returns the current position of the mouse cursor. 141 //! Returns the current position of the mouse cursor.
142 /** \return Returns the current position of the cursor. The returned position 142 /** \return Returns the current position of the cursor. The returned position
143 is a value between (0.0f, 0.0f) and (1.0f, 1.0f), where (0.0f, 0.0f) is 143 is a value between (0.0f, 0.0f) and (1.0f, 1.0f), where (0.0f, 0.0f) is
144 the top left corner and (1.0f, 1.0f) is the bottom right corner of the 144 the top left corner and (1.0f, 1.0f) is the bottom right corner of the
145 render window. */ 145 render window. */
146 virtual core::position2d<f32> getRelativePosition() = 0; 146 virtual core::position2d<f32> getRelativePosition() = 0;
147 147
148 //! Sets an absolute reference rect for setting and retrieving the cursor position. 148 //! Sets an absolute reference rect for setting and retrieving the cursor position.
149 /** If this rect is set, the cursor position is not being calculated relative to 149 /** If this rect is set, the cursor position is not being calculated relative to
150 the rendering window but to this rect. You can set the rect pointer to 0 to disable 150 the rendering window but to this rect. You can set the rect pointer to 0 to disable
151 this feature again. This feature is useful when rendering into parts of foreign windows 151 this feature again. This feature is useful when rendering into parts of foreign windows
152 for example in an editor. 152 for example in an editor.
153 \param rect: A pointer to an reference rectangle or 0 to disable the reference rectangle.*/ 153 \param rect: A pointer to an reference rectangle or 0 to disable the reference rectangle.*/
154 virtual void setReferenceRect(core::rect<s32>* rect=0) = 0; 154 virtual void setReferenceRect(core::rect<s32>* rect=0) = 0;
155 155
156 156
157 //! Sets the active cursor icon 157 //! Sets the active cursor icon
158 /** Setting cursor icons is so far only supported on Win32 and Linux */ 158 /** Setting cursor icons is so far only supported on Win32 and Linux */
159 virtual void setActiveIcon(ECURSOR_ICON iconId) {} 159 virtual void setActiveIcon(ECURSOR_ICON iconId) {}
160 160
161 //! Gets the currently active icon 161 //! Gets the currently active icon
162 virtual ECURSOR_ICON getActiveIcon() const { return gui::ECI_NORMAL; } 162 virtual ECURSOR_ICON getActiveIcon() const { return gui::ECI_NORMAL; }
163 163
164 //! Add a custom sprite as cursor icon. 164 //! Add a custom sprite as cursor icon.
165 /** \return Identification for the icon */ 165 /** \return Identification for the icon */
166 virtual ECURSOR_ICON addIcon(const gui::SCursorSprite& icon) { return gui::ECI_NORMAL; } 166 virtual ECURSOR_ICON addIcon(const gui::SCursorSprite& icon) { return gui::ECI_NORMAL; }
167 167
168 //! replace a cursor icon. 168 //! replace a cursor icon.
169 /** Changing cursor icons is so far only supported on Win32 and Linux 169 /** Changing cursor icons is so far only supported on Win32 and Linux
170 Note that this only changes the icons within your application, system cursors outside your 170 Note that this only changes the icons within your application, system cursors outside your
171 application will not be affected. 171 application will not be affected.
172 */ 172 */
173 virtual void changeIcon(ECURSOR_ICON iconId, const gui::SCursorSprite& sprite) {} 173 virtual void changeIcon(ECURSOR_ICON iconId, const gui::SCursorSprite& sprite) {}
174 174
175 //! Return a system-specific size which is supported for cursors. Larger icons will fail, smaller icons might work. 175 //! Return a system-specific size which is supported for cursors. Larger icons will fail, smaller icons might work.
176 virtual core::dimension2di getSupportedIconSize() const { return core::dimension2di(0,0); } 176 virtual core::dimension2di getSupportedIconSize() const { return core::dimension2di(0,0); }
177 177
178 //! Set platform specific behavior flags. 178 //! Set platform specific behavior flags.
179 virtual void setPlatformBehavior(ECURSOR_PLATFORM_BEHAVIOR behavior) {} 179 virtual void setPlatformBehavior(ECURSOR_PLATFORM_BEHAVIOR behavior) {}
180 180
181 //! Return platform specific behavior. 181 //! Return platform specific behavior.
182 /** \return Behavior set by setPlatformBehavior or ECPB_NONE for platforms not implementing specific behaviors. 182 /** \return Behavior set by setPlatformBehavior or ECPB_NONE for platforms not implementing specific behaviors.
183 */ 183 */
184 virtual ECURSOR_PLATFORM_BEHAVIOR getPlatformBehavior() const { return ECPB_NONE; } 184 virtual ECURSOR_PLATFORM_BEHAVIOR getPlatformBehavior() const { return ECPB_NONE; }
185 }; 185 };
186 186
187 187
188} // end namespace gui 188} // end namespace gui
189} // end namespace irr 189} // end namespace irr
190 190
191#endif 191#endif
192 192