165
164
* action #REQUIRED >
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.
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 " entity.
178
177
* \par Example: UI Definition
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
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.
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.
224
223
* \par UI Merging
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.
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.
234
233
* \par Accelerators
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.
241
240
* \par Smart Separators
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.
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.
254
253
* \par Empty Menus
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:
260
259
* - make them disappear by hiding the menu item they're attached to