382414fb0029b8050385cc978804d87f9337a699
1 /* Glom
2 *
3 * Copyright (C) 2001-2004 Murray Cumming
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2 of the
8 * License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public
16 * License along with this program; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
19 */
21 #ifndef GLOM_MODE_DESIGN_COMBO_TEXTGLADE_HH
22 #define GLOM_MODE_DESIGN_COMBO_TEXTGLADE_HH
24 #include <gtkmm/combobox.h>
26 #include <gtkmm/liststore.h>
28 /** This class should just derive from Gtk::ComboBoxText and provide a
29 * constuctor suitable for libglade's get_widget_derived() template.
30 * However, I have reimplemented Gtk::ComboBoxText here temporarily,
31 * until the fixes in gtkmm 2.4.3 are widely available.
32 */
33 class ComboText : public Gtk::ComboBox
34 {
35 public:
36 ComboText();
37 virtual ~ComboText();
39 void append_text(const Glib::ustring& text);
40 void insert_text(int position, const Glib::ustring& text);
41 void prepend_text(const Glib::ustring& text);
42 Glib::ustring get_active_text() const;
44 //This is not part of ComboBoxText:
45 void clear_text();
46 void set_active_text(const Glib::ustring& text);
48 protected:
50 //Tree model columns:
51 //These columns are used by the model that is created by the default constructor
52 class TextModelColumns : public Gtk::TreeModel::ColumnRecord
53 {
54 public:
55 TextModelColumns()
56 { add(m_column); }
58 Gtk::TreeModelColumn<Glib::ustring> m_column;
59 };
61 TextModelColumns m_text_columns;
62 Glib::RefPtr<Gtk::ListStore> m_model;
64 };
66 #endif //GLOM_MODE_DESIGN_COMBO_TEXTGLADE_HH