[Libreoffice-commits] core.git: vcl/source

Caolán McNamara caolanm at redhat.com
Fri Jul 19 08:19:46 PDT 2013


 vcl/source/control/button.cxx |   51 ++++++++++++++++++++++++------------------
 1 file changed, 30 insertions(+), 21 deletions(-)

New commits:
commit 3305fd648f9f17145620954e24ade4d4ea62d60f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Jul 19 16:15:52 2013 +0100

    Only do the WB_TOP hack for radiobuttons
    
    RadioButtons are the only ones abusing WB_TOP for image align, so only set it
    for those.
    
    Change-Id: Ie616b132c6771c4233295703ee56e60131c477cf

diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 2c447a4..8b89cd6 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -610,36 +610,15 @@ bool Button::set_property(const OString &rKey, const OString &rValue)
     if (rKey == "image-position")
     {
         ImageAlign eAlign = IMAGEALIGN_LEFT;
-        WinBits nBits = GetStyle();
         if (rValue == "left")
-        {
-            nBits &= ~(WB_CENTER | WB_RIGHT);
-            nBits |= WB_LEFT;
             eAlign = IMAGEALIGN_LEFT;
-        }
         else if (rValue == "right")
-        {
-            nBits &= ~(WB_CENTER | WB_LEFT);
-            nBits |= WB_RIGHT;
             eAlign = IMAGEALIGN_RIGHT;
-        }
         else if (rValue == "top")
-        {
-            nBits &= ~(WB_VCENTER | WB_BOTTOM);
-            nBits |= WB_TOP;
             eAlign = IMAGEALIGN_TOP;
-        }
         else if (rValue == "bottom")
-        {
-            nBits &= ~(WB_VCENTER | WB_TOP);
-            nBits |= WB_BOTTOM;
             eAlign = IMAGEALIGN_BOTTOM;
-        }
         SetImageAlign(eAlign);
-        //Its rather mad to have to set these bits when there is the other
-        //image align. Looks like e.g. the radiobuttons etc weren't converted
-        //over to image align fully.
-        SetStyle(nBits);
     }
     else
         return Control::set_property(rKey, rValue);
@@ -2886,6 +2865,36 @@ bool RadioButton::set_property(const OString &rKey, const OString &rValue)
 {
     if (rKey == "active")
         SetState(toBool(rValue));
+    else if (rKey == "image-position")
+    {
+        WinBits nBits = GetStyle();
+        if (rValue == "left")
+        {
+            nBits &= ~(WB_CENTER | WB_RIGHT);
+            nBits |= WB_LEFT;
+        }
+        else if (rValue == "right")
+        {
+            nBits &= ~(WB_CENTER | WB_LEFT);
+            nBits |= WB_RIGHT;
+        }
+        else if (rValue == "top")
+        {
+            nBits &= ~(WB_VCENTER | WB_BOTTOM);
+            nBits |= WB_TOP;
+        }
+        else if (rValue == "bottom")
+        {
+            nBits &= ~(WB_VCENTER | WB_TOP);
+            nBits |= WB_BOTTOM;
+        }
+        //Its rather mad to have to set these bits when there is the other
+        //image align. Looks like e.g. the radiobuttons etc weren't converted
+        //over to image align fully.
+        SetStyle(nBits);
+        //Deliberate to set the sane ImageAlign property
+        return Button::set_property(rKey, rValue);
+    }
     else
         return Button::set_property(rKey, rValue);
     return true;


More information about the Libreoffice-commits mailing list