Crazy Eddie's GUI System  0.8.4
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
InputEvent.h
1 /***********************************************************************
2  created: 30/5/2004
3  author: Paul D Turner
4 
5  purpose: Defines interface to input event classes
6 *************************************************************************/
7 /***************************************************************************
8  * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
9  *
10  * Permission is hereby granted, free of charge, to any person obtaining
11  * a copy of this software and associated documentation files (the
12  * "Software"), to deal in the Software without restriction, including
13  * without limitation the rights to use, copy, modify, merge, publish,
14  * distribute, sublicense, and/or sell copies of the Software, and to
15  * permit persons to whom the Software is furnished to do so, subject to
16  * the following conditions:
17  *
18  * The above copyright notice and this permission notice shall be
19  * included in all copies or substantial portions of the Software.
20  *
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
24  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
25  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
26  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27  * OTHER DEALINGS IN THE SOFTWARE.
28  ***************************************************************************/
29 #ifndef _CEGUIInputEvent_h_
30 #define _CEGUIInputEvent_h_
31 
32 #include "CEGUI/Base.h"
33 #include "CEGUI/EventArgs.h"
34 #include "CEGUI/String.h"
35 #include "CEGUI/Vector.h"
36 #include "CEGUI/Size.h"
37 
38 #if defined(_MSC_VER)
39 # pragma warning(push)
40 # pragma warning(disable : 4251)
41 #endif
42 
43 // Start of CEGUI namespace section
44 namespace CEGUI
45 {
50 struct CEGUIEXPORT Key
51 {
52  // enumeration of scan codes. Customised from table taken from Ogre, which took them from DirectInput...
53  enum Scan
54  {
55  Unknown =0x00,
56  Escape =0x01,
57  One =0x02,
58  Two =0x03,
59  Three =0x04,
60  Four =0x05,
61  Five =0x06,
62  Six =0x07,
63  Seven =0x08,
64  Eight =0x09,
65  Nine =0x0A,
66  Zero =0x0B,
67  Minus =0x0C, /* - on main keyboard */
68  Equals =0x0D,
69  Backspace =0x0E, /* backspace */
70  Tab =0x0F,
71  Q =0x10,
72  W =0x11,
73  E =0x12,
74  R =0x13,
75  T =0x14,
76  Y =0x15,
77  U =0x16,
78  I =0x17,
79  O =0x18,
80  P =0x19,
81  LeftBracket =0x1A,
82  RightBracket =0x1B,
83  Return =0x1C, /* Enter on main keyboard */
84  LeftControl =0x1D,
85  A =0x1E,
86  S =0x1F,
87  D =0x20,
88  F =0x21,
89  G =0x22,
90  H =0x23,
91  J =0x24,
92  K =0x25,
93  L =0x26,
94  Semicolon =0x27,
95  Apostrophe =0x28,
96  Grave =0x29, /* accent grave */
97  LeftShift =0x2A,
98  Backslash =0x2B,
99  Z =0x2C,
100  X =0x2D,
101  C =0x2E,
102  V =0x2F,
103  B =0x30,
104  N =0x31,
105  M =0x32,
106  Comma =0x33,
107  Period =0x34, /* . on main keyboard */
108  Slash =0x35, /* '/' on main keyboard */
109  RightShift =0x36,
110  Multiply =0x37, /* * on numeric keypad */
111  LeftAlt =0x38, /* left Alt */
112  Space =0x39,
113  Capital =0x3A,
114  F1 =0x3B,
115  F2 =0x3C,
116  F3 =0x3D,
117  F4 =0x3E,
118  F5 =0x3F,
119  F6 =0x40,
120  F7 =0x41,
121  F8 =0x42,
122  F9 =0x43,
123  F10 =0x44,
124  NumLock =0x45,
125  ScrollLock =0x46, /* Scroll Lock */
126  Numpad7 =0x47,
127  Numpad8 =0x48,
128  Numpad9 =0x49,
129  Subtract =0x4A, /* - on numeric keypad */
130  Numpad4 =0x4B,
131  Numpad5 =0x4C,
132  Numpad6 =0x4D,
133  Add =0x4E, /* + on numeric keypad */
134  Numpad1 =0x4F,
135  Numpad2 =0x50,
136  Numpad3 =0x51,
137  Numpad0 =0x52,
138  Decimal =0x53, /* . on numeric keypad */
139  OEM_102 =0x56, /* < > | on UK/Germany keyboards */
140  F11 =0x57,
141  F12 =0x58,
142  F13 =0x64, /* (NEC PC98) */
143  F14 =0x65, /* (NEC PC98) */
144  F15 =0x66, /* (NEC PC98) */
145  Kana =0x70, /* (Japanese keyboard) */
146  ABNT_C1 =0x73, /* / ? on Portugese (Brazilian) keyboards */
147  Convert =0x79, /* (Japanese keyboard) */
148  NoConvert =0x7B, /* (Japanese keyboard) */
149  Yen =0x7D, /* (Japanese keyboard) */
150  ABNT_C2 =0x7E, /* Numpad . on Portugese (Brazilian) keyboards */
151  NumpadEquals =0x8D, /* = on numeric keypad (NEC PC98) */
152  PrevTrack =0x90, /* Previous Track (KC_CIRCUMFLEX on Japanese keyboard) */
153  At =0x91, /* (NEC PC98) */
154  Colon =0x92, /* (NEC PC98) */
155  Underline =0x93, /* (NEC PC98) */
156  Kanji =0x94, /* (Japanese keyboard) */
157  Stop =0x95, /* (NEC PC98) */
158  AX =0x96, /* (Japan AX) */
159  Unlabeled =0x97, /* (J3100) */
160  NextTrack =0x99, /* Next Track */
161  NumpadEnter =0x9C, /* Enter on numeric keypad */
162  RightControl =0x9D,
163  Mute =0xA0, /* Mute */
164  Calculator =0xA1, /* Calculator */
165  PlayPause =0xA2, /* Play / Pause */
166  MediaStop =0xA4, /* Media Stop */
167  VolumeDown =0xAE, /* Volume - */
168  VolumeUp =0xB0, /* Volume + */
169  WebHome =0xB2, /* Web home */
170  NumpadComma =0xB3, /* , on numeric keypad (NEC PC98) */
171  Divide =0xB5, /* / on numeric keypad */
172  SysRq =0xB7,
173  RightAlt =0xB8, /* right Alt */
174  Pause =0xC5, /* Pause */
175  Home =0xC7, /* Home on arrow keypad */
176  ArrowUp =0xC8, /* UpArrow on arrow keypad */
177  PageUp =0xC9, /* PgUp on arrow keypad */
178  ArrowLeft =0xCB, /* LeftArrow on arrow keypad */
179  ArrowRight =0xCD, /* RightArrow on arrow keypad */
180  End =0xCF, /* End on arrow keypad */
181  ArrowDown =0xD0, /* DownArrow on arrow keypad */
182  PageDown =0xD1, /* PgDn on arrow keypad */
183  Insert =0xD2, /* Insert on arrow keypad */
184  Delete =0xD3, /* Delete on arrow keypad */
185  LeftWindows =0xDB, /* Left Windows key */
186  RightWindows =0xDC, /* Right Windows key - Correct spelling :) */
187  AppMenu =0xDD, /* AppMenu key */
188  Power =0xDE, /* System Power */
189  Sleep =0xDF, /* System Sleep */
190  Wake =0xE3, /* System Wake */
191  WebSearch =0xE5, /* Web Search */
192  WebFavorites =0xE6, /* Web Favorites */
193  WebRefresh =0xE7, /* Web Refresh */
194  WebStop =0xE8, /* Web Stop */
195  WebForward =0xE9, /* Web Forward */
196  WebBack =0xEA, /* Web Back */
197  MyComputer =0xEB, /* My Computer */
198  Mail =0xEC, /* Mail */
199  MediaSelect =0xED /* Media Select */
200  };
201 
202 };
203 
204 
210 {
225 };
226 
227 
233 {
234  LeftMouse = 0x0001,
235  RightMouse = 0x0002,
236  Shift = 0x0004,
237  Control = 0x0008,
238  MiddleMouse = 0x0010,
239  X1Mouse = 0x0020,
240  X2Mouse = 0x0040,
241  Alt = 0x0080,
242  InvalidSysKey = 0x8000
243 };
244 
245 
251 class CEGUIEXPORT WindowEventArgs : public EventArgs
252 {
253 public:
254  WindowEventArgs(Window* wnd) : window(wnd) {}
255 
257 };
258 
263 class CEGUIEXPORT UpdateEventArgs : public WindowEventArgs
264 {
265 public:
266  UpdateEventArgs(Window* window, float tslf) :
267  WindowEventArgs(window),
268  d_timeSinceLastFrame(tslf)
269  {}
270 
272 };
273 
274 
280 class CEGUIEXPORT MouseEventArgs : public WindowEventArgs
281 {
282 public:
283  MouseEventArgs(Window* wnd) : WindowEventArgs(wnd) {}
284 
288  uint sysKeys;
289  float wheelChange;
290  uint clickCount;
291 };
292 
293 
299 class CEGUIEXPORT MouseCursorEventArgs : public EventArgs
300 {
301 public:
302  MouseCursorEventArgs(MouseCursor* cursor) : mouseCursor(cursor) {}
303 
305  const Image* image;
306 };
307 
308 
314 class CEGUIEXPORT KeyEventArgs : public WindowEventArgs
315 {
316 public:
317  KeyEventArgs(Window* wnd) : WindowEventArgs(wnd) {}
318 
320  Key::Scan scancode;
321  uint sysKeys;
322 };
323 
324 
329 class CEGUIEXPORT ActivationEventArgs : public WindowEventArgs
330 {
331 public:
333 
335 };
336 
341 class CEGUIEXPORT DragDropEventArgs : public WindowEventArgs
342 {
343 public:
346 };
347 
353 class CEGUIEXPORT DisplayEventArgs : public EventArgs
354 {
355 public:
356  DisplayEventArgs(const Sizef& sz):
357  size(sz)
358  {}
359 
362 };
363 
365 class CEGUIEXPORT ResourceEventArgs : public EventArgs
366 {
367 public:
368  ResourceEventArgs(const String& type, const String& name) :
369  resourceType(type),
370  resourceName(name)
371  {}
372 
377 };
378 
380 class CEGUIEXPORT FontEventArgs : public EventArgs
381 {
382 public:
383  FontEventArgs(Font* font) :
384  font(font)
385  {}
386 
389 };
390 
391 } // End of CEGUI namespace section
392 
393 #if defined(_MSC_VER)
394 # pragma warning(pop)
395 #endif
396 
397 #endif // end of guard _CEGUIInputEvent_h_