]> Dogcows Code - chaz/openbox/blob - openbox/menu.h
2371dee011d01ad8f2ea3552a24f1e62e4b95d56
[chaz/openbox] / openbox / menu.h
1 #ifndef __menu_h
2 #define __menu_h
3
4 #include "action.h"
5 #include "render/render.h"
6
7 #include <glib.h>
8
9 extern GHashTable *menu_map;
10
11 typedef struct Menu {
12 char *label;
13 char *name;
14
15 GList *entries;
16 /* GList *tail; */
17
18 /* ? */
19 gboolean shown;
20 gboolean invalid;
21
22 struct Menu *parent;
23
24 /* waste o' pointers */
25 void (*show)( /* some bummu */);
26 void (*hide)( /* some bummu */);
27 void (*update)( /* some bummu */);
28 void (*mouseover)( /* some bummu */);
29 void (*selected)( /* some bummu */);
30
31
32 /* render stuff */
33 Window frame;
34 Window title;
35 Appearance *a_title;
36 int title_min_w, title_h;
37 Window items;
38 Appearance *a_items;
39 int bullet_w;
40 int item_h;
41 int width;
42 } Menu;
43
44 typedef enum MenuEntryRenderType {
45 MenuEntryRenderType_None = 0,
46 MenuEntryRenderType_Submenu = 1 << 0,
47 MenuEntryRenderType_Boolean = 1 << 1,
48 MenuEntryRenderType_Separator = 1 << 2,
49
50 MenuEntryRenderType_Other = 1 << 7
51 } MenuEntryRenderType;
52
53 typedef struct {
54 char *label;
55 Menu *parent;
56
57 Action *action;
58
59 MenuEntryRenderType render_type;
60 gboolean hilite;
61 gboolean enabled;
62 gboolean boolean_value;
63
64 Menu *submenu;
65
66 /* render stuff */
67 Window item;
68 Appearance *a_item;
69 Appearance *a_disabled;
70 Appearance *a_hilite;
71 int y;
72 int min_w;
73 } MenuEntry;
74
75 void menu_startup();
76 void menu_shutdown();
77
78 Menu *menu_new(char *label, char *name, Menu *parent);
79 void menu_free(char *name);
80
81 void menu_show(char *name, int x, int y, Client *client);
82
83 MenuEntry *menu_entry_new_full(char *label, Action *action,
84 MenuEntryRenderType render_type,
85 gpointer submenu);
86
87 #define menu_entry_new(label, action) \
88 menu_entry_new_full(label, action, MenuEntryRenderType_None, NULL)
89
90 void menu_entry_free(MenuEntry *entry);
91
92 void menu_entry_set_submenu(MenuEntry *entry, Menu *submenu);
93
94 void menu_add_entry(Menu *menu, MenuEntry *entry);
95
96 MenuEntry *menu_find_entry(Menu *menu, Window win);
97
98 void menu_entry_render(MenuEntry *self);
99
100 #endif
This page took 0.034888 seconds and 3 git commands to generate.