Added SILC Thread Queue API
[crypto.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 1 if key press was consumed, -1 if not, 0 if it's beginning of a
33    key combo. Control characters should be sent as "^@" .. "^_" instead of
34    #0..#31 chars, #127 should be sent as ^? */
35 int key_pressed(KEYBOARD_REC *keyboard, const char *key);
36
37 void key_bind(const char *id, const char *description,
38               const char *key_default, const char *data, SIGNAL_FUNC func);
39 void key_unbind(const char *id, SIGNAL_FUNC func);
40
41 void key_configure_freeze(void);
42 void key_configure_thaw(void);
43
44 void key_configure_add(const char *id, const char *key, const char *data);
45 void key_configure_remove(const char *key);
46
47 KEYINFO_REC *key_info_find(const char *id);
48
49 #define ENTRY_REDIRECT_FLAG_HOTKEY      0x01
50 #define ENTRY_REDIRECT_FLAG_HIDDEN      0x02
51
52 void keyboard_entry_redirect(SIGNAL_FUNC func, const char *entry,
53                              int flags, void *data);
54
55 void keyboard_init(void);
56 void keyboard_deinit(void);
57
58 #endif