]> git.decadent.org.uk Git - ion3.git/blob - mod_menu/menu.h
a79d36a08f0446b7eecf56a986cc97c763e596aa
[ion3.git] / mod_menu / menu.h
1 /*
2  * ion/mod_menu/menu.h
3  *
4  * Copyright (c) Tuomo Valkonen 1999-2006. 
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 };
29
30 DECLCLASS(WMenu){
31     WWindow win;
32     GrBrush *brush;
33     GrBrush *entry_brush;
34
35     WFitParams last_fp;
36     
37     bool pmenu_mode;
38     bool big_mode;
39     int n_entries, selected_entry;
40     int first_entry, vis_entries;
41     int max_entry_w, entry_h, entry_spacing;
42     WMenuEntry *entries;
43     
44     WMenu *submenu;
45     
46     ExtlTab tab;
47     ExtlFn handler;
48     
49     char *typeahead;
50     
51     uint gm_kcb, gm_state;
52 };
53
54
55 INTRSTRUCT(WMenuCreateParams);
56
57 DECLSTRUCT(WMenuCreateParams){
58     ExtlFn handler;
59     ExtlTab tab;
60     bool pmenu_mode;
61     bool submenu_mode;
62     bool big_mode;
63     int initial;
64     WRectangle refg;
65 };
66
67
68 extern WMenu *create_menu(WWindow *par, const WFitParams *fp,
69                           const WMenuCreateParams *params);
70 extern bool menu_init(WMenu *menu, WWindow *par, const WFitParams *fp,
71                       const WMenuCreateParams *params);
72 extern void menu_deinit(WMenu *menu);
73
74 extern bool menu_fitrep(WMenu *menu, WWindow *par, const WFitParams *fp);
75
76 extern void menu_finish(WMenu *menu);
77 extern void menu_cancel(WMenu *menu);
78 extern bool menu_rqclose(WMenu *menu);
79 extern void menu_updategr(WMenu *menu);
80
81 extern int menu_entry_at_root(WMenu *menu, int root_x, int root_y);
82 extern void menu_release(WMenu *menu, XButtonEvent *ev);
83 extern void menu_motion(WMenu *menu, XMotionEvent *ev, int dx, int dy);
84 extern void menu_button(WMenu *menu, XButtonEvent *ev);
85 extern int menu_press(WMenu *menu, XButtonEvent *ev, WRegion **reg_ret);
86
87 extern void mod_menu_set_scroll_params(int delay, int amount);
88
89 extern void menu_typeahead_clear(WMenu *menu);
90
91 extern void menu_select_nth(WMenu *menu, int n);
92 extern void menu_select_prev(WMenu *menu);
93 extern void menu_select_next(WMenu *menu);
94
95 #endif /* ION_MOD_MENU_MENU_H */