~centralelyon2010/inkscape/imagelinks2

« back to all changes in this revision

Viewing changes to src/ui/widget/scalar.cpp

  • Committer: JazzyNico
  • Date: 2011-08-29 20:25:30 UTC
  • Revision ID: nicoduf@yahoo.fr-20110829202530-6deuoz11q90usldv
Code refactoring and merging with trunk (revision 10599).

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
 
20
20
#include "scalar.h"
 
21
#include "spinbutton.h"
21
22
 
22
23
namespace Inkscape {
23
24
namespace UI {
37
38
               Glib::ustring const &suffix,
38
39
               Glib::ustring const &icon,
39
40
               bool mnemonic)
40
 
    : Labelled(label, tooltip, new Gtk::SpinButton(), suffix, icon, mnemonic),
 
41
    : Labelled(label, tooltip, new SpinButton(), suffix, icon, mnemonic),
41
42
      setProgrammatically(false)
42
43
{
43
 
    static_cast<Gtk::SpinButton*>(_widget)->set_numeric();
44
44
}
45
45
 
46
46
/**
59
59
               Glib::ustring const &suffix,
60
60
               Glib::ustring const &icon,
61
61
               bool mnemonic)
62
 
    : Labelled(label, tooltip, new Gtk::SpinButton(0.0, digits), suffix, icon, mnemonic),
 
62
    : Labelled(label, tooltip, new SpinButton(0.0, digits), suffix, icon, mnemonic),
63
63
      setProgrammatically(false)
64
64
{
65
 
    static_cast<Gtk::SpinButton*>(_widget)->set_numeric();
66
65
}
67
66
 
68
67
/**
83
82
               Glib::ustring const &suffix,
84
83
               Glib::ustring const &icon,
85
84
               bool mnemonic)
86
 
    : Labelled(label, tooltip, new Gtk::SpinButton(adjust, 0.0, digits), suffix, icon, mnemonic),
 
85
    : Labelled(label, tooltip, new SpinButton(adjust, 0.0, digits), suffix, icon, mnemonic),
87
86
      setProgrammatically(false)
88
87
{
89
 
    static_cast<Gtk::SpinButton*>(_widget)->set_numeric();
90
88
}
91
89
 
92
90
/** Fetches the precision of the spin buton */
94
92
Scalar::getDigits() const
95
93
{
96
94
    g_assert(_widget != NULL);
97
 
    return static_cast<Gtk::SpinButton*>(_widget)->get_digits();
 
95
    return static_cast<SpinButton*>(_widget)->get_digits();
98
96
}
99
97
 
100
98
/** Gets the current step ingrement used by the spin button */
103
101
{
104
102
    g_assert(_widget != NULL);
105
103
    double step, page;
106
 
    static_cast<Gtk::SpinButton*>(_widget)->get_increments(step, page);
 
104
    static_cast<SpinButton*>(_widget)->get_increments(step, page);
107
105
    return step;
108
106
}
109
107
 
113
111
{
114
112
    g_assert(_widget != NULL);
115
113
    double step, page;
116
 
    static_cast<Gtk::SpinButton*>(_widget)->get_increments(step, page);
 
114
    static_cast<SpinButton*>(_widget)->get_increments(step, page);
117
115
    return page;
118
116
}
119
117
 
123
121
{
124
122
    g_assert(_widget != NULL);
125
123
    double min, max;
126
 
    static_cast<Gtk::SpinButton*>(_widget)->get_range(min, max);
 
124
    static_cast<SpinButton*>(_widget)->get_range(min, max);
127
125
    return min;
128
126
}
129
127
 
133
131
{
134
132
    g_assert(_widget != NULL);
135
133
    double min, max;
136
 
    static_cast<Gtk::SpinButton*>(_widget)->get_range(min, max);
 
134
    static_cast<SpinButton*>(_widget)->get_range(min, max);
137
135
    return max;
138
136
}
139
137
 
142
140
Scalar::getValue() const
143
141
{
144
142
    g_assert(_widget != NULL);
145
 
    return static_cast<Gtk::SpinButton*>(_widget)->get_value();
 
143
    return static_cast<SpinButton*>(_widget)->get_value();
146
144
}
147
145
 
148
146
/** Get the value spin_button represented as an integer. */
150
148
Scalar::getValueAsInt() const
151
149
{
152
150
    g_assert(_widget != NULL);
153
 
    return static_cast<Gtk::SpinButton*>(_widget)->get_value_as_int();
 
151
    return static_cast<SpinButton*>(_widget)->get_value_as_int();
154
152
}
155
153
 
156
154
 
159
157
Scalar::setDigits(unsigned digits)
160
158
{
161
159
    g_assert(_widget != NULL);
162
 
    static_cast<Gtk::SpinButton*>(_widget)->set_digits(digits);
 
160
    static_cast<SpinButton*>(_widget)->set_digits(digits);
163
161
}
164
162
 
165
163
/** Sets the step and page increments for the spin button
169
167
Scalar::setIncrements(double step, double /*page*/)
170
168
{
171
169
    g_assert(_widget != NULL);
172
 
    static_cast<Gtk::SpinButton*>(_widget)->set_increments(step, 0);
 
170
    static_cast<SpinButton*>(_widget)->set_increments(step, 0);
173
171
}
174
172
 
175
173
/** Sets the minimum and maximum range allowed for the spin button */
177
175
Scalar::setRange(double min, double max)
178
176
{
179
177
    g_assert(_widget != NULL);
180
 
    static_cast<Gtk::SpinButton*>(_widget)->set_range(min, max);
 
178
    static_cast<SpinButton*>(_widget)->set_range(min, max);
181
179
}
182
180
 
183
181
/** Sets the value of the spin button */
186
184
{
187
185
    g_assert(_widget != NULL);
188
186
    setProgrammatically = true; // callback is supposed to reset back, if it cares
189
 
    static_cast<Gtk::SpinButton*>(_widget)->set_value(value);
 
187
    static_cast<SpinButton*>(_widget)->set_value(value);
190
188
}
191
189
 
192
190
/** Manually forces an update of the spin button */
193
191
void
194
192
Scalar::update() {
195
193
    g_assert(_widget != NULL);
196
 
    static_cast<Gtk::SpinButton*>(_widget)->update();
 
194
    static_cast<SpinButton*>(_widget)->update();
197
195
}
198
196
 
199
197
 
202
200
Glib::SignalProxy0<void>
203
201
Scalar::signal_value_changed()
204
202
{
205
 
    return static_cast<Gtk::SpinButton*>(_widget)->signal_value_changed();
 
203
    return static_cast<SpinButton*>(_widget)->signal_value_changed();
206
204
}
207
205
 
208
206
 
219
217
  fill-column:99
220
218
  End:
221
219
*/
222
 
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
 
220
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :