5 #include "render/render.h"
13 typedef void(*menu_controller_show
)(struct Menu
*self
, int x
, int y
, Client
*);
14 typedef void(*menu_controller_update
)(struct Menu
*self
);
15 typedef void(*menu_controller_mouseover
)(struct MenuEntry
*self
,
18 extern GHashTable
*menu_hash
;
33 struct Menu
*open_submenu
;
35 /* place a menu on screen */
36 menu_controller_show show
;
37 void (*hide
)( /* some bummu */);
40 menu_controller_update update
;
41 menu_controller_mouseover mouseover
;
42 void (*selected
)( /* some bummu */);
49 RrAppearance
*a_title
;
50 int title_min_w
, title_h
;
52 RrAppearance
*a_items
;
63 typedef enum MenuEntryRenderType
{
64 MenuEntryRenderType_None
= 0,
65 MenuEntryRenderType_Submenu
= 1 << 0,
66 MenuEntryRenderType_Boolean
= 1 << 1,
67 MenuEntryRenderType_Separator
= 1 << 2,
69 MenuEntryRenderType_Other
= 1 << 7
70 } MenuEntryRenderType
;
72 typedef struct MenuEntry
{
78 MenuEntryRenderType render_type
;
81 gboolean boolean_value
;
88 RrAppearance
*a_disabled
;
89 RrAppearance
*a_hilite
;
97 #define menu_new(l, n, p) \
98 menu_new_full(l, n, p, NULL, NULL)
100 Menu
*menu_new_full(char *label
, char *name
, Menu
*parent
,
101 menu_controller_show show
, menu_controller_update update
);
102 void menu_free(char *name
);
104 void menu_show(char *name
, int x
, int y
, Client
*client
);
105 void menu_show_full(Menu
*menu
, int x
, int y
, Client
*client
);
107 void menu_hide(Menu
*self
);
109 void menu_clear(Menu
*self
);
111 MenuEntry
*menu_entry_new_full(char *label
, Action
*action
,
112 MenuEntryRenderType render_type
,
115 #define menu_entry_new(label, action) \
116 menu_entry_new_full(label, action, MenuEntryRenderType_None, NULL)
118 #define menu_entry_new_separator(label) \
119 menu_entry_new_full(label, NULL, MenuEntryRenderType_Separator, NULL)
121 #define menu_entry_new_submenu(label, submenu) \
122 menu_entry_new_full(label, NULL, MenuEntryRenderType_Submenu, submenu)
124 #define menu_entry_new_boolean(label, action) \
125 menu_entry_new_full(label, action, MenuEntryRenderType_Boolean, NULL)
127 void menu_entry_free(MenuEntry
*entry
);
129 void menu_entry_set_submenu(MenuEntry
*entry
, Menu
*submenu
);
131 void menu_add_entry(Menu
*menu
, MenuEntry
*entry
);
133 MenuEntry
*menu_find_entry(Menu
*menu
, Window win
);
135 void menu_entry_render(MenuEntry
*self
);
137 void menu_entry_fire(MenuEntry
*self
);
139 void menu_render(Menu
*self
);
140 void menu_render_full(Menu
*self
);
142 void menu_control_mouseover(MenuEntry
*entry
, gboolean enter
);