Main Page Widgets Namespaces Book

# Gtk::MenuShell Class Reference
[Widgets, Container Widgets, Menu classes]

The abstract base class for Gtk::Menu and Gtk::MenuBar. More...

Inheritance diagram for Gtk::MenuShell:

[legend]
List of all members.

## Public Types

typedef Menu_Helpers::AccelKey | AccelKey
typedef Menu_Helpers::MenuList | MenuList

## Public Member Functions

virtual | ~MenuShell ()
GtkMenuShell* | gobj ()
| Provides access to the underlying C GtkObject.
const GtkMenuShell* | gobj () const
| Provides access to the underlying C GtkObject.
void | append (MenuItem& menu_item)
void | prepend (MenuItem& menu_item)
void | insert (MenuItem& menu_item, int position)
void | select_item (MenuItem& menu_item)
void | deselect ()
void | activate_item (MenuItem& menu_item, bool force_deactivate=false)
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 | deactivate ()
Glib::SignalProxy0<void> | signal_deactivate ()
Glib::SignalProxy0<void> | signal_selection_done ()
Glib::SignalProxy1< void, MenuDirectionType > | signal_move_current ()
Glib::SignalProxy1< void, bool > | signal_activate_current ()
Glib::SignalProxy0<void> | signal_cancel ()
MenuList& | items ()
const MenuList& | items () const
void | accelerate (Window& window)
| Initializes menu accelerators.
void | accelerate (Widget& parent)
| Initializes menu accelerators.

## Protected Member Functions

virtual void | on_deactivate ()
virtual void | on_selection_done ()
virtual void | on_move_current (MenuDirectionType direction)
virtual void | on_activate_current (bool force_hide)
virtual void | on_cancel ()
| MenuShell ()

## Friends

class | Menu_Helpers::MenuList

## Related Functions

(Note that these are not member functions.)
Gtk::MenuShell* | wrap (GtkMenuShell* object, bool take_copy=false)

## Detailed Description

The abstract base class for Gtk::Menu and Gtk::MenuBar.

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.

## Member Typedef Documentation

typedef Menu_Helpers::AccelKey Gtk::MenuShell::AccelKey

typedef Menu_Helpers::MenuList Gtk::MenuShell::MenuList

## Constructor & Destructor Documentation

virtual Gtk::MenuShell::~MenuShell | ( |  | ) | `[virtual]`

Gtk::MenuShell::MenuShell | ( |  | ) | `[protected]`

## Member Function Documentation

void Gtk::MenuShell::accelerate | ( | Widget& | parent | ) |

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.

Parameters:

  parent | Parent widget used as starting point for searching the toplevel window.

void Gtk::MenuShell::accelerate | ( | Window& | window | ) |

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.

Parameters:

  window | Window where the menu is shown. Inside this window the AccelGroup object is stored that will be used to initialize the accelerators.

void Gtk::MenuShell::activate_item | ( | MenuItem& | menu_item,
|  | bool | force_deactivate = false
| ) |

void Gtk::MenuShell::append | ( | MenuItem& | menu_item | ) |

void Gtk::MenuShell::deactivate | ( |  | ) |

void Gtk::MenuShell::deselect | ( |  | ) |

const GtkMenuShell* Gtk::MenuShell::gobj | ( |  | ) | const`[inline]`

| Provides access to the underlying C GtkObject. Reimplemented from Gtk::Container. Reimplemented in Gtk::Menu, and Gtk::MenuBar.

GtkMenuShell* Gtk::MenuShell::gobj | ( |  | ) | `[inline]`

| Provides access to the underlying C GtkObject. Reimplemented from Gtk::Container. Reimplemented in Gtk::Menu, and Gtk::MenuBar.

void Gtk::MenuShell::insert | ( | MenuItem& | menu_item,
|  | int | position
| ) |

const MenuList& Gtk::MenuShell::items | ( |  | ) | const

MenuList& Gtk::MenuShell::items | ( |  | ) |

virtual void Gtk::MenuShell::on_activate_current | ( | bool | force_hide | ) | `[protected, virtual]`

virtual void Gtk::MenuShell::on_cancel | ( |  | ) | `[protected, virtual]`

virtual void Gtk::MenuShell::on_deactivate | ( |  | ) | `[protected, virtual]`

virtual void Gtk::MenuShell::on_move_current | ( | MenuDirectionType | direction | ) | `[protected, virtual]`

virtual void Gtk::MenuShell::on_selection_done | ( |  | ) | `[protected, virtual]`

void Gtk::MenuShell::prepend | ( | MenuItem& | menu_item | ) |

void Gtk::MenuShell::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.

Since: 2.2

Parameters:

  search_sensitive | If `true`, search for the first selectable menu item, otherwise select nothing if the first item isn't sensitive. This should be `false` if the menu is being popped up initially.

void Gtk::MenuShell::select_item | ( | MenuItem& | menu_item | ) |

Glib::SignalProxy1<void,bool> Gtk::MenuShell::signal_activate_current | ( |  | ) |

Prototype:
  `void activate_current(bool force_hide)`

Glib::SignalProxy0<void> Gtk::MenuShell::signal_cancel | ( |  | ) |

Prototype:
  `void cancel()`

Glib::SignalProxy0<void> Gtk::MenuShell::signal_deactivate | ( |  | ) |

Prototype:
  `void deactivate()`

Glib::SignalProxy1<void,MenuDirectionType> Gtk::MenuShell::signal_move_current | ( |  | ) |

Prototype:
  `void move_current(MenuDirectionType direction)`

Glib::SignalProxy0<void> Gtk::MenuShell::signal_selection_done | ( |  | ) |

Prototype:
  `void selection_done()`

## Friends And Related Function Documentation

friend class Menu_Helpers::MenuList`[friend]`

Gtk::MenuShell* wrap | ( | GtkMenuShell* | object,
|  | bool | take_copy = false
| ) | `[related]`

The documentation for this class was generated from the following file:

- menushell.h