]> icculus.org git repositories - mikachu/openbox.git/blob - openbox/menuframe.h
let you use "last" in desktop action
[mikachu/openbox.git] / openbox / menuframe.h
1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
2
3    menuframe.h for the Openbox window manager
4    Copyright (c) 2006        Mikael Magnusson
5    Copyright (c) 2003-2007   Dana Jansens
6
7    This program is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 2 of the License, or
10    (at your option) any later version.
11
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16
17    See the COPYING file for a copy of the GNU General Public License.
18 */
19
20 #ifndef ob__menuframe_h
21 #define ob__menuframe_h
22
23 #include "geom.h"
24 #include "window.h"
25 #include "render/render.h"
26
27 #include <glib.h>
28
29 struct _ObClient;
30 struct _ObMenu;
31 struct _ObMenuEntry;
32
33 typedef struct _ObMenuFrame ObMenuFrame;
34 typedef struct _ObMenuEntryFrame ObMenuEntryFrame;
35
36 extern GList *menu_frame_visible;
37
38 struct _ObMenuFrame
39 {
40     /* stuff to be an ObWindow */
41     Window_InternalType type;
42     Window window;
43
44     struct _ObMenu *menu;
45
46     /* The client that the visual instance of the menu is associated with for
47        its actions */
48     struct _ObClient *client;
49
50     ObMenuFrame *parent;
51     ObMenuEntryFrame *parent_entry;
52     ObMenuFrame *child;
53
54     GList *entries;
55     ObMenuEntryFrame *selected;
56
57     /* show entries from the menu starting at this index */
58     guint show_from;
59
60     /* If the submenus are being drawn to the right or the left */
61     gboolean direction_right;
62
63     /* On-screen area (including borders!) */
64     Rect area;
65     Strut item_margin;
66     gint inner_w; /* inside the borders */
67     gint item_h;  /* height of all normal items */
68     gint text_x;  /* offset at which the text appears in the items */
69     gint text_w;  /* width of the text area in the items */
70     gint text_h;  /* height of the items */
71
72     gint monitor; /* monitor on which to show the menu in xinerama */
73
74     RrAppearance *a_title;
75     RrAppearance *a_items;
76 };
77
78 struct _ObMenuEntryFrame
79 {
80     struct _ObMenuEntry *entry;
81     ObMenuFrame *frame;
82
83     guint ignore_enters;
84
85     Rect area;
86     gint border;
87
88     Window window;
89     Window icon;
90     Window text;
91     Window bullet;
92
93     RrAppearance *a_normal;
94     RrAppearance *a_selected;
95     RrAppearance *a_disabled;
96     RrAppearance *a_disabled_selected;
97
98     RrAppearance *a_icon;
99     RrAppearance *a_mask;
100     RrAppearance *a_bullet_normal;
101     RrAppearance *a_bullet_selected;
102     RrAppearance *a_separator;
103     RrAppearance *a_text_normal;
104     RrAppearance *a_text_selected;
105     RrAppearance *a_text_disabled;
106     RrAppearance *a_text_disabled_selected;
107     RrAppearance *a_text_title;
108 };
109
110 extern GHashTable *menu_frame_map;
111
112 void menu_frame_startup(gboolean reconfig);
113 void menu_frame_shutdown(gboolean reconfig);
114
115 ObMenuFrame* menu_frame_new(struct _ObMenu *menu,
116                             guint show_from,
117                             struct _ObClient *client);
118 void menu_frame_free(ObMenuFrame *self);
119
120 void menu_frame_move(ObMenuFrame *self, gint x, gint y);
121 void menu_frame_move_on_screen(ObMenuFrame *self, gint x, gint y,
122                                gint *dx, gint *dy);
123
124 gboolean menu_frame_show_topmenu(ObMenuFrame *self, gint x, gint y,
125                                  gint button);
126 gboolean menu_frame_show_submenu(ObMenuFrame *self, ObMenuFrame *parent,
127                                  ObMenuEntryFrame *parent_entry);
128
129 void menu_frame_hide_all();
130 void menu_frame_hide_all_client(struct _ObClient *client);
131
132 void menu_frame_render(ObMenuFrame *self);
133
134 void menu_frame_select(ObMenuFrame *self, ObMenuEntryFrame *entry,
135                        gboolean immediate);
136 void menu_frame_select_previous(ObMenuFrame *self);
137 void menu_frame_select_next(ObMenuFrame *self);
138
139 ObMenuFrame* menu_frame_under(gint x, gint y);
140 ObMenuEntryFrame* menu_entry_frame_under(gint x, gint y);
141
142 void menu_entry_frame_show_submenu(ObMenuEntryFrame *self);
143
144 void menu_entry_frame_execute(ObMenuEntryFrame *self, guint state);
145
146 #endif