Menu

gio.Menu is a simple implementation of gio.MenuModel You populate a gio.Menu by adding gio.MenuItem instances to it.

There are some convenience functions to allow you to directly add items (avoiding gio.MenuItem) for the common cases. To add a regular item, use Menu.insert. To add a section, use Menu.insertSection. To add a submenu, use Menu.insertSubmenu.

Constructors

this
this(GMenu* gMenu, bool ownedRef = false)

Sets our main struct and passes it to the parent class.

this
this()

Creates a new gio.Menu

Members

Functions

append
void append(string label, string detailedAction)

Convenience function for appending a normal menu item to the end of menu. Combine Menu.itemNew and Menu.insertItem for a more flexible alternative.

appendItem
void appendItem(MenuItem item)

Appends item to the end of menu.

appendSection
void appendSection(string label, MenuModel section)

Convenience function for appending a section menu item to the end of menu. Combine Menu.itemNewSection and Menu.insertItem for a more flexible alternative.

appendSubmenu
void appendSubmenu(string label, MenuModel submenu)

Convenience function for appending a submenu menu item to the end of menu. Combine Menu.itemNewSubmenu and Menu.insertItem for a more flexible alternative.

freeze
void freeze()

Marks menu as frozen.

getMenuStruct
GMenu* getMenuStruct(bool transferOwnership = false)

Get the main Gtk struct

getStruct
void* getStruct()

the main Gtk struct as a void*

insert
void insert(int position, string label, string detailedAction)

Convenience function for inserting a normal menu item into menu. Combine Menu.itemNew and Menu.insertItem for a more flexible alternative.

insertItem
void insertItem(int position, MenuItem item)

Inserts item into menu.

insertSection
void insertSection(int position, string label, MenuModel section)

Convenience function for inserting a section menu item into menu. Combine Menu.itemNewSection and Menu.insertItem for a more flexible alternative.

insertSubmenu
void insertSubmenu(int position, string label, MenuModel submenu)

Convenience function for inserting a submenu menu item into menu. Combine Menu.itemNewSubmenu and Menu.insertItem for a more flexible alternative.

prepend
void prepend(string label, string detailedAction)

Convenience function for prepending a normal menu item to the start of menu. Combine Menu.itemNew and Menu.insertItem for a more flexible alternative.

prependItem
void prependItem(MenuItem item)

Prepends item to the start of menu.

prependSection
void prependSection(string label, MenuModel section)

Convenience function for prepending a section menu item to the start of menu. Combine Menu.itemNewSection and Menu.insertItem for a more flexible alternative.

prependSubmenu
void prependSubmenu(string label, MenuModel submenu)

Convenience function for prepending a submenu menu item to the start of menu. Combine Menu.itemNewSubmenu and Menu.insertItem for a more flexible alternative.

remove
void remove(int position)

Removes an item from the menu.

removeAll
void removeAll()

Removes all items in the menu.

Static functions

getType
GType getType()

Variables

gMenu
GMenu* gMenu;

the main Gtk struct

Inherited Members

From MenuModel

gMenuModel
GMenuModel* gMenuModel;

the main Gtk struct

getMenuModelStruct
GMenuModel* getMenuModelStruct(bool transferOwnership = false)

Get the main Gtk struct

getStruct
void* getStruct()

the main Gtk struct as a void*

getType
GType getType()
getItemAttributeValue
Variant getItemAttributeValue(int itemIndex, string attribute, VariantType expectedType)

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

getItemLink
MenuModel getItemLink(int itemIndex, string link)

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

getNItems
int getNItems()

Query the number of items in model.

isMutable
bool isMutable()

Queries if model is mutable.

itemsChanged
void itemsChanged(int position, int removed, int added)

Requests emission of the items-changed signal on model.

iterateItemAttributes
MenuAttributeIter iterateItemAttributes(int itemIndex)

Creates a gio.MenuAttributeIter to iterate over the attributes of the item at position item_index in model.

iterateItemLinks
MenuLinkIter iterateItemLinks(int itemIndex)

Creates a gio.MenuLinkIter to iterate over the links of the item at position item_index in model.

addOnItemsChanged
gulong addOnItemsChanged(void delegate(int, int, int, MenuModel) dlg, ConnectFlags connectFlags = cast(ConnectFlags)0)

Emitted when a change has occured to the menu.

Meta

Since

2.32