Install ardour as a binary, a script and a set of shared
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / comboboxtext.h
1 // -*- c++ -*-
2 #ifndef _GTKMM_COMBOBOXTEXT_H
3 #define _GTKMM_COMBOBOXTEXT_H
4
5 /* comboboxtext.h
6  * 
7  * Copyright (C) 2003 The gtkmm Development Team
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Library General Public
11  * License as published by the Free Software Foundation; either
12  * version 2 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Library General Public License for more details.
18  *
19  * You should have received a copy of the GNU Library General Public
20  * License along with this library; if not, write to the Free
21  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22  */
23
24 #include <gtkmm/combobox.h>
25
26 namespace Gtk
27 {
28
29 //This is a C++ convenience class that is equivalent to the gtk_combo_box_new_text() C convenience function.
30
31 /** This is a specialisation of the ComboBox which has one column of text (a simple list),
32  * and appropriate methods for setting and getting the text.
33  *
34  * Note that you can not use this class with Gnome::Glade::Xml::get_widget_derived() to wrap a GtkComboBox added 
35  * in the Glade user interface designer, because Glade adds its own TreeModel instead of using the TreeModel from 
36  * this class. You could use a normal Gtk::ComboBox instead, though you can not use Glade to add rows to a TreeModel 
37  * that is defined in your C++ code.
38  *
39  * @ingroup Widgets
40  */
41
42 class ComboBoxText
43 : public ComboBox
44 {
45 #ifndef DOXYGEN_SHOULD_SKIP_THIS
46 private:
47   // noncopyable
48   ComboBoxText(const ComboBoxText&);
49   ComboBoxText& operator=(const ComboBoxText&);
50
51 protected:
52   explicit ComboBoxText(const Glib::ConstructParams& construct_params);
53   explicit ComboBoxText(GtkComboBox* castitem);
54
55 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
56
57 public:
58   ComboBoxText();
59   
60   void append_text(const Glib::ustring& text);
61   
62   void insert_text(int position, const Glib::ustring& text);
63   
64   void prepend_text(const Glib::ustring& text);
65
66   Glib::ustring get_active_text() const;
67   void set_active_text(const Glib::ustring& text);
68
69   void clear();
70
71 protected:
72
73   //Tree model columns:
74   //These columns are used by the model that is created by the default constructor
75   class TextModelColumns : public Gtk::TreeModel::ColumnRecord
76   {
77   public:
78     TextModelColumns()
79     { add(m_column); }
80
81     Gtk::TreeModelColumn<Glib::ustring> m_column;
82   };
83
84   TextModelColumns m_text_columns;
85 };
86
87
88 } // namespace Gtk
89
90
91 #endif /* _GTKMM_COMBOBOXTEXT_H */
92