]> git.saurik.com Git - wxWidgets.git/commitdiff
Add required padding to DoGetBestSize() for small bitmaps when using themes
authorJamie Gadd <jrgadd2@cs.latrobe.edu.au>
Mon, 19 Jun 2006 23:50:18 +0000 (23:50 +0000)
committerJamie Gadd <jrgadd2@cs.latrobe.edu.au>
Mon, 19 Jun 2006 23:50:18 +0000 (23:50 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39799 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/bmpbuttn.cpp

index 6dfee11693c97d43c92e49f186b6f81bc5e92645..be094dd3c53e408ae11a05fb9d72de7b2de8d1d4 100644 (file)
@@ -603,11 +603,11 @@ wxSize wxBitmapButton::DoGetBestSize() const
                                                     TMT_CONTENTMARGINS, NULL,
                                                     &margins);
 
-            // 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() +
+            // XP doesn't draw themed buttons correctly when the client area is
+            // smaller than 8x8 - enforce this minimum size for small bitmaps
+            wxSize best(wxMax(8, m_bmpNormal.GetWidth()) +
+                            margins.cxLeftWidth + margins.cxRightWidth + 2,
+                        wxMax(8, m_bmpNormal.GetHeight()) +
                             margins.cyTopHeight + margins.cyBottomHeight + 2);
             CacheBestSize(best);
             return best;