6 #include "render/render.h"
16 typedef void(*menu_controller_show
)(struct Menu
*self
,
17 int x
, int y
, struct _ObClient
*);
18 typedef void(*menu_controller_update
)(struct Menu
*self
);
19 typedef void(*menu_controller_mouseover
)(struct MenuEntry
*self
,
22 extern GHashTable
*menu_hash
;
23 extern GSList
*menu_visible
;
38 struct Menu
*open_submenu
;
40 /* place a menu on screen */
41 menu_controller_show show
;
42 void (*hide
)( /* some bummu */);
45 menu_controller_update update
;
46 menu_controller_mouseover mouseover
;
47 void (*selected
)( /* some bummu */);
51 struct _ObClient
*client
;
54 RrAppearance
*a_title
;
55 int title_min_w
, title_h
;
57 RrAppearance
*a_items
;
62 guint xin_area
; /* index of the xinerama head/area */
69 typedef enum MenuEntryRenderType
{
70 MenuEntryRenderType_None
= 0,
71 MenuEntryRenderType_Submenu
= 1 << 0,
72 MenuEntryRenderType_Boolean
= 1 << 1,
73 MenuEntryRenderType_Separator
= 1 << 2,
75 MenuEntryRenderType_Other
= 1 << 7
76 } MenuEntryRenderType
;
78 typedef struct MenuEntry
{
84 MenuEntryRenderType render_type
;
87 gboolean boolean_value
;
94 RrAppearance
*a_disabled
;
95 RrAppearance
*a_hilite
;
101 void menu_shutdown();
103 #define menu_new(l, n, p) \
104 menu_new_full(l, n, p, NULL, NULL)
106 Menu
*menu_new_full(char *label
, char *name
, Menu
*parent
,
107 menu_controller_show show
, menu_controller_update update
);
108 void menu_free(char *name
);
110 void menu_show(char *name
, int x
, int y
, struct _ObClient
*client
);
111 void menu_show_full(Menu
*menu
, int x
, int y
, struct _ObClient
*client
);
113 void menu_hide(Menu
*self
);
115 void menu_clear(Menu
*self
);
117 MenuEntry
*menu_entry_new_full(char *label
, Action
*action
,
118 MenuEntryRenderType render_type
,
121 #define menu_entry_new(label, action) \
122 menu_entry_new_full(label, action, MenuEntryRenderType_None, NULL)
124 #define menu_entry_new_separator(label) \
125 menu_entry_new_full(label, NULL, MenuEntryRenderType_Separator, NULL)
127 #define menu_entry_new_submenu(label, submenu) \
128 menu_entry_new_full(label, NULL, MenuEntryRenderType_Submenu, submenu)
130 #define menu_entry_new_boolean(label, action) \
131 menu_entry_new_full(label, action, MenuEntryRenderType_Boolean, NULL)
133 void menu_entry_free(MenuEntry
*entry
);
135 void menu_entry_set_submenu(MenuEntry
*entry
, Menu
*submenu
);
137 void menu_add_entry(Menu
*menu
, MenuEntry
*entry
);
139 MenuEntry
*menu_find_entry(Menu
*menu
, Window win
);
140 MenuEntry
*menu_find_entry_by_pos(Menu
*menu
, int x
, int y
);
142 void menu_entry_render(MenuEntry
*self
);
144 void menu_entry_fire(MenuEntry
*self
);
146 void menu_render(Menu
*self
);
147 void menu_render_full(Menu
*self
);
149 void menu_control_mouseover(MenuEntry
*entry
, gboolean enter
);