# Gtk::ComboBoxText Class Reference
Widgets

This is a specialisation of the ComboBox which has one column of text (a simple list), and appropriate methods for setting and getting the text. More...

Inheritance diagram for Gtk::ComboBoxText:
[legend]
Collaboration diagram for Gtk::ComboBoxText:
[legend]

List of all members.

## Classes

class | TextModelColumns

## Public Member Functions

| ComboBoxText ()
| Creates a new empty ComboBoxText, without an entry.
| ComboBoxText (bool has_entry)
| Creates a new empty ComboBoxText, optionally with an entry.
void | append (const Glib::ustring& text)
| Add an item to the end of the drop-down list.
void | insert (int position, const Glib::ustring& text)
void | prepend (const Glib::ustring& text)
| Add an item to the beginning of the drop-down list.
void | append_text (const Glib::ustring& text)
| Add an item to the end of the drop-down list.
void | insert_text (int position, const Glib::ustring& text)
void | prepend_text (const Glib::ustring& text)
| Add an item to the beginning of the drop-down list.
void | clear_items ()
| Remove all items from the drop-down menu.
Glib::ustring | get_active_text () const
| Get the currently-chosen item.
void | set_active_text (const Glib::ustring& text)
| Set the currently-chosen item if it matches the specified text.
void | clear ()
void | remove_all ()
| Remove all items from the drop-down menu.
void | remove_text (const Glib::ustring& text)
| Remove the specified item if it is in the drop-down menu.

## Protected Attributes

TextModelColumns | m_text_columns

## Detailed Description

This is a specialisation of the ComboBox which has one column of text (a simple list), and appropriate methods for setting and getting the text.

You should not call set_model() or attempt to pack more cells into this combo box via its CellLayout base class.

Note that you cannot use this class with Gnome::Glade::Xml::get_widget_derived() to wrap a GtkComboBox added in the Glade user interface designer, because Glade adds its own TreeModel instead of using the TreeModel from this class. You could use a normal Gtk::ComboBox instead, though you can not use Glade to add rows to a TreeModel that is defined in your C++ code.

## Constructor & Destructor Documentation

Gtk::ComboBoxText::ComboBoxText | ( |  | ) |

Creates a new empty ComboBoxText, without an entry.

Gtk::ComboBoxText::ComboBoxText | ( | bool | has_entry | ) | `[explicit]`

Creates a new empty ComboBoxText, optionally with an entry.

Parameters:

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

## Member Function Documentation

void Gtk::ComboBoxText::append | ( | const Glib::ustring & | text | ) |

Add an item to the end of the drop-down list.

Parameters:

  text | The text for the item.

void Gtk::ComboBoxText::append_text | ( | const Glib::ustring & | text | ) |

Add an item to the end of the drop-down list.

Parameters:

  text | The text for the item.

Deprecated:
  Use append().

void Gtk::ComboBoxText::clear | ( |  | ) |

Deprecated:
  Use remove_all(). Since 2.8.

Reimplemented from Gtk::CellLayout.

void Gtk::ComboBoxText::clear_items | ( |  | ) |

Remove all items from the drop-down menu.

Deprecated:
  Use remove_all().

Glib::ustring Gtk::ComboBoxText::get_active_text | ( |  | ) | const

Get the currently-chosen item.

Returns:
  The text of the active item.

void Gtk::ComboBoxText::insert | ( | int | position,
|  | const Glib::ustring & | text
| ) |  |

void Gtk::ComboBoxText::insert_text | ( | int | position,
|  | const Glib::ustring & | text
| ) |  |

Deprecated:
  Use insert().

void Gtk::ComboBoxText::prepend | ( | const Glib::ustring & | text | ) |

Add an item to the beginning of the drop-down list.

Parameters:

  text | The text for the item.

void Gtk::ComboBoxText::prepend_text | ( | const Glib::ustring & | text | ) |

Add an item to the beginning of the drop-down list.

Parameters:

  text | The text for the item.

Deprecated:
  Use prepend().

void Gtk::ComboBoxText::remove_all | ( |  | ) |

Remove all items from the drop-down menu.

void Gtk::ComboBoxText::remove_text | ( | const Glib::ustring & | text | ) |

Remove the specified item if it is in the drop-down menu.

The text of the item that should be removed.

void Gtk::ComboBoxText::set_active_text | ( | const Glib::ustring & | text | ) |

Set the currently-chosen item if it matches the specified text.

The text of the item that should be selected.

## Member Data Documentation

TextModelColumns Gtk::ComboBoxText::m_text_columns`[protected]`

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

- gtkmm/comboboxtext.h