include/SDL_keysym.h
author Sam Lantinga <slouken@libsdl.org>
Sat, 10 Jun 2006 09:11:59 +0000
branchSDL-1.3
changeset 1673 624e1412fbba
parent 1662 782fd950bd46
permissions -rw-r--r--
Keyboard code update in progress
     1 /*
     2     SDL - Simple DirectMedia Layer
     3     Copyright (C) 1997-2006 Sam Lantinga
     4 
     5     This library is free software; you can redistribute it and/or
     6     modify it under the terms of the GNU Lesser General Public
     7     License as published by the Free Software Foundation; either
     8     version 2.1 of the License, or (at your option) any later version.
     9 
    10     This library is distributed in the hope that it will be useful,
    11     but WITHOUT ANY WARRANTY; without even the implied warranty of
    12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    13     Lesser General Public License for more details.
    14 
    15     You should have received a copy of the GNU Lesser General Public
    16     License along with this library; if not, write to the Free Software
    17     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    18 
    19     Sam Lantinga
    20     slouken@libsdl.org
    21 */
    22 
    23 /**
    24  * \file SDL_keysym.h
    25  */
    26 
    27 #ifndef _SDL_keysym_h
    28 #define _SDL_keysym_h
    29 
    30 /**
    31  * \enum SDLKey
    32  *
    33  * \brief The SDL virtual key representation
    34  *
    35  * The SDLKey represents the unmodified character printed on the key
    36  * for the current keyboard layout.  The first 255 characters are used
    37  * unchanged from Latin-1, e.g. a key with 'a' on it will have the value "a".
    38  * The rest of the keys are named below, and fall into the range above 255.
    39  */
    40 typedef enum
    41 {
    42     /* The keyboard syms have been cleverly chosen to map to ASCII */
    43     SDLK_UNKNOWN = 0,
    44     SDLK_FIRST = 0,
    45     SDLK_BACKSPACE = 8,
    46     SDLK_TAB = 9,
    47     SDLK_CLEAR = 12,
    48     SDLK_RETURN = 13,
    49     SDLK_PAUSE = 19,
    50     SDLK_ESCAPE = 27,
    51     SDLK_SPACE = 32,
    52     SDLK_EXCLAIM = 33,
    53     SDLK_QUOTEDBL = 34,
    54     SDLK_HASH = 35,
    55     SDLK_DOLLAR = 36,
    56     SDLK_AMPERSAND = 38,
    57     SDLK_QUOTE = 39,
    58     SDLK_LEFTPAREN = 40,
    59     SDLK_RIGHTPAREN = 41,
    60     SDLK_ASTERISK = 42,
    61     SDLK_PLUS = 43,
    62     SDLK_COMMA = 44,
    63     SDLK_MINUS = 45,
    64     SDLK_PERIOD = 46,
    65     SDLK_SLASH = 47,
    66     SDLK_0 = 48,
    67     SDLK_1 = 49,
    68     SDLK_2 = 50,
    69     SDLK_3 = 51,
    70     SDLK_4 = 52,
    71     SDLK_5 = 53,
    72     SDLK_6 = 54,
    73     SDLK_7 = 55,
    74     SDLK_8 = 56,
    75     SDLK_9 = 57,
    76     SDLK_COLON = 58,
    77     SDLK_SEMICOLON = 59,
    78     SDLK_LESS = 60,
    79     SDLK_EQUALS = 61,
    80     SDLK_GREATER = 62,
    81     SDLK_QUESTION = 63,
    82     SDLK_AT = 64,
    83     /* 
    84        Skip uppercase letters
    85      */
    86     SDLK_LEFTBRACKET = 91,
    87     SDLK_BACKSLASH = 92,
    88     SDLK_RIGHTBRACKET = 93,
    89     SDLK_CARET = 94,
    90     SDLK_UNDERSCORE = 95,
    91     SDLK_BACKQUOTE = 96,
    92     SDLK_a = 97,
    93     SDLK_b = 98,
    94     SDLK_c = 99,
    95     SDLK_d = 100,
    96     SDLK_e = 101,
    97     SDLK_f = 102,
    98     SDLK_g = 103,
    99     SDLK_h = 104,
   100     SDLK_i = 105,
   101     SDLK_j = 106,
   102     SDLK_k = 107,
   103     SDLK_l = 108,
   104     SDLK_m = 109,
   105     SDLK_n = 110,
   106     SDLK_o = 111,
   107     SDLK_p = 112,
   108     SDLK_q = 113,
   109     SDLK_r = 114,
   110     SDLK_s = 115,
   111     SDLK_t = 116,
   112     SDLK_u = 117,
   113     SDLK_v = 118,
   114     SDLK_w = 119,
   115     SDLK_x = 120,
   116     SDLK_y = 121,
   117     SDLK_z = 122,
   118     SDLK_DELETE = 127,
   119     /* End of ASCII mapped keysyms */
   120 
   121     /* Numeric keypad */
   122     SDLK_KP0 = 256,
   123     SDLK_KP1 = 257,
   124     SDLK_KP2 = 258,
   125     SDLK_KP3 = 259,
   126     SDLK_KP4 = 260,
   127     SDLK_KP5 = 261,
   128     SDLK_KP6 = 262,
   129     SDLK_KP7 = 263,
   130     SDLK_KP8 = 264,
   131     SDLK_KP9 = 265,
   132     SDLK_KP_PERIOD = 266,
   133     SDLK_KP_DIVIDE = 267,
   134     SDLK_KP_MULTIPLY = 268,
   135     SDLK_KP_MINUS = 269,
   136     SDLK_KP_PLUS = 270,
   137     SDLK_KP_ENTER = 271,
   138     SDLK_KP_EQUALS = 272,
   139 
   140     /* Arrows + Home/End pad */
   141     SDLK_UP = 273,
   142     SDLK_DOWN = 274,
   143     SDLK_RIGHT = 275,
   144     SDLK_LEFT = 276,
   145     SDLK_INSERT = 277,
   146     SDLK_HOME = 278,
   147     SDLK_END = 279,
   148     SDLK_PAGEUP = 280,
   149     SDLK_PAGEDOWN = 281,
   150 
   151     /* Function keys */
   152     SDLK_F1 = 282,
   153     SDLK_F2 = 283,
   154     SDLK_F3 = 284,
   155     SDLK_F4 = 285,
   156     SDLK_F5 = 286,
   157     SDLK_F6 = 287,
   158     SDLK_F7 = 288,
   159     SDLK_F8 = 289,
   160     SDLK_F9 = 290,
   161     SDLK_F10 = 291,
   162     SDLK_F11 = 292,
   163     SDLK_F12 = 293,
   164     SDLK_F13 = 294,
   165     SDLK_F14 = 295,
   166     SDLK_F15 = 296,
   167 
   168     /* Key state modifier keys */
   169     SDLK_NUMLOCK = 300,
   170     SDLK_CAPSLOCK = 301,
   171     SDLK_SCROLLOCK = 302,
   172     SDLK_RSHIFT = 303,
   173     SDLK_LSHIFT = 304,
   174     SDLK_RCTRL = 305,
   175     SDLK_LCTRL = 306,
   176     SDLK_RALT = 307,
   177     SDLK_LALT = 308,
   178     SDLK_RMETA = 309,
   179     SDLK_LMETA = 310,
   180     SDLK_LSUPER = 311,          /**< Left "Windows" key */
   181     SDLK_RSUPER = 312,          /**< Right "Windows" key */
   182     SDLK_MODE = 313,            /**< "Alt Gr" key */
   183     SDLK_COMPOSE = 314,         /**< Multi-key compose key */
   184 
   185     /* Miscellaneous function keys */
   186     SDLK_HELP = 315,
   187     SDLK_PRINT = 316,
   188     SDLK_SYSREQ = 317,
   189     SDLK_BREAK = 318,
   190     SDLK_MENU = 319,
   191     SDLK_POWER = 320,           /**< Power Macintosh power key */
   192     SDLK_EURO = 321,            /**< Some european keyboards */
   193     SDLK_UNDO = 322,            /**< Atari keyboard has Undo */
   194 
   195     /* Add any other keys here */
   196 
   197     SDLK_LAST
   198 } SDLKey;
   199 
   200 /**
   201  * \enum SDLMod
   202  *
   203  * \brief Enumeration of valid key mods (possibly OR'd together)
   204  */
   205 typedef enum
   206 {
   207     KMOD_NONE = 0x0000,
   208     KMOD_LSHIFT = 0x0001,
   209     KMOD_RSHIFT = 0x0002,
   210     KMOD_LCTRL = 0x0040,
   211     KMOD_RCTRL = 0x0080,
   212     KMOD_LALT = 0x0100,
   213     KMOD_RALT = 0x0200,
   214     KMOD_LMETA = 0x0400,
   215     KMOD_RMETA = 0x0800,
   216     KMOD_NUM = 0x1000,
   217     KMOD_CAPS = 0x2000,
   218     KMOD_MODE = 0x4000,
   219     KMOD_RESERVED = 0x8000
   220 } SDLMod;
   221 
   222 #define KMOD_CTRL	(KMOD_LCTRL|KMOD_RCTRL)
   223 #define KMOD_SHIFT	(KMOD_LSHIFT|KMOD_RSHIFT)
   224 #define KMOD_ALT	(KMOD_LALT|KMOD_RALT)
   225 #define KMOD_META	(KMOD_LMETA|KMOD_RMETA)
   226 
   227 #endif /* _SDL_keysym_h */