5 #include "render/render.h"
13 typedef void(*menu_controller_show
)(struct Menu
*self
,
14 int x
, int y
, ObClient
*);
15 typedef void(*menu_controller_update
)(struct Menu
*self
);
16 typedef void(*menu_controller_mouseover
)(struct MenuEntry
*self
,
19 extern GHashTable
*menu_hash
;
20 extern GSList
*menu_visible
;
35 struct Menu
*open_submenu
;
37 /* place a menu on screen */
38 menu_controller_show show
;
39 void (*hide
)( /* some bummu */);
42 menu_controller_update update
;
43 menu_controller_mouseover mouseover
;
44 void (*selected
)( /* some bummu */);
51 RrAppearance
*a_title
;
52 int title_min_w
, title_h
;
54 RrAppearance
*a_items
;
59 guint xin_area
; /* index of the xinerama head/area */
66 typedef enum MenuEntryRenderType
{
67 MenuEntryRenderType_None
= 0,
68 MenuEntryRenderType_Submenu
= 1 << 0,
69 MenuEntryRenderType_Boolean
= 1 << 1,
70 MenuEntryRenderType_Separator
= 1 << 2,
72 MenuEntryRenderType_Other
= 1 << 7
73 } MenuEntryRenderType
;
75 typedef struct MenuEntry
{
81 MenuEntryRenderType render_type
;
84 gboolean boolean_value
;
91 RrAppearance
*a_disabled
;
92 RrAppearance
*a_hilite
;
100 #define menu_new(l, n, p) \
101 menu_new_full(l, n, p, NULL, NULL)
103 Menu
*menu_new_full(char *label
, char *name
, Menu
*parent
,
104 menu_controller_show show
, menu_controller_update update
);
105 void menu_free(char *name
);
107 void menu_show(char *name
, int x
, int y
, ObClient
*client
);
108 void menu_show_full(Menu
*menu
, int x
, int y
, ObClient
*client
);
110 void menu_hide(Menu
*self
);
112 void menu_clear(Menu
*self
);
114 MenuEntry
*menu_entry_new_full(char *label
, Action
*action
,
115 MenuEntryRenderType render_type
,
118 #define menu_entry_new(label, action) \
119 menu_entry_new_full(label, action, MenuEntryRenderType_None, NULL)
121 #define menu_entry_new_separator(label) \
122 menu_entry_new_full(label, NULL, MenuEntryRenderType_Separator, NULL)
124 #define menu_entry_new_submenu(label, submenu) \
125 menu_entry_new_full(label, NULL, MenuEntryRenderType_Submenu, submenu)
127 #define menu_entry_new_boolean(label, action) \
128 menu_entry_new_full(label, action, MenuEntryRenderType_Boolean, NULL)
130 void menu_entry_free(MenuEntry
*entry
);
132 void menu_entry_set_submenu(MenuEntry
*entry
, Menu
*submenu
);
134 void menu_add_entry(Menu
*menu
, MenuEntry
*entry
);
136 MenuEntry
*menu_find_entry(Menu
*menu
, Window win
);
137 MenuEntry
*menu_find_entry_by_pos(Menu
*menu
, int x
, int y
);
139 void menu_entry_render(MenuEntry
*self
);
141 void menu_entry_fire(MenuEntry
*self
);
143 void menu_render(Menu
*self
);
144 void menu_render_full(Menu
*self
);
146 void menu_control_mouseover(MenuEntry
*entry
, gboolean enter
);