]> Dogcows Code - chaz/openbox/blob - openbox/menuframe.h
Merge branch 'backport' into work
[chaz/openbox] / 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 ObWindow obwin;
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 /* if a submenu was selected, then this holds the entry for that submenu
57 until it is closed */
58 ObMenuEntryFrame *open_submenu;
59
60 /* show entries from the menu starting at this index */
61 guint show_from;
62
63 /* If the submenus are being drawn to the right or the left */
64 gboolean direction_right;
65
66 /* On-screen area (including borders!) */
67 Rect area;
68 Strut item_margin;
69 gint inner_w; /* inside the borders */
70 gint item_h; /* height of all normal items */
71 gint text_x; /* offset at which the text appears in the items */
72 gint text_w; /* width of the text area in the items */
73 gint text_h; /* height of the items */
74
75 gint monitor; /* monitor on which to show the menu in xinerama */
76
77 /* We make a copy of this for each menu, so that we don't have to re-render
78 the background of the entire menu each time we render an item inside it.
79 */
80 RrAppearance *a_items;
81
82 gboolean got_press; /* don't allow a KeyRelease event to run things in the
83 menu until it has seen a KeyPress. this is to
84 avoid having the keybinding used to show the menu
85 end up running something inside the menu */
86 };
87
88 struct _ObMenuEntryFrame
89 {
90 struct _ObMenuEntry *entry;
91 ObMenuFrame *frame;
92
93 guint ignore_enters;
94
95 Rect area;
96 gint border;
97
98 Window window;
99 Window icon;
100 Window text;
101 Window bullet;
102 };
103
104 extern GHashTable *menu_frame_map;
105
106 void menu_frame_startup(gboolean reconfig);
107 void menu_frame_shutdown(gboolean reconfig);
108
109 ObMenuFrame* menu_frame_new(struct _ObMenu *menu,
110 guint show_from,
111 struct _ObClient *client);
112 void menu_frame_free(ObMenuFrame *self);
113
114 void menu_frame_move(ObMenuFrame *self, gint x, gint y);
115 void menu_frame_move_on_screen(ObMenuFrame *self, gint x, gint y,
116 gint *dx, gint *dy);
117
118 gboolean menu_frame_show_topmenu(ObMenuFrame *self, gint x, gint y,
119 gint button);
120 gboolean menu_frame_show_submenu(ObMenuFrame *self, ObMenuFrame *parent,
121 ObMenuEntryFrame *parent_entry);
122
123 void menu_frame_hide_all(void);
124 void menu_frame_hide_all_client(struct _ObClient *client);
125
126 void menu_frame_render(ObMenuFrame *self);
127
128 void menu_frame_select(ObMenuFrame *self, ObMenuEntryFrame *entry,
129 gboolean immediate);
130 void menu_frame_select_previous(ObMenuFrame *self);
131 void menu_frame_select_next(ObMenuFrame *self);
132
133 ObMenuFrame* menu_frame_under(gint x, gint y);
134 ObMenuEntryFrame* menu_entry_frame_under(gint x, gint y);
135
136 void menu_entry_frame_show_submenu(ObMenuEntryFrame *self);
137
138 void menu_entry_frame_execute(ObMenuEntryFrame *self, guint state);
139
140 #endif
This page took 0.033636 seconds and 4 git commands to generate.