1 /* 2 SDL - Simple DirectMedia Layer 3 Copyright (C) 1997-2009 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 #ifndef _SDL_screenkeyboard_h 24 #define _SDL_screenkeyboard_h 25 26 #include "SDL_stdinc.h" 27 #include "SDL_video.h" 28 #include "SDL_keysym.h" 29 30 /* On-screen keyboard exposed to the application, it's yet available on Android platform only */ 31 32 #include "begin_code.h" 33 /* Set up for C function definitions, even when using C++ */ 34 #ifdef __cplusplus 35 extern "C" { 36 #endif 37 38 /* Button IDs */ 39 enum { 40 41 SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD = 0, /* Joystick/D-Pad button */ 42 43 SDL_ANDROID_SCREENKEYBOARD_BUTTON_0, /* Main (usually Fire) button */ 44 SDL_ANDROID_SCREENKEYBOARD_BUTTON_1, 45 SDL_ANDROID_SCREENKEYBOARD_BUTTON_2, 46 SDL_ANDROID_SCREENKEYBOARD_BUTTON_3, 47 SDL_ANDROID_SCREENKEYBOARD_BUTTON_4, 48 SDL_ANDROID_SCREENKEYBOARD_BUTTON_5, 49 50 SDL_ANDROID_SCREENKEYBOARD_BUTTON_TEXT, /* Button to show screen keyboard */ 51 52 SDL_ANDROID_SCREENKEYBOARD_BUTTON_NUM 53 }; 54 55 /* All functions return 0 on failure and 1 on success, contrary to other SDL API */ 56 57 extern DECLSPEC int SDLCALL SDL_ANDROID_SetScreenKeyboardButtonPos(int buttonId, SDL_Rect * pos); 58 extern DECLSPEC int SDLCALL SDL_ANDROID_GetScreenKeyboardButtonPos(int buttonId, SDL_Rect * pos); 59 60 extern DECLSPEC int SDLCALL SDL_ANDROID_SetScreenKeyboardButtonKey(int buttonId, SDLKey key); 61 /* Returns SDLK_UNKNOWN on failure */ 62 extern DECLSPEC SDLKey SDLCALL SDL_ANDROID_GetScreenKeyboardButtonKey(int buttonId); 63 64 /* Buttons 0 and 1 may have auto-fire state */ 65 extern DECLSPEC int SDLCALL SDL_ANDROID_SetScreenKeyboardAutoFireButtonsAmount(int nbuttons); 66 extern DECLSPEC int SDLCALL SDL_ANDROID_GetScreenKeyboardAutoFireButtonsAmount(); 67 68 extern DECLSPEC int SDLCALL SDL_ANDROID_SetScreenKeyboardShown(int shown); 69 extern DECLSPEC int SDLCALL SDL_ANDROID_GetScreenKeyboardShown(); 70 71 extern DECLSPEC int SDLCALL SDL_ANDROID_GetScreenKeyboardSize(); 72 73 /* Show Android on-screen keyboard, and pass entered text back to application as SDL keypress events, 74 previousText is UTF-8 encoded, it may be NULL, only 256 first bytes will be used, and this call will not block */ 75 extern DECLSPEC int SDLCALL SDL_ANDROID_ToggleScreenKeyboardTextInput(const char * previousText); 76 77 /* Show Android on-screen keyboard, and pass entered text back to application in a buffer, 78 using buffer contents as previous text (UTF-8 encoded), the buffer may be of any size - 79 this call will block until user typed all text */ 80 extern DECLSPEC int SDLCALL SDL_ANDROID_GetScreenKeyboardTextInput(char * textBuf, int textBufSize); 81 82 /* Whether user redefined on-screen keyboard layout via SDL menu, app should not enforce it's own layout in that case */ 83 extern DECLSPEC int SDLCALL SDL_ANDROID_GetScreenKeyboardRedefinedByUser(); 84 85 #ifdef __cplusplus 86 } 87 #endif 88 #include "close_code.h" 89 90 #endif 91