/* Copyright (C) 2010 The gtkmm Development Team * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see . */ #include _DEFS(gtkmm,gtk) _PINCLUDE(gtkmm/private/combobox_p.h) namespace Gtk { /** This is a simple variant of ComboBox that hides the model-view complexity for simple text-only use cases. * You can add items to a ComboBoxText with append(), insert() or prepend() and remove items with remove_text(). * * If the ComboBoxText contains an entry (via the 'has_entry' property), its contents can be retrieved using * get_active_text(). The entry itself can be accessed by calling ComboBox::get_entry() or ComboBox::get_entry_text(). * * You should not call set_model() or attempt to pack more cells into this combo box via its CellLayout base class. * * @ingroup Widgets */ class GTKMM_API ComboBoxText : public ComboBox { _CLASS_GTKOBJECT(ComboBoxText, GtkComboBoxText, GTK_COMBO_BOX_TEXT, ComboBox, GtkComboBox, , , GTKMM_API) public: /** Creates a new empty ComboBoxText, optionally with an entry. * @param has_entry If this is true then this will have an Entry widget. */ explicit ComboBoxText(bool has_entry = false); _IGNORE(gtk_combo_box_text_new_with_entry) _WRAP_METHOD(void append(const Glib::ustring& text), gtk_combo_box_text_append_text) _WRAP_METHOD(void append(const Glib::ustring& id, const Glib::ustring& text), gtk_combo_box_text_append) _WRAP_METHOD(void insert(int position, const Glib::ustring& text), gtk_combo_box_text_insert_text) _WRAP_METHOD(void insert(int position, const Glib::ustring& id, const Glib::ustring& text), gtk_combo_box_text_insert) _WRAP_METHOD(void prepend(const Glib::ustring& text), gtk_combo_box_text_prepend_text) _WRAP_METHOD(void prepend(const Glib::ustring& id, const Glib::ustring& text), gtk_combo_box_text_prepend) _WRAP_METHOD(void remove_text(int position), gtk_combo_box_text_remove) _WRAP_METHOD(Glib::ustring get_active_text() const, gtk_combo_box_text_get_active_text) _WRAP_METHOD(void remove_all(), gtk_combo_box_text_remove_all) //TODO: Add a C function? void set_active_text(const Glib::ustring& text); }; } // namespace Gtk