summaryrefslogtreecommitdiffstats
path: root/src/ui/widget/unit-menu.cpp
diff options
context:
space:
mode:
authorKrzysztof Kosi??ski <tweenk.pl@gmail.com>2011-06-19 10:00:24 +0000
committerKrzysztof KosiƄski <tweenk.pl@gmail.com>2011-06-19 10:00:24 +0000
commit06dfaa02d7a80bcdff717d579a48f81643f53f31 (patch)
tree49b8e67ad9051f1507b0959cac986383ab4001e2 /src/ui/widget/unit-menu.cpp
parentFix rendering of control points (diff)
parentfix bug 796451: Measure tools should support rotation constraint (diff)
downloadinkscape-06dfaa02d7a80bcdff717d579a48f81643f53f31.tar.gz
inkscape-06dfaa02d7a80bcdff717d579a48f81643f53f31.zip
Merge from trunk
(bzr r9508.1.89)
Diffstat (limited to 'src/ui/widget/unit-menu.cpp')
-rw-r--r--src/ui/widget/unit-menu.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/ui/widget/unit-menu.cpp b/src/ui/widget/unit-menu.cpp
index b4271762c..362f5d90f 100644
--- a/src/ui/widget/unit-menu.cpp
+++ b/src/ui/widget/unit-menu.cpp
@@ -54,6 +54,27 @@ UnitMenu::setUnitType(UnitType unit_type)
return true;
}
+/** Removes all unit entries, then adds the unit type to the widget.
+ This extracts the corresponding
+ units from the unit map matching the given type, and appends them
+ to the dropdown widget. It causes the primary unit for the given
+ unit_type to be selected. */
+bool
+UnitMenu::resetUnitType(UnitType unit_type)
+{
+ clear_text();
+
+ return setUnitType(unit_type);
+}
+
+/** Adds a unit, possibly user-defined, to the menu. */
+void
+UnitMenu::addUnit(Unit const& u)
+{
+ _unit_table.addUnit(u, false);
+ append_text(u.abbr);
+}
+
/** Returns the Unit object corresponding to the current selection
in the dropdown widget */
Unit