From 38ee74b053f63c3884a0dfbb558aa851607f9cf4 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 1 Sep 2003 00:34:41 +0000 Subject: [PATCH] Add an example UI description. * gtk/tmpl/gtkuimanager.sgml: Add an example UI description. --- docs/reference/ChangeLog | 2 + docs/reference/gtk/tmpl/gtkuimanager.sgml | 102 +++++++++++++++++----- 2 files changed, 81 insertions(+), 23 deletions(-) diff --git a/docs/reference/ChangeLog b/docs/reference/ChangeLog index 2267b68ec3..17d36893d5 100644 --- a/docs/reference/ChangeLog +++ b/docs/reference/ChangeLog @@ -1,5 +1,7 @@ 2003-09-01 Matthias Clasen + * gtk/tmpl/gtkuimanager.sgml: Add an example UI description. + * gtk/gtk-sections.txt: Add gtk_ui_manager_ensure_update. 2003-08-31 Matthias Clasen diff --git a/docs/reference/gtk/tmpl/gtkuimanager.sgml b/docs/reference/gtk/tmpl/gtkuimanager.sgml index 3bf4e5f9ce..dbcf7fb562 100644 --- a/docs/reference/gtk/tmpl/gtkuimanager.sgml +++ b/docs/reference/gtk/tmpl/gtkuimanager.sgml @@ -12,8 +12,8 @@ action groups. UI Definitions -The UI definitions are specified in an XML format which is described -by the following DTD. +The UI definitions are specified in a #GMarkup format which can be +roughly described by the following XML DTD. <!ELEMENT ui (menubar|toolbar|popup)* > <!ELEMENT menubar (menuitem|separator|placeholder|menu)* > @@ -38,29 +38,77 @@ by the following DTD. action #REQUIRED pos (top|bot) #IMPLIED > -There are some additional restrictions beyond those specified in the DTD, e.g. -every toolitem must have a toolbar in its anchestry and every menuitem must have -a menubar or popup in its anchestry. If a name is not specified, it defaults to -the action. If an action is not specified either, the element name is used. +There are some additional restrictions beyond those specified in the +DTD, e.g. every toolitem must have a toolbar in its anchestry and +every menuitem must have a menubar or popup in its anchestry. If a name +is not specified, it defaults to the action. If an action is not specified +either, the element name is used. + + +A UI definition + +<ui> + <menubar> + <menu name="FileMenu" action="FileMenuAction"> + <menuitem name="New" action="New2Action" /> + <placeholder name="FileMenuAdditions" /> + </menu> + <menu name="JustifyMenu" action="JustifyMenuAction"> + <menuitem name="Left" action="justify-left"/> + <menuitem name="Centre" action="justify-center"/> + <menuitem name="Right" action="justify-right"/> + <menuitem name="Fill" action="justify-fill"/> + </menu> + </menubar> + <toolbar action="toolbar1"> + <placeholder name="JustifyToolItems"> + <separator/> + <toolitem name="Left" action="justify-left"/> + <toolitem name="Centre" action="justify-center"/> + <toolitem name="Right" action="justify-right"/> + <toolitem name="Fill" action="justify-fill"/> + <separator/> + </placeholder> + </toolbar> +</ui> + + + +The constructed widget hierarchy is very similar to the element tree +of the XML, with the exception that placeholders are merged into their +parents. The correspondence of XML elements to widgets should be +almost obvious: + +menubar +a #GtkMenuBar + +toolbar +a #GtkToolbar + +popup +a toplevel #GtkMenu + +menu +a #GtkMenu attached to a menuitem + +menuitem +a #GtkMenuItem subclass, the exact type depends on the +action + +toolitem +a #GtkToolItem subclass, the exact type depends on the +action + +separator +a #GtkSeparatorMenuItem or +#GtkSeparatorToolItem + + -The constructed widget hierarchy is very similar to the element -tree of the XML, with the exception that placeholders are merged into their -parents. The correspondence of XML elements to widgets should be almost obvious: - -menubar: a #GtkMenuBar -toolbar: a #GtkToolBar -popup: a toplevel #GtkMenu -menu: a #GtkMenu attached to a menuitem -menuitem: a #GtkMenuItem subclass, the exact type depends on the action -toolitem: a #GtkToolItem subclass, the exact type depends on the action -separator: a #GtkSeparatorMenuItem or #GtkSeparatorToolItem - - - -The pos attribute determines where a constructed widget is positioned wrt. to its -siblings in the partially constructed tree. If it is "top", the widget is prepended, -otherwise it is appended. +The pos attribute determines where a constructed widget is positioned +wrt. to its siblings in the partially constructed tree. If it is +"top", the widget is prepended, otherwise it is appended. @@ -199,6 +247,14 @@ otherwise it is appended. @Returns: + + + + + +@self: + +