Debian Codegraph @

gtk/src/comboboxtext.hg

raw
1 /* Copyright (C) 2010 The gtkmm Development Team
2 *
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public
5 * License as published by the Free Software Foundation; either
6 * version 2.1 of the License, or (at your option) any later version.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, see <https://www.gnu.org/licenses/>.
15 */
16
17 #include <gtkmm/combobox.h>
18
19 _DEFS(gtkmm,gtk)
20 _PINCLUDE(gtkmm/private/combobox_p.h)
21
22
23 namespace Gtk
24 {
25
26 /** This is a simple variant of ComboBox that hides the model-view complexity for simple text-only use cases.
27 * You can add items to a ComboBoxText with append(), insert() or prepend() and remove items with remove_text().
28 *
29 * If the ComboBoxText contains an entry (via the 'has_entry' property), its contents can be retrieved using
30 * get_active_text(). The entry itself can be accessed by calling ComboBox::get_entry() or ComboBox::get_entry_text().
31 *
32 * You should not call set_model() or attempt to pack more cells into this combo box via its CellLayout base class.
33 *
34 * @ingroup Widgets
35 */
36 class GTKMM_API ComboBoxText
37 : public ComboBox
38 {
39 _CLASS_GTKOBJECT(ComboBoxText, GtkComboBoxText, GTK_COMBO_BOX_TEXT, ComboBox, GtkComboBox, , , GTKMM_API)
40 public:
41
42 /** Creates a new empty ComboBoxText, optionally with an entry.
43 * @param has_entry If this is true then this will have an Entry widget.
44 */
45 explicit ComboBoxText(bool has_entry = false);
46 _IGNORE(gtk_combo_box_text_new_with_entry)
47
48 _WRAP_METHOD(void append(const Glib::ustring& text), gtk_combo_box_text_append_text)
49 _WRAP_METHOD(void append(const Glib::ustring& id, const Glib::ustring& text), gtk_combo_box_text_append)
50 _WRAP_METHOD(void insert(int position, const Glib::ustring& text), gtk_combo_box_text_insert_text)
51 _WRAP_METHOD(void insert(int position, const Glib::ustring& id, const Glib::ustring& text), gtk_combo_box_text_insert)
52 _WRAP_METHOD(void prepend(const Glib::ustring& text), gtk_combo_box_text_prepend_text)
53 _WRAP_METHOD(void prepend(const Glib::ustring& id, const Glib::ustring& text), gtk_combo_box_text_prepend)
54
55 _WRAP_METHOD(void remove_text(int position), gtk_combo_box_text_remove)
56 _WRAP_METHOD(Glib::ustring get_active_text() const, gtk_combo_box_text_get_active_text)
57
58 _WRAP_METHOD(void remove_all(), gtk_combo_box_text_remove_all)
59
60 //TODO: Add a C function?
61 void set_active_text(const Glib::ustring& text);
62 };
63
64 } // namespace Gtk