1 /**
2 * \brief Scalar Widget - A labelled text box, with spin buttons and optional
3 * icon or suffix, for entering arbitrary number values.
4 *
5 * Authors:
6 * Carl Hetherington <inkscape@carlh.net>
7 * Derek P. Moore <derekm@hackunix.org>
8 * Bryce Harrington <bryce@bryceharrington.org>
9 *
10 * Copyright (C) 2004 Carl Hetherington
11 *
12 * Released under GNU GPL. Read the file 'COPYING' for more information.
13 */
15 #ifndef INKSCAPE_UI_WIDGET_SCALAR_H
16 #define INKSCAPE_UI_WIDGET_SCALAR_H
18 #include <gtkmm/adjustment.h>
19 #include <gtkmm/spinbutton.h>
21 #include "labelled.h"
23 namespace Inkscape {
24 namespace UI {
25 namespace Widget {
27 class Scalar : public Labelled
28 {
29 public:
30 Scalar(Glib::ustring const &label,
31 Glib::ustring const &tooltip,
32 Glib::ustring const &suffix = "",
33 Glib::ustring const &icon = "",
34 bool mnemonic = true);
35 Scalar(Glib::ustring const &label,
36 Glib::ustring const &tooltip,
37 unsigned digits,
38 Glib::ustring const &suffix = "",
39 Glib::ustring const &icon = "",
40 bool mnemonic = true);
41 Scalar(Glib::ustring const &label,
42 Glib::ustring const &tooltip,
43 Gtk::Adjustment &adjust,
44 unsigned digits = 0,
45 Glib::ustring const &suffix = "",
46 Glib::ustring const &icon = "",
47 bool mnemonic = true);
49 unsigned getDigits() const;
50 double getStep() const;
51 double getPage() const;
52 double getRangeMin() const;
53 double getRangeMax() const;
54 bool getSnapToTicks() const;
55 double getValue() const;
56 int getValueAsInt() const;
58 void setDigits(unsigned digits);
59 void setIncrements(double step, double page);
60 void setRange(double min, double max);
61 void setValue(double value);
63 void update();
65 Glib::SignalProxy0<void> signal_value_changed();
67 bool setProgrammatically; // true if the value was set by setValue, not changed by the user;
68 // if a callback checks it, it must reset it back to false
69 };
71 } // namespace Widget
72 } // namespace UI
73 } // namespace Inkscape
75 #endif // INKSCAPE_UI_WIDGET_SCALAR_H
77 /*
78 Local Variables:
79 mode:c++
80 c-file-style:"stroustrup"
81 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
82 indent-tabs-mode:nil
83 fill-column:99
84 End:
85 */
86 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :