]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/anybutton.cpp
Only impose minimal height for buttons with non-empty label in wxMSW.
[wxWidgets.git] / src / msw / anybutton.cpp
index 2bf1b41f4ca8fdbdf0b885716744f42840d4dfed..b8fc1ad197875ed900e1815a0192549dceb0c06f 100644 (file)
@@ -429,27 +429,31 @@ wxSize wxMSWButton::IncreaseToStdSizeAndCache(wxControl *btn, const wxSize& size
 {
     wxSize sizeBtn(size);
 
-    // All buttons have at least the standard height and, unless the user
-    // explicitly wants them to be as small as possible and used wxBU_EXACTFIT
-    // style to indicate this, of at least the standard width too.
-    //
-    // Notice that we really want to make all buttons equally high, otherwise
-    // they look ugly and the existing code using wxBU_EXACTFIT only uses it to
-    // control width and not height.
-
     // The 50x14 button size is documented in the "Recommended sizing and
     // spacing" section of MSDN layout article.
     //
     // Note that we intentionally don't use GetDefaultSize() here, because
     // it's inexact -- dialog units depend on this dialog's font.
     const wxSize sizeDef = btn->ConvertDialogToPixels(wxSize(50, 14));
-    if ( !btn->HasFlag(wxBU_EXACTFIT) )
+
+    // All buttons should have at least the standard size, unless the user
+    // explicitly wants them to be as small as possible and used wxBU_EXACTFIT
+    // style to indicate this.
+    const bool incToStdSize = !btn->HasFlag(wxBU_EXACTFIT);
+    if ( incToStdSize )
     {
         if ( sizeBtn.x < sizeDef.x )
             sizeBtn.x = sizeDef.x;
     }
-    if ( sizeBtn.y < sizeDef.y )
-        sizeBtn.y = sizeDef.y;
+
+    // Notice that we really want to make all buttons with text label equally
+    // high, otherwise they look ugly and the existing code using wxBU_EXACTFIT
+    // only uses it to control width and not height.
+    if ( incToStdSize || !btn->GetLabel().empty() )
+    {
+        if ( sizeBtn.y < sizeDef.y )
+            sizeBtn.y = sizeDef.y;
+    }
 
     btn->CacheBestSize(sizeBtn);