MenuItem

constructor(label: String? = null, detailedAction: String? = null)

Creates a new #GMenuItem.

If @label is non-null it is used to set the "label" attribute of the new item.

If @detailed_action is non-null it is used to set the "action" and possibly the "target" attribute of the new item. See g_menu_item_set_detailed_action() for more information.

Return

a new #GMenuItem

Since

2.32

Parameters

label

the section label, or null

detailedAction

the detailed action string, or null


constructor(model: MenuModel, itemIndex: Int)

Creates a #GMenuItem as an exact copy of an existing menu item in a #GMenuModel.

Return

a new #GMenuItem.

Since

2.34

Parameters

model

a #GMenuModel

itemIndex

the index of an item in @model


constructor(label: String? = null, section: MenuModel)

Creates a new #GMenuItem representing a section.

This is a convenience API around g_menu_item_new() and g_menu_item_set_section().

The effect of having one menu appear as a section of another is exactly as it sounds: the items from @section become a direct part of the menu that @menu_item is added to.

Visual separation is typically displayed between two non-empty sections. If @label is non-null then it will be incorporated into this visual indication. This allows for labeled subsections of a menu.

As a simple example, consider a typical "Edit" menu from a simple program. It probably contains an "Undo" and "Redo" item, followed by a separator, followed by "Cut", "Copy" and "Paste".

This would be accomplished by creating three #GMenu instances. The first would be populated with the "Undo" and "Redo" items, and the second with the "Cut", "Copy" and "Paste" items. The first and second menus would then be added as submenus of the third. In XML format, this would look something like the following: |[

]|

The following example is exactly equivalent. It is more illustrative of the exact relationship between the menus and items (keeping in mind that the 'link' element defines a new menu that is linked to the containing one). The style of the second example is more verbose and difficult to read (and therefore not recommended except for the purpose of understanding what is really going on). |[

]|

Return

a new #GMenuItem

Since

2.32

Parameters

label

the section label, or null

section

a #GMenuModel with the items of the section


constructor(pointer: <Error class: unknown class><<Error class: unknown class>>)