Crazy Eddies GUI System: CEGUIInputEvent.h Source File

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

# 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     Crazy Eddie's GUI System (http://www.cegui.org.uk)
    00010     Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
    00011
    00012     This library is free software; you can redistribute it and/or
    00013     modify it under the terms of the GNU Lesser General Public
    00014     License as published by the Free Software Foundation; either
    00015     version 2.1 of the License, or (at your option) any later version.
    00016
    00017     This library is distributed in the hope that it will be useful,
    00018     but WITHOUT ANY WARRANTY; without even the implied warranty of
    00019     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00020     Lesser General Public License for more details.
    00021
    00022     You should have received a copy of the GNU Lesser General Public
    00023     License along with this library; if not, write to the Free Software
    00024     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    00025 *************************************************************************/
    00026 #ifndef _CEGUIInputEvent_h_
    00027 #define _CEGUIInputEvent_h_
    00028
    00029 #include "CEGUIBase.h"
    00030 #include "CEGUIEventArgs.h"
    00031 #include "CEGUIString.h"
    00032 #include "CEGUIVector.h"
    00033
    00034
    00035 // Start of CEGUI namespace section
    00036 namespace CEGUI
    00037 {
    00042 struct CEGUIEXPORT Key
    00043 {
    00044         // enumeration of scan codes.  Customised from table taken from Ogre, which took them from DirectInput...
    00045         enum Scan
    00046     {
    00047         Escape          =0x01,
    00048         One             =0x02,
    00049         Two             =0x03,
    00050         Three           =0x04,
    00051         Four            =0x05,
    00052         Five            =0x06,
    00053         Six             =0x07,
    00054         Seven           =0x08,
    00055         Eight           =0x09,
    00056         Nine            =0x0A,
    00057         Zero            =0x0B,
    00058         Minus           =0x0C,    /* - on main keyboard */
    00059         Equals                  =0x0D,
    00060         Backspace               =0x0E,    /* backspace */
    00061         Tab                             =0x0F,
    00062         Q               =0x10,
    00063         W               =0x11,
    00064         E               =0x12,
    00065         R               =0x13,
    00066         T               =0x14,
    00067         Y               =0x15,
    00068         U               =0x16,
    00069         I               =0x17,
    00070         O               =0x18,
    00071         P               =0x19,
    00072         LeftBracket     =0x1A,
    00073         RightBracket    =0x1B,
    00074         Return                  =0x1C,    /* Enter on main keyboard */
    00075         LeftControl             =0x1D,
    00076         A               =0x1E,
    00077         S               =0x1F,
    00078         D               =0x20,
    00079         F               =0x21,
    00080         G               =0x22,
    00081         H               =0x23,
    00082         J               =0x24,
    00083         K               =0x25,
    00084         L               =0x26,
    00085         Semicolon       =0x27,
    00086         Apostrophe              =0x28,
    00087         Grave           =0x29,    /* accent grave */
    00088         LeftShift       =0x2A,
    00089         Backslash       =0x2B,
    00090         Z               =0x2C,
    00091         X               =0x2D,
    00092         C               =0x2E,
    00093         V               =0x2F,
    00094         B               =0x30,
    00095         N               =0x31,
    00096         M               =0x32,
    00097         Comma           =0x33,
    00098         Period          =0x34,    /* . on main keyboard */
    00099         Slash           =0x35,    /* '/' on main keyboard */
    00100         RightShift      =0x36,
    00101         Multiply        =0x37,    /* * on numeric keypad */
    00102         LeftAlt        =0x38,    /* left Alt */
    00103         Space           =0x39,
    00104         Capital         =0x3A,
    00105         F1              =0x3B,
    00106         F2              =0x3C,
    00107         F3              =0x3D,
    00108         F4              =0x3E,
    00109         F5              =0x3F,
    00110         F6              =0x40,
    00111         F7              =0x41,
    00112         F8              =0x42,
    00113         F9              =0x43,
    00114         F10             =0x44,
    00115         NumLock         =0x45,
    00116         ScrollLock      =0x46,    /* Scroll Lock */
    00117         Numpad7         =0x47,
    00118         Numpad8         =0x48,
    00119         Numpad9         =0x49,
    00120         Subtract        =0x4A,    /* - on numeric keypad */
    00121         Numpad4         =0x4B,
    00122         Numpad5         =0x4C,
    00123         Numpad6         =0x4D,
    00124         Add                             =0x4E,    /* + on numeric keypad */
    00125         Numpad1         =0x4F,
    00126         Numpad2         =0x50,
    00127         Numpad3         =0x51,
    00128         Numpad0         =0x52,
    00129         Decimal                 =0x53,    /* . on numeric keypad */
    00130         OEM_102         =0x56,    /* < > | on UK/Germany keyboards */
    00131         F11             =0x57,
    00132         F12             =0x58,
    00133         F13             =0x64,    /*                     (NEC PC98) */
    00134         F14             =0x65,    /*                     (NEC PC98) */
    00135         F15             =0x66,    /*                     (NEC PC98) */
    00136         Kana            =0x70,    /* (Japanese keyboard)            */
    00137         ABNT_C1         =0x73,    /* / ? on Portugese (Brazilian) keyboards */
    00138         Convert         =0x79,    /* (Japanese keyboard)            */
    00139         NoConvert       =0x7B,    /* (Japanese keyboard)            */
    00140         Yen             =0x7D,    /* (Japanese keyboard)            */
    00141         ABNT_C2         =0x7E,    /* Numpad . on Portugese (Brazilian) keyboards */
    00142         NumpadEquals    =0x8D,    /* = on numeric keypad (NEC PC98) */
    00143         PrevTrack       =0x90,    /* Previous Track (KC_CIRCUMFLEX on Japanese keyboard) */
    00144         At              =0x91,    /*                     (NEC PC98) */
    00145         Colon           =0x92,    /*                     (NEC PC98) */
    00146         Underline       =0x93,    /*                     (NEC PC98) */
    00147         Kanji           =0x94,    /* (Japanese keyboard)            */
    00148         Stop            =0x95,    /*                     (NEC PC98) */
    00149         AX              =0x96,    /*                     (Japan AX) */
    00150         Unlabeled       =0x97,    /*                        (J3100) */
    00151         NextTrack       =0x99,    /* Next Track */
    00152         NumpadEnter     =0x9C,    /* Enter on numeric keypad */
    00153         RightControl    =0x9D,
    00154         Mute            =0xA0,    /* Mute */
    00155         Calculator      =0xA1,    /* Calculator */
    00156         PlayPause       =0xA2,    /* Play / Pause */
    00157         MediaStop       =0xA4,    /* Media Stop */
    00158         VolumeDown      =0xAE,    /* Volume - */
    00159         VolumeUp        =0xB0,    /* Volume + */
    00160         WebHome         =0xB2,    /* Web home */
    00161         NumpadComma     =0xB3,    /* , on numeric keypad (NEC PC98) */
    00162         Divide          =0xB5,    /* / on numeric keypad */
    00163         SysRq           =0xB7,
    00164         RightAlt        =0xB8,    /* right Alt */
    00165         Pause           =0xC5,    /* Pause */
    00166         Home            =0xC7,    /* Home on arrow keypad */
    00167         ArrowUp         =0xC8,    /* UpArrow on arrow keypad */
    00168         PageUp          =0xC9,    /* PgUp on arrow keypad */
    00169         ArrowLeft       =0xCB,    /* LeftArrow on arrow keypad */
    00170         ArrowRight      =0xCD,    /* RightArrow on arrow keypad */
    00171         End             =0xCF,    /* End on arrow keypad */
    00172         ArrowDown       =0xD0,    /* DownArrow on arrow keypad */
    00173         PageDown                =0xD1,    /* PgDn on arrow keypad */
    00174         Insert          =0xD2,    /* Insert on arrow keypad */
    00175         Delete          =0xD3,    /* Delete on arrow keypad */
    00176         LeftWindows     =0xDB,    /* Left Windows key */
    00177         RightWindow     =0xDC,    /* Right Windows key */
    00178         RightWindows    =0xDC,    /* Right Windows key - Correct spelling :) */
    00179         AppMenu         =0xDD,    /* AppMenu key */
    00180         Power           =0xDE,    /* System Power */
    00181         Sleep           =0xDF,    /* System Sleep */
    00182         Wake                    =0xE3,    /* System Wake */
    00183         WebSearch               =0xE5,    /* Web Search */
    00184         WebFavorites    =0xE6,    /* Web Favorites */
    00185         WebRefresh              =0xE7,    /* Web Refresh */
    00186         WebStop                 =0xE8,    /* Web Stop */
    00187         WebForward              =0xE9,    /* Web Forward */
    00188         WebBack                 =0xEA,    /* Web Back */
    00189         MyComputer              =0xEB,    /* My Computer */
    00190         Mail                    =0xEC,    /* Mail */
    00191         MediaSelect             =0xED     /* Media Select */
    00192     };
    00193
    00194 };
    00195
    00196
    00201 enum MouseButton
    00202 {
    00203         LeftButton,
    00204         RightButton,
    00205         MiddleButton,
    00206         X1Button,
    00207         X2Button,
    00208         MouseButtonCount,               //<! Dummy value that is == to the maximum number of mouse buttons supported.
    00209         NoButton
    00210 };
    00211
    00212
    00217 enum SystemKey
    00218 {
    00219         LeftMouse               = 0x0001,
    00220         RightMouse              = 0x0002,
    00221         Shift                   = 0x0004,
    00222         Control                 = 0x0008,
    00223         MiddleMouse             = 0x0010,
    00224         X1Mouse                 = 0x0020,
    00225         X2Mouse                 = 0x0040,
    00226         Alt                             = 0x0080
    00227 };
    00228
    00229
    00235 class CEGUIEXPORT WindowEventArgs : public EventArgs
    00236 {
    00237 public:
    00238         WindowEventArgs(Window* wnd) : window(wnd) {}
    00239
    00240         Window* window;
    00241 };
    00242
    00243
    00249 class CEGUIEXPORT MouseEventArgs : public WindowEventArgs
    00250 {
    00251 public:
    00252         MouseEventArgs(Window* wnd) : WindowEventArgs(wnd) {}
    00253
    00254         Point           position;
    00255         Vector2         moveDelta;
    00256         MouseButton     button;
    00257         uint            sysKeys;
    00258         float           wheelChange;
    00259         uint        clickCount;
    00260 };
    00261
    00262
    00268 class CEGUIEXPORT MouseCursorEventArgs : public EventArgs
    00269 {
    00270 public:
    00271         MouseCursorEventArgs(MouseCursor* cursor) : mouseCursor(cursor) {}
    00272
    00273         MouseCursor* mouseCursor;
    00274         const Image* image;
    00275 };
    00276
    00277
    00283 class CEGUIEXPORT KeyEventArgs : public WindowEventArgs
    00284 {
    00285 public:
    00286         KeyEventArgs(Window* wnd) : WindowEventArgs(wnd) {}
    00287
    00288         utf32           codepoint;
    00289         Key::Scan       scancode;
    00290         uint            sysKeys;
    00291 };
    00292
    00293
    00298 class CEGUIEXPORT ActivationEventArgs : public WindowEventArgs
    00299 {
    00300 public:
    00301         ActivationEventArgs(Window* wnd) : WindowEventArgs(wnd) {}
    00302
    00303         Window* otherWindow;
    00304 };
    00305
    00310 class CEGUIEXPORT DragDropEventArgs : public WindowEventArgs
    00311 {
    00312 public:
    00313         DragDropEventArgs(Window* wnd) : WindowEventArgs(wnd) {}
    00314         DragContainer*  dragDropItem; //<! pointer to the DragContainer window being dragged / dropped.
    00315 };
    00316
    00317 } // End of  CEGUI namespace section
    00318
    00319
    00320 #endif  // end of guard _CEGUIInputEvent_h_