1 <!-- ##### SECTION Title ##### -->
4 <!-- ##### SECTION Short_Description ##### -->
5 constructing menus and toolbars from an XML description
7 <!-- ##### SECTION Long_Description ##### -->
9 A #GtkUIManager constructs a user interface (menus and toolbars) from
10 one or more UI definitions, which reference actions from one or ore
13 <refsect2 id="XML-UI"><title>UI Definitions</title>
15 The UI definitions are specified in a #GMarkup format which can be
16 roughly described by the following XML DTD.
18 <!ELEMENT ui (menubar|toolbar|popup)* >
19 <!ELEMENT menubar (menuitem|separator|placeholder|menu)* >
20 <!ELEMENT menu (menuitem|separator|placeholder|menu)* >
21 <!ELEMENT popup (menuitem|separator|placeholder|menu)* >
22 <!ELEMENT toolbar (toolitem|separator|placeholder)* >
23 <!ELEMENT placeholder (menuitem|toolitem|separator|placeholder|menu)* >
24 <!ELEMENT menuitem EMPTY >
25 <!ELEMENT toolitem EMPTY >
26 <!ELEMENT separator EMPTY >
27 <!ATTLIST menubar name #IMPLIED >
28 <!ATTLIST toolbar name #IMPLIED >
29 <!ATTLIST popup name #IMPLIED >
30 <!ATTLIST placeholder name #IMPLIED >
31 <!ATTLIST menu name #IMPLIED
33 pos (top|bot) #IMPLIED >
34 <!ATTLIST menuitem name #IMPLIED
36 pos (top|bot) #IMPLIED >
37 <!ATTLIST toolitem name #IMPLIED
39 pos (top|bot) #IMPLIED >
41 There are some additional restrictions beyond those specified in the
42 DTD, e.g. every toolitem must have a toolbar in its anchestry and
43 every menuitem must have a menubar or popup in its anchestry. If a name
44 is not specified, it defaults to the action. If an action is not specified
45 either, the element name is used.
48 <title>A UI definition</title>
52 <menu name="FileMenu" action="FileMenuAction">
53 <menuitem name="New" action="New2Action" />
54 <placeholder name="FileMenuAdditions" />
56 <menu name="JustifyMenu" action="JustifyMenuAction">
57 <menuitem name="Left" action="justify-left"/>
58 <menuitem name="Centre" action="justify-center"/>
59 <menuitem name="Right" action="justify-right"/>
60 <menuitem name="Fill" action="justify-fill"/>
63 <toolbar action="toolbar1">
64 <placeholder name="JustifyToolItems">
66 <toolitem name="Left" action="justify-left"/>
67 <toolitem name="Centre" action="justify-center"/>
68 <toolitem name="Right" action="justify-right"/>
69 <toolitem name="Fill" action="justify-fill"/>
77 The constructed widget hierarchy is very similar to the element tree
78 of the XML, with the exception that placeholders are merged into their
79 parents. The correspondence of XML elements to widgets should be
82 <varlistentry><term>menubar</term>
83 <listitem><para>a #GtkMenuBar</para></listitem>
85 <varlistentry><term>toolbar</term>
86 <listitem><para>a #GtkToolbar</para></listitem>
88 <varlistentry><term>popup</term>
89 <listitem><para>a toplevel #GtkMenu</para></listitem>
91 <varlistentry><term>menu</term>
92 <listitem><para>a #GtkMenu attached to a menuitem</para></listitem>
94 <varlistentry><term>menuitem</term>
95 <listitem><para>a #GtkMenuItem subclass, the exact type depends on the
96 action</para></listitem>
98 <varlistentry><term>toolitem</term>
99 <listitem><para>a #GtkToolItem subclass, the exact type depends on the
100 action</para></listitem>
102 <varlistentry><term>separator</term>
103 <listitem><para>a #GtkSeparatorMenuItem or
104 #GtkSeparatorToolItem</para></listitem>
109 The pos attribute determines where a constructed widget is positioned
110 wrt. to its siblings in the partially constructed tree. If it is
111 "top", the widget is prepended, otherwise it is appended.
115 <!-- ##### SECTION See_Also ##### -->
120 <!-- ##### STRUCT GtkUIManager ##### -->
126 <!-- ##### FUNCTION gtk_ui_manager_new ##### -->
134 <!-- ##### FUNCTION gtk_ui_manager_set_add_tearoffs ##### -->
143 <!-- ##### FUNCTION gtk_ui_manager_get_add_tearoffs ##### -->
152 <!-- ##### FUNCTION gtk_ui_manager_insert_action_group ##### -->
162 <!-- ##### FUNCTION gtk_ui_manager_remove_action_group ##### -->
171 <!-- ##### FUNCTION gtk_ui_manager_get_action_groups ##### -->
180 <!-- ##### FUNCTION gtk_ui_manager_get_accel_group ##### -->
189 <!-- ##### FUNCTION gtk_ui_manager_get_widget ##### -->
199 <!-- ##### FUNCTION gtk_ui_manager_get_action ##### -->
209 <!-- ##### FUNCTION gtk_ui_manager_add_ui_from_string ##### -->
221 <!-- ##### FUNCTION gtk_ui_manager_add_ui_from_file ##### -->
232 <!-- ##### FUNCTION gtk_ui_manager_remove_ui ##### -->
241 <!-- ##### FUNCTION gtk_ui_manager_get_ui ##### -->
250 <!-- ##### FUNCTION gtk_ui_manager_ensure_update ##### -->
258 <!-- ##### SIGNAL GtkUIManager::add-widget ##### -->
263 @uimanager: the object which received the signal.
266 <!-- ##### SIGNAL GtkUIManager::changed ##### -->
271 @uimanager: the object which received the signal.
273 <!-- ##### ARG GtkUIManager:add-tearoffs ##### -->