Crazy Eddies GUI System: CEGUIInputEvent.h Source File

Crazy Eddies GUI System 0.7.6

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

CEGUIInputEvent.h

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