half way through the changes to new menu code/design. hot shit. static menus work...
[mikachu/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     /* On-screen area (including borders!) */
35     Rect area;
36     gint inner_w; /* inside the borders */
37     gint title_h; /* includes the bwidth below it */
38     gint item_h;  /* height of all normal items */
39     gint text_x;  /* offset at which the text appears in the items */
40     gint text_w;  /* width of the text area in the items */
41
42     GList *entries;
43     ObMenuEntryFrame *selected;
44
45     Window title;
46     Window items;
47
48     RrAppearance *a_title;
49     RrAppearance *a_items;
50 };
51
52 struct _ObMenuEntryFrame
53 {
54     struct _ObMenuEntry *entry;
55     ObMenuFrame *frame;
56
57     Rect area;
58
59     Window window;
60     Window icon;
61     Window text;
62     Window bullet;
63
64     RrAppearance *a_normal;
65     RrAppearance *a_disabled;
66     RrAppearance *a_selected;
67
68     RrAppearance *a_icon;
69     RrAppearance *a_bullet;
70     RrAppearance *a_text_normal;
71     RrAppearance *a_text_disabled;
72     RrAppearance *a_text_selected;
73 };
74
75 ObMenuFrame* menu_frame_new(struct _ObMenu *menu, struct _ObClient *client);
76 void menu_frame_free(ObMenuFrame *self);
77
78 void menu_frame_move(ObMenuFrame *self, gint x, gint y);
79 void menu_frame_move_on_screen(ObMenuFrame *self);
80
81 void menu_frame_show(ObMenuFrame *self, ObMenuFrame *parent);
82 void menu_frame_hide(ObMenuFrame *self);
83
84 void menu_frame_hide_all();
85
86 void menu_frame_select(ObMenuFrame *self, ObMenuEntryFrame *entry);
87
88 ObMenuFrame* menu_frame_under(gint x, gint y);
89 ObMenuEntryFrame* menu_entry_frame_under(gint x, gint y);
90
91 void menu_entry_frame_show_submenu(ObMenuEntryFrame *self);
92
93 void menu_entry_frame_execute(ObMenuEntryFrame *self);
94
95 #endif