1 /* Copyright (C) 2007-2008 The Android Open Source Project 2 ** 3 ** This software is licensed under the terms of the GNU General Public 4 ** License version 2, as published by the Free Software Foundation, and 5 ** may be copied, distributed, and modified under those terms. 6 ** 7 ** This program is distributed in the hope that it will be useful, 8 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 9 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 ** GNU General Public License for more details. 11 */ 12 #ifndef _ANDROID_SKIN_KEYBOARD_H 13 #define _ANDROID_SKIN_KEYBOARD_H 14 15 #include "android/charmap.h" 16 #include "android/config.h" 17 #include "android/skin/image.h" /* for SkinRotation */ 18 #include "android/skin/keyset.h" 19 #include <SDL.h> 20 21 typedef struct SkinKeyboard SkinKeyboard; 22 23 typedef void (*SkinKeyCommandFunc)( void* opaque, SkinKeyCommand command, int param ); 24 25 typedef void (*SkinKeyEventFunc)( void* opaque, AndroidKeyCode code, int down ); 26 27 extern SkinKeyboard* skin_keyboard_create_from_aconfig( AConfig* aconfig, int use_raw_keys ); 28 29 extern SkinKeyboard* skin_keyboard_create_from_kcm( const char* kcm_file_path, int use_raw_keys ); 30 31 extern void skin_keyboard_set_keyset( SkinKeyboard* keyboard, SkinKeyset* kset ); 32 33 extern const char* skin_keyboard_charmap_name( SkinKeyboard* keyboard ); 34 35 extern void skin_keyboard_free( SkinKeyboard* keyboard ); 36 37 extern void skin_keyboard_enable( SkinKeyboard* keyboard, 38 int enabled ); 39 40 extern void skin_keyboard_on_command( SkinKeyboard* keyboard, 41 SkinKeyCommandFunc cmd_func, 42 void* cmd_opaque ); 43 44 extern void skin_keyboard_set_rotation( SkinKeyboard* keyboard, 45 SkinRotation rotation ); 46 47 extern AndroidKeyCode skin_keyboard_rotate_keycode( SkinKeyboard* keyboard, 48 AndroidKeyCode keycode ); 49 50 extern void skin_keyboard_on_key_press( SkinKeyboard* keyboard, 51 SkinKeyEventFunc press_func, 52 void* press_opaque ); 53 54 extern void skin_keyboard_process_event( SkinKeyboard* keyboard, SDL_Event* ev, int down ); 55 extern int skin_keyboard_process_unicode_event( SkinKeyboard* kb, unsigned int unicode, int down ); 56 57 extern void skin_keyboard_add_key_event( SkinKeyboard* k, unsigned code, unsigned down ); 58 extern void skin_keyboard_flush( SkinKeyboard* kb ); 59 60 /* defined in android_main.c */ 61 extern SkinKeyboard* android_emulator_get_keyboard( void ); 62 63 #endif /* _ANDROID_SKIN_KEYBOARD_H */ 64 65