src/events/SDL_keyboard_c.h
changeset 1895 c121d94672cb
child 2129 047245361002
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/events/SDL_keyboard_c.h	Mon Jul 10 21:04:37 2006 +0000
     1.3 @@ -0,0 +1,96 @@
     1.4 +/*
     1.5 +    SDL - Simple DirectMedia Layer
     1.6 +    Copyright (C) 1997-2006 Sam Lantinga
     1.7 +
     1.8 +    This library is free software; you can redistribute it and/or
     1.9 +    modify it under the terms of the GNU Lesser General Public
    1.10 +    License as published by the Free Software Foundation; either
    1.11 +    version 2.1 of the License, or (at your option) any later version.
    1.12 +
    1.13 +    This library is distributed in the hope that it will be useful,
    1.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    1.16 +    Lesser General Public License for more details.
    1.17 +
    1.18 +    You should have received a copy of the GNU Lesser General Public
    1.19 +    License along with this library; if not, write to the Free Software
    1.20 +    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    1.21 +
    1.22 +    Sam Lantinga
    1.23 +    slouken@libsdl.org
    1.24 +*/
    1.25 +#include "SDL_config.h"
    1.26 +
    1.27 +#ifndef _SDL_keyboard_c_h
    1.28 +#define _SDL_keyboard_c_h
    1.29 +
    1.30 +#include "SDL_keysym.h"
    1.31 +#include "SDL_events.h"
    1.32 +
    1.33 +typedef struct SDL_Keyboard SDL_Keyboard;
    1.34 +
    1.35 +struct SDL_Keyboard
    1.36 +{
    1.37 +    /* Free the keyboard when it's time */
    1.38 +    void (*FreeKeyboard) (SDL_Keyboard * keyboard);
    1.39 +
    1.40 +    /* Data common to all keyboards */
    1.41 +    SDL_WindowID focus;
    1.42 +    Uint16 modstate;
    1.43 +    Uint8 keystate[SDLK_LAST];
    1.44 +
    1.45 +    struct
    1.46 +    {
    1.47 +        int firsttime;          /* if we check against the delay or repeat value */
    1.48 +        int delay;              /* the delay before we start repeating */
    1.49 +        int interval;           /* the delay between key repeat events */
    1.50 +        Uint32 timestamp;       /* the time the first keydown event occurred */
    1.51 +
    1.52 +        SDL_Event evt;          /* the event we are supposed to repeat */
    1.53 +    } repeat;
    1.54 +
    1.55 +    void *driverdata;
    1.56 +};
    1.57 +
    1.58 +/* Used by the OS keyboard code to detect whether or not to do UNICODE */
    1.59 +#ifndef DEFAULT_UNICODE_TRANSLATION
    1.60 +#define DEFAULT_UNICODE_TRANSLATION 0   /* Default off because of overhead */
    1.61 +#endif
    1.62 +extern int SDL_TranslateUNICODE;
    1.63 +
    1.64 +/* Initialize the keyboard subsystem */
    1.65 +extern int SDL_KeyboardInit(void);
    1.66 +
    1.67 +/* Get the keyboard at an index */
    1.68 +extern SDL_Keyboard *SDL_GetKeyboard(int index);
    1.69 +
    1.70 +/* Add a keyboard, possibly reattaching at a particular index (or -1),
    1.71 +   returning the index of the keyboard, or -1 if there was an error.
    1.72 + */
    1.73 +extern int SDL_AddKeyboard(const SDL_Keyboard * keyboard, int index);
    1.74 +
    1.75 +/* Remove a keyboard at an index, clearing the slot for later */
    1.76 +extern void SDL_DelKeyboard(int index);
    1.77 +
    1.78 +/* Clear the state of a keyboard at an index */
    1.79 +extern void SDL_ResetKeyboard(int index);
    1.80 +
    1.81 +/* Set the keyboard focus window */
    1.82 +extern void SDL_SetKeyboardFocus(int index, SDL_WindowID windowID);
    1.83 +
    1.84 +/* Send a keyboard event for a keyboard at an index */
    1.85 +extern int SDL_SendKeyboardKey(int index, Uint8 state, Uint8 scancode,
    1.86 +                               SDLKey key);
    1.87 +
    1.88 +/* Send keyboard text input for a keyboard at an index */
    1.89 +extern int SDL_SendKeyboardText(int index, const char *text);
    1.90 +
    1.91 +/* Used by the event loop to queue pending keyboard repeat events */
    1.92 +extern void SDL_CheckKeyRepeat(void);
    1.93 +
    1.94 +/* Shutdown the keyboard subsystem */
    1.95 +extern void SDL_KeyboardQuit(void);
    1.96 +
    1.97 +#endif /* _SDL_keyboard_c_h */
    1.98 +
    1.99 +/* vi: set ts=4 sw=4 expandtab: */