gtkmm: Gtk::ComboBox Class Reference

gtkmm 3.4.0

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | Protected Member Functions | Related Functions
Gtk::ComboBox Class Reference
Widgets

A widget used to choose from a list of items. More...

Inheritance diagram for Gtk::ComboBox:
[legend]

List of all members.

## Public Types
typedef TreeView::SlotRowSeparator | SlotRowSeparator
## Public Member Functions
virtual | ~ComboBox ()
GtkComboBox* | gobj ()
| Provides access to the underlying C GtkObject.
const GtkComboBox* | gobj () const
| Provides access to the underlying C GtkObject.
| ComboBox (bool has_entry=false)
| Creates a new empty #GtkComboBox, optionally with an entry.
| ComboBox (const Glib::RefPtr< TreeModel >& model, bool has_entry=false)
| Creates a new ComboBox with the model initialized to model.
| ComboBox (const Glib::RefPtr< CellArea >& cell_area, bool has_entry=false)
| Creates a new empty #GtkComboBox, optionally with an entry.
void | set_wrap_width (int width)
| Sets the wrap width of combo_box to be width.
int | get_wrap_width () const
| Returns the wrap width which is used to determine the number of columns for the popup menu.
void | set_row_span_column (int row_span)
| Sets the column with row span information for combo_box to be row_span.
int | get_row_span_column () const
| Returns the column with row span information for combo_box.
void | set_column_span_column (int column_span)
| Sets the column with column span information for combo_box to be column_span.
int | get_column_span_column () const
| Returns the column with column span information for combo_box.
bool | get_add_tearoffs () const
| Gets the current value of the :add-tearoffs property.
void | set_add_tearoffs (bool add_tearoffs=true)
| Sets whether the popup menu should have a tearoff menu item.
Glib::ustring | get_title () const
| Gets the current title of the menu in tearoff mode.
void | set_title (const Glib::ustring& title)
| Sets the menu's title in tearoff mode.
bool | get_focus_on_click () const
| Returns whether the combo box grabs focus when it is clicked with the mouse.
void | set_focus_on_click (bool focus_on_click=true)
| Sets whether the combo box will grab focus when it is clicked with the mouse.
int | get_active_row_number () const
| Returns the index of the currently active item, or -1 if there's no active item.
TreeModel::iterator | get_active ()
| Gets an iterator that points to the current active item, if it exists.
TreeModel::const_iterator | get_active () const
| Gets an iterator that points to the current active item, if it exists.
void | set_active (int index)
| Sets the active item of combo_box to be the item at index.
void | set_active (const TreeModel::iterator& iter)
| Sets the current active item to be the one referenced by iter, or unsets the active item if iter is `0`.
Glib::ustring | get_entry_text () const
| Get the text in the entry, if there is an entry.
void | unset_active ()
| Causes no item to be active.
Glib::RefPtr< TreeModel > | get_model ()
| Returns the Gtk::TreeModel which is acting as data source for combo_box.
Glib::RefPtr< const TreeModel > | get_model () const
| Returns the Gtk::TreeModel which is acting as data source for combo_box.
void | set_model (const Glib::RefPtr< TreeModel >& model)
| Sets the model used by combo_box to be model.
void | unset_model ()
| Remove the model from the ComboBox.
void | set_row_separator_func (const SlotRowSeparator& 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 ()
| Causes no separators to be drawn.
void | set_button_sensitivity (SensitivityType sensitivity)
| Sets whether the dropdown button of the combo box should be always sensitive (Gtk::SENSITIVITY_ON), never sensitive (Gtk::SENSITIVITY_OFF) or only if there is at least one item to display (Gtk::SENSITIVITY_AUTO).
SensitivityType | get_button_sensitivity () const
| Returns whether the combo box sets the dropdown button sensitive or not when there are no items in the model.
bool | get_has_entry () const
| Returns whether the combo box has an entry.
void | set_entry_text_column (const TreeModelColumnBase& text_column) const
| Sets the model column which combo_box should use to get strings from to be text_column.
void | set_entry_text_column (int text_column)
| Sets the model column which combo_box should use to get strings from to be text_column.
int | get_entry_text_column () const
| Returns the column which combo_box is using to get the strings from to display in the internal entry.
void | set_popup_fixed_width (bool fixed=true)
| Specifies whether the popup's width should be a fixed width matching the allocated width of the combo box.
bool | get_popup_fixed_width () const
| Gets whether the popup uses a fixed width matching the allocated width of the combo box.
void | popup ()
| Pops up the menu or dropdown list of combo_box.
void | popup (const Glib::RefPtr< Gdk::Device >& device)
| Pops up the menu or dropdown list of combo_box, the popup window will be grabbed so only device and its associated pointer/keyboard are the only Gdk::Devices able to send events to it.
void | popdown ()
| Hides the menu or dropdown list of combo_box.
Glib::RefPtr< Atk::Object > | get_popup_accessible ()
| Gets the accessible object corresponding to the combo box's popup.
Glib::RefPtr< const Atk::Object > | get_popup_accessible () const
| Gets the accessible object corresponding to the combo box's popup.
int | get_id_column () const
| Returns the column which combo_box is using to get string IDs for values from.
void | set_id_column (int id_column)
| Sets the model column which combo_box should use to get string IDs for values from.
Glib::ustring | get_active_id () const
| Returns the ID of the active row of combo_box.
void | get_active_id (const Glib::ustring& active_id)
| Changes the active row of combo_box to the one that has an ID equal to active_id, or unsets the active row if active_id is `0`.
Entry* | get_entry ()
const Entry* | get_entry () const
Glib::PropertyProxy < Glib::RefPtr< TreeModel > > | property_model ()
| The model for the combo box.
Glib::PropertyProxy_ReadOnly < Glib::RefPtr< TreeModel > > | property_model () const
| The model for the combo box.
Glib::PropertyProxy< int > | property_wrap_width ()
| Wrap width for laying out the items in a grid.
Glib::PropertyProxy_ReadOnly< int > | property_wrap_width () const
| Wrap width for laying out the items in a grid.
Glib::PropertyProxy< int > | property_row_span_column ()
| TreeModel column containing the row span values.
Glib::PropertyProxy_ReadOnly< int > | property_row_span_column () const
| TreeModel column containing the row span values.
Glib::PropertyProxy< int > | property_column_span_column ()
| TreeModel column containing the column span values.
Glib::PropertyProxy_ReadOnly< int > | property_column_span_column () const
| TreeModel column containing the column span values.
Glib::PropertyProxy< int > | property_active ()
| The item which is currently active.
Glib::PropertyProxy_ReadOnly< int > | property_active () const
| The item which is currently active.
Glib::PropertyProxy< bool > | property_add_tearoffs ()
| Whether dropdowns should have a tearoff menu item.
Glib::PropertyProxy_ReadOnly < bool > | property_add_tearoffs () const
| Whether dropdowns should have a tearoff menu item.
Glib::PropertyProxy< bool > | property_has_frame ()
| Whether the combo box draws a frame around the child.
Glib::PropertyProxy_ReadOnly < bool > | property_has_frame () const
| Whether the combo box draws a frame around the child.
Glib::PropertyProxy< bool > | property_focus_on_click ()
| Whether the combo box grabs focus when it is clicked with the mouse.
Glib::PropertyProxy_ReadOnly < bool > | property_focus_on_click () const
| Whether the combo box grabs focus when it is clicked with the mouse.
Glib::PropertyProxy < Glib::ustring > | property_tearoff_title ()
| A title that may be displayed by the window manager when the popup is torn-off.
Glib::PropertyProxy_ReadOnly < Glib::ustring > | property_tearoff_title () const
| A title that may be displayed by the window manager when the popup is torn-off.
Glib::PropertyProxy_ReadOnly < bool > | property_popup_shown () const
| Whether the combo's dropdown is shown.
Glib::PropertyProxy < SensitivityType > | property_button_sensitivity ()
| Whether the dropdown button is sensitive when the model is empty.
Glib::PropertyProxy_ReadOnly < SensitivityType > | property_button_sensitivity () const
| Whether the dropdown button is sensitive when the model is empty.
Glib::PropertyProxy< bool > | property_popup_fixed_width ()
| Whether the popup's width should be a fixed width matching the allocated width of the combo box.
Glib::PropertyProxy_ReadOnly < bool > | property_popup_fixed_width () const
| Whether the popup's width should be a fixed width matching the allocated width of the combo box.
Glib::PropertyProxy_ReadOnly < Glib::RefPtr< CellArea > > | property_cell_area () const
| The GtkCellArea used to layout cells.
Glib::PropertyProxy_ReadOnly < bool > | property_has_entry () const
| Whether combo box has an entry.
Glib::PropertyProxy< int > | property_entry_text_column ()
| The column in the combo box's model to associate with strings from the entry if the combo was created with #GtkComboBox:has-entry = TRUE.
Glib::PropertyProxy_ReadOnly< int > | property_entry_text_column () const
| The column in the combo box's model to associate with strings from the entry if the combo was created with #GtkComboBox:has-entry = TRUE.
Glib::PropertyProxy< int > | property_id_column ()
| The column in the combo box's model that provides string IDs for the values in the model.
Glib::PropertyProxy_ReadOnly< int > | property_id_column () const
| The column in the combo box's model that provides string IDs for the values in the model.
Glib::PropertyProxy < Glib::ustring > | property_active_id ()
| The value of the id column for the active row.
Glib::PropertyProxy_ReadOnly < Glib::ustring > | property_active_id () const
| The value of the id column for the active row.
Glib::SignalProxy0< void > | signal_changed ()
Glib::SignalProxy1 < Glib::ustring, const TreeModel::Path& > | signal_format_entry_text ()
## Protected Member Functions
virtual void | on_changed ()
| This is a default handler for the signal signal_changed().
## Related Functions
(Note that these are not member functions.)
Gtk::ComboBox* | wrap (GtkComboBox* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Detailed Description

A widget used to choose from a list of items.

A ComboBox is a widget that allows the user to choose from a list of valid choices. The ComboBox displays the selected choice. When activated, the ComboBox displays a popup which allows the user to make a new choice. The style in which the selected value is displayed, and the style of the popup is determined by the current theme. It may be similar to a Windows-style combo box.

The ComboBox uses the model-view pattern; the list of valid choices is specified in the form of a tree model, and the display of the choices can be adapted to the data in the model by using cell renderers, as you would in a tree view. This is possible since ComboBox implements the CellLayout interface. The tree model holding the valid choices is not restricted to a flat list, it can be a real tree, and the popup will reflect the tree structure.

To allow the user to enter values not in the model, the 'has-entry' property allows the ComboBox to contain a Gtk::Entry. This entry can be accessed by calling get_entry(), or you can just call get_entry_text() to get the text from the Entry.

For a simple list of textual choices, the model-view API of ComboBox can be a bit overwhelming. In this case, ComboBoxText offers a simple alternative. Both ComboBox and ComboBoxText can contain an entry.

The ComboBox widget looks like this:

## Member Typedef Documentation

typedef TreeView::SlotRowSeparator Gtk::ComboBox::SlotRowSeparator

## Constructor & Destructor Documentation

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

Gtk::ComboBox::ComboBox | ( | bool | has_entry = `false` | ) | `[explicit]`

Creates a new empty #GtkComboBox, optionally with an entry.

Parameters:

  has_entry | If this is true then this will have an Entry widget.

Gtk::ComboBox::ComboBox | ( | const Glib::RefPtr< TreeModel >& | model,
|  | bool | has_entry = `false`
| ) |  | `[explicit]`

Creates a new ComboBox with the model initialized to model.

Parameters:

  model | The model containing data to display in the ComboBox.
  has_entry | If this is true then this will have an Entry widget.

Gtk::ComboBox::ComboBox | ( | const Glib::RefPtr< CellArea >& | cell_area,
|  | bool | has_entry = `false`
| ) |  | `[explicit]`

Creates a new empty #GtkComboBox, optionally with an entry.

Parameters:

  has_entry | If this is true then this will have an Entry widget.

## Member Function Documentation

TreeModel::iterator Gtk::ComboBox::get_active | ( |  | ) |

Gets an iterator that points to the current active item, if it exists.

Returns:
  The iterator.

TreeModel::const_iterator Gtk::ComboBox::get_active | ( |  | ) | const

Gets an iterator that points to the current active item, if it exists.

Returns:
  The iterator.

Glib::ustring Gtk::ComboBox::get_active_id | ( |  | ) | const

Returns the ID of the active row of combo_box.

This value is taken from the active row and the column specified by the Gtk::ComboBox::property_id_column() property of combo_box (see set_id_column()).

The returned value is an interned string which means that you can compare the pointer by value to other interned strings and that you must not free it.

If the Gtk::ComboBox::property_id_column() property of combo_box is not set, or if no row is active, or if the active row has a `0` ID value, then `0` is returned.

Since gtkmm 3.0:

Returns:
  The ID of the active row, or `0`.

void Gtk::ComboBox::get_active_id | ( | const Glib::ustring & | active_id | ) |

Changes the active row of combo_box to the one that has an ID equal to active_id, or unsets the active row if active_id is `0`.

Rows having a `0` ID string cannot be made active by this function.

If the Gtk::ComboBox::property_id_column() property of combo_box is unset or if no row has the given ID then the function does nothing and returns `false`.

Since gtkmm 3.0:

Parameters:

  active_id | The ID of the row to select, or `0`.

Returns:
  `true` if a row with a matching ID was found. If a `0` active_id was given to unset the active row, the function always returns `true`.

int Gtk::ComboBox::get_active_row_number | ( |  | ) | const

Returns the index of the currently active item, or -1 if there's no active item.

If the model is a non-flat treemodel, and the active item is not an immediate child of the root of the tree, this function returns `gtk_tree_path_get_indices (path)[0]`, where `path` is the Gtk::TreePath of the active item.

Since gtkmm 2.4:

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

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

Gets the current value of the :add-tearoffs property.

Returns:
  The current value of the :add-tearoffs property.

SensitivityType Gtk::ComboBox::get_button_sensitivity | ( |  | ) | const

Returns whether the combo box sets the dropdown button sensitive or not when there are no items in the model.

Since gtkmm 2.14:

Returns:
  Gtk::SENSITIVITY_ON if the dropdown button is sensitive when the model is empty, Gtk::SENSITIVITY_OFF if the button is always insensitive or Gtk::SENSITIVITY_AUTO if it is only sensitive as long as the model has one item to be selected.

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

Returns the column with column span information for combo_box.

Since gtkmm 2.6:

Returns:
  The column span column.

Entry* Gtk::ComboBox::get_entry | ( |  | ) |

See also:
  Bin::get_child().

Since gtkmm 2.24:

const Entry* Gtk::ComboBox::get_entry | ( |  | ) | const

See also:
  Bin::get_child().

Since gtkmm 2.24:

Glib::ustring Gtk::ComboBox::get_entry_text | ( |  | ) | const

Get the text in the entry, if there is an entry.

Since gtkmm 2.24:

int Gtk::ComboBox::get_entry_text_column | ( |  | ) | const

Returns the column which combo_box is using to get the strings from to display in the internal entry.

Since gtkmm 2.24:

Returns:
  A column in the data source model of combo_box.

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

Returns whether the combo box grabs focus when it is clicked with the mouse.

See set_focus_on_click().

Since gtkmm 2.6:

Returns:
  `true` if the combo box grabs focus when it is clicked with the mouse.

bool Gtk::ComboBox::get_has_entry | ( |  | ) | const

Returns whether the combo box has an entry.

Since gtkmm 2.24:

Returns:
  Whether there is an entry in combo_box.

int Gtk::ComboBox::get_id_column | ( |  | ) | const

Returns the column which combo_box is using to get string IDs for values from.

Since gtkmm 3.0:

Returns:
  A column in the data source model of combo_box.

Glib::RefPtr<TreeModel> Gtk::ComboBox::get_model | ( |  | ) |

Returns the Gtk::TreeModel which is acting as data source for combo_box.

Since gtkmm 2.4:

Returns:
  A Gtk::TreeModel which was passed during construction.

Glib::RefPtr<const TreeModel> Gtk::ComboBox::get_model | ( |  | ) | const

Returns the Gtk::TreeModel which is acting as data source for combo_box.

Since gtkmm 2.4:

Returns:
  A Gtk::TreeModel which was passed during construction.

Glib::RefPtr<Atk::Object> Gtk::ComboBox::get_popup_accessible | ( |  | ) |

Gets the accessible object corresponding to the combo box's popup.

This function is mostly intended for use by accessibility technologies; applications should have little use for it.

Since gtkmm 2.6:

Returns:
  The accessible object corresponding to the combo box's popup.

Glib::RefPtr<const Atk::Object> Gtk::ComboBox::get_popup_accessible | ( |  | ) | const

Gets the accessible object corresponding to the combo box's popup.

This function is mostly intended for use by accessibility technologies; applications should have little use for it.

Since gtkmm 2.6:

Returns:
  The accessible object corresponding to the combo box's popup.

bool Gtk::ComboBox::get_popup_fixed_width | ( |  | ) | const

Gets whether the popup uses a fixed width matching the allocated width of the combo box.

Since gtkmm 3.0:

Returns:
  `true` if the popup uses a fixed width.

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

Returns the column with row span information for combo_box.

Since gtkmm 2.6:

Returns:
  The row span column.

Glib::ustring Gtk::ComboBox::get_title | ( |  | ) | const

Gets the current title of the menu in tearoff mode.

See set_add_tearoffs().

Since gtkmm 2.10:

Returns:
  The menu's title in tearoff mode. This is an internal copy of the string which must not be freed.

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

Returns the wrap width which is used to determine the number of columns for the popup menu.

If the wrap width is larger than 1, the combo box is in table mode.

Since gtkmm 2.6:

Returns:
  The wrap width.

GtkComboBox* Gtk::ComboBox::gobj | ( |  | ) | `[inline]`

Provides access to the underlying C GtkObject.

Reimplemented from Gtk::Bin.

Reimplemented in Gtk::AppChooserButton, and Gtk::ComboBoxText.

const GtkComboBox* Gtk::ComboBox::gobj | ( |  | ) | const`[inline]`

Provides access to the underlying C GtkObject.

Reimplemented from Gtk::Bin.

Reimplemented in Gtk::AppChooserButton, and Gtk::ComboBoxText.

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

This is a default handler for the signal signal_changed().

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

Hides the menu or dropdown list of combo_box.

This function is mostly intended for use by accessibility technologies; applications should have little use for it.

Since gtkmm 2.4:

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

Pops up the menu or dropdown list of combo_box.

This function is mostly intended for use by accessibility technologies; applications should have little use for it.

Since gtkmm 2.4:

void Gtk::ComboBox::popup | ( | const Glib::RefPtr< Gdk::Device >& | device | ) |

Pops up the menu or dropdown list of combo_box, the popup window will be grabbed so only device and its associated pointer/keyboard are the only Gdk::Devices able to send events to it.

Since gtkmm 3.0:

Parameters:

  device | A Gdk::Device.

Glib::PropertyProxy< int > Gtk::ComboBox::property_active | ( |  | ) |

The item which is currently active.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< int > Gtk::ComboBox::property_active | ( |  | ) | const

The item which is currently active.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy< Glib::ustring > Gtk::ComboBox::property_active_id | ( |  | ) |

The value of the id column for the active row.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< Glib::ustring > Gtk::ComboBox::property_active_id | ( |  | ) | const

The value of the id column for the active row.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy< bool > Gtk::ComboBox::property_add_tearoffs | ( |  | ) |

Whether dropdowns should have a tearoff menu item.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< bool > Gtk::ComboBox::property_add_tearoffs | ( |  | ) | const

Whether dropdowns should have a tearoff menu item.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy< SensitivityType > Gtk::ComboBox::property_button_sensitivity | ( |  | ) |

Whether the dropdown button is sensitive when the model is empty.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< SensitivityType > Gtk::ComboBox::property_button_sensitivity | ( |  | ) | const

Whether the dropdown button is sensitive when the model is empty.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< Glib::RefPtr<CellArea> > Gtk::ComboBox::property_cell_area | ( |  | ) | const

The GtkCellArea used to layout cells.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy< int > Gtk::ComboBox::property_column_span_column | ( |  | ) |

TreeModel column containing the column span values.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< int > Gtk::ComboBox::property_column_span_column | ( |  | ) | const

TreeModel column containing the column span values.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy< int > Gtk::ComboBox::property_entry_text_column | ( |  | ) |

The column in the combo box's model to associate with strings from the entry if the combo was created with #GtkComboBox:has-entry = TRUE.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< int > Gtk::ComboBox::property_entry_text_column | ( |  | ) | const

The column in the combo box's model to associate with strings from the entry if the combo was created with #GtkComboBox:has-entry = TRUE.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy< bool > Gtk::ComboBox::property_focus_on_click | ( |  | ) |

Whether the combo box grabs focus when it is clicked with the mouse.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< bool > Gtk::ComboBox::property_focus_on_click | ( |  | ) | const

Whether the combo box grabs focus when it is clicked with the mouse.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< bool > Gtk::ComboBox::property_has_entry | ( |  | ) | const

Whether combo box has an entry.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy< bool > Gtk::ComboBox::property_has_frame | ( |  | ) |

Whether the combo box draws a frame around the child.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< bool > Gtk::ComboBox::property_has_frame | ( |  | ) | const

Whether the combo box draws a frame around the child.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy< int > Gtk::ComboBox::property_id_column | ( |  | ) |

The column in the combo box's model that provides string IDs for the values in the model.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< int > Gtk::ComboBox::property_id_column | ( |  | ) | const

The column in the combo box's model that provides string IDs for the values in the model.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy< Glib::RefPtr<TreeModel> > Gtk::ComboBox::property_model | ( |  | ) |

The model for the combo box.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< Glib::RefPtr<TreeModel> > Gtk::ComboBox::property_model | ( |  | ) | const

The model for the combo box.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy< bool > Gtk::ComboBox::property_popup_fixed_width | ( |  | ) |

Whether the popup's width should be a fixed width matching the allocated width of the combo box.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< bool > Gtk::ComboBox::property_popup_fixed_width | ( |  | ) | const

Whether the popup's width should be a fixed width matching the allocated width of the combo box.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< bool > Gtk::ComboBox::property_popup_shown | ( |  | ) | const

Whether the combo's dropdown is shown.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy< int > Gtk::ComboBox::property_row_span_column | ( |  | ) |

TreeModel column containing the row span values.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< int > Gtk::ComboBox::property_row_span_column | ( |  | ) | const

TreeModel column containing the row span values.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy< Glib::ustring > Gtk::ComboBox::property_tearoff_title | ( |  | ) |

A title that may be displayed by the window manager when the popup is torn-off.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< Glib::ustring > Gtk::ComboBox::property_tearoff_title | ( |  | ) | const

A title that may be displayed by the window manager when the popup is torn-off.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy< int > Gtk::ComboBox::property_wrap_width | ( |  | ) |

Wrap width for laying out the items in a grid.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< int > Gtk::ComboBox::property_wrap_width | ( |  | ) | const

Wrap width for laying out the items in a grid.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

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

Sets the active item of combo_box to be the item at index.

Since gtkmm 2.4:

Parameters:

  index | An index in the model passed during construction, or -1 to have no active item.

void Gtk::ComboBox::set_active | ( | const TreeModel::iterator& | iter | ) |

Sets the current active item to be the one referenced by iter, or unsets the active item if iter is `0`.

Since gtkmm 2.4:

Parameters:

  iter | The Gtk::TreeIter, or `0`.

void Gtk::ComboBox::set_add_tearoffs | ( | bool | add_tearoffs = `true` | ) |

Sets whether the popup menu should have a tearoff menu item.

Since gtkmm 2.6:

Parameters:

  add_tearoffs | `true` to add tearoff menu items.

void Gtk::ComboBox::set_button_sensitivity | ( | SensitivityType | sensitivity | ) |

Sets whether the dropdown button of the combo box should be always sensitive (Gtk::SENSITIVITY_ON), never sensitive (Gtk::SENSITIVITY_OFF) or only if there is at least one item to display (Gtk::SENSITIVITY_AUTO).

Since gtkmm 2.14:

Parameters:

  sensitivity | Specify the sensitivity of the dropdown button.

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

Sets the column with column span information for combo_box to be column_span.

The column span column contains integers which indicate how many columns an item should span.

Since gtkmm 2.4:

Parameters:

  column_span | A column in the model passed during construction.

void Gtk::ComboBox::set_entry_text_column | ( | const TreeModelColumnBase& | text_column | ) | const

Sets the model column which combo_box should use to get strings from to be text_column.

The column text_column in the model of combo_box must be of type TYPE_STRING.

This is only relevant if combo_box has been created with Gtk::ComboBox::property_has_entry() as `true`.

Since gtkmm 2.24:

Parameters:

  text_column | A column in model to get the strings from for the internal entry.

void Gtk::ComboBox::set_entry_text_column | ( | int | text_column | ) |

Sets the model column which combo_box should use to get strings from to be text_column.

The column text_column in the model of combo_box must be of type TYPE_STRING.

This is only relevant if combo_box has been created with Gtk::ComboBox::property_has_entry() as `true`.

Since gtkmm 2.24:

Parameters:

  text_column | A column in model to get the strings from for the internal entry.

void Gtk::ComboBox::set_focus_on_click | ( | bool | focus_on_click = `true` | ) |

Sets whether the combo box will grab focus when it is clicked with the mouse.

Making mouse clicks not grab focus is useful in places like toolbars where you don't want the keyboard focus removed from the main area of the application.

Since gtkmm 2.6:

Parameters:

  focus_on_click | Whether the combo box grabs focus when clicked with the mouse.

void Gtk::ComboBox::set_id_column | ( | int | id_column | ) |

Sets the model column which combo_box should use to get string IDs for values from.

The column id_column in the model of combo_box must be of type TYPE_STRING.

Since gtkmm 3.0:

Parameters:

  id_column | A column in model to get string IDs for values from.

void Gtk::ComboBox::set_model | ( | const Glib::RefPtr< TreeModel >& | model | ) |

Sets the model used by combo_box to be model.

Will unset a previously set model (if applicable). Use unset_model() to unset the old model.

Note that this function does not clear the cell renderers, you have to call Gtk::CellLayout::clear() yourself if you need to set up different cell renderers for the new model.

Since gtkmm 2.4:

Parameters:

  model | A Gtk::TreeModel.

void Gtk::ComboBox::set_popup_fixed_width | ( | bool | fixed = `true` | ) |

Specifies whether the popup's width should be a fixed width matching the allocated width of the combo box.

Since gtkmm 3.0:

Parameters:

  fixed | Whether to use a fixed popup width.

void Gtk::ComboBox::set_row_separator_func | ( | const SlotRowSeparator& | slot | ) |

Sets the row separator function, which is used to determine whether a row should be drawn as a separator.

See also unset_row_separator_func().

Parameters:

  slot | The callback.

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

Sets the column with row span information for combo_box to be row_span.

The row span column contains integers which indicate how many rows an item should span.

Since gtkmm 2.4:

Parameters:

  row_span | A column in the model passed during construction.

void Gtk::ComboBox::set_title | ( | const Glib::ustring & | title | ) |

Sets the menu's title in tearoff mode.

Since gtkmm 2.10:

Parameters:

  title | A title for the menu in tearoff mode.

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

Sets the wrap width of combo_box to be width.

The wrap width is basically the preferred number of columns when you want the popup to be layed out in a table.

Since gtkmm 2.4:

Parameters:

  width | Preferred number of columns.

Glib::SignalProxy0< void > Gtk::ComboBox::signal_changed | ( |  | ) |

Slot Prototype:
  `void on_my_changed()`

The changed signal is emitted when the active item is changed. The can be due to the user selecting a different item from the list, or due to a call to Gtk::ComboBox::set_active_iter(). It will also be emitted while typing into the entry of a combo box with an entry.

Since gtkmm 2.4:

Glib::SignalProxy1< Glib::ustring,const TreeModel::Path& > Gtk::ComboBox::signal_format_entry_text | ( |  | ) |

Slot Prototype:
  `Glib::ustring on_my_format_entry_text(const TreeModel::Path& path)`

For combo boxes that are created with an entry (See GtkComboBox:has-entry).

A signal which allows you to change how the text displayed in a combo box's entry is displayed.

Connect a signal handler which returns an allocated string representing path. That string will then be used to set the text in the combo box's entry. The default signal handler uses the text from the GtkComboBox::entry-text-column model column.

Here's an example signal handler which fetches data from the model and displays it in the entry.

[C example ellipted]

Since gtkmm 3.4:

Parameters:

  path | The GtkTreePath string from the combo box's current model to format text for.

Returns:
  A newly allocated string representing path for the current GtkComboBox model.

void Gtk::ComboBox::unset_active | ( |  | ) |

Causes no item to be active.

See also set_active().

void Gtk::ComboBox::unset_model | ( |  | ) |

Remove the model from the ComboBox.

See also:
  set_model().

Since gtkmm 2.16:

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

Causes no separators to be drawn.

## Friends And Related Function Documentation

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

A Glib::wrap() method for this object.

Parameters:

  object | The C instance.
  take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns:
  A C++ instance that wraps this C instance.

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

- gtkmm/combobox.h