/*
  Copyright (C) 2010-2011  Charles Pence <charles@charlespence.net>
  Copyright (C) 1996-1997  Id Software, Inc.

  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef KEYS_H__
#define KEYS_H__

#include <SDL/SDL_keysym.h>

//
// these are the key numbers that should be passed to Key_Event
//
#define    K_TAB            SDLK_TAB
#define    K_ENTER            SDLK_RETURN
#define    K_ESCAPE        SDLK_ESCAPE
#define    K_SPACE            SDLK_SPACE

// normal keys should be passed as lowercased ascii

#define    K_BACKSPACE        SDLK_BACKSPACE
#define    K_UPARROW        SDLK_UP
#define    K_DOWNARROW        SDLK_DOWN
#define    K_LEFTARROW        SDLK_LEFT
#define    K_RIGHTARROW    SDLK_RIGHT

#define    K_ALT            SDLK_RALT
#define    K_CTRL            SDLK_RCTRL
#define    K_SHIFT            SDLK_RSHIFT
#define    K_F1            SDLK_F1
#define    K_F2            SDLK_F2
#define    K_F3            SDLK_F3
#define    K_F4            SDLK_F4
#define    K_F5            SDLK_F5
#define    K_F6            SDLK_F6
#define    K_F7            SDLK_F7
#define    K_F8            SDLK_F8
#define    K_F9            SDLK_F9
#define    K_F10            SDLK_F10
#define    K_F11            SDLK_F11
#define    K_F12            SDLK_F12
#define    K_INS            SDLK_INSERT
#define    K_DEL            SDLK_DELETE
#define    K_PGDN            SDLK_PAGEUP
#define    K_PGUP            SDLK_PAGEDOWN
#define    K_HOME            SDLK_HOME
#define    K_END            SDLK_END

#define K_PAUSE            SDLK_PAUSE

//
// mouse buttons generate virtual keys
//
#define    K_MOUSE1        SDLK_LAST + 1
#define    K_MOUSE2        SDLK_LAST + 2
#define    K_MOUSE3        SDLK_LAST + 3
#define K_MOUSE4        SDLK_LAST + 4
#define K_MOUSE5        SDLK_LAST + 5

#define K_MWHEELUP        SDLK_LAST + 6
#define K_MWHEELDOWN    SDLK_LAST + 7

#define K_LAST          SDLK_LAST + 8



typedef enum {key_game, key_console, key_message, key_menu} keydest_t;

extern keydest_t    key_dest;
extern    int        key_repeats[K_LAST];
extern    int        key_count;            // incremented every key event
extern    int        key_lastpress;

void Key_Event (int key, qboolean down);
void Key_Init (void);
void Key_WriteBindings (File &fp);
void Key_SetBinding (int keynum, const std::string &binding);
void Key_ClearStates (void);
std::string Key_BindingForKey(int key);

#endif /* KEYS_H__ */

