Learn R Programming

RGtk2 (version 2.8.8)

GtkUIManager: GtkUIManager

Description

Constructing menus and toolbars from an XML description

Arguments

Methods and Functions

gtkUIManagerNew() gtkUIManagerSetAddTearoffs(object, add.tearoffs) gtkUIManagerGetAddTearoffs(object) gtkUIManagerInsertActionGroup(object, action.group, pos) gtkUIManagerRemoveActionGroup(object, action.group) gtkUIManagerGetActionGroups(object) gtkUIManagerGetAccelGroup(object) gtkUIManagerGetWidget(object, path) gtkUIManagerGetToplevels(object, types) gtkUIManagerGetAction(object, path) gtkUIManagerAddUiFromString(object, buffer, length = -1, .errwarn = TRUE) gtkUIManagerAddUiFromFile(object, filename, .errwarn = TRUE) gtkUIManagerNewMergeId(object) gtkUIManagerAddUi(object, merge.id, path, name, action = NULL, type, top) gtkUIManagerRemoveUi(object, merge.id) gtkUIManagerGetUi(object) gtkUIManagerEnsureUpdate(object) gtkUIManager()

Hierarchy

\link{GObject} +----GtkUIManager

Detailed Description

A GtkUIManager constructs a user interface (menus and toolbars) from one or more UI definitions, which reference actions from one or more action groups.

UI Merging

The most remarkable feature of GtkUIManager is that it can overlay a set of menuitems and toolitems over another one, and demerge them later. Merging is done based on the names of the XML elements. Each element is identified by a path which consists of the names of its anchestors, separated by slashes. For example, the menuitem named "Left" in the example above has the path /ui/menubar/JustifyMenu/Left and the toolitem with the same name has path /ui/toolbar1/JustifyToolItems/Left.

Accelerators

Every action has an accelerator path. Accelerators are installed together with menuitem proxies, but they can also be explicitly added with elements in the UI definition. This makes it possible to have accelerators for actions even if they have no visible proxies.

Smart Separators

The separators created by GtkUIManager are "smart", i.e. they do not show up in the UI unless they end up between two visible menu or tool items. Separators which are located at the very beginning or end of the menu or toolbar containing them, or multiple separators next to each other, are hidden. This is a useful feature, since the merging of UI elements from multiple sources can make it hard or impossible to determine in advance whether a separator will end up in such an unfortunate position. For separators in toolbars, you can set expand="true" to turn them from a small, visible separator to an expanding, invisible one. Toolitems following an expanding separator are effectively right-aligned.

Empty Menus

Submenus pose similar problems to separators inconnection with merging. It is impossible to know in advance whether they will end up empty after merging. GtkUIManager offers two ways to treat empty submenus:
  • make them disappear by hiding the menu item they're attached to
  • add an insensitive "Empty" item
The behaviour is chosen based on the "hide_if_empty" property of the action to which the submenu is associated.

Convenient Construction

gtkUIManager is the equivalent of gtkUIManagerNew.

References

http://developer.gnome.org/doc/API/2.0/gtk/GtkUIManager.html