Remove ancient/unused flowcanvas and libglademm from repository.
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / menuitem.h
1 // -*- c++ -*-
2 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #ifndef _GTKMM_MENUITEM_H
4 #define _GTKMM_MENUITEM_H
5
6
7 #include <glibmm.h>
8
9 /* $Id$ */
10
11
12 /* menuitem.h
13  * 
14  * Copyright (C) 1998-2002 The gtkmm Development Team
15  *
16  * This library is free software; you can redistribute it and/or
17  * modify it under the terms of the GNU Library General Public
18  * License as published by the Free Software Foundation; either
19  * version 2 of the License, or (at your option) any later version.
20  *
21  * This library is distributed in the hope that it will be useful,
22  * but WITHOUT ANY WARRANTY; without even the implied warranty of
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
24  * Library General Public License for more details.
25  *
26  * You should have received a copy of the GNU Library General Public
27  * License along with this library; if not, write to the Free
28  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29  */
30  
31 #include <gtkmm/item.h>
32 #include <gtkmm/accelkey.h>
33 #include <gtkmm/accellabel.h>
34
35
36 #ifndef DOXYGEN_SHOULD_SKIP_THIS
37 typedef struct _GtkMenuItem GtkMenuItem;
38 typedef struct _GtkMenuItemClass GtkMenuItemClass;
39 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
40
41
42 namespace Gtk
43 { class MenuItem_Class; } // namespace Gtk
44 namespace Gtk
45 {
46
47 class Menu;
48 namespace Menu_Helpers { class Element; }
49
50 /** Child item for menus.
51  * Handle highlighting, alignment, events and submenus.
52  * As it derives from Gtk::Bin it can hold any valid child widget, altough only a few are really useful.
53  * @ingroup Widgets
54  * @ingroup Menus
55  */
56
57 class MenuItem : public Item
58 {
59   public:
60 #ifndef DOXYGEN_SHOULD_SKIP_THIS
61   typedef MenuItem CppObjectType;
62   typedef MenuItem_Class CppClassType;
63   typedef GtkMenuItem BaseObjectType;
64   typedef GtkMenuItemClass BaseClassType;
65 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
66
67   virtual ~MenuItem();
68
69 #ifndef DOXYGEN_SHOULD_SKIP_THIS
70
71 private:
72   friend class MenuItem_Class;
73   static CppClassType menuitem_class_;
74
75   // noncopyable
76   MenuItem(const MenuItem&);
77   MenuItem& operator=(const MenuItem&);
78
79 protected:
80   explicit MenuItem(const Glib::ConstructParams& construct_params);
81   explicit MenuItem(GtkMenuItem* castitem);
82
83 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
84
85 public:
86 #ifndef DOXYGEN_SHOULD_SKIP_THIS
87   static GType get_type()      G_GNUC_CONST;
88   static GType get_base_type() G_GNUC_CONST;
89 #endif
90
91   ///Provides access to the underlying C GtkObject.
92   GtkMenuItem*       gobj()       { return reinterpret_cast<GtkMenuItem*>(gobject_); }
93
94   ///Provides access to the underlying C GtkObject.
95   const GtkMenuItem* gobj() const { return reinterpret_cast<GtkMenuItem*>(gobject_); }
96
97
98 public:
99   //C++ methods used to invoke GTK+ virtual functions:
100 #ifdef GLIBMM_VFUNCS_ENABLED
101 #endif //GLIBMM_VFUNCS_ENABLED
102
103 protected:
104   //GTK+ Virtual Functions (override these to change behaviour):
105 #ifdef GLIBMM_VFUNCS_ENABLED
106 #endif //GLIBMM_VFUNCS_ENABLED
107
108   //Default Signal Handlers::
109 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
110   virtual void on_activate();
111   virtual void on_activate_item();
112   virtual void on_toggle_size_request(int* requisition);
113   virtual void on_toggle_size_allocate(int allocation);
114 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
115
116
117 private:
118
119 public:
120
121   /// Create an empty menu item
122   MenuItem();
123
124   /// Create a menu item with widget
125   explicit MenuItem(Widget& widget);
126
127   /// Create a menu item with label
128   explicit MenuItem(const Glib::ustring& label, bool mnemonic = false);
129
130   
131   /** Sets or replaces the menu item's submenu, or removes it when a <tt>0</tt>
132    * submenu is passed.
133    * @param submenu The submenu, or <tt>0</tt>.
134    */
135   void set_submenu(Menu& submenu);
136   
137   /** Gets the submenu underneath this menu item, if any. See
138    * set_submenu().
139    * @return Submenu for this menu item, or <tt>0</tt> if none.
140    */
141   Menu* get_submenu();
142   
143   /** Gets the submenu underneath this menu item, if any. See
144    * set_submenu().
145    * @return Submenu for this menu item, or <tt>0</tt> if none.
146    */
147   const Menu* get_submenu() const;
148   bool has_submenu() const;
149
150   
151   /** Removes the widget's submenu.
152    * 
153    * Deprecated: 2.12: remove_submenu() is deprecated and
154    * should not be used in newly written code. Use
155    * set_submenu() instead.
156    */
157   void remove_submenu();
158   
159   void select();
160   
161   void deselect();
162   
163   void activate();
164   
165   void toggle_size_request(int& requisition);
166   
167   void toggle_size_allocate(int allocation);
168   
169   /** Sets whether the menu item appears justified at the right
170    * side of a menu bar. This was traditionally done for "Help" menu
171    * items, but is now considered a bad idea. (If the widget
172    * layout is reversed for a right-to-left language like Hebrew
173    * or Arabic, right-justified-menu-items appear at the left.)
174    * @param right_justified If <tt>true</tt> the menu item will appear at the 
175    * far right if added to a menu bar.
176    */
177   void set_right_justified(bool right_justified = true);
178   
179   /** Gets whether the menu item appears justified at the right
180    * side of the menu bar.
181    * @return <tt>true</tt> if the menu item will appear at the
182    * far right if added to a menu bar.
183    */
184   bool get_right_justified() const;
185   
186   /** Set the accelerator path on @a menu_item , through which runtime changes of the
187    * menu item's accelerator caused by the user can be identified and saved to
188    * persistant storage (see gtk_accel_map_save() on this).
189    * To setup a default accelerator for this menu item, call
190    * gtk_accel_map_add_entry() with the same @a accel_path .
191    * See also gtk_accel_map_add_entry() on the specifics of accelerator paths,
192    * and set_accel_path() for a more convenient variant of this function.
193    * 
194    * This function is basically a convenience wrapper that handles calling
195    * Gtk::Widget::set_accel_path() with the appropriate accelerator group for
196    * the menu item.
197    * 
198    * Note that you do need to set an accelerator on the parent menu with
199    * set_accel_group() for this to work.
200    * @param accel_path Accelerator path, corresponding to this menu item's
201    * functionality.
202    */
203   void set_accel_path(const Glib::ustring& accel_path);
204   void unset_accel_path();
205
206   
207   /**
208    * @par Prototype:
209    * <tt>void on_my_%activate()</tt>
210    */
211
212   Glib::SignalProxy0< void > signal_activate();
213
214   
215   /**
216    * @par Prototype:
217    * <tt>void on_my_%activate_item()</tt>
218    */
219
220   Glib::SignalProxy0< void > signal_activate_item();
221
222   
223   /**
224    * @par Prototype:
225    * <tt>void on_my_%toggle_size_request(int* requisition)</tt>
226    */
227
228   Glib::SignalProxy1< void,int* > signal_toggle_size_request();
229
230   
231   /**
232    * @par Prototype:
233    * <tt>void on_my_%toggle_size_allocate(int allocation)</tt>
234    */
235
236   Glib::SignalProxy1< void,int > signal_toggle_size_allocate();
237
238
239   void accelerate(Window& window);
240
241 protected:
242
243   void add_accel_label(const Glib::ustring& label, bool mnemonic = true);
244
245   void set_accel_key(const AccelKey& accel_key);
246
247 private:
248
249   friend class Menu_Helpers::Element;
250
251   //This data is set by MenuElem, and will be used in on_realize(), in the call to add_accelerator().
252   AccelKey accel_key_;
253
254
255 };
256
257 } /* namespace Gtk */
258
259
260 namespace Glib
261 {
262   /** A Glib::wrap() method for this object.
263    * 
264    * @param object The C instance.
265    * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
266    * @result A C++ instance that wraps this C instance.
267    *
268    * @relates Gtk::MenuItem
269    */
270   Gtk::MenuItem* wrap(GtkMenuItem* object, bool take_copy = false);
271 } //namespace Glib
272
273
274 #endif /* _GTKMM_MENUITEM_H */
275