![]() |
![]() |
It 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. It can have a submenu associated with it, allowing for nested hierarchical menus. You can use append(), prepend() and insert() to add Gtk::MenuItem widgets, but you will probably find it more convenient to use the STL-style items() interface with the Gtk::Menu_Helpers::MenuElem() class.
Public Types | |
typedef Menu_Helpers::MenuList | MenuList |
Public Member Functions | |
void | accelerate (Widget& parent) |
Initializes menu accelerators. | |
void | accelerate (Window& window) |
Initializes menu accelerators. | |
void | activate_item (MenuItem& menu_item, bool force_deactivate=false) |
void | append (MenuItem& menu_item) |
void | cancel () |
Cancels the selection within the menu shell. | |
void | deactivate () |
void | deselect () |
bool | get_take_focus () const |
Returns true if the menu shell will take the keyboard focus on popup. | |
const GtkMenuShell* | gobj () const |
Provides access to the underlying C GtkObject. | |
GtkMenuShell* | gobj () |
Provides access to the underlying C GtkObject. | |
void | insert (MenuItem& menu_item, int position) |
const MenuList& | items () const |
MenuList& | items () |
void | prepend (MenuItem& menu_item) |
Glib::PropertyProxy_ReadOnly< bool > | property_take_focus () const |
A boolean that determines whether the menu grabs the keyboard focus. | |
Glib::PropertyProxy<bool> | property_take_focus () |
A boolean that determines whether the menu grabs the keyboard focus. | |
void | select_first (bool search_sensitive=true) |
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 | select_item (MenuItem& menu_item) |
void | set_take_focus (bool take_focus=true) |
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. | |
Glib::SignalProxy0<void> | signal_deactivate () |
Glib::SignalProxy0<void> | signal_selection_done () |
virtual | ~MenuShell () |
Protected Member Functions | |
MenuShell () | |
virtual void | on_deactivate () |
virtual void | on_selection_done () |
Friends | |
class | Menu_Helpers::MenuList |
Related Functions | |
(Note that these are not member functions.) | |
Gtk::MenuShell* | wrap (GtkMenuShell* object, bool take_copy=false) |
|
|
|
|
|
|
|
Initializes menu accelerators. Does the same as the accelerate(Window& window) method. But you can use any parent widget where the menu is used. This method then gets the toplevel window using Widget::get_toplevel() and uses this window for registering the menu accelerators.
|
|
Initializes menu accelerators. This method initializes the menu accelerators. Therefore an AccelGroup object is needed which is stored in each Window object in the Gtkmm library implementation. When using MenuBar and OptionMenu objects this method is called automatically when the menus are realized. Because most likely the MenuBar and OptionMenu is attached to a window at this time and the window object can be found automatically. Important note when using popup menus: If you are using accelerated menu entries inside a popup menu you have to call the accelerate() method manually. This is because the popup menu is not connected to any window and the accelerators should be initialized even before the popup menu is shown. The right place to call the accelerate() method is right after the popup menu has been build.
|
|
|
|
|
|
Cancels the selection within the menu shell.
|
|
|
|
|
|
Returns
|
|
Provides access to the underlying C GtkObject.
Reimplemented from Gtk::Container. Reimplemented in Gtk::Menu, Gtk::MenuBar, and Gtk::RecentChooserMenu. |
|
Provides access to the underlying C GtkObject.
Reimplemented from Gtk::Container. Reimplemented in Gtk::Menu, Gtk::MenuBar, and Gtk::RecentChooserMenu. |
|
|
|
|
|
|
|
|
|
|
|
|
|
A boolean that determines whether the menu grabs the keyboard focus. You rarely need to use properties because there are get_ and set_ methods for almost all of them.
|
|
A boolean that determines whether the menu grabs the keyboard focus. You rarely need to use properties because there are get_ and set_ methods for almost all of them.
|
|
Select the first visible or selectable child of the menu shell; don't select tearoff items unless the only item is a tearoff item.
|
|
|
|
If take_focus is
Setting take_focus to 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 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 See also gdk_keyboard_grab()
|
|
|
|
|
|
|
|
|