eff8966a37d6c2f770b77ac8beec8bad8fa2ac93
[silc.git] / apps / irssi / src / fe-common / core / keyboard.h
1 #ifndef __KEYBOARD_H
2 #define __KEYBOARD_H
3
4 #include "signals.h"
5
6 typedef struct _KEYBOARD_REC KEYBOARD_REC;
7 typedef struct _KEYINFO_REC KEYINFO_REC;
8 typedef struct _KEY_REC KEY_REC;
9
10 struct _KEYINFO_REC {
11         char *id;
12         char *description;
13
14         GSList *keys, *default_keys;
15 };
16
17 struct _KEY_REC {
18         KEYINFO_REC *info;
19
20         char *key;
21         char *data;
22 };
23
24 extern GSList *keyinfos;
25
26 /* Creates a new "keyboard" - this is used only for keeping track of
27    key combo states and sending the gui_data parameter in "key pressed"
28    signal */
29 KEYBOARD_REC *keyboard_create(void *gui_data);
30 /* Destroys a keyboard */
31 void keyboard_destroy(KEYBOARD_REC *keyboard);
32 /* Returns TRUE if key press was consumed. Control characters should be sent
33    as "^@" .. "^_" instead of #0..#31 chars, #127 should be sent as ^? */
34 int key_pressed(KEYBOARD_REC *keyboard, const char *key);
35
36 void key_bind(const char *id, const char *description,
37               const char *key_default, const char *data, SIGNAL_FUNC func);
38 void key_unbind(const char *id, SIGNAL_FUNC func);
39
40 void key_configure_freeze(void);
41 void key_configure_thaw(void);
42
43 void key_configure_add(const char *id, const char *key, const char *data);
44 void key_configure_remove(const char *key);
45
46 KEYINFO_REC *key_info_find(const char *id);
47
48 #define ENTRY_REDIRECT_FLAG_HOTKEY      0x01
49 #define ENTRY_REDIRECT_FLAG_HIDDEN      0x02
50
51 void keyboard_entry_redirect(SIGNAL_FUNC func, const char *entry,
52                              int flags, void *data);
53
54 void keyboard_init(void);
55 void keyboard_deinit(void);
56
57 #endif