]> Dogcows Code - chaz/openbox/blob - openbox/menuframe.h
fix menus to show on the screen the mouse cursor spawned them from
[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) 2003 Ben Jansens
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 See the COPYING file for a copy of the GNU General Public License.
17 */
18
19 #ifndef ob__menuframe_h
20 #define ob__menuframe_h
21
22 #include "geom.h"
23 #include "window.h"
24 #include "render/render.h"
25
26 #include <glib.h>
27
28 struct _ObClient;
29 struct _ObMenu;
30 struct _ObMenuEntry;
31
32 typedef struct _ObMenuFrame ObMenuFrame;
33 typedef struct _ObMenuEntryFrame ObMenuEntryFrame;
34
35 extern GList *menu_frame_visible;
36
37 struct _ObMenuFrame
38 {
39 /* stuff to be an ObWindow */
40 Window_InternalType type;
41 Window window;
42
43 struct _ObMenu *menu;
44
45 /* The client that the visual instance of the menu is associated with for
46 its actions */
47 struct _ObClient *client;
48
49 ObMenuFrame *parent;
50 ObMenuFrame *child;
51
52 GList *entries;
53 ObMenuEntryFrame *selected;
54
55 /* If a titlebar is displayed for the menu or not (for top-level menus) */
56 gboolean show_title;
57
58 /* On-screen area (including borders!) */
59 Rect area;
60 Strut item_margin;
61 gint inner_w; /* inside the borders */
62 gint title_h; /* includes the bwidth below it */
63 gint item_h; /* height of all normal items */
64 gint text_x; /* offset at which the text appears in the items */
65 gint text_w; /* width of the text area in the items */
66
67 gint monitor; /* monitor on which to show the menu in xinerama */
68
69 Window title;
70 Window items;
71
72 RrAppearance *a_title;
73 RrAppearance *a_items;
74 };
75
76 struct _ObMenuEntryFrame
77 {
78 struct _ObMenuEntry *entry;
79 ObMenuFrame *frame;
80
81 Rect area;
82
83 Window window;
84 Window icon;
85 Window text;
86 Window bullet;
87
88 RrAppearance *a_normal;
89 RrAppearance *a_disabled;
90 RrAppearance *a_selected;
91
92 RrAppearance *a_icon;
93 RrAppearance *a_mask;
94 RrAppearance *a_bullet_normal;
95 RrAppearance *a_bullet_selected;
96 RrAppearance *a_separator;
97 RrAppearance *a_text_normal;
98 RrAppearance *a_text_disabled;
99 RrAppearance *a_text_selected;
100 };
101
102 ObMenuFrame* menu_frame_new(struct _ObMenu *menu, struct _ObClient *client);
103 void menu_frame_free(ObMenuFrame *self);
104
105 void menu_frame_move(ObMenuFrame *self, gint x, gint y);
106 void menu_frame_move_on_screen(ObMenuFrame *self);
107
108 gboolean menu_frame_show(ObMenuFrame *self, ObMenuFrame *parent);
109 void menu_frame_hide(ObMenuFrame *self);
110
111 void menu_frame_hide_all();
112 void menu_frame_hide_all_client(struct _ObClient *client);
113
114 void menu_frame_select(ObMenuFrame *self, ObMenuEntryFrame *entry);
115 void menu_frame_select_previous(ObMenuFrame *self);
116 void menu_frame_select_next(ObMenuFrame *self);
117
118 ObMenuFrame* menu_frame_under(gint x, gint y);
119 ObMenuEntryFrame* menu_entry_frame_under(gint x, gint y);
120
121 void menu_entry_frame_show_submenu(ObMenuEntryFrame *self);
122
123 void menu_entry_frame_execute(ObMenuEntryFrame *self, guint state);
124
125 #endif
This page took 0.04676 seconds and 5 git commands to generate.