]> git.saurik.com Git - wxWidgets.git/commitdiff
set the initial size of bitmap buttons correctly again after it was broken by r61081...
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 27 Jun 2009 22:22:48 +0000 (22:22 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 27 Jun 2009 22:22:48 +0000 (22:22 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61221 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/gtk/bmpbuttn.h
src/gtk/bmpbuttn.cpp

index a0a17b3ac091472da5616925e1c78b184a7ee8b7..15966f3f4104efc39af4dadd6eac87dcdf50cbb8 100644 (file)
@@ -38,19 +38,9 @@ public:
                 const wxSize& size = wxDefaultSize,
                 long style = 0,
                 const wxValidator& validator = wxDefaultValidator,
-                const wxString& name = wxButtonNameStr)
-    {
-        if ( !wxBitmapButtonBase::Create(parent, id, "",
-                                         pos, size,
-                                         style | wxBU_NOTEXT,
-                                         validator, name) )
-            return false;
-
-        SetBitmapLabel(bitmap);
-
-        return true;
-    }
+                const wxString& name = wxButtonNameStr);
 
+private:
     DECLARE_DYNAMIC_CLASS(wxBitmapButton)
 };
 
index 5dcd0493942af50f0dba0dd31c24283343537108..a3df929f8dccf49afaff1f3ea63587254973979e 100644 (file)
 
 IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton,wxButton)
 
+bool wxBitmapButton::Create(wxWindow *parent,
+                            wxWindowID id,
+                            const wxBitmap& bitmap,
+                            const wxPoint& pos,
+                            const wxSize& size,
+                            long style,
+                            const wxValidator& validator,
+                            const wxString& name)
+{
+    if ( !wxBitmapButtonBase::Create(parent, id, "",
+                                     pos, size,
+                                     style | wxBU_NOTEXT,
+                                     validator, name) )
+        return false;
+
+    if ( bitmap.IsOk() )
+    {
+        SetBitmapLabel(bitmap);
+
+        // we need to adjust the size after setting the bitmap as it may be too
+        // big for the default button size
+        SetInitialSize(size);
+    }
+
+    return true;
+}
 #endif // wxUSE_BMPBUTTON