vcl/source/control/spinfld.cxx |   19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

New commits:
commit 9723d0c14c90454496b7a05289bd6994e28c0aa5
Author: Caolán McNamara <caol...@redhat.com>
Date:   Tue Nov 13 15:32:19 2012 +0000

    macosx theme has a gap between edit area and up/down area
    
    in spinbuttons, so adding just the width of the up/down buttons
    will not take into account that intermediate space in determining
    the optimal size
    
    Change-Id: I219a02b3313e87f4c927d52de34eda040b13133e

diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx
index ecb0e51..47aa197 100644
--- a/vcl/source/control/spinfld.cxx
+++ b/vcl/source/control/spinfld.cxx
@@ -995,7 +995,24 @@ Size SpinField::CalcMinimumSizeForText(const rtl::OUString 
&rString) const
     if ( GetStyle() & WB_DROPDOWN )
         aSz.Width() += GetSettings().GetStyleSettings().GetScrollBarSize();
     if ( GetStyle() & WB_SPIN )
-        aSz.Width() += maUpperRect.GetWidth();
+    {
+        ImplControlValue aControlValue;
+        Rectangle aArea( Point(), Size(100, aSz.Height()));
+        Rectangle aEntireBound, aEntireContent, aEditBound, aEditContent;
+        if (
+               GetNativeControlRegion(CTRL_SPINBOX, PART_ENTIRE_CONTROL,
+                   aArea, 0, aControlValue, rtl::OUString(), aEntireBound, 
aEntireContent) &&
+               GetNativeControlRegion(CTRL_SPINBOX, PART_SUB_EDIT,
+                   aArea, 0, aControlValue, rtl::OUString(), aEditBound, 
aEditContent)
+           )
+        {
+            aSz.Width() += (aEntireContent.GetWidth() - 
aEditContent.GetWidth());
+        }
+        else
+        {
+            aSz.Width() += maUpperRect.GetWidth();
+        }
+    }
 
     return aSz;
 }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to