]> git.decadent.org.uk Git - ion3.git/blob - mod_menu/menu.h
[svn-upgrade] Integrating new upstream version, ion3 (20070203)
[ion3.git] / mod_menu / menu.h
1 /*
2  * ion/mod_menu/menu.h
3  *
4  * Copyright (c) Tuomo Valkonen 1999-2007. 
5  *
6  * Ion is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation; either version 2.1 of the License, or
9  * (at your option) any later version.
10  */
11
12 #ifndef ION_MOD_MENU_MENU_H
13 #define ION_MOD_MENU_MENU_H
14
15 #include <ioncore/common.h>
16 #include <ioncore/window.h>
17 #include <ioncore/gr.h>
18 #include <ioncore/rectangle.h>
19
20 INTRCLASS(WMenu);
21 INTRSTRUCT(WMenuEntry);
22
23 #define WMENUENTRY_SUBMENU 0x0001
24
25 DECLSTRUCT(WMenuEntry){
26     char *title;
27     int flags;
28     GrStyleSpec attr;
29 };
30
31 DECLCLASS(WMenu){
32     WWindow win;
33     GrBrush *brush;
34     GrBrush *entry_brush;
35
36     WFitParams last_fp;
37     
38     bool pmenu_mode;
39     bool big_mode;
40     int n_entries, selected_entry;
41     int first_entry, vis_entries;
42     int max_entry_w, entry_h, entry_spacing;
43     WMenuEntry *entries;
44     
45     WMenu *submenu;
46     
47     ExtlTab tab;
48     ExtlFn handler;
49     
50     char *typeahead;
51     
52     uint gm_kcb, gm_state;
53 };
54
55
56 INTRSTRUCT(WMenuCreateParams);
57
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;
66 };
67
68
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);
74
75 extern bool menu_fitrep(WMenu *menu, WWindow *par, const WFitParams *fp);
76
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);
81
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);
87
88 extern void mod_menu_set_scroll_params(int delay, int amount);
89
90 extern void menu_typeahead_clear(WMenu *menu);
91
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);
95
96 #endif /* ION_MOD_MENU_MENU_H */