Xfce Foundation Classes
Main Page | Index | Namespace List | Alphabetical List | Class List | File List

# Xfc::Gtk::ComboBox Class Reference

A GtkComboBox C++ wrapper class. More...

`#include <xfc/gtk/combobox.hh>`

Inheritance diagram for Xfc::Gtk::ComboBox:

List of all members.

## Signal Prototypes

- const ChangedSignalType changed_signal
    Changed signal (see signal_changed()).

## Public Types

- typedef sigc::slot< bool,
  const TreeModel &, const
  TreeIter & > RowSeparatorSlot
    Signature of the callback slot called to determine whether the row pointed to by iter should be rendered as a separator.

## Public Member Functions

Constructors

- ComboBox ()
    Constructs a new combo box.
- ComboBox (TreeModel &model)
    Constructs a new combo box with the model initialized to model.
- virtual ~ComboBox ()
    Destructor.

Accessors

- GtkComboBox * gtk_combo_box () const
    Get a pointer to the GtkComboBox structure.
- operator GtkComboBox * () const
    Conversion operator; safely converts an ComboBox to a GtkComboBox pointer.
- int get_wrap_width () const
    Gets the wrap width which is used to determine the number of columns for the popup menu.
- int get_row_span_column () const
    Gets the column with row span information for the combo box.
- int get_column_span_column () const
    Gets the column with column span information for the combo box.
- bool get_add_tearoffs () const
    Determines whether dropdowns should have a tearoff menu item.
- bool get_focus_on_click () const
    Determines whether the combo box grabs focus when it is clicked with the mouse (see set_focus_on_click()).
- int get_active () const
    Gets the index of the currently active item, or -1 if there's no active item.
- bool get_active_iter (TreeIter &iter) const
    Sets iter to point to the current active item, if it exists.
- TreeModel * get_model () const
    Gets the Gtk::TreeModel which is acting as data source for the combo box.
- Atk::Object * get_popup_accessible () const
    Gets the accessible object corresponding to the combo box's popup.

Methods

- void set_wrap_width (int width)
    Sets the wrap width of the combo box to be width.
- void set_row_span_column (int row_span)
    Sets the column with row span information for the combo box to be row_span.
- void set_column_span_column (int column_span)
    Sets the column with column span information for the combo box to be column_span.
- void set_add_tearoffs (bool add_tearoffs)
    Sets whether the popup menu should have a tearoff menu item.
- void set_focus_on_click (bool focus_on_click)
    Sets whether the combo box will grab focus when it is clicked with the mouse.
- void set_active (int index)
    Sets the active item of the combo box to be the item at index.
- void set_active_iter (const TreeIter &iter)
    Sets the current active item to be the one referenced by iter.
- void set_model (TreeModel &model)
    Sets the model used by the combo box to be model.
- void set_row_separator_func (const RowSeparatorSlot &slot)
    Sets the row separator function, which is used to determine whether a row should be drawn as a separator.
- void unset_row_separator_func ()
    Unsets the row separator function set by set_row_separator_func().
- void popup ()
    Pops up the menu or dropdown list of the combo box.
- void popdown ()
    Hides the menu or dropdown list of the combo box.

Signal Proxies

- const ChangedSignalProxy signal_changed ()
    Connect to the changed_signal; emitted when the active item in the combo box is changed.

## Protected Member Functions

Constructors

- ComboBox (GtkComboBox *combo_box, bool owns_reference=false)
    Construct a new ComboBox from an existing GtkComboBox.

## Detailed Description

A GtkComboBox C++ wrapper class.

The ComboBox widget is used to choose an item from a list of items.

See also: the ComboBox HOWTOs and examples.

## Member Typedef Documentation

typedef sigc::slot<bool, const TreeModel&, const TreeIter&> Xfc::Gtk::ComboBox::RowSeparatorSlot

| Signature of the callback slot called to determine whether the row pointed to by iter should be rendered as a separator. Example: Method signature for RowSeparatorSlot.
                 void method(const TreeModel& model, const TreeIter& iter);
                 // model: The TreeModel.
                 // iter: A TreeIter pointing to a row in the model.
                 // return: <EM>true</EM> if the row is a separator.
A common way to implement this is to have a boolean column in the model, whose values the RowSeparatorSlot returns.

## Constructor & Destructor Documentation

Xfc::Gtk::ComboBox::ComboBox | ( | GtkComboBox * | combo_box,
|  | bool | owns_reference = `false`
| ) | `[explicit, protected]`

  | Construct a new ComboBox from an existing GtkComboBox. Parameters:
  | combo_box | A pointer to a GtkComboBox.
  | owns_reference | Set false if the initial reference count is floating, set true if it's not.
The combo_box can be a newly created GtkComboBox or an existing GtkComboBox (see G::Object::Object).

Xfc::Gtk::ComboBox::ComboBox | ( | TreeModel & | model | ) |

  | Constructs a new combo box with the model initialized to model. Parameters:
  | model | A Gtk::TreeModel.

## Member Function Documentation

int Xfc::Gtk::ComboBox::get_active | ( |  | ) | const

| Gets the index of the currently active item, or -1 if there's no active item. Returns: An integer which is the index of the currently active item, or -1 if there's no active item.

bool Xfc::Gtk::ComboBox::get_active_iter | ( | TreeIter & | iter | ) | const

  | Sets iter to point to the current active item, if it exists. Parameters:
  | iter | A Gtk::TreeIter.
Returns: true if iter was set to point to the active item.

bool Xfc::Gtk::ComboBox::get_add_tearoffs | ( |  | ) | const

| Determines whether dropdowns should have a tearoff menu item. Returns: true if the dropdowns have a tearoff menu item.

int Xfc::Gtk::ComboBox::get_column_span_column | ( |  | ) | const

| Gets the column with column span information for the combo box. Returns: The column span column.

bool Xfc::Gtk::ComboBox::get_focus_on_click | ( |  | ) | const

| Determines whether the combo box grabs focus when it is clicked with the mouse (see set_focus_on_click()). Returns: true if the combo box grabs focus when it is clicked with the mouse.

TreeModel* Xfc::Gtk::ComboBox::get_model | ( |  | ) | const

| Gets the Gtk::TreeModel which is acting as data source for the combo box. Returns: A Gtk::TreeModel.

Atk::Object* Xfc::Gtk::ComboBox::get_popup_accessible | ( |  | ) | const

| Gets the accessible object corresponding to the combo box's popup. Returns: The accessible object corresponding to the combo box's popup. This method is mostly intended for use by accessibility technologies; applications should have little use for it.

int Xfc::Gtk::ComboBox::get_row_span_column | ( |  | ) | const

| Gets the column with row span information for the combo box. Returns: The row span column.

int Xfc::Gtk::ComboBox::get_wrap_width | ( |  | ) | const

| Gets the wrap width which is used to determine the number of columns for the popup menu. Returns: The wrap width. If the wrap width is larger than 1, the combo box is in grid mode.

void Xfc::Gtk::ComboBox::popdown | ( |  | ) |

| Hides the menu or dropdown list of the combo box. This method is mostly intended for use by accessibility technologies; applications should have little use for it.

void Xfc::Gtk::ComboBox::popup | ( |  | ) |

| Pops up the menu or dropdown list of the combo box. This method is mostly intended for use by accessibility technologies; applications should have little use for it.

void Xfc::Gtk::ComboBox::set_active | ( | int | index | ) |

  | Sets the active item of the combo box to be the item at index. Parameters:
  | index | An index in the model passed during construction, or -1 to have no active item.

void Xfc::Gtk::ComboBox::set_active_iter | ( | const TreeIter & | iter | ) |

  | Sets the current active item to be the one referenced by iter. Parameters:
  | iter | The Gtk::TreeIter.
iter must correspond to a path of depth one.

void Xfc::Gtk::ComboBox::set_add_tearoffs | ( | bool | add_tearoffs | ) |

  | Sets whether the popup menu should have a tearoff menu item. Parameters:
  | add_tearoffs | Set to true to add tearoff menu items.

void Xfc::Gtk::ComboBox::set_column_span_column | ( | int | column_span | ) |

  | Sets the column with column span information for the combo box to be column_span. Parameters:
  | column_span | A column in the model passed during construction.
The column span column contains integers which indicate how many columns an item should span.

void Xfc::Gtk::ComboBox::set_focus_on_click | ( | bool | focus_on_click | ) |

  | Sets whether the combo box will grab focus when it is clicked with the mouse. Parameters:
  | focus_on_click | Set to true if the combo box grabs focus when clicked with the mouse.
Making mouse clicks not grab focus is useful in places like toolbarswhere you don't want the keyboard focus removed from the main area of the application.

void Xfc::Gtk::ComboBox::set_model | ( | TreeModel & | model | ) |

  | Sets the model used by the combo box to be model. Parameters:
  | model | A Gtk::TreeModel.
Will unset a previously set model (if applicable).

void Xfc::Gtk::ComboBox::set_row_separator_func | ( | const RowSeparatorSlot & | slot | ) |

  | Sets the row separator function, which is used to determine whether a row should be drawn as a separator. Parameters:
  | slot | The RowSeparatorSlot to call.
By default no separators are drawn

void Xfc::Gtk::ComboBox::set_row_span_column | ( | int | row_span | ) |

  | Sets the column with row span information for the combo box to be row_span. Parameters:
  | row_span | A column in the model passed during construction.
The row span column contains integers which indicate how many rows an item should span.

void Xfc::Gtk::ComboBox::set_wrap_width | ( | int | width | ) |

  | Sets the wrap width of the combo box to be width. Parameters:
  | width | The preferred number of columns.
The wrap width is basically the preferred number of columns when you want the popup to be layed out in a table.

void Xfc::Gtk::ComboBox::unset_row_separator_func | ( |  | ) |

| Unsets the row separator function set by set_row_separator_func(). After calling this method no separators will be drawn. This is the default value so you only need to call this method if you previously called set_row_separator_func().

## Member Data Documentation

const ChangedSignalType Xfc::Gtk::ComboBox::changed_signal`[static, protected]`

| Changed signal (see signal_changed()). Calls a slot with the signature:
                 void function();

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

- combobox.hh

Xfce Foundation Classes

Copyright © 2004-2005 The XFC Development Team | XFC 4.3