A text entry field with a dropdown list. More...
Inherits Gtk::ComboBox.
Inherited by Gtk::ComboBoxEntryText.
Public Member Functions | |
virtual | ~ComboBoxEntry () |
GtkComboBoxEntry* | gobj () |
Provides access to the underlying C GtkObject. | |
const GtkComboBoxEntry* | gobj () const |
Provides access to the underlying C GtkObject. | |
ComboBoxEntry () | |
ComboBoxEntry (const Glib::RefPtr< TreeModel >& model, const TreeModelColumnBase& text_column) | |
Creates a new ComboBoxEntry which has an Entry as child and a list of strings as popup. | |
ComboBoxEntry (const Glib::RefPtr< TreeModel >& model, int text_column=0) | |
Creates a new ComboBoxEntry which has an Entry as child and a list of strings as popup. | |
void | set_text_column (const TreeModelColumnBase& text_column) const |
Sets the model column which entry_box should use to get strings from to be text_column. | |
void | set_text_column (int text_column) const |
Sets the model column which entry_box should use to get strings from to be text_column. | |
int | get_text_column () const |
Returns the column which entry_box is using to get the strings from. | |
Glib::ustring | get_active_text () const |
Returns the currently active string. | |
Entry* | get_entry () |
const Entry* | get_entry () const |
Related Functions | |
(Note that these are not member functions.) | |
Gtk::ComboBoxEntry* | wrap (GtkComboBoxEntry* object, bool take_copy=false) |
A Glib::wrap() method for this object. |
A text entry field with a dropdown list.
A ComboBoxEntry is a widget that allows the user to choose from a list of valid choices or enter a different value. It is very similar to a ComboBox, but it displays the selected value in an entry to allow modifying it.
In contrast to a ComboBox, the underlying model of a ComboBoxEntry must always have a text column (see set_text_column()), and the entry will show the content of the text column in the selected row. To get the text from the entry, use get_active_text().
The changed signal will be emitted while typing into a ComboBoxEntry, as well as when selecting an item from the ComboBoxEntry's list. Use get_active() to discover whether an item was actually selected from the list.
See also ComboBoxEntryText, which is specialised for a single text column.
To add and remove strings from the list, just modify the model using its data manipulation API. You can get the Entry by using get_child().
If you have special needs that go beyond a simple entry (e.g. input validation), it is possible to replace the child entry by a different widget using Gtk::Container::remove() and Gtk::Container::add().
The ComboBoxEntry widget looks like this:
virtual Gtk::ComboBoxEntry::~ComboBoxEntry | ( | ) | [virtual] |
Gtk::ComboBoxEntry::ComboBoxEntry | ( | ) |
Gtk::ComboBoxEntry::ComboBoxEntry | ( | const Glib::RefPtr< TreeModel >& | model, | |
const TreeModelColumnBase& | text_column | |||
) | [explicit] |
Creates a new ComboBoxEntry which has an Entry as child and a list of strings as popup.
You can get the Entry from a ComboBoxEntry using get_entry(). To add and remove strings from the list, just modify model using its data manipulation API.
model | A TreeModel. | |
text_column | A column in model to get the strings from. |
Gtk::ComboBoxEntry::ComboBoxEntry | ( | const Glib::RefPtr< TreeModel >& | model, | |
int | text_column = 0 | |||
) | [explicit] |
Creates a new ComboBoxEntry which has an Entry as child and a list of strings as popup.
You can get the Entry from a ComboBoxEntry using get_entry(). To add and remove strings from the list, just modify model using its data manipulation API.
model | A TreeModel. | |
text_column | A column in model to get the strings from. |
Glib::ustring Gtk::ComboBoxEntry::get_active_text | ( | ) | const |
Returns the currently active string.
Reimplemented in Gtk::ComboBoxEntryText.
const Entry* Gtk::ComboBoxEntry::get_entry | ( | ) | const |
Entry* Gtk::ComboBoxEntry::get_entry | ( | ) |
int Gtk::ComboBoxEntry::get_text_column | ( | ) | const |
Returns the column which entry_box is using to get the strings from.
const GtkComboBoxEntry* Gtk::ComboBoxEntry::gobj | ( | ) | const [inline] |
Provides access to the underlying C GtkObject.
Reimplemented from Gtk::ComboBox.
GtkComboBoxEntry* Gtk::ComboBoxEntry::gobj | ( | ) | [inline] |
Provides access to the underlying C GtkObject.
Reimplemented from Gtk::ComboBox.
void Gtk::ComboBoxEntry::set_text_column | ( | int | text_column | ) | const |
Sets the model column which entry_box should use to get strings from to be text_column.
text_column | A column in model to get the strings from. |
void Gtk::ComboBoxEntry::set_text_column | ( | const TreeModelColumnBase& | text_column | ) | const |
Sets the model column which entry_box should use to get strings from to be text_column.
text_column | A column in model to get the strings from. |
Gtk::ComboBoxEntry* wrap | ( | GtkComboBoxEntry * | object, | |
bool | take_copy = false | |||
) | [related] |
A Glib::wrap() method for this object.
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. |