7 #include "render/render.h"
8 #include "parser/parse.h"
14 struct _ObMenuEntryFrame
;
16 typedef struct _ObMenu ObMenu
;
17 typedef struct _ObMenuEntry ObMenuEntry
;
18 typedef struct _ObNormalMenuEntry ObNormalMenuEntry
;
19 typedef struct _ObSubmenuMenuEntry ObSubmenuMenuEntry
;
20 typedef struct _ObSeparatorMenuEntry ObSeparatorMenuEntry
;
22 typedef void (*ObMenuUpdateFunc
)(struct _ObMenuFrame
*frame
, gpointer data
);
23 typedef void (*ObMenuExecuteFunc
)(struct _ObMenuEntry
*entry
, gpointer data
);
24 typedef void (*ObMenuDestroyFunc
)(struct _ObMenu
*menu
, gpointer data
);
28 /* Name of the menu. Used in the showmenu action. */
33 /* Command to execute to rebuild the menu */
36 /* ObMenuEntry list */
42 ObMenuUpdateFunc update_func
;
43 ObMenuExecuteFunc execute_func
;
44 ObMenuDestroyFunc destroy_func
;
49 OB_MENU_ENTRY_TYPE_NORMAL
,
50 OB_MENU_ENTRY_TYPE_SUBMENU
,
51 OB_MENU_ENTRY_TYPE_SEPARATOR
54 struct _ObNormalMenuEntry
{
60 /* List of ObActions */
70 RrColor
*mask_normal_color
;
71 RrColor
*mask_disabled_color
;
72 RrColor
*mask_selected_color
;
75 struct _ObSubmenuMenuEntry
{
80 struct _ObSeparatorMenuEntry
{
81 gchar foo
; /* placeholder */
92 ObNormalMenuEntry normal
;
93 ObSubmenuMenuEntry submenu
;
94 ObSeparatorMenuEntry separator
;
98 void menu_startup(gboolean reconfig
);
99 void menu_shutdown(gboolean reconfig
);
101 ObMenu
* menu_new(gchar
*name
, gchar
*title
, gpointer data
);
102 void menu_free(ObMenu
*menu
);
104 /* Repopulate a pipe-menu by running its command */
105 void menu_pipe_execute(ObMenu
*self
);
107 void menu_show(gchar
*name
, gint x
, gint y
, struct _ObClient
*client
);
109 void menu_set_update_func(ObMenu
*menu
, ObMenuUpdateFunc func
);
110 void menu_set_execute_func(ObMenu
*menu
, ObMenuExecuteFunc func
);
111 void menu_set_destroy_func(ObMenu
*menu
, ObMenuDestroyFunc func
);
113 /* functions for building menus */
114 ObMenuEntry
* menu_add_normal(ObMenu
*menu
, gint id
, gchar
*label
,
116 ObMenuEntry
* menu_add_submenu(ObMenu
*menu
, gint id
, gchar
*submenu
);
117 ObMenuEntry
* menu_add_separator(ObMenu
*menu
, gint id
);
119 void menu_clear_entries(ObMenu
*menu
);
120 void menu_entry_remove(ObMenuEntry
*self
);
122 ObMenuEntry
* menu_find_entry_id(ObMenu
*self
, gint id
);
124 /* fills in the submenus, for use when a menu is being shown */
125 void menu_find_submenus(ObMenu
*self
);