keyboard.h revision cccd28ca5064a7bd14282cd774ee5bb7126d5845
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
21typedef struct SkinKeyboard   SkinKeyboard;
22
23typedef void (*SkinKeyCommandFunc)( void*  opaque, SkinKeyCommand  command, int  param );
24
25typedef void (*SkinKeyEventFunc)( void*  opaque, AndroidKeyCode  code, int  down );
26
27extern SkinKeyboard*  skin_keyboard_create_from_aconfig( AConfig*  aconfig, int  use_raw_keys );
28
29extern SkinKeyboard*  skin_keyboard_create_from_kcm( const char*  kcm_file_path, int  use_raw_keys );
30
31extern void           skin_keyboard_set_keyset( SkinKeyboard*  keyboard, SkinKeyset*  kset );
32
33extern const char*    skin_keyboard_charmap_name( SkinKeyboard*  keyboard );
34
35extern void           skin_keyboard_free( SkinKeyboard*  keyboard );
36
37extern void           skin_keyboard_enable( SkinKeyboard*  keyboard,
38                                            int            enabled );
39
40extern void           skin_keyboard_on_command( SkinKeyboard*       keyboard,
41                                                SkinKeyCommandFunc  cmd_func,
42                                                void*               cmd_opaque );
43
44extern void           skin_keyboard_set_rotation( SkinKeyboard*     keyboard,
45                                                  SkinRotation      rotation );
46
47extern AndroidKeyCode skin_keyboard_rotate_keycode( SkinKeyboard*   keyboard,
48                                                    AndroidKeyCode  keycode );
49
50extern void           skin_keyboard_on_key_press( SkinKeyboard*     keyboard,
51                                                  SkinKeyEventFunc  press_func,
52                                                  void*             press_opaque );
53
54extern void           skin_keyboard_process_event( SkinKeyboard*  keyboard, SDL_Event*  ev, int  down );
55extern int            skin_keyboard_process_unicode_event( SkinKeyboard*  kb,  unsigned int  unicode, int  down );
56
57extern void           skin_keyboard_add_key_event( SkinKeyboard*  k, unsigned code, unsigned  down );
58extern void           skin_keyboard_flush( SkinKeyboard*  kb );
59
60/* defined in android_main.c */
61extern SkinKeyboard*  android_emulator_get_keyboard( void );
62
63#endif /* _ANDROID_SKIN_KEYBOARD_H */
64
65