~ubuntu-branches/ubuntu/quantal/gtkmm3.0/quantal

« back to all changes in this revision

Viewing changes to gtk/gtkmm/uimanager.h

  • Committer: Package Import Robot
  • Author(s): Robert Ancell
  • Date: 2012-09-28 09:25:06 UTC
  • mfrom: (1.1.14)
  • Revision ID: package-import@ubuntu.com-20120928092506-9h63ais5o750a8sk
Tags: 3.5.13-0ubuntu1
* New upstream release
* debian/control:
  - Bump build-depends on libglibmm-2.4-dev, libgtk-3-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
#include <glibmm/ustring.h>
8
8
#include <sigc++/sigc++.h>
9
9
 
10
 
/* $Id: uimanager.hg,v 1.17 2006/05/11 11:40:24 murrayc Exp $ */
11
 
 
12
 
/* Copyright (C) 2003 The gtkmm Development Team
 
10
/*
 
11
 * Copyright (C) 2003 The gtkmm Development Team
13
12
 *
14
13
 * This library is free software; you can redistribute it and/or
15
14
 * modify it under the terms of the GNU Lesser General Public
31
30
#include <gtkmm/widget.h>
32
31
#include <gtkmm/action.h>
33
32
#include <gtkmm/actiongroup.h>
34
 
 
 
33
 
35
34
 
36
35
#ifndef DOXYGEN_SHOULD_SKIP_THIS
37
36
typedef struct _GtkUIManager GtkUIManager;
43
42
{ class UIManager_Class; } // namespace Gtk
44
43
namespace Gtk
45
44
{
46
 
        
 
45
 
47
46
/** @addtogroup gtkmmEnums gtkmm Enums and Flags */
48
47
 
49
48
/**
141
140
 * <!ELEMENT toolitem     (menu?) >
142
141
 * <!ELEMENT separator    EMPTY >
143
142
 * <!ELEMENT accelerator  EMPTY >
144
 
 * <!ATTLIST menubar      name                  #IMPLIED 
145
 
 *                      action                #IMPLIED >
146
 
 * <!ATTLIST toolbar      name                  #IMPLIED 
147
 
 *                      action                #IMPLIED >
148
 
 * <!ATTLIST popup        name                  #IMPLIED 
 
143
 * <!ATTLIST menubar      name                  #IMPLIED
 
144
 *                      action                #IMPLIED >
 
145
 * <!ATTLIST toolbar      name                  #IMPLIED
 
146
 *                      action                #IMPLIED >
 
147
 * <!ATTLIST popup        name                  #IMPLIED
149
148
 *                      action                #IMPLIED >
150
149
 * <!ATTLIST placeholder  name                  #IMPLIED
151
150
 *                       action                #IMPLIED >
165
164
 *                       action                #REQUIRED >
166
165
 * \endcode
167
166
 *
168
 
 * There are some additional restrictions beyond those specified in the DTD, e.g. 
 
167
 * There are some additional restrictions beyond those specified in the DTD, e.g.
169
168
 * every toolitem must have a toolbar in its anchestry and every menuitem must have a +
170
 
 * menubar or popup in its anchestry. Since a GMarkup parser is used to parse the UI description, 
 
169
 * menubar or popup in its anchestry. Since a GMarkup parser is used to parse the UI description,
171
170
 * it must not only be valid XML, but valid GMarkup.
172
171
 *
173
172
 * If a name is not specified, it defaults to the action. If an action is not specified either,
174
 
 * the element name is used. The name and action attributes must not contain '/' characters after 
175
 
 * parsing (since that would mess up path lookup) and must be usable as XML attributes when 
 
173
 * the element name is used. The name and action attributes must not contain '/' characters after
 
174
 * parsing (since that would mess up path lookup) and must be usable as XML attributes when
176
175
 * enclosed in doublequotes, thus they must not '"' characters or references to the &quot; entity.
177
176
 *
178
177
 * \par Example: UI Definition
202
201
 * </toolbar>
203
202
 * </ui>
204
203
 * \endcode
205
 
 * 
 
204
 *
206
205
 * The constructed widget hierarchy is very similar to the element tree of the XML,
207
206
 * with the exception that placeholders are merged into their parents. The correspondence
208
207
 * of XML elements to widgets should be almost obvious:
211
210
 * - popup  a toplevel Gtk::Menu
212
211
 * - menu  a Gtk::Menu attached to a menuitem
213
212
 * - menuitem  a Gtk::MenuItem subclass, the exact type depends on the action
214
 
 * - toolitem  a Gtk::ToolItem subclass, the exact type depends on the action. 
215
 
 * Note that toolitem elements may contain a menu element, but only if their 
 
213
 * - toolitem  a Gtk::ToolItem subclass, the exact type depends on the action.
 
214
 * Note that toolitem elements may contain a menu element, but only if their
216
215
 * associated action specifies a Gtk::MenuToolButton as proxy.
217
216
 * - separator  a Gtk::SeparatorMenuItem or Gtk::SeparatorToolItem
218
217
 * - accelerator        a keyboard accelerator
219
 
 * 
220
 
 * The "position" attribute determines where a constructed widget is positioned wrt. 
221
 
 * to its siblings in the partially constructed tree. If it is "top", the widget is 
222
 
 * prepended, otherwise it is appended. 
 
218
 *
 
219
 * The "position" attribute determines where a constructed widget is positioned wrt.
 
220
 * to its siblings in the partially constructed tree. If it is "top", the widget is
 
221
 * prepended, otherwise it is appended.
223
222
 *
224
223
 * \par UI Merging
225
224
 *
226
 
 * The most remarkable feature of Gtk::UIManager is that it can overlay a set of menuitems 
 
225
 * The most remarkable feature of Gtk::UIManager is that it can overlay a set of menuitems
227
226
 * and toolitems over another one, and demerge them later.
228
227
 *
229
228
 * Merging is done based on the names of the XML elements. Each element is identified by
230
 
 * a path which consists of the names of its anchestors, separated by slashes. For example, 
231
 
 * the menuitem named "Left" in the example above has the path /ui/menubar/JustifyMenu/Left 
 
229
 * a path which consists of the names of its anchestors, separated by slashes. For example,
 
230
 * the menuitem named "Left" in the example above has the path /ui/menubar/JustifyMenu/Left
232
231
 * and the toolitem with the same name has path /ui/toolbar1/JustifyToolItems/Left.
233
232
 *
234
233
 * \par Accelerators
235
234
 *
236
 
 * Every action has an accelerator path. Accelerators are installed together with menuitem 
237
 
 * proxies, but they can also be explicitly added with <accelerator> elements in the 
238
 
 * UI definition. This makes it possible to have accelerators for actions even 
 
235
 * Every action has an accelerator path. Accelerators are installed together with menuitem
 
236
 * proxies, but they can also be explicitly added with <accelerator> elements in the
 
237
 * UI definition. This makes it possible to have accelerators for actions even
239
238
 * if they have no visible proxies.
240
 
 * 
 
239
 *
241
240
 * \par Smart Separators
242
241
 *
243
 
 * The separators created by Gtk::UIManager are "smart", i.e. they do not show up in 
244
 
 * the UI unless they end up between two visible menu or tool items. Separators which are 
245
 
 * located at the very beginning or end of the menu or toolbar containing them, or multiple 
246
 
 * separators next to each other, are hidden. This is a useful feature, since the merging 
247
 
 * of UI elements from multiple sources can make it hard or impossible to determine in 
 
242
 * The separators created by Gtk::UIManager are "smart", i.e. they do not show up in
 
243
 * the UI unless they end up between two visible menu or tool items. Separators which are
 
244
 * located at the very beginning or end of the menu or toolbar containing them, or multiple
 
245
 * separators next to each other, are hidden. This is a useful feature, since the merging
 
246
 * of UI elements from multiple sources can make it hard or impossible to determine in
248
247
 * advance whether a separator will end up in such an unfortunate position.
249
248
 *
250
249
 * For separators in toolbars, you can set expand="true" to turn them from a small,
251
 
 * visible separator to an expanding, invisible one. Toolitems following an expanding 
 
250
 * visible separator to an expanding, invisible one. Toolitems following an expanding
252
251
 * separator are effectively right-aligned.
253
252
 *
254
253
 * \par Empty Menus
255
254
 *
256
 
 * Submenus pose similar problems to separators inconnection with merging. It is impossible 
257
 
 * to know in advance whether they will end up empty after merging. Gtk::UIManager offers 
 
255
 * Submenus pose similar problems to separators inconnection with merging. It is impossible
 
256
 * to know in advance whether they will end up empty after merging. Gtk::UIManager offers
258
257
 * two ways to treat empty submenus:
259
258
 *
260
259
 * - make them disappear by hiding the menu item they're attached to
398
397
   * and should not be modified.
399
398
   */
400
399
  std::vector< Glib::RefPtr<const ActionGroup> > get_action_groups() const;
401
 
  
 
400
 
402
401
  
403
402
  /** Returns the Gtk::AccelGroup associated with @a manager.
404
403
   * 
479
478
   * all toplevel widgets of the requested types.  Free the returned list with Glib::slist_free().
480
479
   */
481
480
  std::vector<const Widget*> get_toplevels(UIManagerItemType types) const;
482
 
                 
 
481
 
483
482
  
484
483
  /** Looks up an action by following a path. See gtk_ui_manager_get_widget()
485
484
   * for more information about paths.
502
501
  Glib::RefPtr<const Action> get_action(const Glib::ustring& path) const;
503
502
 
504
503
  typedef guint ui_merge_id;
505
 
    
 
504
 
506
505
  /** Parses a string containing a UI definition and
507
506
   * merges it with the current contents. An enclosing &lt;ui&gt;
508
507
   * element is added if it is missing.
511
510
   * @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.
512
511
   * @throws exception
513
512
   * @newin{2,4}
514
 
   */ 
 
513
   */
515
514
  ui_merge_id add_ui_from_string(const Glib::ustring& buffer);
516
515
  
517
516
  
578
577
   * is added after its siblings.
579
578
   */
580
579
  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);
581
 
  
 
580
 
582
581
  
583
582
  /** Unmerges the part of @a manager<!-- -->s content identified by @a merge_id.
584
583
   *