Debian Codegraph @

gtk/src/spinbutton.hg

raw
1 /* Copyright (C) 1998-2002 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/entry.h>
18 #include <gtkmm/editable.h>
19
20 _DEFS(gtkmm,gtk)
21 _PINCLUDE(gtkmm/private/entry_p.h)
22
23
24 namespace Gtk
25 {
26
27 _CC_INCLUDE(gtk/gtk.h)
28 _WRAP_ENUM(SpinButtonUpdatePolicy, GtkSpinButtonUpdatePolicy, decl_prefix GTKMM_API)
29 _WRAP_ENUM(SpinType, GtkSpinType, decl_prefix GTKMM_API)
30
31 /** @ingroup gtkmmEnums */
32 enum { INPUT_ERROR = -1 };
33
34 class GTKMM_API Adjustment;
35
36 /** numeric Entry with up/down buttons
37 * Slightly misnamed, this should be called a SpinEntry.
38 *
39 * The SpinButton widget looks like this:
40 * @image html spinbutton1.png
41 *
42 * @ingroup Widgets
43 */
44 class GTKMM_API SpinButton : public Entry
45 {
46 _CLASS_GTKOBJECT(SpinButton,GtkSpinButton,GTK_SPIN_BUTTON,Gtk::Entry,GtkEntry,,,GTKMM_API)
47 public:
48
49 //TODO: This constructor should be implicit
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(const Glib::RefPtr<Adjustment>& adjustment, double climb_rate = 0.0, guint digits = 0), gtk_spin_button_new)
56
57
58 _WRAP_METHOD(void configure(const Glib::RefPtr<Adjustment>& adjustment, double climb_rate, guint digits), gtk_spin_button_configure)
59
60 _WRAP_METHOD(void set_adjustment(const Glib::RefPtr<Adjustment>& adjustment), gtk_spin_button_set_adjustment)
61 void unset_adjustment();
62 _WRAP_METHOD(Glib::RefPtr<Adjustment> get_adjustment(), gtk_spin_button_get_adjustment, refreturn)
63 _WRAP_METHOD(Glib::RefPtr<const Adjustment> get_adjustment() const, gtk_spin_button_get_adjustment, refreturn, 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 _WRAP_SIGNAL(int input(double* new_value), "input")
95 _WRAP_SIGNAL(bool output(), "output")
96 _WRAP_SIGNAL(void wrapped(), "wrapped")
97 _WRAP_SIGNAL(void value_changed(), "value_changed")
98
99 //Keybinding signals:
100 _IGNORE_SIGNAL("change_value")
101
102 _WRAP_PROPERTY("adjustment", Glib::RefPtr<Adjustment>)
103 _WRAP_PROPERTY("climb-rate", double)
104 _WRAP_PROPERTY("digits", guint)
105 _WRAP_PROPERTY("snap-to-ticks", bool)
106 _WRAP_PROPERTY("numeric", bool)
107 _WRAP_PROPERTY("wrap", bool)
108 _WRAP_PROPERTY("update-policy", SpinButtonUpdatePolicy)
109 _WRAP_PROPERTY("value", double)
110 };
111
112 } // namespace Gtk