]> git.saurik.com Git - wxWidgets.git/commitdiff
bitmap button size was too small when uxtheme functions were used to get the margins
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 15 Jun 2006 16:01:17 +0000 (16:01 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 15 Jun 2006 16:01:17 +0000 (16:01 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39744 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/bmpbuttn.cpp

index 08cca12468fea69f25ddacf3f58a69a7b2490ed2..c47f2abc913d2b80447fec1d1137a0e58970bc52 100644 (file)
@@ -593,19 +593,22 @@ wxSize wxBitmapButton::DoGetBestSize() const
     if ( m_bmpNormal.Ok() )
     {
 #if wxUSE_UXTHEME
-        if ( (GetWindowStyleFlag() & wxBU_AUTODRAW) && wxUxThemeEngine::GetIfActive() )
+        if ( wxUxThemeEngine::GetIfActive() )
         {
             wxUxThemeHandle theme((wxBitmapButton *)this, L"BUTTON");
 
-            // calculate content area margins
-            // assuming here that each state is the same size
             MARGINS margins;
             wxUxThemeEngine::Get()->GetThemeMargins(theme, NULL,
                                                     BP_PUSHBUTTON, PBS_NORMAL,
                                                     TMT_CONTENTMARGINS, NULL,
                                                     &margins);
-            wxSize best(m_bmpNormal.GetWidth() + 2 * (margins.cxLeftWidth + 1),
-                        m_bmpNormal.GetHeight() + 2* (margins.cyTopHeight + 1));
+
+            // the margins we get are too small, part of the bitmap is
+            // truncated if we use them -- so add a little extra space
+            wxSize best(m_bmpNormal.GetWidth() +
+                            margins.cxLeftWidth + margins.cxRightWidth + 5,
+                        m_bmpNormal.GetHeight() +
+                            margins.cyTopHeight + margins.cyBottomHeight + 5);
             CacheBestSize(best);
             return best;
         }