Crazy Eddie's GUI System
0.8.4
|
00001 /*********************************************************************** 00002 created: 30/5/2004 00003 author: Paul D Turner 00004 00005 purpose: Defines interface to input event classes 00006 *************************************************************************/ 00007 /*************************************************************************** 00008 * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team 00009 * 00010 * Permission is hereby granted, free of charge, to any person obtaining 00011 * a copy of this software and associated documentation files (the 00012 * "Software"), to deal in the Software without restriction, including 00013 * without limitation the rights to use, copy, modify, merge, publish, 00014 * distribute, sublicense, and/or sell copies of the Software, and to 00015 * permit persons to whom the Software is furnished to do so, subject to 00016 * the following conditions: 00017 * 00018 * The above copyright notice and this permission notice shall be 00019 * included in all copies or substantial portions of the Software. 00020 * 00021 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00022 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00023 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 00024 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 00025 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 00026 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 00027 * OTHER DEALINGS IN THE SOFTWARE. 00028 ***************************************************************************/ 00029 #ifndef _CEGUIInputEvent_h_ 00030 #define _CEGUIInputEvent_h_ 00031 00032 #include "CEGUI/Base.h" 00033 #include "CEGUI/EventArgs.h" 00034 #include "CEGUI/String.h" 00035 #include "CEGUI/Vector.h" 00036 #include "CEGUI/Size.h" 00037 00038 #if defined(_MSC_VER) 00039 # pragma warning(push) 00040 # pragma warning(disable : 4251) 00041 #endif 00042 00043 // Start of CEGUI namespace section 00044 namespace CEGUI 00045 { 00050 struct CEGUIEXPORT Key 00051 { 00052 // enumeration of scan codes. Customised from table taken from Ogre, which took them from DirectInput... 00053 enum Scan 00054 { 00055 Unknown =0x00, 00056 Escape =0x01, 00057 One =0x02, 00058 Two =0x03, 00059 Three =0x04, 00060 Four =0x05, 00061 Five =0x06, 00062 Six =0x07, 00063 Seven =0x08, 00064 Eight =0x09, 00065 Nine =0x0A, 00066 Zero =0x0B, 00067 Minus =0x0C, /* - on main keyboard */ 00068 Equals =0x0D, 00069 Backspace =0x0E, /* backspace */ 00070 Tab =0x0F, 00071 Q =0x10, 00072 W =0x11, 00073 E =0x12, 00074 R =0x13, 00075 T =0x14, 00076 Y =0x15, 00077 U =0x16, 00078 I =0x17, 00079 O =0x18, 00080 P =0x19, 00081 LeftBracket =0x1A, 00082 RightBracket =0x1B, 00083 Return =0x1C, /* Enter on main keyboard */ 00084 LeftControl =0x1D, 00085 A =0x1E, 00086 S =0x1F, 00087 D =0x20, 00088 F =0x21, 00089 G =0x22, 00090 H =0x23, 00091 J =0x24, 00092 K =0x25, 00093 L =0x26, 00094 Semicolon =0x27, 00095 Apostrophe =0x28, 00096 Grave =0x29, /* accent grave */ 00097 LeftShift =0x2A, 00098 Backslash =0x2B, 00099 Z =0x2C, 00100 X =0x2D, 00101 C =0x2E, 00102 V =0x2F, 00103 B =0x30, 00104 N =0x31, 00105 M =0x32, 00106 Comma =0x33, 00107 Period =0x34, /* . on main keyboard */ 00108 Slash =0x35, /* '/' on main keyboard */ 00109 RightShift =0x36, 00110 Multiply =0x37, /* * on numeric keypad */ 00111 LeftAlt =0x38, /* left Alt */ 00112 Space =0x39, 00113 Capital =0x3A, 00114 F1 =0x3B, 00115 F2 =0x3C, 00116 F3 =0x3D, 00117 F4 =0x3E, 00118 F5 =0x3F, 00119 F6 =0x40, 00120 F7 =0x41, 00121 F8 =0x42, 00122 F9 =0x43, 00123 F10 =0x44, 00124 NumLock =0x45, 00125 ScrollLock =0x46, /* Scroll Lock */ 00126 Numpad7 =0x47, 00127 Numpad8 =0x48, 00128 Numpad9 =0x49, 00129 Subtract =0x4A, /* - on numeric keypad */ 00130 Numpad4 =0x4B, 00131 Numpad5 =0x4C, 00132 Numpad6 =0x4D, 00133 Add =0x4E, /* + on numeric keypad */ 00134 Numpad1 =0x4F, 00135 Numpad2 =0x50, 00136 Numpad3 =0x51, 00137 Numpad0 =0x52, 00138 Decimal =0x53, /* . on numeric keypad */ 00139 OEM_102 =0x56, /* < > | on UK/Germany keyboards */ 00140 F11 =0x57, 00141 F12 =0x58, 00142 F13 =0x64, /* (NEC PC98) */ 00143 F14 =0x65, /* (NEC PC98) */ 00144 F15 =0x66, /* (NEC PC98) */ 00145 Kana =0x70, /* (Japanese keyboard) */ 00146 ABNT_C1 =0x73, /* / ? on Portugese (Brazilian) keyboards */ 00147 Convert =0x79, /* (Japanese keyboard) */ 00148 NoConvert =0x7B, /* (Japanese keyboard) */ 00149 Yen =0x7D, /* (Japanese keyboard) */ 00150 ABNT_C2 =0x7E, /* Numpad . on Portugese (Brazilian) keyboards */ 00151 NumpadEquals =0x8D, /* = on numeric keypad (NEC PC98) */ 00152 PrevTrack =0x90, /* Previous Track (KC_CIRCUMFLEX on Japanese keyboard) */ 00153 At =0x91, /* (NEC PC98) */ 00154 Colon =0x92, /* (NEC PC98) */ 00155 Underline =0x93, /* (NEC PC98) */ 00156 Kanji =0x94, /* (Japanese keyboard) */ 00157 Stop =0x95, /* (NEC PC98) */ 00158 AX =0x96, /* (Japan AX) */ 00159 Unlabeled =0x97, /* (J3100) */ 00160 NextTrack =0x99, /* Next Track */ 00161 NumpadEnter =0x9C, /* Enter on numeric keypad */ 00162 RightControl =0x9D, 00163 Mute =0xA0, /* Mute */ 00164 Calculator =0xA1, /* Calculator */ 00165 PlayPause =0xA2, /* Play / Pause */ 00166 MediaStop =0xA4, /* Media Stop */ 00167 VolumeDown =0xAE, /* Volume - */ 00168 VolumeUp =0xB0, /* Volume + */ 00169 WebHome =0xB2, /* Web home */ 00170 NumpadComma =0xB3, /* , on numeric keypad (NEC PC98) */ 00171 Divide =0xB5, /* / on numeric keypad */ 00172 SysRq =0xB7, 00173 RightAlt =0xB8, /* right Alt */ 00174 Pause =0xC5, /* Pause */ 00175 Home =0xC7, /* Home on arrow keypad */ 00176 ArrowUp =0xC8, /* UpArrow on arrow keypad */ 00177 PageUp =0xC9, /* PgUp on arrow keypad */ 00178 ArrowLeft =0xCB, /* LeftArrow on arrow keypad */ 00179 ArrowRight =0xCD, /* RightArrow on arrow keypad */ 00180 End =0xCF, /* End on arrow keypad */ 00181 ArrowDown =0xD0, /* DownArrow on arrow keypad */ 00182 PageDown =0xD1, /* PgDn on arrow keypad */ 00183 Insert =0xD2, /* Insert on arrow keypad */ 00184 Delete =0xD3, /* Delete on arrow keypad */ 00185 LeftWindows =0xDB, /* Left Windows key */ 00186 RightWindows =0xDC, /* Right Windows key - Correct spelling :) */ 00187 AppMenu =0xDD, /* AppMenu key */ 00188 Power =0xDE, /* System Power */ 00189 Sleep =0xDF, /* System Sleep */ 00190 Wake =0xE3, /* System Wake */ 00191 WebSearch =0xE5, /* Web Search */ 00192 WebFavorites =0xE6, /* Web Favorites */ 00193 WebRefresh =0xE7, /* Web Refresh */ 00194 WebStop =0xE8, /* Web Stop */ 00195 WebForward =0xE9, /* Web Forward */ 00196 WebBack =0xEA, /* Web Back */ 00197 MyComputer =0xEB, /* My Computer */ 00198 Mail =0xEC, /* Mail */ 00199 MediaSelect =0xED /* Media Select */ 00200 }; 00201 00202 }; 00203 00204 00209 enum MouseButton 00210 { 00212 LeftButton, 00214 RightButton, 00216 MiddleButton, 00218 X1Button, 00220 X2Button, 00222 MouseButtonCount, 00224 NoButton 00225 }; 00226 00227 00232 enum SystemKey 00233 { 00234 LeftMouse = 0x0001, 00235 RightMouse = 0x0002, 00236 Shift = 0x0004, 00237 Control = 0x0008, 00238 MiddleMouse = 0x0010, 00239 X1Mouse = 0x0020, 00240 X2Mouse = 0x0040, 00241 Alt = 0x0080, 00242 InvalidSysKey = 0x8000 00243 }; 00244 00245 00251 class CEGUIEXPORT WindowEventArgs : public EventArgs 00252 { 00253 public: 00254 WindowEventArgs(Window* wnd) : window(wnd) {} 00255 00256 Window* window; 00257 }; 00258 00263 class CEGUIEXPORT UpdateEventArgs : public WindowEventArgs 00264 { 00265 public: 00266 UpdateEventArgs(Window* window, float tslf) : 00267 WindowEventArgs(window), 00268 d_timeSinceLastFrame(tslf) 00269 {} 00270 00271 float d_timeSinceLastFrame; 00272 }; 00273 00274 00280 class CEGUIEXPORT MouseEventArgs : public WindowEventArgs 00281 { 00282 public: 00283 MouseEventArgs(Window* wnd) : WindowEventArgs(wnd) {} 00284 00285 Vector2f position; 00286 Vector2f moveDelta; 00287 MouseButton button; 00288 uint sysKeys; 00289 float wheelChange; 00290 uint clickCount; 00291 }; 00292 00293 00299 class CEGUIEXPORT MouseCursorEventArgs : public EventArgs 00300 { 00301 public: 00302 MouseCursorEventArgs(MouseCursor* cursor) : mouseCursor(cursor) {} 00303 00304 MouseCursor* mouseCursor; 00305 const Image* image; 00306 }; 00307 00308 00314 class CEGUIEXPORT KeyEventArgs : public WindowEventArgs 00315 { 00316 public: 00317 KeyEventArgs(Window* wnd) : WindowEventArgs(wnd) {} 00318 00319 String::value_type codepoint; 00320 Key::Scan scancode; 00321 uint sysKeys; 00322 }; 00323 00324 00329 class CEGUIEXPORT ActivationEventArgs : public WindowEventArgs 00330 { 00331 public: 00332 ActivationEventArgs(Window* wnd) : WindowEventArgs(wnd) {} 00333 00334 Window* otherWindow; 00335 }; 00336 00341 class CEGUIEXPORT DragDropEventArgs : public WindowEventArgs 00342 { 00343 public: 00344 DragDropEventArgs(Window* wnd) : WindowEventArgs(wnd) {} 00345 DragContainer* dragDropItem; 00346 }; 00347 00353 class CEGUIEXPORT DisplayEventArgs : public EventArgs 00354 { 00355 public: 00356 DisplayEventArgs(const Sizef& sz): 00357 size(sz) 00358 {} 00359 00361 Sizef size; 00362 }; 00363 00365 class CEGUIEXPORT ResourceEventArgs : public EventArgs 00366 { 00367 public: 00368 ResourceEventArgs(const String& type, const String& name) : 00369 resourceType(type), 00370 resourceName(name) 00371 {} 00372 00374 String resourceType; 00376 String resourceName; 00377 }; 00378 00380 class CEGUIEXPORT FontEventArgs : public EventArgs 00381 { 00382 public: 00383 FontEventArgs(Font* font) : 00384 font(font) 00385 {} 00386 00388 Font* font; 00389 }; 00390 00391 } // End of CEGUI namespace section 00392 00393 #if defined(_MSC_VER) 00394 # pragma warning(pop) 00395 #endif 00396 00397 #endif // end of guard _CEGUIInputEvent_h_