Added SILC Thread Queue API
[crypto.git] / apps / irssi / src / fe-text / cuix-api.h
1 #ifndef __CUIX_API_H
2 #define __CUIX_API_H
3
4 #include "term-curses.h"
5
6 #define MAX_FIELD_SIZE 64
7
8 WINDOW *cuix_win;
9 PANEL *p_main;
10 PANEL *p_cuix;
11
12 enum objtype {
13     /* For objects */
14     CUIX_MENU,
15     CUIX_FORM,
16     CUIX_LIST,
17     /* For entries */
18     /* NB: LABEL must stay the first entry, as it is used to test if we have
19      * an object or an entry */
20     CUIX_LABEL,
21     CUIX_FIELD,
22     CUIX_MENUENTRY
23 };
24
25
26
27 /* This is the type of the action to be executed when the entry has been
28  * successfully selected (in case of a menuentry) or filled (in case of a
29  * field). */
30 typedef int(*action_fn_type)(char *);
31
32
33 typedef struct entry {
34     int type;
35     char *data; /* contains label or submenu title */
36     action_fn_type action;
37 } entry;
38
39
40 typedef struct object {
41     int type;
42     char *title;
43     void **entries;
44     int alloced; /* defines the current size of entries */ 
45     int last; /* index of the first non-alloced entry */
46 } object;
47
48
49 /* Object definitions */
50
51 object *create_menu (char *title);
52 object *create_form (char *title);
53 /* entries must be NULL terminated */
54 object *create_list (char *title, entry **entries);
55
56
57 entry *create_menuentry (char *label, action_fn_type action);
58 entry *create_label (char *label);
59 entry *create_field (char *label, action_fn_type action);
60
61 void attach_submenu (object *father, object *child);
62 void attach_entry (object *father, void *child);
63
64 void display_object (object *obj);
65
66 void my_menu(void);
67
68 #endif /* __CUIX_API_H */