W Wrapl, The Programming Language

Libraries:Gtk:Gtk:MenuItem

Types

T

Inherits from:

The T 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 Gtk.Gtk.Bin.T 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.

Example 33. A UI definition fragment with submenus

1
2
3
4
5
<object class="GtkMenuItem">
  <child type="submenu">
    <object class="GtkMenu"/>
  </child>
</object>




Constants

Nil : T

Functions

GetType() : Gtk.GObject.Type.T



New() : Gtk.Gtk.MenuItem.T

Creates a new T.

Returns the newly created T


NewWithLabel(label @ Std.String.T) : Gtk.Gtk.MenuItem.T

Creates a new T whose child is a Gtk.Gtk.Label.T.

label the text for the label
Returns the newly created T


NewWithMnemonic(label @ Std.String.T) : Gtk.Gtk.MenuItem.T

Creates a new T containing a label. The label will be created using gtk_label_new_with_mnemonic(), so underscores in label indicate the mnemonic for the menu item.

label The text of the button, with an underscore in front of the mnemonic character
Returns a new T


Methods

:Activate(self @ T) : Std.Object.T

Emits the "activate" signal on the given item

menu_item the menu item


:Deselect(self @ T) : Std.Object.T

Emits the "deselect" signal on the given item. Behaves exactly like Gtk.Gtk.Item.Deselect.

menu_item the menu item


:GetAccelPath(self @ T) : Std.String.T

Retrieve the accelerator path that was previously set on menu_item.

See SetAccelPath for details.

menu_item a valid T
Returns the accelerator path corresponding to this menu item's functionality, or NULL if not set


:GetLabel(self @ T) : Std.String.T

Sets text on the menu_item label

menu_item a T
Returns The text in the menu_item label. This is the internal string used by the label, and must not be modified.


:GetRightJustified(self @ T) : Std.Symbol.T

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

menu_item a T
Returns TRUE if the menu item will appear at the far right if added to a menu bar.


:GetSubmenu(self @ T) : Gtk.Gtk.Widget.T

Gets the submenu underneath this menu item, if any. See SetSubmenu.

menu_item a T
Returns submenu for this menu item, or NULL if none. [transfer none]


:GetUseUnderline(self @ T) : Std.Symbol.T

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

menu_item a T
Returns TRUE if an embedded underline in the label indicates the mnemonic accelerator key.


:RemoveSubmenu(self @ T) : Std.Object.T

Warning

RemoveSubmenu has been deprecated since version 2.12 and should not be used in newly-written code. RemoveSubmenu is deprecated and should not be used in newly written code. Use SetSubmenu instead.



:Select(self @ T) : Std.Object.T

Emits the "select" signal on the given item. Behaves exactly like Gtk.Gtk.Item.Select.

menu_item the menu item


:SetAccelPath(self @ T, accel_path @ Std.String.T) : Std.Object.T

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.Gtk.AccelMap.Save on this). To setup a default accelerator for this menu item, call Gtk.Gtk.AccelMap.AddEntry with the same accel_path. See also Gtk.Gtk.AccelMap.AddEntry on the specifics of accelerator paths, and Gtk.Gtk.Menu.SetAccelPath for a more convenient variant of this function.

This function is basically a convenience wrapper that handles calling Gtk.Gtk.Widget.SetAccelPath with the appropriate accelerator group for the menu item.

Note that you do need to set an accelerator on the parent menu with Gtk.Gtk.Menu.SetAccelGroup 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().

menu_item a valid T
accel_path accelerator path, corresponding to this menu item's functionality, or NULL to unset the current path. [allow-none]


:SetLabel(self @ T, label @ Std.String.T) : Std.Object.T

Sets text on the menu_item label

menu_item a T
label the text you want to set


:SetRightJustified(self @ T, right_justified @ Std.Symbol.T) : Std.Object.T

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

menu_item a T.
right_justified if TRUE the menu item will appear at the far right if added to a menu bar.


:SetSubmenu(self @ T, submenu @ Gtk.Gtk.Widget.T) : Std.Object.T

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

menu_item a T
submenu the submenu, or NULL. [allow-none]


:SetUseUnderline(self @ T, setting @ Std.Symbol.T) : Std.Object.T

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

menu_item a T
setting TRUE if underlines in the text indicate mnemonics


:ToggleSizeAllocate(self @ T, allocation @ Std.Integer.SmallT) : Std.Object.T

Emits the "toggle_size_allocate" signal on the given item.

menu_item the menu item.
allocation the allocation to use as signal data.


:ToggleSizeRequest(self @ T, requisition @ Std.Object.T) : Std.Object.T

Emits the "toggle_size_request" signal on the given item.

menu_item the menu item
requisition the requisition to use as signal data.