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 = false)

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 = 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 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.

Static functions

getType
GType getType()

Variables

gMenu
GMenu* gMenu;

the main Gtk struct

Meta

Since

2.32