add new sigc++2 directory
[ardour.git] / libs / gtkmm2 / gtk / src / spinbutton.hg
1 /* $Id: spinbutton.hg,v 1.4 2006/07/19 15:35:02 murrayc Exp $ */
2
3 /* Copyright (C) 1998-2002 The gtkmm Development Team
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the Free
17  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */
19
20 #include <gtkmm/entry.h>
21 #include <gtkmm/editable.h>
22
23 _DEFS(gtkmm,gtk)
24 _PINCLUDE(gtkmm/private/entry_p.h)
25
26
27 namespace Gtk
28 {
29
30 _CC_INCLUDE(gtk/gtktypebuiltins.h)
31 _WRAP_ENUM(SpinButtonUpdatePolicy, GtkSpinButtonUpdatePolicy)
32 _WRAP_ENUM(SpinType, GtkSpinType)
33
34 /** @ingroup gtkmmEnums */
35 enum { INPUT_ERROR = -1 };
36
37 class Adjustment;
38
39 /** numeric Entry with up/down buttons
40  * Slightly misnamed, this should be called a SpinEntry.
41  *
42  * @ingroup Widgets
43  */
44 class SpinButton : public Entry
45 {
46   _CLASS_GTKOBJECT(SpinButton,GtkSpinButton,GTK_SPIN_BUTTON,Gtk::Entry,GtkEntry)
47   _IMPLEMENTS_INTERFACE(Editable)
48 public:
49
50   //: create instance
51   // adjustment: see Gtk::Adjustment
52   // climb_rate:
53   // digits: number of decimal digits (has to be < 6)
54   SpinButton(double climb_rate = 0.0, guint digits = 0);
55   _WRAP_CTOR(SpinButton(Adjustment& adjustment, double climb_rate = 0.0, guint digits = 0), gtk_spin_button_new)
56
57
58   _WRAP_METHOD(void configure(Adjustment& adjustment, double climb_rate, guint digits), gtk_spin_button_configure)
59
60   _WRAP_METHOD(void set_adjustment(Adjustment& adjustment), gtk_spin_button_set_adjustment)
61   void unset_adjustment();
62   _WRAP_METHOD(Gtk::Adjustment* get_adjustment(), gtk_spin_button_get_adjustment)
63   _WRAP_METHOD(const Gtk::Adjustment* get_adjustment() const, gtk_spin_button_get_adjustment, constversion)
64
65   _WRAP_METHOD(void set_digits(guint digits), gtk_spin_button_set_digits)
66   _WRAP_METHOD(guint get_digits() const, gtk_spin_button_get_digits)
67
68   _WRAP_METHOD(void set_increments(double step, double page), gtk_spin_button_set_increments)
69   _WRAP_METHOD(void get_increments(double& step, double& page) const, gtk_spin_button_get_increments)
70
71   _WRAP_METHOD(void set_range(double min, double max), gtk_spin_button_set_range)
72   _WRAP_METHOD(void get_range(double& min, double& max) const, gtk_spin_button_get_range)
73
74   _WRAP_METHOD(double get_value() const, gtk_spin_button_get_value)
75   _WRAP_METHOD(int get_value_as_int() const, gtk_spin_button_get_value_as_int)
76   _WRAP_METHOD(void set_value(double value), gtk_spin_button_set_value)
77
78   _WRAP_METHOD(void set_update_policy(SpinButtonUpdatePolicy policy), gtk_spin_button_set_update_policy)
79   _WRAP_METHOD(SpinButtonUpdatePolicy get_update_policy() const, gtk_spin_button_get_update_policy)
80
81   _WRAP_METHOD(void set_numeric(bool numeric = true), gtk_spin_button_set_numeric)
82   _WRAP_METHOD(bool get_numeric() const, gtk_spin_button_get_numeric)
83
84   _WRAP_METHOD(void spin(SpinType direction, double increment), gtk_spin_button_spin)
85
86   _WRAP_METHOD(void set_wrap(bool wrap = true), gtk_spin_button_set_wrap)
87   _WRAP_METHOD(bool get_wrap() const, gtk_spin_button_get_wrap)
88
89   _WRAP_METHOD(void set_snap_to_ticks(bool snap_to_ticks = true), gtk_spin_button_set_snap_to_ticks)
90   _WRAP_METHOD(bool get_snap_to_ticks() const, gtk_spin_button_get_snap_to_ticks)
91
92   _WRAP_METHOD(void update(), gtk_spin_button_update)
93
94   /** Convert the Entry text to a number.
95    * The computed number should be written to <tt>*new_value</tt>.
96    * @return
97    * @li <tt>false</tt>: No conversion done, continue with default handler.
98    * @li <tt>true</tt>: Conversion successful, don't call default handler.
99    * @li <tt>Gtk::INPUT_ERROR</tt>: Conversion failed, don't call default handler.
100    */
101   _WRAP_SIGNAL(int input(double* new_value), "input")
102
103   /** Convert the Adjustment position to text.
104    * The computed text should be written via Gtk::Entry::set_text().
105    * @return
106    * @li <tt>false</tt>: No conversion done, continue with default handler.
107    * @li <tt>true</tt>: Conversion successful, don't call default handler.
108    */
109   _WRAP_SIGNAL(bool output(), "output")
110
111   _WRAP_SIGNAL(bool wrapped(), "wrapped", no_default_handler)
112
113   _WRAP_SIGNAL(void value_changed(), "value_changed")
114
115   //Keybinding signals:
116   _IGNORE_SIGNAL("change_value")
117
118   _WRAP_PROPERTY("adjustment", Gtk::Adjustment*)
119   _WRAP_PROPERTY("climb-rate", double)
120   _WRAP_PROPERTY("digits", guint)
121   _WRAP_PROPERTY("snap-to-ticks", bool)
122   _WRAP_PROPERTY("numeric", bool)
123   _WRAP_PROPERTY("wrap", bool)
124   _WRAP_PROPERTY("update-policy", SpinButtonUpdatePolicy)
125   _WRAP_PROPERTY("value", double)
126 };
127
128 } // namespace Gtk
129