diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-05-23 14:25:22 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-09-28 08:48:21 +0100 |
commit | 0672af08922647dc8d5410197666a47a774121f4 (patch) | |
tree | b9d57dd22485df9a3fd92290f2ac7f6b73e069c0 | |
parent | f25d95627451e505e06625f7784cd19c5ded29e9 (diff) |
We'll need to customize the xml format a little for some things
But we might be able to get them upstreamed to gtk and we can
still do the pony work with glade (and/or tweak glade to retain
alien properties)
-rw-r--r-- | cui/uiconfig/ui/10000.ui | 1 | ||||
-rw-r--r-- | vcl/inc/vcl/field.hxx | 3 | ||||
-rw-r--r-- | vcl/source/control/field.cxx | 24 | ||||
-rw-r--r-- | vcl/source/window/builder.cxx | 2 |
4 files changed, 28 insertions, 2 deletions
diff --git a/cui/uiconfig/ui/10000.ui b/cui/uiconfig/ui/10000.ui index 24a649b8a743..2ccc3dc91348 100644 --- a/cui/uiconfig/ui/10000.ui +++ b/cui/uiconfig/ui/10000.ui @@ -186,6 +186,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="invisible_char">●</property> + <property name="format">%</property> </object> <packing> <property name="expand">False</property> diff --git a/vcl/inc/vcl/field.hxx b/vcl/inc/vcl/field.hxx index 03809e1fd4ca..929bf1ac7cae 100644 --- a/vcl/inc/vcl/field.hxx +++ b/vcl/inc/vcl/field.hxx @@ -592,6 +592,9 @@ public: static double ConvertDoubleValue( sal_Int64 nValue, sal_uInt16 nDecDigits, MapUnit eInUnit, FieldUnit eOutUnit ) { return ConvertDoubleValue( static_cast<double>(nValue), nDecDigits, eInUnit, eOutUnit ); } + + virtual bool set_property(const rtl::OString &rKey, const rtl::OString &rValue); + virtual void take_properties(Window &rOther); }; diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx index f1bc68c843c7..fbf7f39665dd 100644 --- a/vcl/source/control/field.cxx +++ b/vcl/source/control/field.cxx @@ -1672,7 +1672,29 @@ MetricField::MetricField( Window* pParent, const ResId& rResId ) : Show(); } -// ----------------------------------------------------------------------- +bool MetricField::set_property(const rtl::OString &rKey, const rtl::OString &rValue) +{ + if (rKey.equalsL(RTL_CONSTASCII_STRINGPARAM("format"))) + { + maCustomUnitText = rtl::OStringToOUString(rValue, RTL_TEXTENCODING_UTF8); + meUnit = FUNIT_CUSTOM; + } + else + return SpinField::set_property(rKey, rValue); + return true; +} + +void MetricField::take_properties(Window &rOther) +{ + MetricField &rOtherField = static_cast<MetricField&>(rOther); + + maCustomUnitText = rOtherField.maCustomUnitText; + maCurUnitText = rOtherField.maCurUnitText; + mnBaseValue = rOtherField.mnBaseValue; + meUnit = rOtherField.meUnit; + + SpinField::take_properties(rOther); +} void MetricField::ImplLoadRes( const ResId& rResId ) { diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index ab2a776b458c..98e008700f36 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -180,7 +180,7 @@ Window *VclBuilder::makeObject(Window *pParent, const rtl::OString &name, const else if (name.equalsL(RTL_CONSTASCII_STRINGPARAM("GtkCheckButton"))) pWindow = new CheckBox(pParent, WB_CENTER|WB_VCENTER|WB_3DLOOK); else if (name.equalsL(RTL_CONSTASCII_STRINGPARAM("GtkSpinButton"))) - pWindow = new NumericField(pParent, WB_RIGHT|WB_SPIN|WB_BORDER|WB_3DLOOK); + pWindow = new MetricField(pParent, WB_RIGHT|WB_SPIN|WB_BORDER|WB_3DLOOK); else if (name.equalsL(RTL_CONSTASCII_STRINGPARAM("GtkComboBox"))) pWindow = new ListBox(pParent, WB_DROPDOWN|WB_CENTER|WB_VCENTER|WB_3DLOOK); else if (name.equalsL(RTL_CONSTASCII_STRINGPARAM("GtkLabel"))) |