/*
*     ___                       ____               __
*    / _ \___ _    _____ ____  /  _/__  ___  __ __/ /_
*   / ___/ _ \ |/|/ / -_) __/ _/ // _ \/ _ \/ // / __/
*  /_/   \___/__,__/\__/_/   /___/_//_/ .__/\_,_/\__/
*                                    /_/
*
*   Original Code by John Garrison
*   Written July 17 1999
*   To be released under the LGPL
*
*   Keyboard interface routines
*
*   See LICENSE.TXT for more LGPL info
*/

#ifndef _PI_keyboard_H
#define _PI_keyboard_H

#ifdef __cplusplus
extern "C" {
#endif

#include "powerinput.h"

/* This comes from the SDL Keysym header file */
typedef enum {
   PIK_UNKNOW = 0,
   PIK_FIRST = 0,
   PIK_BACKSPACE = 8,
   PIK_TAB = 9,
   PIK_CLEAR = 12,
   PIK_RETURN = 13,
   PIK_PAUSE = 19,
   PIK_ESCAPE = 27,
   PIK_SPACE = 32,
   PIK_EXCLAIM = 33,
   PIK_QUOTEDBL = 34,
   PIK_HASH = 35,
   PIK_DOLLAR = 36,
   PIK_AMPERSAND = 38,
   PIK_QUOTE = 39,
   PIK_LEFTPAREN = 40,
   PIK_RIGHTPAREN = 41,
   PIK_ASTERISK = 42,
   PIK_PLUS = 43,
   PIK_COMMA = 44,
   PIK_MINUS = 45,
   PIK_PERIOD = 46,
   PIK_SLASH = 47,
   PIK_0 = 48,
   PIK_1 = 49,
   PIK_2 = 50,
   PIK_3 = 51,
   PIK_4 = 52,
   PIK_5 = 53,
   PIK_6 = 54,
   PIK_7 = 55,
   PIK_8 = 56,
   PIK_9 = 57,
   PIK_COLON = 58,
   PIK_SEMICOLON = 59,
   PIK_LESS = 60,
   PIK_EQUALS = 61,
   PIK_GREATER = 62,
   PIK_QUESTION = 63,
   PIK_AT = 64,

   PIK_LEFTBRACKET = 91,
   PIK_BACKSLASH = 92,
   PIK_RIGHTBRACKET = 93,
   PIK_CARET = 94,
   PIK_UNDERSCORE = 95,
   PIK_BACKQUOTE = 96,
   PIK_a = 97,
   PIK_b = 98,
   PIK_c = 99,
   PIK_d = 100,
   PIK_e = 101,
   PIK_f = 102,
   PIK_g = 103,
   PIK_h = 104,
   PIK_i = 105,
   PIK_j = 106,
   PIK_k = 107,
   PIK_l = 108,
   PIK_m = 109,
   PIK_n = 110,
   PIK_o = 111,
   PIK_p = 112,
   PIK_q = 113,
   PIK_r = 114,
   PIK_s = 115,
   PIK_t = 116,
   PIK_u = 117,
   PIK_v = 118,
   PIK_w = 119,
   PIK_x = 120,
   PIK_y = 121,
   PIK_z = 122,
   PIK_DELETE = 127,

   PIK_WORLD_0 = 160,
   PIK_WORLD_1 = 161,
   PIK_WORLD_2 = 162,
   PIK_WORLD_3 = 163,
   PIK_WORLD_4 = 164,
   PIK_WORLD_5 = 165,
   PIK_WORLD_6 = 166,
   PIK_WORLD_7 = 167,
   PIK_WORLD_8 = 168,
   PIK_WORLD_9 = 169,
   PIK_WORLD_10 = 170,
   PIK_WORLD_11 = 171,
   PIK_WORLD_12 = 172,
   PIK_WORLD_13 = 173,
   PIK_WORLD_14 = 174,
   PIK_WORLD_15 = 175,
   PIK_WORLD_16 = 176,
   PIK_WORLD_17 = 177,
   PIK_WORLD_18 = 178,
   PIK_WORLD_19 = 179,
   PIK_WORLD_20 = 180,
   PIK_WORLD_21 = 181,
   PIK_WORLD_22 = 182,
   PIK_WORLD_23 = 183,
   PIK_WORLD_24 = 184,
   PIK_WORLD_25 = 185,
   PIK_WORLD_26 = 186,
   PIK_WORLD_27 = 187,
   PIK_WORLD_28 = 188,
   PIK_WORLD_29 = 189,
   PIK_WORLD_30 = 190,
   PIK_WORLD_31 = 191,
   PIK_WORLD_32 = 192,
   PIK_WORLD_33 = 193,
   PIK_WORLD_34 = 194,
   PIK_WORLD_35 = 195,
   PIK_WORLD_36 = 196,
   PIK_WORLD_37 = 197,
   PIK_WORLD_38 = 198,
   PIK_WORLD_39 = 199,
   PIK_WORLD_40 = 200,
   PIK_WORLD_41 = 201,
   PIK_WORLD_42 = 202,
   PIK_WORLD_43 = 203,
   PIK_WORLD_44 = 204,
   PIK_WORLD_45 = 205,
   PIK_WORLD_46 = 206,
   PIK_WORLD_47 = 207,
   PIK_WORLD_48 = 208,
   PIK_WORLD_49 = 209,
   PIK_WORLD_50 = 210,
   PIK_WORLD_51 = 211,
   PIK_WORLD_52 = 212,
   PIK_WORLD_53 = 213,
   PIK_WORLD_54 = 214,
   PIK_WORLD_55 = 215,
   PIK_WORLD_56 = 216,
   PIK_WORLD_57 = 217,
   PIK_WORLD_58 = 218,
   PIK_WORLD_59 = 219,
   PIK_WORLD_60 = 220,
   PIK_WORLD_61 = 221,
   PIK_WORLD_62 = 222,
   PIK_WORLD_63 = 223,
   PIK_WORLD_64 = 224,
   PIK_WORLD_65 = 225,
   PIK_WORLD_66 = 226,
   PIK_WORLD_67 = 227,
   PIK_WORLD_68 = 228,
   PIK_WORLD_69 = 229,
   PIK_WORLD_70 = 230,
   PIK_WORLD_71 = 231,
   PIK_WORLD_72 = 232,
   PIK_WORLD_73 = 233,
   PIK_WORLD_74 = 234,
   PIK_WORLD_75 = 235,
   PIK_WORLD_76 = 236,
   PIK_WORLD_77 = 237,
   PIK_WORLD_78 = 238,
   PIK_WORLD_79 = 239,
   PIK_WORLD_80 = 240,
   PIK_WORLD_81 = 241,
   PIK_WORLD_82 = 242,
   PIK_WORLD_83 = 243,
   PIK_WORLD_84 = 244,
   PIK_WORLD_85 = 245,
   PIK_WORLD_86 = 246,
   PIK_WORLD_87 = 247,
   PIK_WORLD_88 = 248,
   PIK_WORLD_89 = 249,
   PIK_WORLD_90 = 250,
   PIK_WORLD_91 = 251,
   PIK_WORLD_92 = 252,
   PIK_WORLD_93 = 253,
   PIK_WORLD_94 = 254,
   PIK_WORLD_95 = 255,

   PIK_KP0 = 256,
   PIK_KP1 = 257,
   PIK_KP2 = 258,
   PIK_KP3 = 259,
   PIK_KP4 = 260,
   PIK_KP5 = 261,
   PIK_KP6 = 262,
   PIK_KP7 = 263,
   PIK_KP8 = 264,
   PIK_KP9 = 265,
   PIK_KP_PERIOD = 266,
   PIK_KP_DIVIDE = 267,
   PIK_KP_MULTIPLY = 268,
   PIK_KP_MINUS = 269,
   PIK_KP_PLUS = 270,
   PIK_KP_ENTER = 271,
   PIK_KP_EQUALS = 272,

   PIK_UP = 273,
   PIK_DOWN = 274,
   PIK_RIGHT = 275,
   PIK_LEFT = 276,
   PIK_INSERT = 277,
   PIK_HOME = 278,
   PIK_END = 279,
   PIK_PAGEUP = 280,
   PIK_PAGEDOWN = 281,

   PIK_F1 = 282,
   PIK_F2 = 283,
   PIK_F3 = 284,
   PIK_F4 = 285,
   PIK_F5 = 286,
   PIK_F6 = 287,
   PIK_F7 = 288,
   PIK_F8 = 289,
   PIK_F9 = 290,
   PIK_F10 = 291,
   PIK_F11 = 292,
   PIK_F12 = 293,
   PIK_F13 = 294,
   PIK_F14 = 295,
   PIK_F15 = 296,

   PIK_NUMLOCK = 300,
   PIK_CAPSLOCK = 301,
   PIK_SCROLLOCK = 302,
   PIK_RSHIFT = 303,
   PIK_LSHIFT = 304,
   PIK_RCTRL = 305,
   PIK_LCTRL = 306,
   PIK_RALT = 307,
   PIK_LALT = 308,
   PIK_RMETA = 309,
   PIK_LMETA = 310,
   PIK_LSUPER = 311,
   PIK_RSUPER = 312,
   PIK_MODE = 313,


   PIK_HELP = 315,
   PIK_PRINT = 316,
   PIK_SYSREQ = 317,
   PIK_BREAK = 318,
   PIK_MENU = 319,
   PIK_POWER = 320,
   PIK_EURO = 321,

   PIK_LAST
} PIKey;

#define PIK_ENTER PIK_RETURN
#define PIK_ESC PIK_ESCAPE

typedef enum {
PIMOD_NONE  = 0x0000,
PIMOD_LSHIFT= 0x0001,
PIMOD_RSHIFT= 0x0002,
PIMOD_LCTRL = 0x0040,
PIMOD_RCTRL = 0x0080,
PIMOD_LALT  = 0x0100,
PIMOD_RALT  = 0x0200,
PIMOD_LMETA = 0x0400,
PIMOD_RMETA = 0x0800,
PIMOD_NUM   = 0x1000,
PIMOD_CAPS  = 0x2000,
PIMOD_MODE  = 0x4000,
PIMOD_RESERVED = 0x8000
} PIMod;

#define PIMOD_CTRL       (PIMOD_LCTRL|PIMOD_RCTRL)
#define PIMOD_SHIFT      (PIMOD_LSHIFT|PIMOD_RSHIFT)
#define PIMOD_ALT        (PIMOD_LALT|PIMOD_RALT)
#define PIMOD_META       (PIMOD_LMETA|PIMOD_RMETA)


Uint8 *PI_GetKeyboardState();
int PI_IsKeyDown(int Key);
int PI_WasKeyPressed(Uint8 *Keys, int Key);
PIMod PI_GetModifierState();
int PI_IsModifierDown(int Mod);
int PI_WasModifierPressed(Uint8 *Mods, int Mod);

#ifdef __cplusplus
};
#endif

#endif