]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/bmpbuttn.cpp
Fix memory leak by letting the base class version handle the
[wxWidgets.git] / src / msw / bmpbuttn.cpp
index ee417d6608ee26c9935be9c6d1455bdd7df8124f..1465f35008c524af152498cf6f7444148f048ce1 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     04/01/98
 // RCS-ID:      $Id$
 // Copyright:   (c) Julian Smart
-// Licence:     wxWindows licence
+// Licence:     wxWidgets licence
 /////////////////////////////////////////////////////////////////////////////
 
 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
@@ -76,7 +76,7 @@ wxEND_FLAGS( wxBitmapButtonStyle )
 IMPLEMENT_DYNAMIC_CLASS_XTI(wxBitmapButton, wxButton,"wx/bmpbuttn.h")
 
 wxBEGIN_PROPERTIES_TABLE(wxBitmapButton)
-    wxPROPERTY_FLAGS( WindowStyle , wxBitmapButtonStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
+    wxPROPERTY_FLAGS( WindowStyle , wxBitmapButtonStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE, 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
 wxEND_PROPERTIES_TABLE()
 
 wxBEGIN_HANDLERS_TABLE(wxBitmapButton)
@@ -466,7 +466,21 @@ wxSize wxBitmapButton::DoGetBestSize() const
         best.x = m_bmpNormal.GetWidth() + 2*m_marginX;
         best.y = m_bmpNormal.GetHeight() + 2*m_marginY;
     }
+
+    // all buttons have at least the standard size unless the user explicitly
+    // wants them to be of smaller size and used wxBU_EXACTFIT style when
+    // creating the button
+    if ( !HasFlag(wxBU_EXACTFIT) )
+    {
+        wxSize sz = GetDefaultSize();
+        if (best.x > sz.x)
+            sz.x = best.x;
+        if (best.y > sz.y)
+            sz.y = best.y;
+    }
+
     return best;
 }
 
 #endif // wxUSE_BMPBUTTON
+