Menu

open class Menu(pointer: <Error class: unknown class><<Error class: unknown class>>) : MenuModel

#GMenu is a simple implementation of #GMenuModel. You populate a #GMenu by adding #GMenuItem instances to it.

There are some convenience functions to allow you to directly add items (avoiding #GMenuItem) for the common cases. To add a regular item, use g_menu_insert(). To add a section, use g_menu_insert_section(). To add a submenu, use g_menu_insert_submenu().

Since

2.32

Constructors

Link copied to clipboard
constructor()

Creates a new #GMenu.

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

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val gioMenuModelPointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard
val gioMenuPointer: <Error class: unknown class><<Error class: unknown class>>

Functions

Link copied to clipboard
open fun append(label: String? = null, detailedAction: String? = null)

Convenience function for appending a normal menu item to the end of

Link copied to clipboard
open fun appendItem(item: MenuItem)

Appends @item to the end of @menu.

Link copied to clipboard
open fun appendSection(label: String? = null, section: MenuModel)

Convenience function for appending a section menu item to the end of

Link copied to clipboard
open fun appendSubmenu(label: String? = null, submenu: MenuModel)

Convenience function for appending a submenu menu item to the end of

Link copied to clipboard
fun connectItemsChanged(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: (position: Int, removed: Int, added: Int) -> Unit): <Error class: unknown class>

Emitted when a change has occurred to the menu.

Link copied to clipboard
open fun freeze()

Marks @menu as frozen.

Link copied to clipboard
open fun getItemAttributeValue(itemIndex: Int, attribute: String, expectedType: <Error class: unknown class>? = null): <Error class: unknown class>?

Queries the item at position @item_index in @model for the attribute specified by @attribute.

Link copied to clipboard
open fun getItemLink(itemIndex: Int, link: String): MenuModel?

Queries the item at position @item_index in @model for the link specified by @link.

Link copied to clipboard
open fun getNItems(): Int

Query the number of items in @model.

Link copied to clipboard
open fun insert(position: Int, label: String? = null, detailedAction: String? = null)

Convenience function for inserting a normal menu item into @menu. Combine g_menu_item_new() and g_menu_insert_item() for a more flexible alternative.

Link copied to clipboard
open fun insertItem(position: Int, item: MenuItem)

Inserts @item into @menu.

Link copied to clipboard
open fun insertSection(position: Int, label: String? = null, section: MenuModel)

Convenience function for inserting a section menu item into @menu. Combine g_menu_item_new_section() and g_menu_insert_item() for a more flexible alternative.

Link copied to clipboard
open fun insertSubmenu(position: Int, label: String? = null, submenu: MenuModel)

Convenience function for inserting a submenu menu item into @menu. Combine g_menu_item_new_submenu() and g_menu_insert_item() for a more flexible alternative.

Link copied to clipboard
open fun isMutable(): Boolean

Queries if @model is mutable.

Link copied to clipboard
open fun itemsChanged(position: Int, removed: Int, added: Int)

Requests emission of the #GMenuModel::items-changed signal on @model.

Link copied to clipboard

Creates a #GMenuAttributeIter to iterate over the attributes of the item at position @item_index in @model.

Link copied to clipboard
open fun iterateItemLinks(itemIndex: Int): MenuLinkIter

Creates a #GMenuLinkIter to iterate over the links of the item at position @item_index in @model.

Link copied to clipboard
open fun prepend(label: String? = null, detailedAction: String? = null)

Convenience function for prepending a normal menu item to the start of @menu. Combine g_menu_item_new() and g_menu_insert_item() for a more flexible alternative.

Link copied to clipboard
open fun prependItem(item: MenuItem)

Prepends @item to the start of @menu.

Link copied to clipboard
open fun prependSection(label: String? = null, section: MenuModel)

Convenience function for prepending a section menu item to the start of @menu. Combine g_menu_item_new_section() and g_menu_insert_item() for a more flexible alternative.

Link copied to clipboard
open fun prependSubmenu(label: String? = null, submenu: MenuModel)

Convenience function for prepending a submenu menu item to the start of @menu. Combine g_menu_item_new_submenu() and g_menu_insert_item() for a more flexible alternative.

Link copied to clipboard
open fun remove(position: Int)

Removes an item from the menu.

Link copied to clipboard
open fun removeAll()

Removes all items in the menu.