[Libreoffice-commits] .: vcl/inc vcl/source

Noel Power noelp at kemper.freedesktop.org
Fri Jul 6 06:39:22 PDT 2012


 vcl/inc/vcl/button.hxx        |    4 ++++
 vcl/source/control/button.cxx |   17 +++++++++++------
 2 files changed, 15 insertions(+), 6 deletions(-)

New commits:
commit 2bc2d09bba2e3f34e8ce13571de9ff7007e1c2b6
Author: Noel Power <noel.power at novell.com>
Date:   Fri Jul 6 14:38:51 2012 +0100

    additional fix for fdo#51336 for radiobuttons
    
    Change-Id: Ib35d27962b2c63221e1967886236547b3b1047d6

diff --git a/vcl/inc/vcl/button.hxx b/vcl/inc/vcl/button.hxx
index 64f7581..9eb6088 100644
--- a/vcl/inc/vcl/button.hxx
+++ b/vcl/inc/vcl/button.hxx
@@ -313,6 +313,10 @@ private:
 protected:
     using Control::ImplInitSettings;
     using Window::ImplInit;
+    // allows the behaviour of horizontal placement of the checbox image to be
+    // overridden.
+    virtual void ImplHandleHoriAlign( const Point& rPos, const Size& rSize,
+                                    const Size& rImageSize, Rectangle& rStateRect );
     SAL_DLLPRIVATE void     ImplInit( Window* pParent, WinBits nStyle );
     SAL_DLLPRIVATE void     ImplLoadRes( const ResId& rResId );
 
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index e3ed723..9ba7e8f 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -2124,6 +2124,14 @@ if ( bNativeOK == sal_False )
 
 // -----------------------------------------------------------------------
 
+void RadioButton:: ImplHandleHoriAlign( const Point& rPos, const Size& /*rSize*/,
+                                    const Size& /*rImageSize*/, Rectangle& rStateRect )
+{
+    // align Checkbox image left ( always )
+    rStateRect.Left() = rPos.X();
+}
+// -----------------------------------------------------------------------
+
 void RadioButton::ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags,
                             const Point& rPos, const Size& rSize,
                             const Size& rImageSize, Rectangle& rStateRect,
@@ -2188,12 +2196,9 @@ void RadioButton::ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags,
         }
         else
         {
-            if ( nWinStyle & WB_CENTER )
-                rStateRect.Left() = rPos.X()+((rSize.Width()-rImageSize.Width())/2);
-            else if ( nWinStyle & WB_RIGHT )
-                rStateRect.Left() = rPos.X()+rSize.Width()-rImageSize.Width(); //-1;
-            else
-                rStateRect.Left() = rPos.X(); //+1;
+            // allow specific handling of WB_CENTER, WB_LEFT & WB_RIGHT by
+            // by subclasses
+            ImplHandleHoriAlign( rPos, rSize, rImageSize, rStateRect );
             if ( nWinStyle & WB_VCENTER )
                 rStateRect.Top() = rPos.Y()+((rSize.Height()-rImageSize.Height())/2);
             else if ( nWinStyle & WB_BOTTOM )


More information about the Libreoffice-commits mailing list