Reference Manual

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

# Inti::Gtk::OptionMenu Class Reference

A GtkOptionMenu C++ wrapper class. More...

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

Inheritance diagram for Inti::Gtk::OptionMenu:

List of all members.

## Public Member Functions

Constructors

- OptionMenu ()
    Construct a new option menu.
- OptionMenu (Menu &menu, unsigned int index=0)
    Construct a new option menu with a menu that is popped up to allow the user to choose a new value.
- virtual ~OptionMenu ()
    Destructor.

Accessors

- GtkOptionMenu * gtk_option_menu () const
    Get a pointer to the GtkOptionMenu structure.
- GtkOptionMenuClass * gtk_option_menu_class () const
    Get a pointer to the GtkOptionMenuClass structure.
- operator GtkOptionMenu * () const
    Conversion operator; safely converts an OptionMenu to a GtkOptionMenu pointer.
- Menu * get_menu () const
    Returns the Menu associated with the OptionMenu.
- int get_history () const
    Retrieves the index of the currently selected menu item.

Methods

- void set_menu (Menu &menu)
    Sets the Menu that is popped up to allow the user to choose a new value.
- void remove_menu ()
    Removes the popup menu from the option menu.
- void set_history (unsigned int index)
    Selects the menu item specified by index making it the newly selected value for the option menu.

Property Proxies

- const MenuPropertyProxy prop_menu ()
    The menu of options (Menu* : Read / Write).

Signal Proxies

- const ChangedSignalProxy sig_changed ()
    Connect to the changed_signal; emitted when the selected menu item changes.

## Protected Member Functions

Constructors

- OptionMenu (GtkOptionMenu *option_menu, bool reference=false)
    Construct a new OptionMenu from an existing GtkOptionMenu.

Signal Handlers

- virtual void on_changed ()
    Called when the selected menu item changes.

## Detailed Description

A GtkOptionMenu C++ wrapper class.

OptionMenu is a widget that allows the user to choose from a list of valid choices. The OptionMenu displays the selected choice. When activated the OptionMenu displays a popup Menu which allows the user to make a new choice.

Using a OptionMenu is simple; construct a Menu, then append menu items to it with Gtk::MenuShell::append(). Set that menu on the option menu with set_menu(). Set the selected menu item with set_history(); connect to the "changed" signal on the option menu; in the "changed" signal, check the new selected menu item with get_history().

## Constructor & Destructor Documentation

Inti::Gtk::OptionMenu::OptionMenu | ( | GtkOptionMenu * | option_menu,
|  | bool | reference = false
| ) | `[explicit, protected]`

Construct a new OptionMenu from an existing GtkOptionMenu.

Parameters:

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

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

Inti::Gtk::OptionMenu::OptionMenu | ( | Menu & | menu,
|  | unsigned int | index = 0
| ) | `[explicit]`

Construct a new option menu with a menu that is popped up to allow the user to choose a new value.

Parameters:

  menu | The Menu to associate with the option menu.
  index | The index of the menu item to select; index values are from 0 to n-1.

## Member Function Documentation

int Inti::Gtk::OptionMenu::get_history | ( |  | ) | const

Retrieves the index of the currently selected menu item.

Returns:
  The index of the selected menu item, or -1 if there are no menu items.

The menu items are numbered from top to bottom, starting with 0.

virtual void Inti::Gtk::OptionMenu::on_changed | ( |  | ) | `[protected, virtual]`

| Called when the selected menu item changes. Call get_history() to get the index of the selected menu item.

void Inti::Gtk::OptionMenu::set_history | ( | unsigned int | index | ) |

Selects the menu item specified by index making it the newly selected value for the option menu.

Parameters:

  index | The index of the menu item to select; index values are from 0 to n-1.

void Inti::Gtk::OptionMenu::set_menu | ( | Menu & | menu | ) |

Sets the Menu that is popped up to allow the user to choose a new value.

Parameters:

  menu | The Menu to associate with the option menu.

You should provide a simple menu avoiding the use of tearoff menu items, submenus, and accelerators.

const ChangedSignalProxy Inti::Gtk::OptionMenu::sig_changed | ( |  | ) | `[inline]`

| Connect to the changed_signal; emitted when the selected menu item changes. Call get_history() to get the index of the selected menu item.

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

- optionmenu.h

Main Page - Footer