2
// Generated by gtkmmproc -- DO NOT MODIFY!
3
#ifndef _GTKMM_UIMANAGER_H
4
#define _GTKMM_UIMANAGER_H
10
/* Copyright (C) 2003 The gtkmm Development Team
12
* This library is free software; you can redistribute it and/or
13
* modify it under the terms of the GNU Library General Public
14
* License as published by the Free Software Foundation; either
15
* version 2 of the License, or (at your option) any later version.
17
* This library is distributed in the hope that it will be useful,
18
* but WITHOUT ANY WARRANTY; without even the implied warranty of
19
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20
* Library General Public License for more details.
22
* You should have received a copy of the GNU Library General Public
23
* License along with this library; if not, write to the Free
24
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27
#include <gtkmm/widget.h>
28
#include <gtkmm/action.h>
29
#include <gtkmm/actiongroup.h>
30
#include <gtkmm/uimanager.h>
33
#ifndef DOXYGEN_SHOULD_SKIP_THIS
34
typedef struct _GtkUIManager GtkUIManager;
35
typedef struct _GtkUIManagerClass GtkUIManagerClass;
36
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
40
{ class UIManager_Class; } // namespace Gtk
44
/** @addtogroup gtkmmEnums Enums and Flags */
48
* @par Bitwise operators:
49
* <tt>%UIManagerItemType operator|(UIManagerItemType, UIManagerItemType)</tt><br>
50
* <tt>%UIManagerItemType operator&(UIManagerItemType, UIManagerItemType)</tt><br>
51
* <tt>%UIManagerItemType operator^(UIManagerItemType, UIManagerItemType)</tt><br>
52
* <tt>%UIManagerItemType operator~(UIManagerItemType)</tt><br>
53
* <tt>%UIManagerItemType& operator|=(UIManagerItemType&, UIManagerItemType)</tt><br>
54
* <tt>%UIManagerItemType& operator&=(UIManagerItemType&, UIManagerItemType)</tt><br>
55
* <tt>%UIManagerItemType& operator^=(UIManagerItemType&, UIManagerItemType)</tt><br>
57
enum UIManagerItemType
60
UI_MANAGER_MENUBAR = 1 << 0,
61
UI_MANAGER_MENU = 1 << 1,
62
UI_MANAGER_TOOLBAR = 1 << 2,
63
UI_MANAGER_PLACEHOLDER = 1 << 3,
64
UI_MANAGER_POPUP = 1 << 4,
65
UI_MANAGER_MENUITEM = 1 << 5,
66
UI_MANAGER_TOOLITEM = 1 << 6,
67
UI_MANAGER_SEPARATOR = 1 << 7,
68
UI_MANAGER_ACCELERATOR = 1 << 8
71
/** @ingroup gtkmmEnums */
72
inline UIManagerItemType operator|(UIManagerItemType lhs, UIManagerItemType rhs)
73
{ return static_cast<UIManagerItemType>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); }
75
/** @ingroup gtkmmEnums */
76
inline UIManagerItemType operator&(UIManagerItemType lhs, UIManagerItemType rhs)
77
{ return static_cast<UIManagerItemType>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); }
79
/** @ingroup gtkmmEnums */
80
inline UIManagerItemType operator^(UIManagerItemType lhs, UIManagerItemType rhs)
81
{ return static_cast<UIManagerItemType>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); }
83
/** @ingroup gtkmmEnums */
84
inline UIManagerItemType operator~(UIManagerItemType flags)
85
{ return static_cast<UIManagerItemType>(~static_cast<unsigned>(flags)); }
87
/** @ingroup gtkmmEnums */
88
inline UIManagerItemType& operator|=(UIManagerItemType& lhs, UIManagerItemType rhs)
89
{ return (lhs = static_cast<UIManagerItemType>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); }
91
/** @ingroup gtkmmEnums */
92
inline UIManagerItemType& operator&=(UIManagerItemType& lhs, UIManagerItemType rhs)
93
{ return (lhs = static_cast<UIManagerItemType>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); }
95
/** @ingroup gtkmmEnums */
96
inline UIManagerItemType& operator^=(UIManagerItemType& lhs, UIManagerItemType rhs)
97
{ return (lhs = static_cast<UIManagerItemType>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); }
102
#ifndef DOXYGEN_SHOULD_SKIP_THIS
107
class Value<Gtk::UIManagerItemType> : public Glib::Value_Flags<Gtk::UIManagerItemType>
110
static GType value_type() G_GNUC_CONST;
114
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
121
class UIManager : public Glib::Object
124
#ifndef DOXYGEN_SHOULD_SKIP_THIS
127
typedef UIManager CppObjectType;
128
typedef UIManager_Class CppClassType;
129
typedef GtkUIManager BaseObjectType;
130
typedef GtkUIManagerClass BaseClassType;
132
private: friend class UIManager_Class;
133
static CppClassType uimanager_class_;
137
UIManager(const UIManager&);
138
UIManager& operator=(const UIManager&);
141
explicit UIManager(const Glib::ConstructParams& construct_params);
142
explicit UIManager(GtkUIManager* castitem);
144
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
147
virtual ~UIManager();
149
#ifndef DOXYGEN_SHOULD_SKIP_THIS
150
static GType get_type() G_GNUC_CONST;
151
static GType get_base_type() G_GNUC_CONST;
154
///Provides access to the underlying C GObject.
155
GtkUIManager* gobj() { return reinterpret_cast<GtkUIManager*>(gobject_); }
157
///Provides access to the underlying C GObject.
158
const GtkUIManager* gobj() const { return reinterpret_cast<GtkUIManager*>(gobject_); }
160
///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
161
GtkUIManager* gobj_copy();
170
static Glib::RefPtr<UIManager> create();
173
/** Sets the "add_tearoffs" property, which controls whether menus
174
* generated by this Gtk::UIManager will have tearoff menu items.
176
* Note that this only affects regular menus. Generated popup
177
* menus never have tearoff menu items.
180
* @param add_tearoffs Whether tearoff menu items are added.
182
void set_add_tearoffs(bool add_tearoffs = true);
184
/** Returns whether menus generated by this Gtk::UIManager
185
* will have tearoff menu items.
186
* @return Whether tearoff menu items are added
190
bool get_add_tearoffs() const;
192
/** Inserts an action group into the list of action groups associated
193
* with @a self . Actions in earlier groups hide actions with the same
194
* name in later groups.
197
* @param action_group The action group to be inserted.
198
* @param pos The position at which the group will be inserted.
200
void insert_action_group(const Glib::RefPtr<ActionGroup>& action_group, int pos = 0);
202
/** Removes an action group from the list of action groups associated
206
* @param action_group The action group to be removed.
208
void remove_action_group(const Glib::RefPtr<ActionGroup>& action_group);
211
/** Returns the list of action groups associated with @a self .
212
* @return A G::List of action groups. The list is owned by GTK+
213
* and should not be modified.
217
Glib::ListHandle< Glib::RefPtr<ActionGroup> > get_action_groups();
219
/** Returns the list of action groups associated with @a self .
220
* @return A G::List of action groups. The list is owned by GTK+
221
* and should not be modified.
225
Glib::ListHandle< Glib::RefPtr<const ActionGroup> > get_action_groups() const;
228
/** Returns the Gtk::AccelGroup associated with @a self .
229
* @return The Gtk::AccelGroup.
233
Glib::RefPtr<AccelGroup> get_accel_group();
235
/** Returns the Gtk::AccelGroup associated with @a self .
236
* @return The Gtk::AccelGroup.
240
Glib::RefPtr<const AccelGroup> get_accel_group() const;
242
/** Looks up a widget by following a path.
243
* The path consists of the names specified in the XML description of the UI.
244
* separated by '/'. Elements which don't have a name or action attribute in
245
* the XML (e.g. <popup>) can be addressed by their XML element name
246
* (e.g. "popup"). The root element ("/ui") can be omitted in the path.
248
* Note that the widget found by following a path that ends in a <menu>
249
* element is the menuitem to which the menu is attached, not the menu itself.
250
* @param path A path.
251
* @return The widget found by following the path, or <tt>0</tt> if no widget
256
Widget* get_widget(const Glib::ustring& path);
258
/** Looks up a widget by following a path.
259
* The path consists of the names specified in the XML description of the UI.
260
* separated by '/'. Elements which don't have a name or action attribute in
261
* the XML (e.g. <popup>) can be addressed by their XML element name
262
* (e.g. "popup"). The root element ("/ui") can be omitted in the path.
264
* Note that the widget found by following a path that ends in a <menu>
265
* element is the menuitem to which the menu is attached, not the menu itself.
266
* @param path A path.
267
* @return The widget found by following the path, or <tt>0</tt> if no widget
272
const Widget* get_widget(const Glib::ustring& path) const;
275
/** Obtains a list of all toplevel widgets of the requested types.
276
* @param types Specifies the types of toplevel widgets to include. Allowed
277
* types are Gtk::UI_MANAGER_MENUBAR, Gtk::UI_MANAGER_TOOLBAR and
278
* Gtk::UI_MANAGER_POPUP.
279
* @return A newly-allocated of all toplevel widgets of the requested
284
Glib::SListHandle<Widget*> get_toplevels(UIManagerItemType types);
286
/** Obtains a list of all toplevel widgets of the requested types.
287
* @param types Specifies the types of toplevel widgets to include. Allowed
288
* types are Gtk::UI_MANAGER_MENUBAR, Gtk::UI_MANAGER_TOOLBAR and
289
* Gtk::UI_MANAGER_POPUP.
290
* @return A newly-allocated of all toplevel widgets of the requested
295
Glib::SListHandle<const Widget*> get_toplevels(UIManagerItemType types) const;
298
/** Looks up an action by following a path. See gtk_ui_manager_get_widget()
299
* for more information about paths.
300
* @param path A path.
301
* @return The action whose proxy widget is found by following the path,
302
* or <tt>0</tt> if no widget was found.
306
Glib::RefPtr<Action> get_action(const Glib::ustring& path);
308
/** Looks up an action by following a path. See gtk_ui_manager_get_widget()
309
* for more information about paths.
310
* @param path A path.
311
* @return The action whose proxy widget is found by following the path,
312
* or <tt>0</tt> if no widget was found.
316
Glib::RefPtr<const Action> get_action(const Glib::ustring& path) const;
318
typedef guint ui_merge_id;
320
/** Parses a string containing a UI definition and
321
* merges it with the current contents. An enclosing <ui>
322
* element is added if it is missing.
324
* @param buffer the string to parse
325
* @result The merge id for the merged UI. The merge id can be used to unmerge the UI with remove_ui(). If an error occurred, the return value is 0.
329
ui_merge_id add_ui_from_string(const Glib::ustring& buffer);
332
/** Parses a file containing a UI definition and
333
* merges it with the current contents of @a self .
334
* @param filename The name of the file to parse.
335
* @return The merge id for the merged UI. The merge id can be used
336
* to unmerge the UI with gtk_ui_manager_remove_ui(). If an error occurred,
337
* the return value is 0.
341
ui_merge_id add_ui_from_file(const Glib::ustring& filename);
343
//TODO: Is top=true a good default?
346
/** Adds a UI element to the current contents of @a self .
348
* If @a type is Gtk::UI_MANAGER_AUTO, GTK+ inserts a menuitem, toolitem or
349
* separator if such an element can be inserted at the place determined by
350
* @a path . Otherwise @a type must indicate an element that can be inserted at
351
* the place determined by @a path .
353
* @a see add_ui_separator().
356
* @param merge_id The merge id for the merged UI, see gtk_ui_manager_new_merge_id().
357
* @param path A path.
358
* @param name The name for the added UI element.
359
* @param action The name of the action to be proxied, if this is not a separator.
360
* @param type The type of UI element to add.
361
* @param top If <tt>true</tt>, the UI element is added before its siblings, otherwise it
362
* is added after its siblings.
364
void add_ui(ui_merge_id merge_id, const Glib::ustring& path, const Glib::ustring& name, const Glib::ustring& action, UIManagerItemType type = Gtk::UI_MANAGER_AUTO, bool top = true);
366
/** Adds a separator UI element to the current contents.
368
* If @a type is Gtk::UI_MANAGER_AUTO, GTK+ inserts a menuitem, toolitem or
369
* separator if such an element can be inserted at the place determined by
370
* @a path . Otherwise @a type must indicate an element that can be inserted at
371
* the place determined by @a path.
376
* @param merge_id The merge id for the merged UI, see gtk_ui_manager_new_merge_id().
377
* @param path A path.
378
* @param name The name for the added UI element.
379
* @param type The type of UI element to add.
380
* @param top If <tt>true</tt>, the UI element is added before its siblings, otherwise it
381
* is added after its siblings.
383
void add_ui_separator(ui_merge_id merge_id, const Glib::ustring& path, const Glib::ustring& name = "", UIManagerItemType type = Gtk::UI_MANAGER_AUTO, bool top = true);
386
/** Unmerges the part of @a self <!-- -->s content identified by @a merge_id .
389
* @param merge_id A merge id as returned by gtk_ui_manager_add_ui_from_string().
391
void remove_ui(ui_merge_id merge_id);
393
/** Creates a UI definition of the merged UI.
394
* @return A newly allocated string containing an XML representation of
399
Glib::ustring get_ui() const;
401
/** Makes sure that all pending updates to the UI have been completed.
403
* This may occasionally be necessary, since Gtk::UIManager updates the
404
* UI in an idle function. A typical example where this function is
405
* useful is to enforce that the menubar and toolbar have been added to
406
* the main window before showing it:
409
* gtk_container_add (GTK_CONTAINER (window), vbox);
410
* g_signal_connect (merge, "add_widget",
411
* G_CALLBACK (add_widget), vbox);
412
* gtk_ui_manager_add_ui_from_file (merge, "my-menus");
413
* gtk_ui_manager_add_ui_from_file (merge, "my-toolbars");
414
* gtk_ui_manager_ensure_update (merge);
415
* gtk_widget_show (window);
421
void ensure_update();
423
/** Returns an unused merge id, suitable for use with
424
* gtk_ui_manager_add_ui().
425
* @return An unused merge id.
429
ui_merge_id new_merge_id();
432
Glib::SignalProxy1< void,Widget* > signal_add_widget();
435
Glib::SignalProxy0< void > signal_actions_changed();
438
Glib::SignalProxy2< void,const Glib::RefPtr<Action>&,Widget* > signal_connect_proxy();
441
Glib::SignalProxy2< void,const Glib::RefPtr<Action>&,Widget* > signal_disconnect_proxy();
444
Glib::SignalProxy1< void,const Glib::RefPtr<Action>& > signal_pre_activate();
447
Glib::SignalProxy1< void,const Glib::RefPtr<Action>& > signal_post_activate();
450
/** Whether tearoff menu items should be added to menus.
452
* You rarely need to use properties because there are get_ and set_ methods for almost all of them.
453
* @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
454
* the value of the property changes.
456
Glib::PropertyProxy<bool> property_add_tearoffs() ;
458
/** Whether tearoff menu items should be added to menus.
460
* You rarely need to use properties because there are get_ and set_ methods for almost all of them.
461
* @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
462
* the value of the property changes.
464
Glib::PropertyProxy_ReadOnly<bool> property_add_tearoffs() const;
466
/** An XML string describing the merged UI.
468
* You rarely need to use properties because there are get_ and set_ methods for almost all of them.
469
* @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
470
* the value of the property changes.
472
Glib::PropertyProxy_ReadOnly<Glib::ustring> property_ui() const;
478
//C++ methods used to invoke GTK+ virtual functions:
481
//GTK+ Virtual Functions (override these to change behaviour):
483
//Default Signal Handlers::
484
virtual void on_add_widget(Widget* widget);
485
virtual void on_actions_changed();
495
/** @relates Gtk::UIManager
496
* @param object The C instance
497
* @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
498
* @result A C++ instance that wraps this C instance.
500
Glib::RefPtr<Gtk::UIManager> wrap(GtkUIManager* object, bool take_copy = false);
504
#endif /* _GTKMM_UIMANAGER_H */