2003-04-14 21:26:01 +00:00
|
|
|
#ifndef __menu_h
|
|
|
|
#define __menu_h
|
|
|
|
|
|
|
|
#include "action.h"
|
2003-04-15 18:29:55 +00:00
|
|
|
#include "render/render.h"
|
|
|
|
|
2003-04-14 21:26:01 +00:00
|
|
|
#include <glib.h>
|
|
|
|
|
|
|
|
typedef struct Menu {
|
|
|
|
char *label;
|
|
|
|
char *name;
|
|
|
|
|
|
|
|
GList *entries;
|
|
|
|
/* GList *tail; */
|
|
|
|
|
|
|
|
/* ? */
|
|
|
|
gboolean shown;
|
|
|
|
gboolean invalid;
|
2003-04-15 18:29:55 +00:00
|
|
|
gpointer render_data; /* where the engine can store anything it likes */
|
2003-04-14 21:26:01 +00:00
|
|
|
|
|
|
|
struct Menu *parent;
|
|
|
|
|
|
|
|
/* waste o' pointers */
|
|
|
|
void (*show)( /* some bummu */);
|
|
|
|
void (*hide)( /* some bummu */);
|
|
|
|
void (*update)( /* some bummu */);
|
|
|
|
void (*mouseover)( /* some bummu */);
|
|
|
|
void (*selected)( /* some bummu */);
|
|
|
|
} Menu;
|
|
|
|
|
2003-04-15 18:29:55 +00:00
|
|
|
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;
|
|
|
|
|
2003-04-14 21:26:01 +00:00
|
|
|
typedef enum MenuEntryRenderType {
|
|
|
|
MenuEntryRenderType_None = 0,
|
|
|
|
MenuEntryRenderType_Submenu = 1 << 0,
|
|
|
|
MenuEntryRenderType_Boolean = 1 << 1,
|
|
|
|
MenuEntryRenderType_Separator = 1 << 2,
|
|
|
|
|
|
|
|
MenuEntryRenderType_Other = 1 << 7
|
|
|
|
} MenuEntryRenderType;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
char *label;
|
|
|
|
Menu *parent;
|
|
|
|
|
2003-04-15 18:29:55 +00:00
|
|
|
Action *action;
|
2003-04-14 21:26:01 +00:00
|
|
|
|
|
|
|
MenuEntryRenderType render_type;
|
|
|
|
gboolean enabled;
|
|
|
|
gboolean boolean_value;
|
|
|
|
gpointer render_data; /* where the engine can store anything it likes */
|
|
|
|
|
|
|
|
Menu *submenu;
|
|
|
|
} MenuEntry;
|
|
|
|
|
2003-04-15 18:29:55 +00:00
|
|
|
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);
|
2003-04-14 21:26:01 +00:00
|
|
|
|
2003-04-15 18:29:55 +00:00
|
|
|
MenuEntry *menu_entry_new_full(char *label, Action *action,
|
|
|
|
MenuEntryRenderType render_type,
|
|
|
|
gpointer submenu);
|
2003-04-14 21:26:01 +00:00
|
|
|
|
|
|
|
#define menu_entry_new(label, action) \
|
2003-04-15 18:29:55 +00:00
|
|
|
menu_entry_new_full(label, action, MenuEntryRenderType_None, NULL)
|
2003-04-14 21:26:01 +00:00
|
|
|
|
2003-04-15 18:29:55 +00:00
|
|
|
void menu_entry_free(MenuEntry *entry);
|
2003-04-14 21:26:01 +00:00
|
|
|
|
|
|
|
void menu_entry_set_submenu(MenuEntry *entry, Menu *submenu);
|
|
|
|
|
|
|
|
void menu_add_entry(Menu *menu, MenuEntry *entry);
|
|
|
|
#endif
|