gtkmm 2.24.2
Public Member Functions | Related Functions

Gtk::ComboBoxEntry Class Reference

A text entry field with a dropdown list. More...

Inheritance diagram for Gtk::ComboBoxEntry:
Inheritance graph
[legend]
Collaboration diagram for Gtk::ComboBoxEntry:
Collaboration graph
[legend]

List of all members.

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.
Entryget_entry ()
const Entryget_entry () const
Glib::PropertyProxy< int > property_text_column ()
 A column in the data source model to get the strings from.
Glib::PropertyProxy_ReadOnly< int > property_text_column () const
 A column in the data source model to get the strings from.

Related Functions

(Note that these are not member functions.)
Gtk::ComboBoxEntrywrap (GtkComboBoxEntry* object, bool take_copy=false)
 A Glib::wrap() method for this object.

Detailed Description

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:

comboboxentry1.png
Deprecated:
Instead use ComboBox with has_entry = true.

Constructor & Destructor Documentation

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.

Parameters:
modelA TreeModel.
text_columnA 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.

Parameters:
modelA TreeModel.
text_columnA column in model to get the strings from.

Member Function Documentation

Glib::ustring Gtk::ComboBoxEntry::get_active_text ( ) const

Returns the currently active string.

Returns:
The currently active text.
Since gtkmm 2.14:

Reimplemented in Gtk::ComboBoxEntryText.

const Entry* Gtk::ComboBoxEntry::get_entry ( ) const
See also:
Bin::get_child().

Reimplemented from Gtk::ComboBox.

Entry* Gtk::ComboBoxEntry::get_entry ( )
See also:
Bin::get_child().

Reimplemented from Gtk::ComboBox.

int Gtk::ComboBoxEntry::get_text_column ( ) const

Returns the column which entry_box is using to get the strings from.

Since gtkmm 2.4:

Deprecated: 2.24: Use get_entry_text_column() instead

Returns:
A column in the data source model of entry_box.
GtkComboBoxEntry* Gtk::ComboBoxEntry::gobj ( ) [inline]

Provides access to the underlying C GtkObject.

Reimplemented from Gtk::ComboBox.

const GtkComboBoxEntry* Gtk::ComboBoxEntry::gobj ( ) const [inline]

Provides access to the underlying C GtkObject.

Reimplemented from Gtk::ComboBox.

Glib::PropertyProxy_ReadOnly<int> Gtk::ComboBoxEntry::property_text_column ( ) const

A column in the data source model to get the strings from.

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::ComboBoxEntry::property_text_column ( )

A column in the data source model to get the strings from.

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::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.

Since gtkmm 2.4:

Deprecated: 2.24: Use set_entry_text_column() instead

Parameters:
text_columnA column in model to get the strings from.
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.

Since gtkmm 2.4:

Deprecated: 2.24: Use set_entry_text_column() instead

Parameters:
text_columnA column in model to get the strings from.

Friends And Related Function Documentation

Gtk::ComboBoxEntry* wrap ( GtkComboBoxEntry *  object,
bool  take_copy = false 
) [related]

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

Parameters:
objectThe C instance.
take_copyFalse 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: