Debian Codegraph @

gtk/src/hvscale.ccg

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/adjustment.h>
18
19 #include <gtk/gtk.h>
20 #include <math.h>
21 #include <cstring> //For strlen()
22 #include <memory>
23
24 using std::strlen;
25
26 namespace Gtk
27 {
28
29 VScale::VScale(double min, double max, double step)
30 :
31 _CONSTRUCT_SPECIFIC(Scale, VScale)
32 {
33 auto adjustment = Adjustment::create(min, min, max, step, 10 * step, step);
34 set_adjustment(adjustment);
35
36 set_digits( calc_digits_(step) );
37 }
38
39 VScale::VScale(const Glib::RefPtr<Adjustment>& adjustment)
40 :
41 _CONSTRUCT_SPECIFIC(Scale, VScale)
42 {
43 set_adjustment(adjustment);
44 }
45
46 VScale::VScale()
47 :
48 _CONSTRUCT_SPECIFIC(Scale, VScale)
49 {
50 auto adjustment = Adjustment::create(0.0, 0.0, 0.0,
51 0.0, 0.0, 0.0);
52 set_adjustment(adjustment);
53 }
54
55 HScale::HScale(double min, double max, double step)
56 :
57 _CONSTRUCT_SPECIFIC(Scale, HScale)
58 {
59 auto adjustment = Adjustment::create(min, min, max, step, 10 * step, step);
60 set_adjustment(adjustment);
61
62 set_digits( calc_digits_(step) );
63 }
64
65 HScale::HScale()
66 :
67 _CONSTRUCT_SPECIFIC(Scale, HScale)
68 {
69 auto adjustment = Adjustment::create(0.0, 0.0, 0.0,
70 0.0, 0.0, 0.0);
71 set_adjustment(adjustment);
72 }
73
74 HScale::HScale(const Glib::RefPtr<Adjustment>& adjustment)
75 :
76 _CONSTRUCT_SPECIFIC(Scale, HScale)
77 {
78 set_adjustment(adjustment);
79 }
80
81 } // namespace Gtk