]> Dogcows Code - chaz/openbox/blob - openbox/menu.h
menus works on some level. add a built-in root menu
[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 Client *client;
34 Window frame;
35 Window title;
36 Appearance *a_title;
37 int title_min_w, title_h;
38 Window items;
39 Appearance *a_items;
40 int bullet_w;
41 int item_h;
42 int width;
43 } Menu;
44
45 typedef enum MenuEntryRenderType {
46 MenuEntryRenderType_None = 0,
47 MenuEntryRenderType_Submenu = 1 << 0,
48 MenuEntryRenderType_Boolean = 1 << 1,
49 MenuEntryRenderType_Separator = 1 << 2,
50
51 MenuEntryRenderType_Other = 1 << 7
52 } MenuEntryRenderType;
53
54 typedef struct {
55 char *label;
56 Menu *parent;
57
58 Action *action;
59
60 MenuEntryRenderType render_type;
61 gboolean hilite;
62 gboolean enabled;
63 gboolean boolean_value;
64
65 Menu *submenu;
66
67 /* render stuff */
68 Window item;
69 Appearance *a_item;
70 Appearance *a_disabled;
71 Appearance *a_hilite;
72 int y;
73 int min_w;
74 } MenuEntry;
75
76 void menu_startup();
77 void menu_shutdown();
78
79 Menu *menu_new(char *label, char *name, Menu *parent);
80 void menu_free(char *name);
81
82 void menu_show(char *name, int x, int y, Client *client);
83 void menu_hide(Menu *self);
84
85 MenuEntry *menu_entry_new_full(char *label, Action *action,
86 MenuEntryRenderType render_type,
87 gpointer submenu);
88
89 #define menu_entry_new(label, action) \
90 menu_entry_new_full(label, action, MenuEntryRenderType_None, NULL)
91
92 void menu_entry_free(MenuEntry *entry);
93
94 void menu_entry_set_submenu(MenuEntry *entry, Menu *submenu);
95
96 void menu_add_entry(Menu *menu, MenuEntry *entry);
97
98 MenuEntry *menu_find_entry(Menu *menu, Window win);
99
100 void menu_entry_render(MenuEntry *self);
101
102 void menu_entry_fire(MenuEntry *self);
103
104 #endif
This page took 0.039394 seconds and 5 git commands to generate.