summaryrefslogtreecommitdiffstats
path: root/src/ui/widget/unit-menu.cpp
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2011-04-17 12:51:06 +0000
committerJohan Engelen <goejendaagh@zonnet.nl>2011-04-17 12:51:06 +0000
commit70829da1b189d6d8f07f12d97b9273d56dbd789e (patch)
treed041efcd3a74ce09398665b066a0bd891dad2fde /src/ui/widget/unit-menu.cpp
parentchange spinbox to new one in many places. (diff)
downloadinkscape-70829da1b189d6d8f07f12d97b9273d56dbd789e.tar.gz
inkscape-70829da1b189d6d8f07f12d97b9273d56dbd789e.zip
add new preference widget for a number with a unit.
change Preferences > Steps to this new widget (bzr r10177)
Diffstat (limited to 'src/ui/widget/unit-menu.cpp')
-rw-r--r--src/ui/widget/unit-menu.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/ui/widget/unit-menu.cpp b/src/ui/widget/unit-menu.cpp
index b4271762c..5c68f7196 100644
--- a/src/ui/widget/unit-menu.cpp
+++ b/src/ui/widget/unit-menu.cpp
@@ -54,6 +54,19 @@ 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);
+}
+
/** Returns the Unit object corresponding to the current selection
in the dropdown widget */
Unit