Menu

#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().

Constructors

this
this(GMenu* gMenu, bool ownedRef)

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

this
this()

Creates a new #GMenu.

Members

Functions

append
void append(string label, string detailedAction)

Convenience function for appending a normal menu item to the end of @menu. Combine g_menu_item_new() and g_menu_insert_item() 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 g_menu_item_new_section() and g_menu_insert_item() 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 g_menu_item_new_submenu() and g_menu_insert_item() for a more flexible alternative.

freeze
void freeze()

Marks @menu as frozen.

getMenuStruct
GMenu* getMenuStruct(bool transferOwnership)

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 g_menu_item_new() and g_menu_insert_item() 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 g_menu_item_new_section() and g_menu_insert_item() 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 g_menu_item_new_submenu() and g_menu_insert_item() 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 g_menu_item_new() and g_menu_insert_item() 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 g_menu_item_new_section() and g_menu_insert_item() 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 g_menu_item_new_submenu() and g_menu_insert_item() 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.

setStruct
void setStruct(GObject* obj)
Undocumented in source. Be warned that the author may not have intended to support it.

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)

Get the main Gtk struct

getStruct
void* getStruct()

the main Gtk struct as a void*

setStruct
void setStruct(GObject* obj)
Undocumented in source. Be warned that the author may not have intended to support it.
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 #GMenuModel::items-changed signal on @model.

iterateItemAttributes
MenuAttributeIter iterateItemAttributes(int itemIndex)

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

iterateItemLinks
MenuLinkIter iterateItemLinks(int itemIndex)

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

OnItemsChangedDelegateWrapper
class OnItemsChangedDelegateWrapper
Undocumented in source.
onItemsChangedListeners
OnItemsChangedDelegateWrapper[] onItemsChangedListeners;
Undocumented in source.
addOnItemsChanged
gulong addOnItemsChanged(void delegate(int, int, int, MenuModel) dlg, ConnectFlags connectFlags)

Emitted when a change has occured to the menu.

callBackItemsChanged
void callBackItemsChanged(GMenuModel* menumodelStruct, int position, int removed, int added, OnItemsChangedDelegateWrapper wrapper)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackItemsChangedDestroy
void callBackItemsChangedDestroy(OnItemsChangedDelegateWrapper wrapper, GClosure* closure)
Undocumented in source. Be warned that the author may not have intended to support it.

Meta

Since

2.32