gtk.menu_shell

Module for [MenuShell] class

Types 3

A #GtkMenuShell is the abstract base class used to derive the #GtkMenu and #GtkMenuBar subclasses.

A #GtkMenuShell is a container of #GtkMenuItem objects arranged in a list which can be navigated, selected, and activated by the user to perform application functions. A #GtkMenuItem can have a submenu associated with it, allowing for nested hierarchical menus.

Terminology

A menu item can be “selected”, this means that it is displayed in the prelight state, and if it has a submenu, that submenu will be popped up.

A menu is “active” when it is visible onscreen and the user is selecting from it. A menubar is not active until the user clicks on one of its menuitems. When a menu is active, passing the mouse over a submenu will pop it up.

There is also is a concept of the current menu and a current menu item. The current menu item is the selected menu item that is furthest down in the hierarchy. (Every active menu shell does not necessarily contain a selected menu item, but if it does, then the parent menu shell must also contain a selected menu item.) The current menu is the menu that contains the current menu item. It will always have a GTK grab and receive all key presses.

Methods
GType _gType() @property
MenuShell self()Returns `this`, for use in `with` statements.
MenuShellGidBuilder builder()Get builder for [gtk.menu_shell.MenuShell] Returns: New builder object
bool takeFocus() @propertyGet `takeFocus` property. Returns: A boolean that determines whether the menu and its submenus grab the keyboard focus. See [gtk.menushell.MenuShell.setTakeFocus] and [gtk.menushell.MenuShell.getTa...
void takeFocus(bool propval) @propertySet `takeFocus` property. Params: propval = A boolean that determines whether the menu and its submenus grab the keyboard focus. See [gtk.menushell.MenuShell.setTakeFocus] and [gtk.menushell.MenuSh...
void activateItem(gtk.widget.Widget menuItem, bool forceDeactivate)Activates the menu item within the menu shell.
void append(gtk.menu_item.MenuItem child)Adds a new #GtkMenuItem to the end of the menu shell's item list.
void bindModel(gio.menu_model.MenuModel model, string actionNamespace, bool withSeparators)Establishes a binding between a #GtkMenuShell and a #GMenuModel.
void cancel()Cancels the selection within the menu shell.
void deactivate()Deactivates the menu shell.
void deselect()Deselects the currently selected item from the menu shell, if any.
gtk.widget.Widget getParentShell()Gets the parent menu shell.
gtk.widget.Widget getSelectedItem()Gets the currently selected item. Returns: the currently selected item
bool getTakeFocus()Returns true if the menu shell will take the keyboard focus on popup. Returns: true if the menu shell will take the keyboard focus on popup.
void insert(gtk.widget.Widget child, int position)Adds a new #GtkMenuItem to the menu shell’s item list at the position indicated by position.
void prepend(gtk.widget.Widget child)Adds a new #GtkMenuItem to the beginning of the menu shell's item list.
void selectFirst(bool searchSensitive)Select the first visible or selectable child of the menu shell; don’t select tearoff items unless the only item is a tearoff item.
void selectItem(gtk.widget.Widget menuItem)Selects the menu item from the menu shell.
void setTakeFocus(bool takeFocus)If take_focus is true (the default) the menu shell will take the keyboard focus so that it will receive all keyboard events which is needed to enable keyboard navigation in menus.
gulong connectActivateCurrent(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] == bool))) && (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : gtk.menu_shell.MenuShell))) && Parameters!T.length < 3)Connect to `ActivateCurrent` signal.
gulong connectCancel(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.menu_shell.MenuShell))) && Parameters!T.length < 2)Connect to `Cancel` signal.
gulong connectCycleFocus(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] == gtk.types.DirectionType))) && (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : gtk.menu_shell.MenuShell))) && Parameters!T.length < 3)Connect to `CycleFocus` signal.
gulong connectDeactivate(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.menu_shell.MenuShell))) && Parameters!T.length < 2)Connect to `Deactivate` signal.
gulong connectInsert(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.widget.Widget))) && (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] == int))) && (Parameters!T.length < 3 || (ParameterStorageClassTuple!T[2] == ParameterStorageClass.none && is(Parameters!T[2] : gtk.menu_shell.MenuShell))) && Parameters!T.length < 4)Connect to `Insert` signal.
gulong connectMoveCurrent(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] == gtk.types.MenuDirectionType))) && (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : gtk.menu_shell.MenuShell))) && Parameters!T.length < 3)Connect to `MoveCurrent` signal.
gulong connectMoveSelected(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == bool) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] == int))) && (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : gtk.menu_shell.MenuShell))) && Parameters!T.length < 3)Connect to `MoveSelected` signal.
gulong connectSelectionDone(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.menu_shell.MenuShell))) && Parameters!T.length < 2)Connect to `SelectionDone` signal.
Constructors
this(void * ptr, Flag!"Take" take)
Methods
T takeFocus(bool propval)Set `takeFocus` property. Params: propval = A boolean that determines whether the menu and its submenus grab the keyboard focus. See [gtk.menushell.MenuShell.setTakeFocus] and [gtk.menushell.MenuSh...

Fluent builder for [gtk.menu_shell.MenuShell]

Methods