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