Learn R Programming

RGtk2 (version 2.12.17)

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

GObject +----GtkUIManager

Interfaces

GtkUIManager implements GtkBuildable.

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.

GtkUIManager as GtkBuildable

The GtkUIManager implementation of the GtkBuildable interface accepts GtkActionGroup objects as elements in UI definitions. A GtkUIManager UI definition as described above can be embedded in an GtkUIManager element in a GtkBuilder UI definition. The widgets that are constructed by a GtkUIManager can be embedded in other parts of the constructed user interface with the help of the "constructor" attribute. See the example below. An embedded GtkUIManager UI definition _File

Convenient Construction

gtkUIManager is the equivalent of gtkUIManagerNew.

References

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

See Also

GtkBuilder