Merged revisions 6293,6296-6306,6308 via svnmerge from
[ardour.git] / libs / gtkmm2 / gtk / src / cellrendererspin.hg
1 /* Copyright (C) 2006 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 Library General Public
5  * License as published by the Free Software Foundation; either
6  * version 2 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  * Library General Public License for more details.
12  *
13  * You should have received a copy of the GNU Library General Public
14  * License along with this library; if not, write to the Free
15  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
16  */
17
18 #include <gtkmm/cellrenderertext.h>
19 //#include <gtkmm/treemodel.h>
20
21 _DEFS(gtkmm,gtk)
22 _PINCLUDE(gtkmm/private/cellrenderertext_p.h)
23
24 namespace Gtk
25 {
26
27 /**  Renders a spin button in a cell.
28  *
29  * Gtk::CellRendererSpin renders text in a cell like Gtk::CellRendererText, 
30  * from which it is derived. But while Gtk::CellRendererText offers a simple 
31  * entry to edit the text, Gtk::CellRendererSpin offers a Gtk::SpinButton widget. 
32  * Of course, that means that the text must be parseable as a floating point 
33  * number.
34  *
35  * The range of the spinbutton is taken from the adjustment property of the 
36  * cell renderer, which can be set explicitly or mapped to a column in 
37  * the tree model, like all properties of cell renders. Gtk::CellRendererSpin 
38  * also has properties for the climb rate and the number of digits to display. 
39  * Other Gtk::SpinButton properties can be set in a handler for the start-editing
40  * signal. 
41  *
42  * @ingroup TreeView
43  * @newin2p12
44  */
45 class CellRendererSpin : public CellRendererText
46 {
47   _CLASS_GTKOBJECT(CellRendererSpin, GtkCellRendererSpin, GTK_CELL_RENDERER_SPIN, Gtk::CellRendererText, GtkCellRendererText)
48 public:
49
50   _CTOR_DEFAULT
51   
52   _WRAP_PROPERTY("adjustment", Gtk::Adjustment*)
53   _WRAP_PROPERTY("climb_rate", double)
54   _WRAP_PROPERTY("digits", guint)
55
56 #ifdef GLIBMM_PROPERTIES_ENABLED
57   virtual Glib::PropertyProxy_Base _property_renderable(); //override
58 #endif //GLIBMM_PROPERTIES_ENABLED
59 };
60
61 } // namespace Gtk