mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 15:06:14 +01:00
docs: Move the GMenuModel SECTION
Move it to the struct docs. Signed-off-by: Philip Withnall <philip@tecnocode.co.uk> Helps: #3037
This commit is contained in:
parent
5ce7e8c4f9
commit
c5fb817b02
@ -27,13 +27,9 @@
|
|||||||
#include "gmarshal-internal.h"
|
#include "gmarshal-internal.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SECTION:gmenumodel
|
* GMenuModel:
|
||||||
* @title: GMenuModel
|
|
||||||
* @short_description: An abstract class representing the contents of a menu
|
|
||||||
* @include: gio/gio.h
|
|
||||||
* @see_also: #GActionGroup
|
|
||||||
*
|
*
|
||||||
* #GMenuModel represents the contents of a menu -- an ordered list of
|
* `GMenuModel` represents the contents of a menu — an ordered list of
|
||||||
* menu items. The items are associated with actions, which can be
|
* menu items. The items are associated with actions, which can be
|
||||||
* activated through them. Items can be grouped in sections, and may
|
* activated through them. Items can be grouped in sections, and may
|
||||||
* have submenus associated with them. Both items and sections usually
|
* have submenus associated with them. Both items and sections usually
|
||||||
@ -41,20 +37,20 @@
|
|||||||
* the associated action (ie whether it is stateful, and what kind of
|
* the associated action (ie whether it is stateful, and what kind of
|
||||||
* state it has) can influence the representation of the item.
|
* state it has) can influence the representation of the item.
|
||||||
*
|
*
|
||||||
* The conceptual model of menus in #GMenuModel is hierarchical:
|
* The conceptual model of menus in `GMenuModel` is hierarchical:
|
||||||
* sections and submenus are again represented by #GMenuModels.
|
* sections and submenus are again represented by `GMenuModel`s.
|
||||||
* Menus themselves do not define their own roles. Rather, the role
|
* Menus themselves do not define their own roles. Rather, the role
|
||||||
* of a particular #GMenuModel is defined by the item that references
|
* of a particular `GMenuModel` is defined by the item that references
|
||||||
* it (or, in the case of the 'root' menu, is defined by the context
|
* it (or, in the case of the ‘root’ menu, is defined by the context
|
||||||
* in which it is used).
|
* in which it is used).
|
||||||
*
|
*
|
||||||
* As an example, consider the visible portions of this menu:
|
* As an example, consider the visible portions of this menu:
|
||||||
*
|
*
|
||||||
* ## An example menu # {#menu-example}
|
* ## An example menu
|
||||||
*
|
*
|
||||||
* ![](menu-example.png)
|
* ![](menu-example.png)
|
||||||
*
|
*
|
||||||
* There are 8 "menus" visible in the screenshot: one menubar, two
|
* There are 8 ‘menus’ visible in the screenshot: one menubar, two
|
||||||
* submenus and 5 sections:
|
* submenus and 5 sections:
|
||||||
*
|
*
|
||||||
* - the toplevel menubar (containing 4 items)
|
* - the toplevel menubar (containing 4 items)
|
||||||
@ -66,17 +62,17 @@
|
|||||||
* - the Sources section (containing 2 items)
|
* - the Sources section (containing 2 items)
|
||||||
* - the Markup section (containing 2 items)
|
* - the Markup section (containing 2 items)
|
||||||
*
|
*
|
||||||
* The [example][menu-model] illustrates the conceptual connection between
|
* The [example](#a-menu-example) illustrates the conceptual connection between
|
||||||
* these 8 menus. Each large block in the figure represents a menu and the
|
* these 8 menus. Each large block in the figure represents a menu and the
|
||||||
* smaller blocks within the large block represent items in that menu. Some
|
* smaller blocks within the large block represent items in that menu. Some
|
||||||
* items contain references to other menus.
|
* items contain references to other menus.
|
||||||
*
|
*
|
||||||
* ## A menu example # {#menu-model}
|
* ## A menu example
|
||||||
*
|
*
|
||||||
* ![](menu-model.png)
|
* ![](menu-model.png)
|
||||||
*
|
*
|
||||||
* Notice that the separators visible in the [example][menu-example]
|
* Notice that the separators visible in the [example](#an-example-menu)
|
||||||
* appear nowhere in the [menu model][menu-model]. This is because
|
* appear nowhere in the [menu model](#a-menu-example). This is because
|
||||||
* separators are not explicitly represented in the menu model. Instead,
|
* separators are not explicitly represented in the menu model. Instead,
|
||||||
* a separator is inserted between any two non-empty sections of a menu.
|
* a separator is inserted between any two non-empty sections of a menu.
|
||||||
* Section items can have labels just like any other item. In that case,
|
* Section items can have labels just like any other item. In that case,
|
||||||
@ -85,32 +81,32 @@
|
|||||||
* The motivation for this abstract model of application controls is
|
* The motivation for this abstract model of application controls is
|
||||||
* that modern user interfaces tend to make these controls available
|
* that modern user interfaces tend to make these controls available
|
||||||
* outside the application. Examples include global menus, jumplists,
|
* outside the application. Examples include global menus, jumplists,
|
||||||
* dash boards, etc. To support such uses, it is necessary to 'export'
|
* dash boards, etc. To support such uses, it is necessary to ‘export’
|
||||||
* information about actions and their representation in menus, which
|
* information about actions and their representation in menus, which
|
||||||
* is exactly what the [GActionGroup exporter][gio-GActionGroup-exporter]
|
* is exactly what the action group exporter and the menu model exporter do for
|
||||||
* and the [GMenuModel exporter][gio-GMenuModel-exporter] do for
|
* [iface@Gio.ActionGroup] and [class@Gio.MenuModel]. The client-side
|
||||||
* #GActionGroup and #GMenuModel. The client-side counterparts to
|
* counterparts to make use of the exported information are
|
||||||
* make use of the exported information are #GDBusActionGroup and
|
* [class@Gio.DBusActionGroup] and [class@Gio.DBusMenuModel].
|
||||||
* #GDBusMenuModel.
|
|
||||||
*
|
*
|
||||||
* The API of #GMenuModel is very generic, with iterators for the
|
* The API of `GMenuModel` is very generic, with iterators for the
|
||||||
* attributes and links of an item, see g_menu_model_iterate_item_attributes()
|
* attributes and links of an item, see
|
||||||
* and g_menu_model_iterate_item_links(). The 'standard' attributes and
|
* [method@Gio.MenuModel.iterate_item_attributes] and
|
||||||
* link types have predefined names: %G_MENU_ATTRIBUTE_LABEL,
|
* [method@Gio.MenuModel.iterate_item_links]. The ‘standard’ attributes and
|
||||||
* %G_MENU_ATTRIBUTE_ACTION, %G_MENU_ATTRIBUTE_TARGET, %G_MENU_LINK_SECTION
|
* link types have predefined names: `G_MENU_ATTRIBUTE_LABEL`,
|
||||||
* and %G_MENU_LINK_SUBMENU.
|
* `G_MENU_ATTRIBUTE_ACTION`, `G_MENU_ATTRIBUTE_TARGET`, `G_MENU_LINK_SECTION`
|
||||||
|
* and `G_MENU_LINK_SUBMENU`.
|
||||||
*
|
*
|
||||||
* Items in a #GMenuModel represent active controls if they refer to
|
* Items in a `GMenuModel` represent active controls if they refer to
|
||||||
* an action that can get activated when the user interacts with the
|
* an action that can get activated when the user interacts with the
|
||||||
* menu item. The reference to the action is encoded by the string id
|
* menu item. The reference to the action is encoded by the string ID
|
||||||
* in the %G_MENU_ATTRIBUTE_ACTION attribute. An action id uniquely
|
* in the `G_MENU_ATTRIBUTE_ACTION` attribute. An action ID uniquely
|
||||||
* identifies an action in an action group. Which action group(s) provide
|
* identifies an action in an action group. Which action group(s) provide
|
||||||
* actions depends on the context in which the menu model is used.
|
* actions depends on the context in which the menu model is used.
|
||||||
* E.g. when the model is exported as the application menu of a
|
* E.g. when the model is exported as the application menu of a
|
||||||
* #GtkApplication, actions can be application-wide or window-specific
|
* [class@Gtk.Application], actions can be application-wide or window-specific
|
||||||
* (and thus come from two different action groups). By convention, the
|
* (and thus come from two different action groups). By convention, the
|
||||||
* application-wide actions have names that start with "app.", while the
|
* application-wide actions have names that start with `app.`, while the
|
||||||
* names of window-specific actions start with "win.".
|
* names of window-specific actions start with `win.`.
|
||||||
*
|
*
|
||||||
* While a wide variety of stateful actions is possible, the following
|
* While a wide variety of stateful actions is possible, the following
|
||||||
* is the minimum that is expected to be supported by all users of exported
|
* is the minimum that is expected to be supported by all users of exported
|
||||||
@ -127,12 +123,12 @@
|
|||||||
*
|
*
|
||||||
* ## Boolean State
|
* ## Boolean State
|
||||||
*
|
*
|
||||||
* An action with a boolean state will most typically be used with a "toggle"
|
* An action with a boolean state will most typically be used with a ‘toggle’
|
||||||
* or "switch" menu item. The state can be set directly, but activating the
|
* or ‘switch’ menu item. The state can be set directly, but activating the
|
||||||
* action (with no parameter) results in the state being toggled.
|
* action (with no parameter) results in the state being toggled.
|
||||||
*
|
*
|
||||||
* Selecting a toggle menu item will activate the action. The menu item should
|
* Selecting a toggle menu item will activate the action. The menu item should
|
||||||
* be rendered as "checked" when the state is true.
|
* be rendered as ‘checked’ when the state is true.
|
||||||
*
|
*
|
||||||
* ## String Parameter and State
|
* ## String Parameter and State
|
||||||
*
|
*
|
||||||
@ -144,15 +140,8 @@
|
|||||||
* Radio menu items, in addition to being associated with the action, will
|
* Radio menu items, in addition to being associated with the action, will
|
||||||
* have a target value. Selecting that menu item will result in activation
|
* have a target value. Selecting that menu item will result in activation
|
||||||
* of the action with the target value as the parameter. The menu item should
|
* of the action with the target value as the parameter. The menu item should
|
||||||
* be rendered as "selected" when the state of the action is equal to the
|
* be rendered as ‘selected’ when the state of the action is equal to the
|
||||||
* target value of the menu item.
|
* target value of the menu item.
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GMenuModel:
|
|
||||||
*
|
|
||||||
* #GMenuModel is an opaque structure type. You must access it using the
|
|
||||||
* functions below.
|
|
||||||
*
|
*
|
||||||
* Since: 2.32
|
* Since: 2.32
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user