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-file.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
27/* If kcm_file_path is NULL, create a keyboard using the default built-in qwerty2 charmap */
28extern SkinKeyboard*  skin_keyboard_create( const char*  kcm_file_path, int  use_raw_keys );
29
30extern void           skin_keyboard_set_keyset( SkinKeyboard*  keyboard, SkinKeyset*  kset );
31
32extern const char*    skin_keyboard_charmap_name( SkinKeyboard*  keyboard );
33
34extern void           skin_keyboard_free( SkinKeyboard*  keyboard );
35
36extern void           skin_keyboard_enable( SkinKeyboard*  keyboard,
37                                            int            enabled );
38
39extern void           skin_keyboard_on_command( SkinKeyboard*       keyboard,
40                                                SkinKeyCommandFunc  cmd_func,
41                                                void*               cmd_opaque );
42
43extern void           skin_keyboard_set_rotation( SkinKeyboard*     keyboard,
44                                                  SkinRotation      rotation );
45
46extern AndroidKeyCode skin_keyboard_rotate_keycode( SkinKeyboard*   keyboard,
47                                                    AndroidKeyCode  keycode );
48
49extern void           skin_keyboard_on_key_press( SkinKeyboard*     keyboard,
50                                                  SkinKeyEventFunc  press_func,
51                                                  void*             press_opaque );
52
53extern void           skin_keyboard_process_event( SkinKeyboard*  keyboard, SDL_Event*  ev, int  down );
54extern int            skin_keyboard_process_unicode_event( SkinKeyboard*  kb,  unsigned int  unicode, int  down );
55
56extern void           skin_keyboard_add_key_event( SkinKeyboard*  k, unsigned code, unsigned  down );
57extern void           skin_keyboard_flush( SkinKeyboard*  kb );
58
59/* defined in android_main.c */
60extern SkinKeyboard*  android_emulator_get_keyboard( void );
61
62#endif /* _ANDROID_SKIN_KEYBOARD_H */
63
64