]> icculus.org git repositories - dana/openbox.git/blob - openbox/menu.h
use the frame's position in the maximize function since they're converted to the...
[dana/openbox.git] / openbox / menu.h
1 #ifndef __menu_h
2 #define __menu_h
3
4 #include "action.h"
5 #include <glib.h>
6
7 typedef struct Menu {
8     char *label;
9     char *name;
10     
11     GList *entries;
12     /* GList *tail; */
13
14     /* ? */
15     gboolean shown;
16     gboolean invalid;
17
18     struct Menu *parent;
19
20     /* waste o' pointers */
21     void (*show)( /* some bummu */);
22     void (*hide)( /* some bummu */);
23     void (*update)( /* some bummu */);
24     void (*mouseover)( /* some bummu */);
25     void (*selected)( /* some bummu */);
26 } Menu;
27
28 typedef enum MenuEntryRenderType {
29     MenuEntryRenderType_None = 0,
30     MenuEntryRenderType_Submenu = 1 << 0,
31     MenuEntryRenderType_Boolean = 1 << 1,
32     MenuEntryRenderType_Separator = 1 << 2,
33     
34     MenuEntryRenderType_Other = 1 << 7
35 } MenuEntryRenderType;
36
37
38 typedef struct {
39     char *label;
40     Menu *parent;
41
42     Action action;    
43     
44     MenuEntryRenderType render_type;
45     gboolean enabled;
46     gboolean boolean_value;
47     gpointer render_data; /* where the engine can store anything it likes */
48
49     Menu *submenu;
50 } MenuEntry;
51
52 Menu *menu_new(const char *label, const char *name, Menu *parent);
53 void menu_free(const char *name);
54
55 MenuEntry *menu_entry_new_full(const char *label, Action *action,
56                                const MenuEntryRenderType render_type,
57                                gpointer render_data, gpointer submenu);
58
59 #define menu_entry_new(label, action) \
60   menu_entry_new(label, action, MenuEntryRenderType_None, NULL, NULL)
61
62 void menu_entry_free(const MenuEntry *entry);
63
64 void menu_entry_set_submenu(MenuEntry *entry, Menu *submenu);
65
66 void menu_add_entry(Menu *menu, MenuEntry *entry);
67 #endif