]> Dogcows Code - chaz/openbox/blob - openbox/menuframe.h
Merge branch 'master' into chaz
[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 "obrender/render.h"
26 #include "obt/keyboard.h"
27
28 #include <glib.h>
29
30 struct _ObClient;
31 struct _ObMenu;
32 struct _ObMenuEntry;
33
34 typedef struct _ObMenuFrame ObMenuFrame;
35 typedef struct _ObMenuEntryFrame ObMenuEntryFrame;
36
37 extern GList *menu_frame_visible;
38
39 struct _ObMenuFrame
40 {
41 /* stuff to be an ObWindow */
42 ObWindow obwin;
43 Window window;
44
45 struct _ObMenu *menu;
46
47 /* The client that the visual instance of the menu is associated with for
48 its actions */
49 struct _ObClient *client;
50
51 ObMenuFrame *parent;
52 ObMenuEntryFrame *parent_entry;
53 ObMenuFrame *child;
54 ObMenuEntryFrame *child_entry;
55
56 GList *entries;
57 ObMenuEntryFrame *selected;
58
59 /* show entries from the menu starting at this index */
60 guint show_from;
61
62 /* If the submenus are being drawn to the right or the left */
63 gboolean direction_right;
64
65 /* On-screen area (including borders!) */
66 Rect area;
67 Strut item_margin;
68 gint inner_w; /* inside the borders */
69 gint item_h; /* height of all normal items */
70 gint text_x; /* offset at which the text appears in the items */
71 gint text_w; /* width of the text area in the items */
72 gint text_h; /* height of the items */
73
74 gint monitor; /* monitor on which to show the menu in xinerama */
75
76 /* We make a copy of this for each menu, so that we don't have to re-render
77 the background of the entire menu each time we render an item inside it.
78 */
79 RrAppearance *a_items;
80
81 gboolean got_press; /* don't allow a KeyRelease event to run things in the
82 menu until it has seen a KeyPress. this is to
83 avoid having the keybinding used to show the menu
84 end up running something inside the menu */
85 guint press_keycode; /* the KeyCode that was used in the last KeyPress */
86 gboolean press_doexec; /* if the upcoming KeyRelease should be used to
87 execute the menu item that was selected by the
88 KeyPress */
89 };
90
91 struct _ObMenuEntryFrame
92 {
93 struct _ObMenuEntry *entry;
94 ObMenuFrame *frame;
95
96 guint ignore_enters;
97
98 Rect area;
99 gint border;
100
101 Window window;
102 Window icon;
103 Window text;
104 Window bullet;
105 };
106
107 extern GHashTable *menu_frame_map;
108
109 void menu_frame_startup(gboolean reconfig);
110 void menu_frame_shutdown(gboolean reconfig);
111
112 ObMenuFrame* menu_frame_new(struct _ObMenu *menu,
113 guint show_from,
114 struct _ObClient *client);
115 void menu_frame_free(ObMenuFrame *self);
116
117 ObtIC* menu_frame_ic(ObMenuFrame *self);
118
119 void menu_frame_move(ObMenuFrame *self, gint x, gint y);
120 void menu_frame_move_on_screen(ObMenuFrame *self, gint x, gint y,
121 gint *dx, gint *dy);
122
123 gboolean menu_frame_show_topmenu(ObMenuFrame *self, gint x, gint y,
124 gboolean mouse);
125 gboolean menu_frame_show_submenu(ObMenuFrame *self, ObMenuFrame *parent,
126 ObMenuEntryFrame *parent_entry);
127
128 void menu_frame_hide_all(void);
129 void menu_frame_hide_all_client(struct _ObClient *client);
130
131 void menu_frame_render(ObMenuFrame *self);
132
133 void menu_frame_select(ObMenuFrame *self, ObMenuEntryFrame *entry,
134 gboolean immediate);
135 void menu_frame_select_previous(ObMenuFrame *self);
136 void menu_frame_select_next(ObMenuFrame *self);
137 void menu_frame_select_first(ObMenuFrame *self);
138 void menu_frame_select_last(ObMenuFrame *self);
139
140 ObMenuFrame* menu_frame_under(gint x, gint y);
141 ObMenuEntryFrame* menu_entry_frame_under(gint x, gint y);
142
143 void menu_entry_frame_show_submenu(ObMenuEntryFrame *self);
144
145 void menu_entry_frame_execute(ObMenuEntryFrame *self, guint state);
146
147 #endif
This page took 0.035269 seconds and 4 git commands to generate.