MenuItem

Description The GtkMenuItem widget and the derived widgets are the only valid childs for menus. Their function is to correctly handle highlighting, alignment, events and submenus. As it derives from GtkBin it can hold any valid child widget, altough only a few are really useful. GtkMenuItem as GtkBuildable The GtkMenuItem implementation of the GtkBuildable interface supports adding a submenu by specifying "submenu" as the "type" attribute of a <child> element.

class MenuItem : Item , ActivatableIF {}

Constructors

this
this(GtkMenuItem* gtkMenuItem)

Sets our main struct and passes it to the parent class

this
this(string label, void delegate(MenuItem) dlg, string action)

Creates a new menu item with a label and a listener and a action. used for backward compatibily with DUI.

this
this(void delegate(MenuItem) dlg, string label, string action, bool mnemonic, AccelGroup accelGroup, char accelKey, GdkModifierType modifierType, GtkAccelFlags accelFlags)

Creates a new Item associated with a "activate" delegate and with a action code and optionally accelGroup

this
this(void delegate(MenuItem) dlg, string label, bool mnemonic)

Creates a new Item associated with a "activate" delegate

this
this(string label, bool mnemonic)

Creates a new GtkMenuItem whose child is a GtkLabel.

this
this()

Creates a new GtkMenuItem.

Members

Functions

addOnActivate
void addOnActivate(void delegate(MenuItem) dlg, ConnectFlags connectFlags)

Emitted when the item is activated.

addOnActivateItem
void addOnActivateItem(void delegate(MenuItem) dlg, ConnectFlags connectFlags)

Emitted when the item is activated, but also if the menu item has a submenu. For normal applications, the relevant signal is "activate".

addOnToggleSizeAllocate
void addOnToggleSizeAllocate(void delegate(gint, MenuItem) dlg, ConnectFlags connectFlags)
addOnToggleSizeRequest
void addOnToggleSizeRequest(void delegate(void*, MenuItem) dlg, ConnectFlags connectFlags)

See Also GtkBin for how to handle the child. GtkItem is the abstract class for all sorts of items. GtkMenuShell is always the parent of GtkMenuItem.

deselect
void deselect()

Emits the "deselect" signal on the given item. Behaves exactly like gtk_item_deselect.

getAccelPath
string getAccelPath()

Retrieve the accelerator path that was previously set on menu_item. See gtk_menu_item_set_accel_path() for details. Since 2.14

getActionName
string getActionName()

Gets the application set action code

getLabel
string getLabel()

Sets text on the menu_item label Since 2.16

getMenuItemStruct
GtkMenuItem* getMenuItemStruct()
Undocumented in source. Be warned that the author may not have intended to support it.
getRightJustified
int getRightJustified()

Gets whether the menu item appears justified at the right side of the menu bar.

getStruct
void* getStruct()

the main Gtk struct as a void*

getSubmenu
Widget getSubmenu()

Gets the submenu underneath this menu item, if any. See gtk_menu_item_set_submenu().

getUseUnderline
int getUseUnderline()

Checks if an underline in the text indicates the next character should be used for the mnemonic accelerator key. Since 2.16

itemActivate
void itemActivate()

Emits the "activate" signal on the given item

removeSubmenu
void removeSubmenu()

Warning gtk_menu_item_remove_submenu has been deprecated since version 2.12 and should not be used in newly-written code. gtk_menu_item_remove_submenu() is deprecated and should not be used in newly written code. Use gtk_menu_item_set_submenu() instead. Removes the widget's submenu.

select
void select()

Emits the "select" signal on the given item. Behaves exactly like gtk_item_select.

setAccelPath
void setAccelPath(string accelPath)

Set the accelerator path on menu_item, through which runtime changes of the menu item's accelerator caused by the user can be identified and saved to persistant storage (see gtk_accel_map_save() on this). To setup a default accelerator for this menu item, call gtk_accel_map_add_entry() with the same accel_path. See also gtk_accel_map_add_entry() on the specifics of accelerator paths, and gtk_menu_set_accel_path() for a more convenient variant of this function. This function is basically a convenience wrapper that handles calling gtk_widget_set_accel_path() with the appropriate accelerator group for the menu item. Note that you do need to set an accelerator on the parent menu with gtk_menu_set_accel_group() for this to work. Note that accel_path string will be stored in a GQuark. Therefore, if you pass a static string, you can save some memory by interning it first with g_intern_static_string().

setLabel
void setLabel(string label)

Sets text on the menu_item label Since 2.16

setRightJustified
void setRightJustified(int rightJustified)

Sets whether the menu item appears justified at the right side of a menu bar. This was traditionally done for "Help" menu items, but is now considered a bad idea. (If the widget layout is reversed for a right-to-left language like Hebrew or Arabic, right-justified-menu-items appear at the left.)

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

Sets or replaces the menu item's submenu, or removes it when a NULL submenu is passed.

setUseUnderline
void setUseUnderline(int setting)

If true, an underline in the text indicates the next character should be used for the mnemonic accelerator key. Since 2.16

toggleSizeAllocate
void toggleSizeAllocate(int allocation)

Emits the "toggle_size_allocate" signal on the given item.

toggleSizeRequest
void toggleSizeRequest(int* requisition)

Emits the "toggle_size_request" signal on the given item.

Mixins

__anonymous
mixin ActivatableT!(GtkMenuItem)
Undocumented in source.

Static functions

callBackActivate
void callBackActivate(GtkMenuItem* menuitemStruct, MenuItem _menuItem)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackActivateItem
void callBackActivateItem(GtkMenuItem* menuitemStruct, MenuItem _menuItem)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackToggleSizeAllocate
void callBackToggleSizeAllocate(GtkMenuItem* menuitemStruct, gint arg1, MenuItem _menuItem)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackToggleSizeRequest
void callBackToggleSizeRequest(GtkMenuItem* menuitemStruct, void* arg1, MenuItem _menuItem)
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

connectedSignals
int[string] connectedSignals;
gtkMenuItem
GtkMenuItem* gtkMenuItem;

the main Gtk struct

onActivateItemListeners
void delegate(MenuItem)[] onActivateItemListeners;
Undocumented in source.
onActivateListeners
void delegate(MenuItem)[] onActivateListeners;
Undocumented in source.
onToggleSizeAllocateListeners
void delegate(gint, MenuItem)[] onToggleSizeAllocateListeners;
Undocumented in source.
onToggleSizeRequestListeners
void delegate(void*, MenuItem)[] onToggleSizeRequestListeners;
Undocumented in source.

Inherited Members

From Item

gtkItem
GtkItem* gtkItem;

the main Gtk struct

getItemStruct
GtkItem* getItemStruct()
Undocumented in source. Be warned that the author may not have intended to support it.
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.
connectedSignals
int[string] connectedSignals;
onDeselectListeners
void delegate(Item)[] onDeselectListeners;
Undocumented in source.
addOnDeselect
void addOnDeselect(void delegate(Item) dlg, ConnectFlags connectFlags)

Emitted when the item is deselected.

callBackDeselect
void callBackDeselect(GtkItem* itemStruct, Item _item)
Undocumented in source. Be warned that the author may not have intended to support it.
onSelectListeners
void delegate(Item)[] onSelectListeners;
Undocumented in source.
addOnSelect
void addOnSelect(void delegate(Item) dlg, ConnectFlags connectFlags)

Emitted when the item is selected.

callBackSelect
void callBackSelect(GtkItem* itemStruct, Item _item)
Undocumented in source. Be warned that the author may not have intended to support it.
onToggleListeners
void delegate(Item)[] onToggleListeners;
Undocumented in source.
addOnToggle
void addOnToggle(void delegate(Item) dlg, ConnectFlags connectFlags)

Emitted when the item is toggled.

callBackToggle
void callBackToggle(GtkItem* itemStruct, Item _item)
Undocumented in source. Be warned that the author may not have intended to support it.
select
void select()

Warning gtk_item_select has been deprecated since version 2.22 and should not be used in newly-written code. Use gtk_menu_item_select() instead Emits the "select" signal on the given item.

deselect
void deselect()

Warning gtk_item_deselect has been deprecated since version 2.22 and should not be used in newly-written code. Use gtk_menu_item_deselect() instead Emits the "deselect" signal on the given item.

toggle
void toggle()

Warning gtk_item_toggle has been deprecated since version 2.22 and should not be used in newly-written code. This function will be removed in GTK+ 3 Emits the "toggle" signal on the given item.

From ActivatableIF

getActivatableTStruct
GtkActivatable* getActivatableTStruct()
Undocumented in source.
getStruct
void* getStruct()

the main Gtk struct as a void*

doSetRelatedAction
void doSetRelatedAction(Action action)

This is a utility function for GtkActivatable implementors. When implementing GtkActivatable you must call this when handling changes of the "related-action", and you must also use this to break references in GObject->dispose(). This function adds a reference to the currently set related action for you, it also makes sure the GtkActivatable->update() method is called when the related GtkAction properties change and registers to the action's proxy list. Note Be careful to call this before setting the local copy of the GtkAction property, since this function uses gtk_activatable_get_action() to retrieve the previous action Since 2.16

getRelatedAction
Action getRelatedAction()

Gets the related GtkAction for activatable. Since 2.16

getUseActionAppearance
int getUseActionAppearance()

Gets whether this activatable should reset its layout and appearance when setting the related action or when the action changes appearance. Since 2.16

syncActionProperties
void syncActionProperties(Action action)

This is called to update the activatable completely, this is called internally when the "related-action" property is set or unset and by the implementing class when "use-action-appearance" changes. Since 2.16

setRelatedAction
void setRelatedAction(Action action)

Sets the related action on the activatable object. Note GtkActivatable implementors need to handle the "related-action" property and call gtk_activatable_do_set_related_action() when it changes. Since 2.16

setUseActionAppearance
void setUseActionAppearance(int useAppearance)

Sets whether this activatable should reset its layout and appearance when setting the related action or when the action changes appearance Note GtkActivatable implementors need to handle the "use-action-appearance" property and call gtk_activatable_sync_action_properties() to update activatable if needed. Since 2.16

Meta