Class: Gtk::MenuShell
- Inherits:
-
Object
- Object
- Gtk::MenuShell
- Defined in:
- (unknown)
Instance Method Summary collapse
-
#activate_item(menu_item, force_deactivate) ⇒ nil
Activates the menu item within the menu shell.
-
#append(child) ⇒ nil
Adds a new Gtk::MenuItem to the end of the menu shell’s item list.
-
#bind_model(model, action_namespace, with_separators) ⇒ nil
Establishes a binding between a Gtk::MenuShell and a #GMenuModel.
-
#cancel ⇒ nil
Cancels the selection within the menu shell.
-
#deactivate ⇒ nil
Deactivates the menu shell.
-
#deselect ⇒ nil
Deselects the currently selected item from the menu shell, if any.
-
#insert(child, position) ⇒ nil
Adds a new Gtk::MenuItem to the menu shell’s item list at the position indicated by position.
-
#parent_shell ⇒ Gtk::Widget
Gets the parent menu shell.
-
#prepend(child) ⇒ nil
Adds a new Gtk::MenuItem to the beginning of the menu shell’s item list.
-
#select_first(search_sensitive) ⇒ nil
Select the first visible or selectable child of the menu shell; don’t select tearoff items unless the only item is a tearoff item.
-
#select_item(menu_item) ⇒ nil
Selects the menu item from the menu shell.
-
#selected_item ⇒ Gtk::Widget
Gets the currently selected item.
-
#take_focus ⇒ TrueClass
Returns true if the menu shell will take the keyboard focus on popup.
-
#take_focus=(take_focus) ⇒ TrueClass
A boolean that determines whether the menu and its submenus grab the keyboard focus.
-
#take_focus? ⇒ TrueClass
A boolean that determines whether the menu and its submenus grab the keyboard focus.
Instance Method Details
#activate_item(menu_item, force_deactivate) ⇒ nil
Activates the menu item within the menu shell.
#append(child) ⇒ nil
Adds a new Gtk::MenuItem to the end of the menu shell’s item list.
#bind_model(model, action_namespace, with_separators) ⇒ nil
Establishes a binding between a Gtk::MenuShell 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 nil 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-nil 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 Gtk::Actionable 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 Gtk::MenuShell 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 GMenu::Model.
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 GMenu::Model to gtk_application_set_app_menu() or gtk_application_set_menubar().
#cancel ⇒ nil
Cancels the selection within the menu shell.
#deactivate ⇒ nil
Deactivates the menu shell.
Typically this results in the menu shell being erased from the screen.
#deselect ⇒ nil
Deselects the currently selected item from the menu shell, if any.
#insert(child, position) ⇒ nil
Adds a new Gtk::MenuItem to the menu shell’s item list at the position indicated by position.
#parent_shell ⇒ Gtk::Widget
Gets the parent menu shell.
The parent menu shell of a submenu is the Gtk::Menu or #GtkMenuBar from which it was opened up.
#prepend(child) ⇒ nil
Adds a new Gtk::MenuItem to the beginning of the menu shell’s item list.
#select_first(search_sensitive) ⇒ nil
Select the first visible or selectable child of the menu shell; don’t select tearoff items unless the only item is a tearoff item.
#select_item(menu_item) ⇒ nil
Selects the menu item from the menu shell.
#selected_item ⇒ Gtk::Widget
Gets the currently selected item.
#take_focus ⇒ TrueClass
Returns true if the menu shell will take the keyboard focus on popup.
#take_focus=(take_focus) ⇒ TrueClass
A boolean that determines whether the menu and its submenus grab the keyboard focus. See gtk_menu_shell_set_take_focus() and gtk_menu_shell_get_take_focus().
#take_focus? ⇒ TrueClass
A boolean that determines whether the menu and its submenus grab the keyboard focus. See gtk_menu_shell_set_take_focus() and gtk_menu_shell_get_take_focus().