1 /**
2 * \brief Unit Menu Widget - A drop down menu for choosing unit types.
3 *
4 * Author:
5 * Bryce Harrington <bryce@bryceharrington.org>
6 *
7 * Copyright (C) 2004 Bryce Harrington
8 *
9 * Released under GNU GPL. Read the file 'COPYING' for more information.
10 */
12 #ifndef INKSCAPE_UI_WIDGET_UNIT_H
13 #define INKSCAPE_UI_WIDGET_UNIT_H
15 #include "combo-text.h"
16 #include "util/units.h"
18 using namespace Inkscape::Util;
20 namespace Inkscape {
21 namespace UI {
22 namespace Widget {
24 class UnitMenu : public ComboText
25 {
26 public:
27 UnitMenu();
28 virtual ~UnitMenu();
30 bool setUnitType(UnitType unit_type);
32 bool setUnit(Glib::ustring const &unit);
34 Unit getUnit() const;
35 Glib::ustring getUnitAbbr() const;
36 UnitType getUnitType() const;
37 double getUnitFactor() const;
39 int getDefaultDigits() const;
40 double getDefaultStep() const;
41 double getDefaultPage() const;
43 double getConversion(Glib::ustring const &new_unit_abbr, Glib::ustring const &old_unit_abbr = "no_unit") const;
45 bool isAbsolute() const;
46 bool isRadial() const;
48 UnitTable &getUnitTable() {return _unit_table;}
50 protected:
51 UnitTable _unit_table;
52 UnitType _type;
53 };
55 } // namespace Widget
56 } // namespace UI
57 } // namespace Inkscape
59 #endif // INKSCAPE_UI_WIDGET_UNIT_H
61 /*
62 Local Variables:
63 mode:c++
64 c-file-style:"stroustrup"
65 c-file-offsets:((innamespace . 0)(inline-open . 0))
66 indent-tabs-mode:nil
67 fill-column:99
68 End:
69 */
70 // vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :