MenuBar

The GtkMenuBar is a subclass of GtkMenuShell which contains one or more GtkMenuItems. The result is a standard menu bar which can hold many menu items.

Constructors

this
this(GtkMenuBar* gtkMenuBar)

Sets our main struct and passes it to the parent class

this
this()

Creates a new GtkMenuBar

this
this(MenuModel model)

Creates a new GtkMenuBar and populates it with menu items and submenus according to model. The created menu items are connected to actions found in the GtkApplicationWindow to which the menu bar belongs - typically by means of being contained within the GtkApplicationWindows widget hierarchy.

Members

Functions

append
Menu append(string label, bool rightJustify)
append
void append(Widget widget)
getChildPackDirection
GtkPackDirection getChildPackDirection()

Retrieves the current child pack direction of the menubar. See gtk_menu_bar_set_child_pack_direction(). Since 2.8

getMenuBarStruct
GtkMenuBar* getMenuBarStruct()
Undocumented in source. Be warned that the author may not have intended to support it.
getPackDirection
GtkPackDirection getPackDirection()

Retrieves the current pack direction of the menubar. See gtk_menu_bar_set_pack_direction(). Since 2.8

getStruct
void* getStruct()

the main Gtk struct as a void*

setChildPackDirection
void setChildPackDirection(GtkPackDirection childPackDir)

Sets how widgets should be packed inside the children of a menubar. Since 2.8

setPackDirection
void setPackDirection(GtkPackDirection packDir)

Sets how items should be packed inside a menubar. Since 2.8

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

Variables

gtkMenuBar
GtkMenuBar* gtkMenuBar;

the main Gtk struct

Inherited Members

From MenuShell

gtkMenuShell
GtkMenuShell* gtkMenuShell;

the main Gtk struct

getMenuShellStruct
GtkMenuShell* getMenuShellStruct()
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;
onActivateCurrentListeners
void delegate(gboolean, MenuShell)[] onActivateCurrentListeners;
Undocumented in source.
addOnActivateCurrent
void addOnActivateCurrent(void delegate(gboolean, MenuShell) dlg, ConnectFlags connectFlags)

An action signal that activates the current menu item within the menu shell.

callBackActivateCurrent
void callBackActivateCurrent(GtkMenuShell* menushellStruct, gboolean forceHide, MenuShell _menuShell)
Undocumented in source. Be warned that the author may not have intended to support it.
onCancelListeners
void delegate(MenuShell)[] onCancelListeners;
Undocumented in source.
addOnCancel
void addOnCancel(void delegate(MenuShell) dlg, ConnectFlags connectFlags)

An action signal which cancels the selection within the menu shell. Causes the "selection-done" signal to be emitted.

callBackCancel
void callBackCancel(GtkMenuShell* menushellStruct, MenuShell _menuShell)
Undocumented in source. Be warned that the author may not have intended to support it.
onCycleFocusListeners
void delegate(GtkDirectionType, MenuShell)[] onCycleFocusListeners;
Undocumented in source.
addOnCycleFocus
void addOnCycleFocus(void delegate(GtkDirectionType, MenuShell) dlg, ConnectFlags connectFlags)

A keybinding signal which moves the focus in the given direction.

callBackCycleFocus
void callBackCycleFocus(GtkMenuShell* menushellStruct, GtkDirectionType direction, MenuShell _menuShell)
Undocumented in source. Be warned that the author may not have intended to support it.
onDeactivateListeners
void delegate(MenuShell)[] onDeactivateListeners;
Undocumented in source.
addOnDeactivate
void addOnDeactivate(void delegate(MenuShell) dlg, ConnectFlags connectFlags)

This signal is emitted when a menu shell is deactivated.

callBackDeactivate
void callBackDeactivate(GtkMenuShell* menushellStruct, MenuShell _menuShell)
Undocumented in source. Be warned that the author may not have intended to support it.
onInsertListeners
void delegate(Widget, gint, MenuShell)[] onInsertListeners;
Undocumented in source.
addOnInsert
void addOnInsert(void delegate(Widget, gint, MenuShell) dlg, ConnectFlags connectFlags)

The ::insert signal is emitted when a new GtkMenuItem is added to a GtkMenuShell. A separate signal is used instead of GtkContainer::add because of the need for an additional position parameter. The inverse of this signal is the GtkContainer::removed signal. Since 3.2

callBackInsert
void callBackInsert(GtkMenuShell* menuShellStruct, GtkWidget* child, gint position, MenuShell _menuShell)
Undocumented in source. Be warned that the author may not have intended to support it.
onMoveCurrentListeners
void delegate(GtkMenuDirectionType, MenuShell)[] onMoveCurrentListeners;
Undocumented in source.
addOnMoveCurrent
void addOnMoveCurrent(void delegate(GtkMenuDirectionType, MenuShell) dlg, ConnectFlags connectFlags)

An keybinding signal which moves the current menu item in the direction specified by direction.

callBackMoveCurrent
void callBackMoveCurrent(GtkMenuShell* menushellStruct, GtkMenuDirectionType direction, MenuShell _menuShell)
Undocumented in source. Be warned that the author may not have intended to support it.
onMoveSelectedListeners
bool delegate(gint, MenuShell)[] onMoveSelectedListeners;
Undocumented in source.
addOnMoveSelected
void addOnMoveSelected(bool delegate(gint, MenuShell) dlg, ConnectFlags connectFlags)

The ::move-selected signal is emitted to move the selection to another item. TRUE to stop the signal emission, FALSE to continue Since 2.12

callBackMoveSelected
gboolean callBackMoveSelected(GtkMenuShell* menuShellStruct, gint distance, MenuShell _menuShell)
Undocumented in source. Be warned that the author may not have intended to support it.
onSelectionDoneListeners
void delegate(MenuShell)[] onSelectionDoneListeners;
Undocumented in source.
addOnSelectionDone
void addOnSelectionDone(void delegate(MenuShell) dlg, ConnectFlags connectFlags)

This signal is emitted when a selection has been completed within a menu shell.

callBackSelectionDone
void callBackSelectionDone(GtkMenuShell* menushellStruct, MenuShell _menuShell)
Undocumented in source. Be warned that the author may not have intended to support it.
append
void append(Widget child)

Adds a new GtkMenuItem to the end of the menu shell's item list.

prepend
void prepend(Widget child)

Adds a new GtkMenuItem to the beginning of the menu shell's item list.

insert
void insert(Widget child, int position)

Adds a new GtkMenuItem to the menu shell's item list at the position indicated by position.

deactivate
void deactivate()

Deactivates the menu shell. Typically this results in the menu shell being erased from the screen.

selectItem
void selectItem(Widget menuItem)

Selects the menu item from the menu shell.

selectFirst
void selectFirst(int 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. Since 2.2

deselect
void deselect()

Deselects the currently selected item from the menu shell, if any.

activateItem
void activateItem(Widget menuItem, int forceDeactivate)

Activates the menu item within the menu shell.

cancel
void cancel()

Cancels the selection within the menu shell. Since 2.4

setTakeFocus
void setTakeFocus(int 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. Setting take_focus to FALSE is useful only for special applications like virtual keyboard implementations which should not take keyboard focus. The take_focus state of a menu or menu bar is automatically propagated to submenus whenever a submenu is popped up, so you don't have to worry about recursively setting it for your entire menu hierarchy. Only when programmatically picking a submenu and popping it up manually, the take_focus property of the submenu needs to be set explicitely. Since 2.8

getTakeFocus
int getTakeFocus()

Returns TRUE if the menu shell will take the keyboard focus on popup. Since 2.8

getSelectedItem
Widget getSelectedItem()

Gets the currently selected item.

getParentShell
Widget getParentShell()

Gets the parent menu shell. The parent menu shell of a submenu is the GtkMenu or GtkMenuBar from which it was opened up.

bindModel
void bindModel(MenuModel model, string actionNamespace, int withSeparators)

Establishes a binding between a GtkMenuShell and a GMenuModel. The contents of shell are removed and then refilled with menu items according to model. When model changes, shell is updated. Calling this function twice on shell with different model will cause the first binding to be replaced with a binding to the new model. If model is NULL then any previous binding is undone and all children are removed. with_separators determines if toplevel items (eg: sections) have separators inserted between them. This is typically desired for menus but doesn't make sense for menubars. If action_namespace is non-NULL then the effect is as if all actions mentioned in the model have their names prefixed with the namespace, plus a dot. For example, if the action "quit" is mentioned and action_namespace is "app" then the effective action name is "app.quit". This function uses GtkActionable to define the action name and target values on the created menu items. If you want to use an action group other than "app" and "win", or if you want to use a GtkMenuShell outside of a GtkApplicationWindow, then you will need to attach your own action group to the widget hierarchy using gtk_widget_insert_action_group(). As an example, if you created a group with a "quit" action and inserted it with the name "mygroup" then you would use the action name "mygroup.quit" in your GMenuModel. For most cases you are probably better off using gtk_menu_new_from_model() or gtk_menu_bar_new_from_model() or just directly passing the GMenuModel to gtk_application_set_app_menu() or gtk_application_set_menu_bar().

Meta