Reference Manual

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

# Inti::Gtk::MenuShell Class Reference

A GtkMenuShell C++ wrapper class. More...

`#include <inti/gtk/menushell.h>`

Inheritance diagram for Inti::Gtk::MenuShell:

List of all members.

## Public Member Functions

Constructors

- virtual ~MenuShell ()
    Destructor.

Accessors

- GtkMenuShell * gtk_menu_shell () const
    Get a pointer to the GtkMenuShell structure.
- GtkMenuShellClass * gtk_menu_shell_class () const
    Get a pointer to the GtkMenuShellClass structure.
- operator GtkMenuShell * () const
    Conversion operator; safely converts a MenuShell to a GtkMenuShell pointer.
- bool children (std::vector< MenuItem * > &child_list) const
    Get the list of MenuItem objects contained by this MenuShell.

Methods

- void append (MenuItem &item, const Slot0< void > *callback=0)
    Adds a new menu item to the end of the menu shell's item list.
- void append (MenuItem &item, const AccelKey &accel_key, const Slot0< void > *callback=0)
    Adds a new menu item to the end of the menu shell's item list.
- void append (MenuItem &item, const AccelKey &accel_key, AccelGroup &accel_group, const Slot0< void > *callback=0)
    Adds a new menu item to the end of the menu shell's item list.
- void append (const char *stock_id, const Slot0< void > *callback)
    Adds a new stock menu item to the end of the menu shell's item list.
- void prepend (MenuItem &item, const Slot0< void > *callback=0)
    Adds a new menu item to the beginning of the menu shell's item list.
- void prepend (MenuItem &item, const AccelKey &accel_key, const Slot0< void > *callback=0)
    Adds a new menu item to the beginning of the menu shell's item list.
- void prepend (MenuItem &item, const AccelKey &accel_key, AccelGroup &accel_group, const Slot0< void > *callback=0)
    Adds a new menu item to the beginning of the menu shell's item list.
- void prepend (const char *stock_id, const Slot0< void > *callback)
    Adds a new stock menu item to the beginning of the menu shell's item list.
- void insert (MenuItem &item, int position, const Slot0< void > *callback=0)
    Adds a new menu item to the menu shell's item list at the position indicated by position.
- void insert (MenuItem &item, int position, const AccelKey &accel_key, const Slot0< void > *callback=0)
    Adds a new menu item to the menu shell's item list at the position indicated by position.
- void insert (MenuItem &item, int position, const AccelKey &accel_key, AccelGroup &accel_group, const Slot0< void > *callback=0)
    Adds a new menu item to the menu shell's item list at the position indicated by position.
- void insert (const char *stock_id, int position, const Slot0< void > *callback)
    Adds a new stock menu item to the menu shell's item list at the position indicated by position.
- void select_item (MenuItem &item)
    Selects the menu item from the menu shell.
- void deselect ()
    Deselects the currently selected item from the menu shell, if any.
- void activate_item (MenuItem &item, bool force_deactivate)
    Activates the menu item within the menu shell.
- void deactivate ()
    Deactivates the menu shell.
- void select_first (bool search_sensitive)
    Select the first visible or selectable child of the menu shell; don't select tearoff items unless the only item is a tearoff item.

Signal Proxies

- const DeactivateSignalProxy sig_deactivate ()
    Connect to the deactivate_signal; emitted when a menu shell is deactivated.
- const SelectionDoneSignalProxy sig_selection_done ()
    Connect to the selection_done_signal; emitted when a selection has been completed within a menu shell.

## Protected Member Functions

Constructors

- MenuShell ()
    Construct a new MenuShell.
- MenuShell (GtkMenuShell *menu_shell, bool reference=false)
    Construct a new MenuShell from an existing GtkMenuShell.

Signal Handlers

- virtual void on_deactivate ()
    Called when a menu shell is deactivated.
- virtual void on_selection_done ()
    Called when a selection has been completed within a menu shell.

## Detailed Description

A GtkMenuShell C++ wrapper class.

A MenuShell is the abstract base class used to derive the Menu and MenuBar subclasses. It is a container of MenuItem objects arranged in a list which can be navigated, selected, and activated by the user to perform application functions. A MenuItem can have a submenu associated with it, allowing for nested hierarchical menus.

## Constructor & Destructor Documentation

Inti::Gtk::MenuShell::MenuShell | ( | GtkMenuShell * | menu_shell,
|  | bool | reference = false
| ) | `[explicit, protected]`

Construct a new MenuShell from an existing GtkMenuShell.

Parameters:

  menu_shell | A pointer to a GtkMenuShell.
  reference | Set false if the initial reference count is floating, set true if it's not.

The menu_shell can be a newly created GtkMenuShell or an existing GtkMenuShell (see G::Object::Object).

## Member Function Documentation

void Inti::Gtk::MenuShell::activate_item | ( | MenuItem & | item,
|  | bool | force_deactivate
| ) |

Activates the menu item within the menu shell.

Parameters:

  item | The menu item to activate.
  force_deactivate | If true, force the deactivation of the menu shell after the menu item is activated.

void Inti::Gtk::MenuShell::append | ( | const char * | stock_id,
|  | const Slot0< void > * | callback
| ) |

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

Parameters:

  stock_id | The stock menu item to add.
  callback | The callback slot to connect to the stock menu item's activate_signal.

void Inti::Gtk::MenuShell::append | ( | MenuItem & | item,
|  | const AccelKey & | accel_key,
|  | AccelGroup & | accel_group,
|  | const Slot0< void > * | callback = 0
| ) |

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

Parameters:

  item | The menu item to add.
  accel_key | The accelerator key for the menu item.
  accel_group | The accelerator group to add the accelerator key to.
  callback | The callback slot to connect to item's activate_signal.

void Inti::Gtk::MenuShell::append | ( | MenuItem & | item,
|  | const AccelKey & | accel_key,
|  | const Slot0< void > * | callback = 0
| ) |

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

Parameters:

  item | The menu item to add.
  accel_key | The accelerator key for the menu item.
  callback | The callback slot to connect to item's activate_signal.

Calls Gtk::Menu::get_accel_group() to retrieve the accelerator group for the menu, and adds the accelerator key to this accelerator group.

void Inti::Gtk::MenuShell::append | ( | MenuItem & | item,
|  | const Slot0< void > * | callback = 0
| ) |

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

Parameters:

  item | The menu item to add.
  callback | The callback slot to connect to item's activate_signal.

bool Inti::Gtk::MenuShell::children | ( | std::vector< MenuItem * > & | child_list | ) | const

Get the list of MenuItem objects contained by this MenuShell.

Parameters:

  child_list | A reference to a vector of MenuItem* to hold the child list.

Returns:
  true if the child list is not empty, and false if it is empty.

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

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

void Inti::Gtk::MenuShell::insert | ( | const char * | stock_id,
|  | int | position,
|  | const Slot0< void > * | callback
| ) |

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

Parameters:

  stock_id | The stock menu item to add.
  position | The position in the item list where child is added (numbered from 0 to n-1).
  callback | The callback slot to connect to the stock menu item's activate_signal.

void Inti::Gtk::MenuShell::insert | ( | MenuItem & | item,
|  | int | position,
|  | const AccelKey & | accel_key,
|  | AccelGroup & | accel_group,
|  | const Slot0< void > * | callback = 0
| ) |

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

Parameters:

  item | The menu item to add.
  position | The position in the item list where child is added (numbered from 0 to n-1).
  accel_key | The accelerator key for the menu item.
  accel_group | The accelerator group to add the accelerator key to.
  callback | The callback slot to connect to item's activate_signal.

void Inti::Gtk::MenuShell::insert | ( | MenuItem & | item,
|  | int | position,
|  | const AccelKey & | accel_key,
|  | const Slot0< void > * | callback = 0
| ) |

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

Parameters:

  item | The menu item to add.
  position | The position in the item list where child is added (numbered from 0 to n-1).
  accel_key | The accelerator key for the menu item.
  callback | The callback slot to connect to item's activate_signal.

Calls Gtk::Menu::get_accel_group() to retrieve the accelerator group for the menu, and adds the accelerator key to this accelerator group.

void Inti::Gtk::MenuShell::insert | ( | MenuItem & | item,
|  | int | position,
|  | const Slot0< void > * | callback = 0
| ) |

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

Parameters:

  item | The menu item to add.
  position | The position in the item list where child is added (numbered from 0 to n-1).
  callback | The callback slot to connect to item's activate_signal.

void Inti::Gtk::MenuShell::prepend | ( | const char * | stock_id,
|  | const Slot0< void > * | callback
| ) |

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

Parameters:

  stock_id | The stock menu item to add.
  callback | The callback slot to connect to the stock menu item's activate_signal.

void Inti::Gtk::MenuShell::prepend | ( | MenuItem & | item,
|  | const AccelKey & | accel_key,
|  | AccelGroup & | accel_group,
|  | const Slot0< void > * | callback = 0
| ) |

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

Parameters:

  item | The menu item to add.
  accel_key | The accelerator key for the menu item.
  accel_group | The accelerator group to add the accelerator key to.
  callback | The callback slot to connect to item's activate_signal.

void Inti::Gtk::MenuShell::prepend | ( | MenuItem & | item,
|  | const AccelKey & | accel_key,
|  | const Slot0< void > * | callback = 0
| ) |

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

Parameters:

  item | The menu item to add.
  accel_key | The accelerator key for the menu item.
  callback | The callback slot to connect to item's activate_signal.

Calls Gtk::Menu::get_accel_group() to retrieve the accelerator group for the menu, and adds the accelerator key to this accelerator group.

void Inti::Gtk::MenuShell::prepend | ( | MenuItem & | item,
|  | const Slot0< void > * | callback = 0
| ) |

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

Parameters:

  item | The menu item to add.
  callback | The callback slot to connect to item's activate_signal.

void Inti::Gtk::MenuShell::select_first | ( | bool | search_sensitive | ) |

Select the first visible or selectable child of the menu shell; don't select tearoff items unless the only item is a tearoff item.

Parameters:

  search_sensitive | If true, search for the first selectable menu item, otherwise select nothing if the first item isn't sensitive.

search_sensitive should be false if the menu is being popped up initially.

void Inti::Gtk::MenuShell::select_item | ( | MenuItem & | item | ) |

Selects the menu item from the menu shell.

Parameters:

  item | The MenuItem to select.

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

- menushell.h

Main Page - Footer