X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fmenu.h;h=bbc9fe81d024761969e488d21c70e7937cc11e3b;hb=0e28a07e3d6677aa6af9ad97fbc55f8101f3fdf2;hp=d1a99dcfde0eb8082935b3476ef33cf9d4eca1ef;hpb=22be74583bcf40fd5e762eb818676aa12f7152c4;p=chaz%2Fopenbox diff --git a/openbox/menu.h b/openbox/menu.h index d1a99dcf..bbc9fe81 100644 --- a/openbox/menu.h +++ b/openbox/menu.h @@ -1,10 +1,14 @@ #ifndef __menu_h #define __menu_h +#include "action.h" +#include "render/render.h" + #include typedef struct Menu { char *label; + char *name; GList *entries; /* GList *tail; */ @@ -12,6 +16,7 @@ typedef struct Menu { /* ? */ gboolean shown; gboolean invalid; + gpointer render_data; /* where the engine can store anything it likes */ struct Menu *parent; @@ -23,37 +28,61 @@ typedef struct Menu { void (*selected)( /* some bummu */); } Menu; +typedef struct MenuRenderData { + Window frame; + Window title; + Appearance *a_title; + int title_min_w, title_h; + Window items; + Appearance *a_items; + int item_h; +} MenuRenderData; + typedef enum MenuEntryRenderType { MenuEntryRenderType_None = 0, - MenuEntryRenderType_Submenu 1 << 0, - MenuEntryRenderType_Boolean 1 << 1, - MenuEntryRenderType_Separator 1 << 2, + MenuEntryRenderType_Submenu = 1 << 0, + MenuEntryRenderType_Boolean = 1 << 1, + MenuEntryRenderType_Separator = 1 << 2, - MenuEntryRenderType_Other 1 << 7 -} MenuEntryType; - + MenuEntryRenderType_Other = 1 << 7 +} MenuEntryRenderType; typedef struct { char *label; Menu *parent; - Action action; + Action *action; MenuEntryRenderType render_type; gboolean enabled; gboolean boolean_value; - gpointer render_data; + gpointer render_data; /* where the engine can store anything it likes */ Menu *submenu; } MenuEntry; -Menu *menu_new(char *label, Menu *parent); +typedef struct MenuEntryRenderData { + Window item; + Appearance *a_item; + int min_w; +} MenuEntryRenderData; + +void menu_startup(); +void menu_shutdown(); + +Menu *menu_new(char *label, char *name, Menu *parent); +void menu_free(char *name); + +void menu_show(char *name, int x, int y, Client *client); + MenuEntry *menu_entry_new_full(char *label, Action *action, - MenuEntryRenderType render_type, - gpointer render_data, gpointer submenu); + MenuEntryRenderType render_type, + gpointer submenu); #define menu_entry_new(label, action) \ - menu_entry_new(label, action, MenuEntryRenderType_None, NULL, NULL) + menu_entry_new_full(label, action, MenuEntryRenderType_None, NULL) + +void menu_entry_free(MenuEntry *entry); void menu_entry_set_submenu(MenuEntry *entry, Menu *submenu);