[657] | 1 | /************************************************************************
|
---|
| 2 | filename: CEGUIInputEvent.h
|
---|
| 3 | created: 30/5/2004
|
---|
| 4 | author: Paul D Turner
|
---|
| 5 |
|
---|
| 6 | purpose: Defines interface to input event classes
|
---|
| 7 | *************************************************************************/
|
---|
| 8 | /*************************************************************************
|
---|
| 9 | Crazy Eddie's GUI System (http://www.cegui.org.uk)
|
---|
| 10 | Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
|
---|
| 11 |
|
---|
| 12 | This library is free software; you can redistribute it and/or
|
---|
| 13 | modify it under the terms of the GNU Lesser General Public
|
---|
| 14 | License as published by the Free Software Foundation; either
|
---|
| 15 | version 2.1 of the License, or (at your option) any later version.
|
---|
| 16 |
|
---|
| 17 | This library is distributed in the hope that it will be useful,
|
---|
| 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
| 20 | Lesser General Public License for more details.
|
---|
| 21 |
|
---|
| 22 | You should have received a copy of the GNU Lesser General Public
|
---|
| 23 | License along with this library; if not, write to the Free Software
|
---|
| 24 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
| 25 | *************************************************************************/
|
---|
| 26 | #ifndef _CEGUIInputEvent_h_
|
---|
| 27 | #define _CEGUIInputEvent_h_
|
---|
| 28 |
|
---|
| 29 | #include "CEGUIBase.h"
|
---|
| 30 | #include "CEGUIEventArgs.h"
|
---|
| 31 | #include "CEGUIString.h"
|
---|
| 32 | #include "CEGUIVector.h"
|
---|
| 33 |
|
---|
| 34 |
|
---|
| 35 | // Start of CEGUI namespace section
|
---|
| 36 | namespace CEGUI
|
---|
| 37 | {
|
---|
| 38 | /*!
|
---|
| 39 | \brief
|
---|
| 40 | struct to give scope to scan code enumeration.
|
---|
| 41 | */
|
---|
| 42 | struct CEGUIEXPORT Key
|
---|
| 43 | {
|
---|
| 44 | // enumeration of scan codes. Customised from table taken from Ogre, which took them from DirectInput...
|
---|
| 45 | enum Scan
|
---|
| 46 | {
|
---|
| 47 | Escape =0x01,
|
---|
| 48 | One =0x02,
|
---|
| 49 | Two =0x03,
|
---|
| 50 | Three =0x04,
|
---|
| 51 | Four =0x05,
|
---|
| 52 | Five =0x06,
|
---|
| 53 | Six =0x07,
|
---|
| 54 | Seven =0x08,
|
---|
| 55 | Eight =0x09,
|
---|
| 56 | Nine =0x0A,
|
---|
| 57 | Zero =0x0B,
|
---|
| 58 | Minus =0x0C, /* - on main keyboard */
|
---|
| 59 | Equals =0x0D,
|
---|
| 60 | Backspace =0x0E, /* backspace */
|
---|
| 61 | Tab =0x0F,
|
---|
| 62 | Q =0x10,
|
---|
| 63 | W =0x11,
|
---|
| 64 | E =0x12,
|
---|
| 65 | R =0x13,
|
---|
| 66 | T =0x14,
|
---|
| 67 | Y =0x15,
|
---|
| 68 | U =0x16,
|
---|
| 69 | I =0x17,
|
---|
| 70 | O =0x18,
|
---|
| 71 | P =0x19,
|
---|
| 72 | LeftBracket =0x1A,
|
---|
| 73 | RightBracket =0x1B,
|
---|
| 74 | Return =0x1C, /* Enter on main keyboard */
|
---|
| 75 | LeftControl =0x1D,
|
---|
| 76 | A =0x1E,
|
---|
| 77 | S =0x1F,
|
---|
| 78 | D =0x20,
|
---|
| 79 | F =0x21,
|
---|
| 80 | G =0x22,
|
---|
| 81 | H =0x23,
|
---|
| 82 | J =0x24,
|
---|
| 83 | K =0x25,
|
---|
| 84 | L =0x26,
|
---|
| 85 | Semicolon =0x27,
|
---|
| 86 | Apostrophe =0x28,
|
---|
| 87 | Grave =0x29, /* accent grave */
|
---|
| 88 | LeftShift =0x2A,
|
---|
| 89 | Backslash =0x2B,
|
---|
| 90 | Z =0x2C,
|
---|
| 91 | X =0x2D,
|
---|
| 92 | C =0x2E,
|
---|
| 93 | V =0x2F,
|
---|
| 94 | B =0x30,
|
---|
| 95 | N =0x31,
|
---|
| 96 | M =0x32,
|
---|
| 97 | Comma =0x33,
|
---|
| 98 | Period =0x34, /* . on main keyboard */
|
---|
| 99 | Slash =0x35, /* '/' on main keyboard */
|
---|
| 100 | RightShift =0x36,
|
---|
| 101 | Multiply =0x37, /* * on numeric keypad */
|
---|
| 102 | LeftAlt =0x38, /* left Alt */
|
---|
| 103 | Space =0x39,
|
---|
| 104 | Capital =0x3A,
|
---|
| 105 | F1 =0x3B,
|
---|
| 106 | F2 =0x3C,
|
---|
| 107 | F3 =0x3D,
|
---|
| 108 | F4 =0x3E,
|
---|
| 109 | F5 =0x3F,
|
---|
| 110 | F6 =0x40,
|
---|
| 111 | F7 =0x41,
|
---|
| 112 | F8 =0x42,
|
---|
| 113 | F9 =0x43,
|
---|
| 114 | F10 =0x44,
|
---|
| 115 | NumLock =0x45,
|
---|
| 116 | ScrollLock =0x46, /* Scroll Lock */
|
---|
| 117 | Numpad7 =0x47,
|
---|
| 118 | Numpad8 =0x48,
|
---|
| 119 | Numpad9 =0x49,
|
---|
| 120 | Subtract =0x4A, /* - on numeric keypad */
|
---|
| 121 | Numpad4 =0x4B,
|
---|
| 122 | Numpad5 =0x4C,
|
---|
| 123 | Numpad6 =0x4D,
|
---|
| 124 | Add =0x4E, /* + on numeric keypad */
|
---|
| 125 | Numpad1 =0x4F,
|
---|
| 126 | Numpad2 =0x50,
|
---|
| 127 | Numpad3 =0x51,
|
---|
| 128 | Numpad0 =0x52,
|
---|
| 129 | Decimal =0x53, /* . on numeric keypad */
|
---|
| 130 | OEM_102 =0x56, /* < > | on UK/Germany keyboards */
|
---|
| 131 | F11 =0x57,
|
---|
| 132 | F12 =0x58,
|
---|
| 133 | F13 =0x64, /* (NEC PC98) */
|
---|
| 134 | F14 =0x65, /* (NEC PC98) */
|
---|
| 135 | F15 =0x66, /* (NEC PC98) */
|
---|
| 136 | Kana =0x70, /* (Japanese keyboard) */
|
---|
| 137 | ABNT_C1 =0x73, /* / ? on Portugese (Brazilian) keyboards */
|
---|
| 138 | Convert =0x79, /* (Japanese keyboard) */
|
---|
| 139 | NoConvert =0x7B, /* (Japanese keyboard) */
|
---|
| 140 | Yen =0x7D, /* (Japanese keyboard) */
|
---|
| 141 | ABNT_C2 =0x7E, /* Numpad . on Portugese (Brazilian) keyboards */
|
---|
| 142 | NumpadEquals =0x8D, /* = on numeric keypad (NEC PC98) */
|
---|
| 143 | PrevTrack =0x90, /* Previous Track (KC_CIRCUMFLEX on Japanese keyboard) */
|
---|
| 144 | At =0x91, /* (NEC PC98) */
|
---|
| 145 | Colon =0x92, /* (NEC PC98) */
|
---|
| 146 | Underline =0x93, /* (NEC PC98) */
|
---|
| 147 | Kanji =0x94, /* (Japanese keyboard) */
|
---|
| 148 | Stop =0x95, /* (NEC PC98) */
|
---|
| 149 | AX =0x96, /* (Japan AX) */
|
---|
| 150 | Unlabeled =0x97, /* (J3100) */
|
---|
| 151 | NextTrack =0x99, /* Next Track */
|
---|
| 152 | NumpadEnter =0x9C, /* Enter on numeric keypad */
|
---|
| 153 | RightControl =0x9D,
|
---|
| 154 | Mute =0xA0, /* Mute */
|
---|
| 155 | Calculator =0xA1, /* Calculator */
|
---|
| 156 | PlayPause =0xA2, /* Play / Pause */
|
---|
| 157 | MediaStop =0xA4, /* Media Stop */
|
---|
| 158 | VolumeDown =0xAE, /* Volume - */
|
---|
| 159 | VolumeUp =0xB0, /* Volume + */
|
---|
| 160 | WebHome =0xB2, /* Web home */
|
---|
| 161 | NumpadComma =0xB3, /* , on numeric keypad (NEC PC98) */
|
---|
| 162 | Divide =0xB5, /* / on numeric keypad */
|
---|
| 163 | SysRq =0xB7,
|
---|
| 164 | RightAlt =0xB8, /* right Alt */
|
---|
| 165 | Pause =0xC5, /* Pause */
|
---|
| 166 | Home =0xC7, /* Home on arrow keypad */
|
---|
| 167 | ArrowUp =0xC8, /* UpArrow on arrow keypad */
|
---|
| 168 | PageUp =0xC9, /* PgUp on arrow keypad */
|
---|
| 169 | ArrowLeft =0xCB, /* LeftArrow on arrow keypad */
|
---|
| 170 | ArrowRight =0xCD, /* RightArrow on arrow keypad */
|
---|
| 171 | End =0xCF, /* End on arrow keypad */
|
---|
| 172 | ArrowDown =0xD0, /* DownArrow on arrow keypad */
|
---|
| 173 | PageDown =0xD1, /* PgDn on arrow keypad */
|
---|
| 174 | Insert =0xD2, /* Insert on arrow keypad */
|
---|
| 175 | Delete =0xD3, /* Delete on arrow keypad */
|
---|
| 176 | LeftWindows =0xDB, /* Left Windows key */
|
---|
| 177 | RightWindow =0xDC, /* Right Windows key */
|
---|
| 178 | RightWindows =0xDC, /* Right Windows key - Correct spelling :) */
|
---|
| 179 | AppMenu =0xDD, /* AppMenu key */
|
---|
| 180 | Power =0xDE, /* System Power */
|
---|
| 181 | Sleep =0xDF, /* System Sleep */
|
---|
| 182 | Wake =0xE3, /* System Wake */
|
---|
| 183 | WebSearch =0xE5, /* Web Search */
|
---|
| 184 | WebFavorites =0xE6, /* Web Favorites */
|
---|
| 185 | WebRefresh =0xE7, /* Web Refresh */
|
---|
| 186 | WebStop =0xE8, /* Web Stop */
|
---|
| 187 | WebForward =0xE9, /* Web Forward */
|
---|
| 188 | WebBack =0xEA, /* Web Back */
|
---|
| 189 | MyComputer =0xEB, /* My Computer */
|
---|
| 190 | Mail =0xEC, /* Mail */
|
---|
| 191 | MediaSelect =0xED /* Media Select */
|
---|
| 192 | };
|
---|
| 193 |
|
---|
| 194 | };
|
---|
| 195 |
|
---|
| 196 |
|
---|
| 197 | /*!
|
---|
| 198 | /brief
|
---|
| 199 | Enumeration of mouse buttons
|
---|
| 200 | */
|
---|
| 201 | enum MouseButton
|
---|
| 202 | {
|
---|
| 203 | LeftButton,
|
---|
| 204 | RightButton,
|
---|
| 205 | MiddleButton,
|
---|
| 206 | X1Button,
|
---|
| 207 | X2Button,
|
---|
| 208 | MouseButtonCount, //<! Dummy value that is == to the maximum number of mouse buttons supported.
|
---|
| 209 | NoButton //!< Value set for no mouse button. NB: This is not 0, do not assume!
|
---|
| 210 | };
|
---|
| 211 |
|
---|
| 212 |
|
---|
| 213 | /*!
|
---|
| 214 | \brief
|
---|
| 215 | System key flag values
|
---|
| 216 | */
|
---|
| 217 | enum SystemKey
|
---|
| 218 | {
|
---|
| 219 | LeftMouse = 0x0001, //!< The left mouse button.
|
---|
| 220 | RightMouse = 0x0002, //!< The right mouse button.
|
---|
| 221 | Shift = 0x0004, //!< Either shift key.
|
---|
| 222 | Control = 0x0008, //!< Either control key.
|
---|
| 223 | MiddleMouse = 0x0010, //!< The middle mouse button.
|
---|
| 224 | X1Mouse = 0x0020, //!< The first 'extra' mouse button
|
---|
| 225 | X2Mouse = 0x0040, //!< The second 'extra' mouse button.
|
---|
| 226 | Alt = 0x0080 //!< Either alt key.
|
---|
| 227 | };
|
---|
| 228 |
|
---|
| 229 |
|
---|
| 230 | /*!
|
---|
| 231 | \brief
|
---|
| 232 | EventArgs based class that is used for objects passed to handlers triggered for events
|
---|
| 233 | concerning some Window object.
|
---|
| 234 | */
|
---|
| 235 | class CEGUIEXPORT WindowEventArgs : public EventArgs
|
---|
| 236 | {
|
---|
| 237 | public:
|
---|
| 238 | WindowEventArgs(Window* wnd) : window(wnd) {}
|
---|
| 239 |
|
---|
| 240 | Window* window; //!< pointer to a Window object of relevance to the event.
|
---|
| 241 | };
|
---|
| 242 |
|
---|
| 243 |
|
---|
| 244 | /*!
|
---|
| 245 | \brief
|
---|
| 246 | EventArgs based class that is used for objects passed to input event handlers
|
---|
| 247 | concerning mouse input.
|
---|
| 248 | */
|
---|
| 249 | class CEGUIEXPORT MouseEventArgs : public WindowEventArgs
|
---|
| 250 | {
|
---|
| 251 | public:
|
---|
| 252 | MouseEventArgs(Window* wnd) : WindowEventArgs(wnd) {}
|
---|
| 253 |
|
---|
| 254 | Point position; //!< holds current mouse position.
|
---|
| 255 | Vector2 moveDelta; //!< holds variation of mouse position from last mouse input
|
---|
| 256 | MouseButton button; //!< one of the MouseButton enumerated values describing the mouse button causing the event (for button inputs only)
|
---|
| 257 | uint sysKeys; //!< current state of the system keys and mouse buttons.
|
---|
| 258 | float wheelChange; //!< Holds the amount the scroll wheel has changed.
|
---|
| 259 | uint clickCount; //!< Holds number of mouse button down events currently counted in a multi-click sequence (for button inputs only).
|
---|
| 260 | };
|
---|
| 261 |
|
---|
| 262 |
|
---|
| 263 | /*!
|
---|
| 264 | \brief
|
---|
| 265 | EventArgs based class that is used for objects passed to input event handlers
|
---|
| 266 | concerning mouse cursor events.
|
---|
| 267 | */
|
---|
| 268 | class CEGUIEXPORT MouseCursorEventArgs : public EventArgs
|
---|
| 269 | {
|
---|
| 270 | public:
|
---|
| 271 | MouseCursorEventArgs(MouseCursor* cursor) : mouseCursor(cursor) {}
|
---|
| 272 |
|
---|
| 273 | MouseCursor* mouseCursor; //!< pointer to a MouseCursor object of relevance to the event.
|
---|
| 274 | const Image* image; //!< pointer to an Image object of relevance to the event.
|
---|
| 275 | };
|
---|
| 276 |
|
---|
| 277 |
|
---|
| 278 | /*!
|
---|
| 279 | \brief
|
---|
| 280 | EventArgs based class that is used for objects passed to input event handlers
|
---|
| 281 | concerning keyboard input.
|
---|
| 282 | */
|
---|
| 283 | class CEGUIEXPORT KeyEventArgs : public WindowEventArgs
|
---|
| 284 | {
|
---|
| 285 | public:
|
---|
| 286 | KeyEventArgs(Window* wnd) : WindowEventArgs(wnd) {}
|
---|
| 287 |
|
---|
| 288 | utf32 codepoint; //!< utf32 codepoint for the key (only used for Character inputs).
|
---|
| 289 | Key::Scan scancode; //!< Scan code of key that caused event (only used for key up & down inputs.
|
---|
| 290 | uint sysKeys; //!< current state of the system keys and mouse buttons.
|
---|
| 291 | };
|
---|
| 292 |
|
---|
| 293 |
|
---|
| 294 | /*!
|
---|
| 295 | \brief
|
---|
| 296 | EventArgs based class that is used for Activated and Deactivated window events
|
---|
| 297 | */
|
---|
| 298 | class CEGUIEXPORT ActivationEventArgs : public WindowEventArgs
|
---|
| 299 | {
|
---|
| 300 | public:
|
---|
| 301 | ActivationEventArgs(Window* wnd) : WindowEventArgs(wnd) {}
|
---|
| 302 |
|
---|
| 303 | Window* otherWindow; //!< Pointer to the other window involved in the activation change.
|
---|
| 304 | };
|
---|
| 305 |
|
---|
| 306 | /*!
|
---|
| 307 | \brief
|
---|
| 308 | EventArgs based class used for certain drag/drop notifications
|
---|
| 309 | */
|
---|
| 310 | class CEGUIEXPORT DragDropEventArgs : public WindowEventArgs
|
---|
| 311 | {
|
---|
| 312 | public:
|
---|
| 313 | DragDropEventArgs(Window* wnd) : WindowEventArgs(wnd) {}
|
---|
| 314 | DragContainer* dragDropItem; //<! pointer to the DragContainer window being dragged / dropped.
|
---|
| 315 | };
|
---|
| 316 |
|
---|
| 317 | } // End of CEGUI namespace section
|
---|
| 318 |
|
---|
| 319 |
|
---|
| 320 | #endif // end of guard _CEGUIInputEvent_h_
|
---|