From acdaee5e085f3f90d06307bf34592efa67d91265 Mon Sep 17 00:00:00 2001 From: John Luke Date: Wed, 10 Nov 2004 02:28:55 +0000 Subject: [PATCH] ActionGroup, UIManager, and UIManagerItemType docs svn path=/trunk/gtk-sharp/; revision=35938 --- doc/ChangeLog | 5 +- doc/en/Gtk/ActionGroup.xml | 80 +++++++++------ doc/en/Gtk/UIManager.xml | 164 +++++++++++++++++++------------ doc/en/Gtk/UIManagerItemType.xml | 24 ++--- 4 files changed, 169 insertions(+), 104 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 1042dc29f..3119057f7 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,6 +1,9 @@ 2004-11-09 John Luke - * en/Gtk/Action.xml: doc + * en/Gtk/Action.xml: + * en/Gtk/ActionGroup.xml: + * en/Gtk/UIManagerItemType.xml: + * en/Gtk/UIManager.xml: doc 2004-11-09 Dan Winship diff --git a/doc/en/Gtk/ActionGroup.xml b/doc/en/Gtk/ActionGroup.xml index 059b30b43..84f4db09f 100644 --- a/doc/en/Gtk/ActionGroup.xml +++ b/doc/en/Gtk/ActionGroup.xml @@ -9,8 +9,20 @@ Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. - To be added - To be added + A group of actions + + + +Actions are organised into groups. An action group is essentially a map from names to objects. + + +All actions that would make sense to use in a particular context should be in a single group. Multiple action groups may be used for a particular user interface. In fact, it is expected that most nontrivial applications will make use of multiple groups. For example, in an application that can edit multiple documents, one group holding global actions (e.g. quit, about, new), and one group per document holding actions that act on that document (eg. save, cut/copy/paste, etc). Each window's menus would be constructed from a combination of two action groups. + + +Accelerators are handled by the Gtk accelerator map. All actions are assigned an accelerator path (which normally has the form <Actions>/group-name/action-name) and a shortcut is associated with this accelerator path. All menuitems and toolitems take on this accelerator path. The Gtk accelerator map code makes sure that the correct shortcut is displayed next to the menu item. + + + GLib.Object @@ -49,11 +61,11 @@ - To be added + Sets a function to be used for translating the label and tooltip of GtkActionGroupEntrys added by . a a a - To be added + If you are using gettext(), it is enough to set the translation domain with . @@ -66,9 +78,9 @@ - To be added + Removes an action object from the action group. a - To be added + @@ -82,10 +94,19 @@ - To be added + Adds an action object to the action group and sets up the accelerator. a - a - To be added + a . The accelerator for the action, in the format understood by , or "" for no accelerator, or to use the stock accelerator + + + +If accelerator is , attempts to use the accelerator associated with the stock_id of the action. + + +Accel paths are set to <Actions>/group-name/action-name. + + + @@ -98,9 +119,9 @@ - To be added - a - a + Looks up an action in the action group by name. + a , the name of the action + a , or if no action by that name exists To be added @@ -114,9 +135,10 @@ - To be added + Adds an action object to the action group. a - To be added + Note that this function does not set up the accel path of the action, which can lead to problems if a user tries to modify the accelerator of a menuitem associated with the action. +Therefore you must either set the accel path yourself with , or use . @@ -127,7 +149,7 @@ - To be added + Lists the actions in the action group. a To be added @@ -140,10 +162,10 @@ - To be added + Internal constructor a a - To be added + @@ -154,10 +176,10 @@ - To be added + Internal constructor a a - To be added + @@ -168,10 +190,10 @@ - To be added - a + Creates a new object. + a , the name of the action group. a - To be added + The name of the action group is used when associating keybindings with the actions. @@ -195,9 +217,9 @@ - To be added + The visibility of the ActionGroup a - To be added + The constituent actions can only be logically visible (see ) if they are visible (see ) and their group is visible. @@ -208,9 +230,9 @@ - To be added + The sensitivity of the ActionGroup a - To be added + The constituent actions can only be logically sensitive (see ) if they are sensitive (see ) and their group is sensitive. @@ -221,9 +243,9 @@ - To be added + Gets the name of the action group. a - To be added + @@ -233,7 +255,7 @@ System.String - To be added + Sets the translation domain and uses dgettext() for translating the label and tooltip of s added by . a To be added diff --git a/doc/en/Gtk/UIManager.xml b/doc/en/Gtk/UIManager.xml index c3df4f718..3c9d7fa40 100644 --- a/doc/en/Gtk/UIManager.xml +++ b/doc/en/Gtk/UIManager.xml @@ -9,8 +9,42 @@ Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. - To be added - To be added + Constructs menus and toolbars from an XML description + + +A 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. + +Accelerators + +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: + + + + make them disappear by hiding the menu item they're attached to + + + add an insensitive "Empty" item + + + +The behaviour is chosen based on the "is_important" property of the action to which the submenu is associated. + + GLib.Object @@ -138,7 +172,7 @@ - To be added + emoves an action group from the list of action groups a To be added @@ -153,10 +187,16 @@ - To be added + Looks up a widget by following a path. a - a - To be added + a found by following the path, or if no widget was found. + The path consists of the names specified in the XML description of the UI. separated by '/'. Elements which do not have a name or action attribute in the XML (e.g. <popup>) can be addressed by their XML element name (e.g. "popup"). The root element ("/ui") can be omitted in the path. + + + + The widget found by following a path that ends in a <menu> element is the menuitem to which the menu is attached, not the menu itself. + + @@ -169,10 +209,10 @@ - To be added - a - a - To be added + Parses a string containing a UI definition and merges it with the current contents. + a to parse + a . The merge id for the merged UI. The merge id can be used to unmerge the UI with . If an error occurred, the return value is 0. + An enclosing <ui> element is added if it is missing. @@ -185,10 +225,10 @@ - To be added + Obtains a list of all toplevel widgets of the requested types. a a - To be added + Allowed types are GTK_UI_MANAGER_MENUBAR, GTK_UI_MANAGER_TOOLBAR and GTK_UI_MANAGER_POPUP. @@ -199,8 +239,8 @@ - To be added - To be added + Makes sure that all pending updates to the UI have been completed. + This may occasionally be necessary, since updates the UI in an idle function. @@ -218,14 +258,14 @@ - To be added - a + Adds a UI element to the current contents. + a , the merge id for the merged UI a - a - a - a - a - To be added + a , the name for the added UI element + a , the name of the action to be proxied, or to add a separator + a . the type of UI element to add. + a . If , the UI element is added before its siblings, otherwise it is added after its siblings. + If type is , Gtk inserts a menuitem, toolitem or separator if such an element can be inserted at the place determined by path. Otherwise type must indicate an element that can be inserted at the place determined by path. @@ -238,9 +278,9 @@ - To be added - a - To be added + Unmerges the content identified by . + a from when the ui was added. + @@ -254,10 +294,10 @@ - To be added - a - a - To be added + Inserts an action group into the list of action groups associated with this UIManager + a to be inserted + a , the position at which the group will be inserted. + Actions in earlier groups hide actions with the same name in later groups. @@ -270,9 +310,9 @@ - To be added - a - a + Parses a file containing a UI definition and merges it with the current contents. + a , the name of the file to parse + a . The merge id for the merged UI. The merge id can be used to unmerge the UI with . If an error occurred, the return value is 0. To be added @@ -286,10 +326,10 @@ - To be added + Looks up an action by following a path. a - a - To be added + a whose proxy widget is found by following the path, or if no widget was found. + See for more information about paths. @@ -302,7 +342,7 @@ - To be added + Adds a UI element to the current contents from an embedded resource. a a To be added @@ -316,10 +356,10 @@ - To be added + Internal constructor a a - To be added + @@ -330,10 +370,10 @@ - To be added + Internal constructor a a - To be added + @@ -342,9 +382,9 @@ - To be added + Default constructor a - To be added + @@ -382,9 +422,9 @@ - To be added + The UI represented in XML. a - To be added + @@ -395,9 +435,9 @@ - To be added - a - To be added + Sets the "add_tearoffs" property, which controls whether menus generated by this will have tearoff menu items. + a , whether tearoff menu items are added + Note that this only affects regular menus. Generated popup menus never have tearoff menu items. @@ -408,9 +448,9 @@ - To be added + The associated with this UIManager a - To be added + @@ -421,9 +461,9 @@ - To be added + The list of action groups associated with this UIManager. a - To be added + @@ -434,8 +474,8 @@ - To be added - To be added + The "actions-changed" signal is emitted whenever the set of actions changes. + @@ -446,8 +486,8 @@ - To be added - To be added + The PreActivate signal is emitted just before the action is activated. + This is intended for applications to get notification just before any action is activated. @@ -458,8 +498,8 @@ - To be added - To be added + The AddWidget signal is emitted for each generated menubar and toolbar. + It is not emitted for generated popup menus, which can be obtained by . @@ -470,8 +510,8 @@ - To be added - To be added + The ConnectProxy signal is emitted after connecting a proxy to an action in the group. + This is intended for simple customizations for which a custom action class would be too clumsy, e.g. showing tooltips for menuitems in the statusbar. @@ -482,8 +522,8 @@ - To be added - To be added + The DisconnectProxy signal is emitted after disconnecting a proxy from an action in the group. + @@ -494,8 +534,8 @@ - To be added - To be added + The PostActivate signal is emitted just after the action is activated. + This is intended for applications to get notification just after any action is activated. diff --git a/doc/en/Gtk/UIManagerItemType.xml b/doc/en/Gtk/UIManagerItemType.xml index da98f60aa..b18eb765b 100644 --- a/doc/en/Gtk/UIManagerItemType.xml +++ b/doc/en/Gtk/UIManagerItemType.xml @@ -9,8 +9,8 @@ Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. - To be added - To be added + Used by to determine what UI element to create. + System.Enum @@ -41,7 +41,7 @@ - To be added + Pick the type of the UI element according to context. To be added @@ -54,7 +54,7 @@ - To be added + Create a menubar. To be added @@ -67,7 +67,7 @@ - To be added + Create a menu. To be added @@ -80,7 +80,7 @@ - To be added + Create a toolbar. To be added @@ -93,7 +93,7 @@ - To be added + Insert a placeholder. To be added @@ -106,7 +106,7 @@ - To be added + Create a popup menu. To be added @@ -119,7 +119,7 @@ - To be added + Create a menuitem. To be added @@ -132,7 +132,7 @@ - To be added + Create a toolitem. To be added @@ -145,7 +145,7 @@ - To be added + Create a separator. To be added @@ -158,7 +158,7 @@ - To be added + Install an accelerator. To be added