]> icculus.org git repositories - dana/openbox.git/blob - openbox/menuframe.h
oops backwarsd
[dana/openbox.git] / openbox / menuframe.h
1 #ifndef ob__menuframe_h
2 #define ob__menuframe_h
3
4 #include "geom.h"
5 #include "window.h"
6 #include "render/render.h"
7
8 #include <glib.h>
9
10 struct _ObClient;
11 struct _ObMenu;
12 struct _ObMenuEntry;
13
14 typedef struct _ObMenuFrame ObMenuFrame;
15 typedef struct _ObMenuEntryFrame ObMenuEntryFrame;
16
17 extern GList *menu_frame_visible;
18
19 struct _ObMenuFrame
20 {
21     /* stuff to be an ObWindow */
22     Window_InternalType type;
23     Window window;
24
25     struct _ObMenu *menu;
26
27     /* The client that the visual instance of the menu is associated with for
28        its actions */
29     struct _ObClient *client;
30
31     ObMenuFrame *parent;
32     ObMenuFrame *child;
33
34     GList *entries;
35     ObMenuEntryFrame *selected;
36
37     /* If a titlebar is displayed for the menu or not (for top-level menus) */
38     gboolean show_title;
39
40     /* On-screen area (including borders!) */
41     Rect area;
42     Strut item_margin;
43     gint inner_w; /* inside the borders */
44     gint title_h; /* includes the bwidth below it */
45     gint item_h;  /* height of all normal items */
46     gint text_x;  /* offset at which the text appears in the items */
47     gint text_w;  /* width of the text area in the items */
48
49     Window title;
50     Window items;
51
52     RrAppearance *a_title;
53     RrAppearance *a_items;
54 };
55
56 struct _ObMenuEntryFrame
57 {
58     struct _ObMenuEntry *entry;
59     ObMenuFrame *frame;
60
61     Rect area;
62
63     Window window;
64     Window icon;
65     Window text;
66     Window bullet;
67
68     RrAppearance *a_normal;
69     RrAppearance *a_disabled;
70     RrAppearance *a_selected;
71
72     RrAppearance *a_icon;
73     RrAppearance *a_mask;
74     RrAppearance *a_bullet_normal;
75     RrAppearance *a_bullet_selected;
76     RrAppearance *a_separator;
77     RrAppearance *a_text_normal;
78     RrAppearance *a_text_disabled;
79     RrAppearance *a_text_selected;
80 };
81
82 ObMenuFrame* menu_frame_new(struct _ObMenu *menu, struct _ObClient *client);
83 void menu_frame_free(ObMenuFrame *self);
84
85 void menu_frame_move(ObMenuFrame *self, gint x, gint y);
86 void menu_frame_move_on_screen(ObMenuFrame *self);
87
88 void menu_frame_show(ObMenuFrame *self, ObMenuFrame *parent);
89 void menu_frame_hide(ObMenuFrame *self);
90
91 void menu_frame_hide_all();
92 void menu_frame_hide_all_client(struct _ObClient *client);
93
94 void menu_frame_select(ObMenuFrame *self, ObMenuEntryFrame *entry);
95 void menu_frame_select_previous(ObMenuFrame *self);
96 void menu_frame_select_next(ObMenuFrame *self);
97
98 ObMenuFrame* menu_frame_under(gint x, gint y);
99 ObMenuEntryFrame* menu_entry_frame_under(gint x, gint y);
100
101 void menu_entry_frame_show_submenu(ObMenuEntryFrame *self);
102
103 void menu_entry_frame_execute(ObMenuEntryFrame *self, guint state);
104
105 #endif