6 #include "render/render.h"
13 typedef struct _ObMenu ObMenu
;
14 typedef struct _ObMenuEntry ObMenuEntry
;
16 typedef void(*menu_controller_show
)(ObMenu
*self
, int x
, int y
,
18 typedef void(*menu_controller_update
)(ObMenu
*self
);
19 typedef void(*menu_controller_mouseover
)(ObMenuEntry
*self
, gboolean enter
);
20 typedef void(*menu_controller_selected
)(ObMenuEntry
*self
, unsigned int button
,
21 unsigned int x
, unsigned int y
);
22 typedef void(*menu_controller_hide
)(ObMenu
*self
);
25 extern GHashTable
*menu_hash
;
26 extern GList
*menu_visible
;
44 /* place a menu on screen */
45 menu_controller_show show
;
46 menu_controller_hide hide
;
49 menu_controller_update update
;
50 menu_controller_mouseover mouseover
;
51 menu_controller_selected selected
;
55 struct _ObClient
*client
;
58 RrAppearance
*a_title
;
59 gint title_min_w
, title_h
;
61 RrAppearance
*a_items
;
66 guint xin_area
; /* index of the xinerama head/area */
75 OB_MENU_ENTRY_RENDER_TYPE_NONE
,
76 OB_MENU_ENTRY_RENDER_TYPE_SUBMENU
,
77 OB_MENU_ENTRY_RENDER_TYPE_BOOLEAN
,
78 OB_MENU_ENTRY_RENDER_TYPE_SEPARATOR
,
79 OB_MENU_ENTRY_RENDER_TYPE_OTHER
/* XXX what is this? */
80 } ObMenuEntryRenderType
;
89 ObMenuEntryRenderType render_type
;
92 gboolean boolean_value
;
99 RrAppearance
*a_disabled
;
100 RrAppearance
*a_hilite
;
105 typedef struct PluginMenuCreateData
{
109 } PluginMenuCreateData
;
113 void menu_shutdown();
117 #define menu_new(l, n, p) \
118 menu_new_full(l, n, p, menu_show_full, menu_render, menu_entry_fire, \
119 menu_hide, menu_control_mouseover)
121 ObMenu
*menu_new_full(char *label
, char *name
, ObMenu
*parent
,
122 menu_controller_show show
, menu_controller_update update
,
123 menu_controller_selected selected
,
124 menu_controller_hide hide
,
125 menu_controller_mouseover mouseover
);
127 void menu_free(char *name
);
129 void menu_show(char *name
, int x
, int y
, struct _ObClient
*client
);
130 void menu_show_full(ObMenu
*menu
, int x
, int y
, struct _ObClient
*client
);
132 void menu_hide(ObMenu
*self
);
134 void menu_clear(ObMenu
*self
);
136 ObMenuEntry
*menu_entry_new_full(char *label
, Action
*action
,
137 ObMenuEntryRenderType render_type
,
140 #define menu_entry_new(label, action) \
141 menu_entry_new_full(label, action, OB_MENU_ENTRY_RENDER_TYPE_NONE, NULL)
143 #define menu_entry_new_separator(label) \
144 menu_entry_new_full(label, NULL, OB_MENU_ENTRY_RENDER_TYPE_SEPARATOR, NULL)
146 #define menu_entry_new_submenu(label, submenu) \
147 menu_entry_new_full(label, NULL, OB_MENU_ENTRY_RENDER_TYPE_SUBMENU, submenu)
149 #define menu_entry_new_boolean(label, action) \
150 menu_entry_new_full(label, action, OB_MENU_ENTRY_RENDER_TYPE_BOOLEAN, NULL)
152 void menu_entry_free(ObMenuEntry
*entry
);
154 void menu_entry_set_submenu(ObMenuEntry
*entry
, ObMenu
*submenu
);
156 void menu_add_entry(ObMenu
*menu
, ObMenuEntry
*entry
);
158 ObMenuEntry
*menu_find_entry(ObMenu
*menu
, Window win
);
159 ObMenuEntry
*menu_find_entry_by_submenu(ObMenu
*menu
, ObMenu
*submenu
);
160 ObMenuEntry
*menu_find_entry_by_pos(ObMenu
*menu
, int x
, int y
);
162 void menu_entry_render(ObMenuEntry
*self
);
164 void menu_entry_fire(ObMenuEntry
*self
, unsigned int button
, unsigned int x
,
167 void menu_render(ObMenu
*self
);
168 void menu_render_full(ObMenu
*self
);
170 /*so plugins can call it? */
171 void parse_menu_full(xmlDocPtr doc
, xmlNodePtr node
, void *data
, gboolean
new);
172 void menu_control_mouseover(ObMenuEntry
*entry
, gboolean enter
);
173 ObMenuEntry
*menu_control_keyboard_nav(ObMenuEntry
*over
, ObKey key
);