Released version 3-2014010504
[notion/jeffpc.git] / mod_menu / menu.h
blobfe6470fb91f4ea6581f3d247a4d06afa216bddb8
1 /*
2 * ion/mod_menu/menu.h
4 * Copyright (c) Tuomo Valkonen 1999-2009.
6 * See the included file LICENSE for details.
7 */
9 #ifndef ION_MOD_MENU_MENU_H
10 #define ION_MOD_MENU_MENU_H
12 #include <ioncore/common.h>
13 #include <ioncore/window.h>
14 #include <ioncore/gr.h>
15 #include <ioncore/rectangle.h>
16 #include <ioncore/binding.h>
18 INTRCLASS(WMenu);
19 INTRSTRUCT(WMenuEntry);
21 #define WMENUENTRY_SUBMENU 0x0001
23 DECLSTRUCT(WMenuEntry){
24 char *title;
25 int flags;
26 GrStyleSpec attr;
29 DECLCLASS(WMenu){
30 WWindow win;
31 GrBrush *brush;
32 GrBrush *entry_brush;
34 WFitParams last_fp;
36 bool pmenu_mode;
37 bool big_mode;
38 int n_entries, selected_entry;
39 int first_entry, vis_entries;
40 int max_entry_w, entry_h, entry_spacing;
41 WMenuEntry *entries;
43 WMenu *submenu;
45 ExtlTab tab;
46 ExtlFn handler;
48 char *typeahead;
50 uint gm_kcb, gm_state;
52 /*WBindmap *cycle_bindmap;*/
56 INTRSTRUCT(WMenuCreateParams);
58 DECLSTRUCT(WMenuCreateParams){
59 ExtlFn handler;
60 ExtlTab tab;
61 bool pmenu_mode;
62 bool submenu_mode;
63 bool big_mode;
64 int initial;
65 WRectangle refg;
69 extern WMenu *create_menu(WWindow *par, const WFitParams *fp,
70 const WMenuCreateParams *params);
71 extern bool menu_init(WMenu *menu, WWindow *par, const WFitParams *fp,
72 const WMenuCreateParams *params);
73 extern void menu_deinit(WMenu *menu);
75 extern bool menu_fitrep(WMenu *menu, WWindow *par, const WFitParams *fp);
77 extern void menu_finish(WMenu *menu);
78 extern void menu_cancel(WMenu *menu);
79 extern bool menu_rqclose(WMenu *menu);
80 extern void menu_updategr(WMenu *menu);
82 extern int menu_entry_at_root(WMenu *menu, int root_x, int root_y);
83 extern void menu_release(WMenu *menu, XButtonEvent *ev);
84 extern void menu_motion(WMenu *menu, XMotionEvent *ev, int dx, int dy);
85 extern void menu_button(WMenu *menu, XButtonEvent *ev);
86 extern int menu_press(WMenu *menu, XButtonEvent *ev, WRegion **reg_ret);
88 extern void mod_menu_set_scroll_params(int delay, int amount);
90 extern void menu_typeahead_clear(WMenu *menu);
92 extern void menu_select_nth(WMenu *menu, int n);
93 extern void menu_select_prev(WMenu *menu);
94 extern void menu_select_next(WMenu *menu);
96 #endif /* ION_MOD_MENU_MENU_H */