Crea  Modifica  FrontPage  Indici  Cerca  Ultime modifiche  History  RSS  Login

Gtk::MenuShell

class Gtk::MenuShell

A Gtk::MenuShell is the abstract base class used to derive the Gtk::Menu and Gtk::MenuBar subclasses.

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

Instance Methods

append(child)
Adds a new Gtk::MenuItem to the end of the menu shell's item list.
prepend(child)
Adds a new Gtk::MenuItem to the beginning of the menu shell's item list.
insert(child, position)
Adds a new Gtk::MenuItem to the menu shell's item list at the position indicated by position.
  • child: The Gtk::MenuItem to add.
  • position: The position in the item list where child is added. Positions are numbered from 0 to n-1.
  • Returns: self
deactivate
Deactivates the menu shell. Typically this results in the menu shell being erased from the screen.
  • Returns: self
select_item(menu_item)
Selects the menu item from the menu shell.
deselect
Deselects the currently selected item from the menu shell, if any.
  • Returns: self
activate_item
Activates the menu item within the menu shell.
  • menu_item: The Gtk::MenuItem to activate.
  • force_deactivate: If true, force the deactivation of the menu shell after the menu item is activated.
take_focus
Returns true if the menu shell will take the keyboard focus on popup. Since 2.8
take_focus=(take_focus)
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. Note that setting it to false has side-effects: if the focus is in some other app, it keeps the focus and keynav in the menu doesn't work. Consequently, keynav on the menu will only work if the focus is on some toplevel owned by the onscreen keyboard. To avoid confusing the user, menus with take_focus set to false should not display mnemonics or accelerators, since it cannot be guaranteed that they will work. See also Gdk#Gdk.keyboard_grab?. Since 2.8
  • take_focus: true if the menu shell should take the keyboard focus on popup.
  • returns: take_focus
set_take_focus(take_focus)
Same as Gtk::MenuShell#take_focus=(take_focus). Since 2.8
  • returns: self

Constants

GtkMenuDirectionType

DIR_PARENT
To the parent menu shell.
DIR_CHILD
To the submenu, if any, associated with the item.
DIR_NEXT
To the next menu item.
DIR_PREV
To the previous menu item.

Properties

take-focus: true or false (Read/Write)
A boolean that determines whether the menu and its submenus grab the keyboard focus. See Gtk::MenuShell#take_focus= and Gtk::MenuShell#take_focus. Since 2.8

Signals

activate-current: self, force_hide
An action signal that activates the current menu item within the menu shell.
  • self: Gtk::MenuShell
  • force_hide: if true, hide the menu after activating the menu item.
cancel: self
An action signal which cancels the selection within the menu shell. Causes the GtkMenuShell::selection-done signal to be emitted.
cycle-focus: self, direction
deactivate: self
This signal is emitted when a menu shell is deactivated.
move-current: self, direction
An action signal which moves the current menu item in the direction specified by direction.
selection-done: self
This signal is emitted when a selection has been completed within a menu shell.

- Masao

Ultima modifica:2005/11/17 02:43:41
Parola chiave:
Referenze:[Vte::Terminal] [Gtk::HSeparator] [Gtk::RecentChooserMenu] [Gtk::MenuItem] [Gtk::Menu] [Gtk::OptionMenu] [Gtk::MenuBar] [Gtk::MenuShell]