]> git.saurik.com Git - wxWidgets.git/commitdiff
Fix best size computation for buttons without image and with empty label.
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 22 Dec 2009 15:37:37 +0000 (15:37 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 22 Dec 2009 15:37:37 +0000 (15:37 +0000)
If a button was initially created with an empty label (but without image
neither), its best size was computed and cached as being null. Correct this by
giving the button the default size instead, as expected.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62970 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/button.cpp

index cef76c26d3920cbba0e72f6f3b46bf2a320ab587..67494356d6945d474ca012e5e00d19d34b62f29c 100644 (file)
@@ -574,8 +574,10 @@ wxSize wxButton::DoGetBestSize() const
 {
     wxSize size;
 
-    // account for the text part
-    if ( ShowsLabel() )
+    // account for the text part if we have it or if we don't have any image at
+    // all (buttons initially created with empty label should still have a non
+    // zero size)
+    if ( ShowsLabel() || !m_imageData )
     {
         size = wxMSWButton::ComputeBestSize(const_cast<wxButton *>(this));
     }