The widget used for item in menus
The <gtk-menu-item>
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-bin>
it can hold any valid child widget, altough
only a few are really useful.
Derives from
<gtk-item>
.This class defines the following slots:
submenu
- The submenu attached to the menu item, or NULL if it has none
Emitted when the item is activated, but also if the menu item has a submenu. For normal applications, the relevant signal is "activate".
<gtk-widget>
)Creates a new
<gtk-menu-item>
.
- ret
- the newly created
<gtk-menu-item>
mchars
) ⇒ (ret <gtk-widget>
)Creates a new
<gtk-menu-item>
whose child is a<gtk-label>
.
- label
- the text for the label
- ret
- the newly created
<gtk-menu-item>
mchars
) ⇒ (ret <gtk-widget>
)Creates a new
<gtk-menu-item>
containing a label. The label will be created usinggtk-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
- ret
- a new
<gtk-menu-item>
<gtk-menu-item>
) (right_justified bool
)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
<gtk-menu-item>
.- right-justified
- if ‘
#t
’ the menu item will appear at the far right if added to a menu bar.
<gtk-menu-item>
) (submenu <gtk-widget>
)Sets the widget submenu, or changes it.
- menu-item
- the menu item widget
- submenu
- the submenu
<gtk-menu-item>
) (accel_path mchars
)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, callgtk-accel-map-add-entry
with the same accel-path. See alsogtk-accel-map-add-entry
on the specifics of accelerator paths, andgtk-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.
- menu-item
- a valid
<gtk-menu-item>
- accel-path
- accelerator path, corresponding to this menu item's functionality, or ‘
#f
’ to unset the current path.
<gtk-menu-item>
)Removes the widget's submenu.
- menu-item
- the menu item widget
<gtk-menu-item>
)Emits the "select" signal on the given item. Behaves exactly like
<gtk-item-select>
.
- menu-item
- the menu item
<gtk-menu-item>
)Emits the "deselect" signal on the given item. Behaves exactly like
<gtk-item-deselect>
.
- menu-item
- the menu item
<gtk-menu-item>
)Emits the "activate" signal on the given item
- menu-item
- the menu item
<gtk-menu-item>
) ⇒ (requisition int
)Emits the "toggle_size_request" signal on the given item.
- menu-item
- the menu item
- requisition
- the requisition to use as signal data.
<gtk-menu-item>
) (allocation int
)Emits the "toggle_size_allocate" signal on the given item.
- menu-item
- the menu item.
- allocation
- the allocation to use as signal data.