1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
3 menuframe.h for the Openbox window manager
4 Copyright (c) 2006 Mikael Magnusson
5 Copyright (c) 2003-2007 Dana Jansens
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.
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.
17 See the COPYING file for a copy of the GNU General Public License.
20 #ifndef ob__menuframe_h
21 #define ob__menuframe_h
25 #include "render/render.h"
33 typedef struct _ObMenuFrame ObMenuFrame
;
34 typedef struct _ObMenuEntryFrame ObMenuEntryFrame
;
36 extern GList
*menu_frame_visible
;
40 /* stuff to be an ObWindow */
41 Window_InternalType type
;
46 /* The client that the visual instance of the menu is associated with for
48 struct _ObClient
*client
;
51 ObMenuEntryFrame
*parent_entry
;
55 ObMenuEntryFrame
*selected
;
57 /* show entries from the menu starting at this index */
60 /* If the submenus are being drawn to the right or the left */
61 gboolean direction_right
;
63 /* On-screen area (including borders!) */
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 */
72 gint monitor
; /* monitor on which to show the menu in xinerama */
74 RrAppearance
*a_title
;
75 RrAppearance
*a_items
;
77 gboolean got_press
; /* don't allow a KeyRelease event to run things in the
78 menu until it has seen a KeyPress. this is to
79 avoid having the keybinding used to show the menu
80 end up running something inside the menu */
83 struct _ObMenuEntryFrame
85 struct _ObMenuEntry
*entry
;
98 RrAppearance
*a_normal
;
99 RrAppearance
*a_selected
;
100 RrAppearance
*a_disabled
;
101 RrAppearance
*a_disabled_selected
;
103 RrAppearance
*a_icon
;
104 RrAppearance
*a_mask
;
105 RrAppearance
*a_bullet_normal
;
106 RrAppearance
*a_bullet_selected
;
107 RrAppearance
*a_separator
;
108 RrAppearance
*a_text_normal
;
109 RrAppearance
*a_text_selected
;
110 RrAppearance
*a_text_disabled
;
111 RrAppearance
*a_text_disabled_selected
;
112 RrAppearance
*a_text_title
;
115 extern GHashTable
*menu_frame_map
;
117 void menu_frame_startup(gboolean reconfig
);
118 void menu_frame_shutdown(gboolean reconfig
);
120 ObMenuFrame
* menu_frame_new(struct _ObMenu
*menu
,
122 struct _ObClient
*client
);
123 void menu_frame_free(ObMenuFrame
*self
);
125 void menu_frame_move(ObMenuFrame
*self
, gint x
, gint y
);
126 void menu_frame_move_on_screen(ObMenuFrame
*self
, gint x
, gint y
,
129 gboolean
menu_frame_show_topmenu(ObMenuFrame
*self
, gint x
, gint y
,
131 gboolean
menu_frame_show_submenu(ObMenuFrame
*self
, ObMenuFrame
*parent
,
132 ObMenuEntryFrame
*parent_entry
);
134 void menu_frame_hide_all();
135 void menu_frame_hide_all_client(struct _ObClient
*client
);
137 void menu_frame_render(ObMenuFrame
*self
);
139 void menu_frame_select(ObMenuFrame
*self
, ObMenuEntryFrame
*entry
,
141 void menu_frame_select_previous(ObMenuFrame
*self
);
142 void menu_frame_select_next(ObMenuFrame
*self
);
144 ObMenuFrame
* menu_frame_under(gint x
, gint y
);
145 ObMenuEntryFrame
* menu_entry_frame_under(gint x
, gint y
);
147 void menu_entry_frame_show_submenu(ObMenuEntryFrame
*self
);
149 void menu_entry_frame_execute(ObMenuEntryFrame
*self
, guint state
);