Gtk.UIManager Class
Constructs menus and toolbars from an XML description

See Also: UIManager Members


public class UIManager : GLib.Object


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

TODO: all the xml stuff

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.


Every action has an accelerator path. Accelerators are installed together with menuitem proxies, but they can also be explicitly added with <accelerator> 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.

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:

The behaviour is chosen based on the "is_important" property of the action to which the submenu is associated.


Namespace: Gtk
Assembly: gtk-sharp (in gtk-sharp.dll)
Assembly Versions:
Since: Gtk# 2.4