MyGUI  3.2.1
MyGUI_KeyCode.h
Go to the documentation of this file.
00001 /*
00002  * This source file is part of MyGUI. For the latest info, see http://mygui.info/
00003  * Distributed under the MIT License
00004  * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
00005  */
00006 
00007 #ifndef __MYGUI_KEY_CODE_H__
00008 #define __MYGUI_KEY_CODE_H__
00009 
00010 #include "MyGUI_Prerequest.h"
00011 
00012 namespace MyGUI
00013 {
00014 
00015     struct MYGUI_EXPORT KeyCode
00016     {
00017         enum Enum
00018         {
00019             None          = 0x00,
00020             Escape          = 0x01,
00021             One             = 0x02,
00022             Two             = 0x03,
00023             Three           = 0x04,
00024             Four            = 0x05,
00025             Five            = 0x06,
00026             Six             = 0x07,
00027             Seven           = 0x08,
00028             Eight           = 0x09,
00029             Nine            = 0x0A,
00030             Zero            = 0x0B,
00031             Minus           = 0x0C,    /* - on main keyboard */
00032             Equals          = 0x0D,
00033             Backspace       = 0x0E,    /* Backspace */
00034             Tab             = 0x0F,
00035             Q               = 0x10,
00036             W               = 0x11,
00037             E               = 0x12,
00038             R               = 0x13,
00039             T               = 0x14,
00040             Y               = 0x15,
00041             U               = 0x16,
00042             I               = 0x17,
00043             O               = 0x18,
00044             P               = 0x19,
00045             LeftBracket     = 0x1A,
00046             RightBracket    = 0x1B,
00047             Return          = 0x1C,    /* Enter on main keyboard */
00048             LeftControl     = 0x1D,
00049             A               = 0x1E,
00050             S               = 0x1F,
00051             D               = 0x20,
00052             F               = 0x21,
00053             G               = 0x22,
00054             H               = 0x23,
00055             J               = 0x24,
00056             K               = 0x25,
00057             L               = 0x26,
00058             Semicolon       = 0x27,
00059             Apostrophe      = 0x28,
00060             Grave           = 0x29,    /* Accent grave ( ~ ) */
00061             LeftShift       = 0x2A,
00062             Backslash       = 0x2B,
00063             Z               = 0x2C,
00064             X               = 0x2D,
00065             C               = 0x2E,
00066             V               = 0x2F,
00067             B               = 0x30,
00068             N               = 0x31,
00069             M               = 0x32,
00070             Comma           = 0x33,
00071             Period          = 0x34,    /* . on main keyboard */
00072             Slash           = 0x35,    /* '/' on main keyboard */
00073             RightShift      = 0x36,
00074             Multiply        = 0x37,    /* * on numeric keypad */
00075             LeftAlt        = 0x38,    /* Left Alt */
00076             Space           = 0x39,
00077             Capital         = 0x3A,
00078             F1              = 0x3B,
00079             F2              = 0x3C,
00080             F3              = 0x3D,
00081             F4              = 0x3E,
00082             F5              = 0x3F,
00083             F6              = 0x40,
00084             F7              = 0x41,
00085             F8              = 0x42,
00086             F9              = 0x43,
00087             F10             = 0x44,
00088             NumLock         = 0x45,
00089             ScrollLock      = 0x46,    /* Scroll Lock */
00090             Numpad7         = 0x47,
00091             Numpad8         = 0x48,
00092             Numpad9         = 0x49,
00093             Subtract        = 0x4A,    /* - on numeric keypad */
00094             Numpad4         = 0x4B,
00095             Numpad5         = 0x4C,
00096             Numpad6         = 0x4D,
00097             Add             = 0x4E,    /* + on numeric keypad */
00098             Numpad1         = 0x4F,
00099             Numpad2         = 0x50,
00100             Numpad3         = 0x51,
00101             Numpad0         = 0x52,
00102             Decimal         = 0x53,    /* . on numeric keypad */
00103             OEM_102         = 0x56,    /* < > | on UK/Germany keyboards */
00104             F11             = 0x57,
00105             F12             = 0x58,
00106             F13             = 0x64,    /*                     (NEC PC98) */
00107             F14             = 0x65,    /*                     (NEC PC98) */
00108             F15             = 0x66,    /*                     (NEC PC98) */
00109             Kana            = 0x70,    /* (Japanese keyboard)            */
00110             ABNT_C1         = 0x73,    /* / ? on Portugese (Brazilian) keyboards */
00111             Convert         = 0x79,    /* (Japanese keyboard)            */
00112             NoConvert       = 0x7B,    /* (Japanese keyboard)            */
00113             Yen             = 0x7D,    /* (Japanese keyboard)            */
00114             ABNT_C2         = 0x7E,    /* Numpad . on Portugese (Brazilian) keyboards */
00115             NumpadEquals    = 0x8D,    /* = on numeric keypad (NEC PC98) */
00116             PrevTrack       = 0x90,    /* Previous Track (KC_CIRCUMFLEX on Japanese keyboard) */
00117             At              = 0x91,    /*                     (NEC PC98) */
00118             Colon           = 0x92,    /*                     (NEC PC98) */
00119             Underline       = 0x93,    /*                     (NEC PC98) */
00120             Kanji           = 0x94,    /* (Japanese keyboard)            */
00121             Stop            = 0x95,    /*                     (NEC PC98) */
00122             AX              = 0x96,    /*                     (Japan AX) */
00123             Unlabeled       = 0x97,    /*                        (J3100) */
00124             NextTrack       = 0x99,    /* Next Track */
00125             NumpadEnter     = 0x9C,    /* Enter on numeric keypad */
00126             RightControl    = 0x9D,
00127             Mute            = 0xA0,
00128             Calculator      = 0xA1,
00129             PlayPause       = 0xA2,    /* Play / Pause */
00130             MediaStop       = 0xA4,    /* Media Stop */
00131             VolumeDown      = 0xAE,    /* Volume - */
00132             VolumeUp        = 0xB0,    /* Volume + */
00133             WebHome         = 0xB2,    /* Web home */
00134             NumpadComma     = 0xB3,    /* , on numeric keypad (NEC PC98) */
00135             Divide          = 0xB5,    /* / on numeric keypad */
00136             SysRq           = 0xB7,
00137             RightAlt        = 0xB8,    /* Right Alt */
00138             Pause           = 0xC5,
00139             Home            = 0xC7,    /* Home on arrow keypad */
00140             ArrowUp         = 0xC8,    /* UpArrow on arrow keypad */
00141             PageUp          = 0xC9,    /* PgUp on arrow keypad */
00142             ArrowLeft       = 0xCB,    /* LeftArrow on arrow keypad */
00143             ArrowRight      = 0xCD,    /* RightArrow on arrow keypad */
00144             End             = 0xCF,    /* End on arrow keypad */
00145             ArrowDown       = 0xD0,    /* DownArrow on arrow keypad */
00146             PageDown        = 0xD1,    /* PgDn on arrow keypad */
00147             Insert          = 0xD2,    /* Insert on arrow keypad */
00148             Delete          = 0xD3,    /* Delete on arrow keypad */
00149             LeftWindows     = 0xDB,    /* Left Windows key */
00150             RightWindow     = 0xDC,    /* Right Windows key */
00151             RightWindows    = 0xDC,    /* Right Windows key - Correct spelling :) */
00152             AppMenu         = 0xDD,    /* AppMenu key */
00153             Power           = 0xDE,    /* System Power */
00154             Sleep           = 0xDF,    /* System Sleep */
00155             Wake            = 0xE3,    /* System Wake */
00156             WebSearch       = 0xE5,
00157             WebFavorites    = 0xE6,
00158             WebRefresh      = 0xE7,
00159             WebStop         = 0xE8,
00160             WebForward      = 0xE9,
00161             WebBack         = 0xEA,
00162             MyComputer      = 0xEB,
00163             Mail            = 0xEC,
00164             MediaSelect     = 0xED
00165         };
00166 
00167         KeyCode(Enum _value = None) :
00168             mValue(_value)
00169         {
00170         }
00171 
00172         friend bool operator < (KeyCode const& a, KeyCode const& b)
00173         {
00174             return (a.mValue < b.mValue);
00175         }
00176 
00177         friend bool operator >= (KeyCode const& a, KeyCode const& b)
00178         {
00179             return !(a < b);
00180         }
00181 
00182         friend bool operator > (KeyCode const& a, KeyCode const& b)
00183         {
00184             return (b < a);
00185         }
00186 
00187         friend bool operator <= (KeyCode const& a, KeyCode const& b)
00188         {
00189             return !(a > b);
00190         }
00191 
00192         friend bool operator == (KeyCode const& a, KeyCode const& b)
00193         {
00194             return !(a < b) && !(a > b);
00195         }
00196 
00197         friend bool operator != (KeyCode const& a, KeyCode const& b)
00198         {
00199             return !(a == b);
00200         }
00201 
00202         int getValue() const
00203         {
00204             return mValue;
00205         }
00206 
00207     private:
00208         Enum mValue;
00209     };
00210 
00211 } // namespace MyGUI
00212 
00213 #endif // __MYGUI_KEY_CODE_H__