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
;
19 extern GSList
*menu_visible
;
34 struct Menu
*open_submenu
;
36 /* place a menu on screen */
37 menu_controller_show show
;
38 void (*hide
)( /* some bummu */);
41 menu_controller_update update
;
42 menu_controller_mouseover mouseover
;
43 void (*selected
)( /* some bummu */);
50 RrAppearance
*a_title
;
51 int title_min_w
, title_h
;
53 RrAppearance
*a_items
;
58 guint xin_area
; /* index of the xinerama head/area */
65 typedef enum MenuEntryRenderType
{
66 MenuEntryRenderType_None
= 0,
67 MenuEntryRenderType_Submenu
= 1 << 0,
68 MenuEntryRenderType_Boolean
= 1 << 1,
69 MenuEntryRenderType_Separator
= 1 << 2,
71 MenuEntryRenderType_Other
= 1 << 7
72 } MenuEntryRenderType
;
74 typedef struct MenuEntry
{
80 MenuEntryRenderType render_type
;
83 gboolean boolean_value
;
90 RrAppearance
*a_disabled
;
91 RrAppearance
*a_hilite
;
99 #define menu_new(l, n, p) \
100 menu_new_full(l, n, p, NULL, NULL)
102 Menu
*menu_new_full(char *label
, char *name
, Menu
*parent
,
103 menu_controller_show show
, menu_controller_update update
);
104 void menu_free(char *name
);
106 void menu_show(char *name
, int x
, int y
, Client
*client
);
107 void menu_show_full(Menu
*menu
, int x
, int y
, Client
*client
);
109 void menu_hide(Menu
*self
);
111 void menu_clear(Menu
*self
);
113 MenuEntry
*menu_entry_new_full(char *label
, Action
*action
,
114 MenuEntryRenderType render_type
,
117 #define menu_entry_new(label, action) \
118 menu_entry_new_full(label, action, MenuEntryRenderType_None, NULL)
120 #define menu_entry_new_separator(label) \
121 menu_entry_new_full(label, NULL, MenuEntryRenderType_Separator, NULL)
123 #define menu_entry_new_submenu(label, submenu) \
124 menu_entry_new_full(label, NULL, MenuEntryRenderType_Submenu, submenu)
126 #define menu_entry_new_boolean(label, action) \
127 menu_entry_new_full(label, action, MenuEntryRenderType_Boolean, NULL)
129 void menu_entry_free(MenuEntry
*entry
);
131 void menu_entry_set_submenu(MenuEntry
*entry
, Menu
*submenu
);
133 void menu_add_entry(Menu
*menu
, MenuEntry
*entry
);
135 MenuEntry
*menu_find_entry(Menu
*menu
, Window win
);
136 MenuEntry
*menu_find_entry_by_pos(Menu
*menu
, int x
, int y
);
138 void menu_entry_render(MenuEntry
*self
);
140 void menu_entry_fire(MenuEntry
*self
);
142 void menu_render(Menu
*self
);
143 void menu_render_full(Menu
*self
);
145 void menu_control_mouseover(MenuEntry
*entry
, gboolean enter
);