| 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 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/cellrenderertext.h> |
| 18 |
//#include <gtkmm/treemodel.h> |
| 19 |
|
| 20 |
_DEFS(gtkmm,gtk) |
| 21 |
_PINCLUDE(gtkmm/private/cellrenderertext_p.h) |
| 22 |
|
| 23 |
namespace Gtk |
| 24 |
{ |
| 25 |
|
| 26 |
/** Renders a spin button in a cell. |
| 27 |
* |
| 28 |
* Gtk::CellRendererSpin renders text in a cell like Gtk::CellRendererText, |
| 29 |
* from which it is derived. But while Gtk::CellRendererText offers a simple |
| 30 |
* entry to edit the text, Gtk::CellRendererSpin offers a Gtk::SpinButton widget. |
| 31 |
* Of course, that means that the text must be parseable as a floating point |
| 32 |
* number. |
| 33 |
* |
| 34 |
* The range of the spinbutton is taken from the adjustment property of the |
| 35 |
* cell renderer, which can be set explicitly or mapped to a column in |
| 36 |
* the tree model, like all properties of cell renders. Gtk::CellRendererSpin |
| 37 |
* also has properties for the climb rate and the number of digits to display. |
| 38 |
* Other Gtk::SpinButton properties can be set in a handler for the start-editing |
| 39 |
* signal. |
| 40 |
* |
| 41 |
* @ingroup TreeView |
| 42 |
* @newin{2,12} |
| 43 |
*/ |
| 44 |
class GTKMM_API CellRendererSpin : public CellRendererText |
| 45 |
{ |
| 46 |
_CLASS_GTKOBJECT(CellRendererSpin, GtkCellRendererSpin, GTK_CELL_RENDERER_SPIN, Gtk::CellRendererText, GtkCellRendererText, , , GTKMM_API) |
| 47 |
public: |
| 48 |
|
| 49 |
_CTOR_DEFAULT |
| 50 |
|
| 51 |
_WRAP_PROPERTY("adjustment", Glib::RefPtr<Adjustment>) |
| 52 |
_WRAP_PROPERTY("climb_rate", double) |
| 53 |
_WRAP_PROPERTY("digits", guint) |
| 54 |
|
| 55 |
Glib::PropertyProxy_Base _property_renderable() override; |
| 56 |
}; |
| 57 |
|
| 58 |
} // namespace Gtk |