Ardour  8.7-14-g57a6773833
tk/ytkmm/ytkmm/gtkmm/menu_elems.h
Go to the documentation of this file.
1 /* $Id$ */
2 #ifndef _GTKMM_MENU_ELEMS_H
3 #define _GTKMM_MENU_ELEMS_H
4 /* menu_elems.h
5  *
6  * Copyright (C) 1998-2002 The gtkmm Development Team
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free
20  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21  */
22 
23 #include <gtkmm/container.h>
24 #include <gtkmm/menuitem.h>
25 #include <gtkmm/imagemenuitem.h>
26 #include <gtkmm/radiomenuitem.h>
27 #include <gtkmm/checkmenuitem.h>
28 #include <gtkmm/tearoffmenuitem.h>
30 #include <gtkmm/accelgroup.h>
31 #include <gtkmm/accelkey.h>
32 #include <gdk/gdkkeysyms.h>
33 
34 
35 namespace Gtk
36 {
37 
38 class Menu;
39 
40 namespace Menu_Helpers
41 {
42 
43 // input class (MenuItem-Factory)
44 
45 class Element
46 {
47 public:
48  typedef sigc::slot<void> CallSlot;
49 
51  Element(MenuItem& child);
53 
54  const Glib::RefPtr<MenuItem>& get_child() const;
55 
56 protected:
57 
58  void set_child(MenuItem* pChild);
59  void set_accel_key(const AccelKey& accel_key);
60 
61  //We use a RefPtr to avoid leaks when the manage()d widget never gets added to a container.
62  //TODO: RefPtr is probably meant only for use with a create() method - see the extra reference() in set_child().
63  Glib::RefPtr<MenuItem> child_;
64 };
65 
75 class MenuElem : public Element
76 {
77 public:
78 
79  MenuElem(MenuItem& child);
80 
85  MenuElem(const Glib::ustring& label, const CallSlot& slot = CallSlot());
86 
92  MenuElem(const Glib::ustring& label, const AccelKey& key,
93  const CallSlot& slot = CallSlot());
94 
99  MenuElem(const Glib::ustring& label, Gtk::Menu& submenu);
100 
106  MenuElem(const Glib::ustring& label,
107  const AccelKey& key,
108  Gtk::Menu& submenu);
109 };
110 
111 class SeparatorElem : public Element
112 {
113 public:
115 };
116 
117 class ImageMenuElem : public Element
118 {
119 public:
121 
127  ImageMenuElem(const Glib::ustring& label,
128  Gtk::Widget& image_widget,
129  const CallSlot& slot = CallSlot());
130 
137  ImageMenuElem(const Glib::ustring& label, const AccelKey& key,
138  Gtk::Widget& image_widget,
139  const CallSlot& slot = CallSlot());
140 
146  ImageMenuElem(const Glib::ustring& label,
147  Gtk::Widget& image_widget,
148  Gtk::Menu& submenu);
149 
156  ImageMenuElem(const Glib::ustring& label, const AccelKey& key,
157  Gtk::Widget& image_widget,
158  Gtk::Menu& submenu);
159 };
160 
161 class StockMenuElem : public Element
162 {
163 public:
168  StockMenuElem(const Gtk::StockID& stock_id,
169  const CallSlot& slot = CallSlot());
170 
176  StockMenuElem(const Gtk::StockID& stock_id,
177  const AccelKey& key,
178  const CallSlot& slot = CallSlot());
179 
184  StockMenuElem(const Gtk::StockID& stock_id,
185  Gtk::Menu& submenu);
186 
192  StockMenuElem(const Gtk::StockID& stock_id,
193  const AccelKey& key,
194  Gtk::Menu& submenu);
195 };
196 
197 class CheckMenuElem : public Element
198 {
199 public:
201 
206  CheckMenuElem(const Glib::ustring& label, const CallSlot& slot = CallSlot());
207 
213  CheckMenuElem(const Glib::ustring& label, const AccelKey& key,
214  const CallSlot& slot = CallSlot());
215 };
216 
217 
218 class RadioMenuElem : public Element
219 {
220 public:
222 
227  RadioMenuElem(RadioMenuItem::Group&, const Glib::ustring& label,
228  const CallSlot& slot = CallSlot());
229 
236  RadioMenuElem(RadioMenuItem::Group& group, const Glib::ustring& label,
237  const AccelKey& key,
238  const CallSlot& slot = CallSlot());
239 
240 protected:
242 };
243 
244 class TearoffMenuElem : public Element
245 {
246 public:
248 
253 
259  const CallSlot& slot = CallSlot());
260 };
261 
262 } /* namespace Menu_Helpers */
263 
264 } /* namespace Gtk */
265 
266 #endif //_GTKMM_MENU_ELEMS_H
CheckMenuElem(const Glib::ustring &label, const AccelKey &key, const CallSlot &slot=CallSlot())
CheckMenuElem(const Glib::ustring &label, const CallSlot &slot=CallSlot())
CheckMenuElem(CheckMenuItem &child)
Element(MenuItem &child)
void set_child(MenuItem *pChild)
const Glib::RefPtr< MenuItem > & get_child() const
void set_accel_key(const AccelKey &accel_key)
ImageMenuElem(ImageMenuItem &child)
ImageMenuElem(const Glib::ustring &label, const AccelKey &key, Gtk::Widget &image_widget, Gtk::Menu &submenu)
ImageMenuElem(const Glib::ustring &label, Gtk::Widget &image_widget, const CallSlot &slot=CallSlot())
ImageMenuElem(const Glib::ustring &label, const AccelKey &key, Gtk::Widget &image_widget, const CallSlot &slot=CallSlot())
ImageMenuElem(const Glib::ustring &label, Gtk::Widget &image_widget, Gtk::Menu &submenu)
MenuElem(const Glib::ustring &label, const CallSlot &slot=CallSlot())
MenuElem(MenuItem &child)
MenuElem(const Glib::ustring &label, const AccelKey &key, const CallSlot &slot=CallSlot())
MenuElem(const Glib::ustring &label, Gtk::Menu &submenu)
MenuElem(const Glib::ustring &label, const AccelKey &key, Gtk::Menu &submenu)
RadioMenuElem(RadioMenuItem::Group &group, const Glib::ustring &label, const AccelKey &key, const CallSlot &slot=CallSlot())
RadioMenuElem(RadioMenuItem &child)
RadioMenuElem(RadioMenuItem::Group &, const Glib::ustring &label, const CallSlot &slot=CallSlot())
StockMenuElem(const Gtk::StockID &stock_id, const AccelKey &key, Gtk::Menu &submenu)
StockMenuElem(const Gtk::StockID &stock_id, const CallSlot &slot=CallSlot())
StockMenuElem(const Gtk::StockID &stock_id, Gtk::Menu &submenu)
StockMenuElem(const Gtk::StockID &stock_id, const AccelKey &key, const CallSlot &slot=CallSlot())
TearoffMenuElem(const CallSlot &slot=CallSlot())
TearoffMenuElem(const AccelKey &key, const CallSlot &slot=CallSlot())
TearoffMenuElem(TearoffMenuItem &child)
Definition: ardour_ui.h:188