]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/button.cpp
Set up menu bitmaps correctly for checkable items.
[wxWidgets.git] / src / msw / button.cpp
index c81472bebc848e2dffde05228bb7419dece9f7eb..67494356d6945d474ca012e5e00d19d34b62f29c 100644 (file)
@@ -37,9 +37,9 @@
     #include "wx/dcscreen.h"
     #include "wx/dcclient.h"
     #include "wx/toplevel.h"
     #include "wx/dcscreen.h"
     #include "wx/dcclient.h"
     #include "wx/toplevel.h"
-    #include "wx/imaglist.h"
 #endif
 
 #endif
 
+#include "wx/imaglist.h"
 #include "wx/stockitem.h"
 #include "wx/msw/private.h"
 #include "wx/msw/private/button.h"
 #include "wx/stockitem.h"
 #include "wx/msw/private.h"
 #include "wx/msw/private/button.h"
@@ -574,8 +574,10 @@ wxSize wxButton::DoGetBestSize() const
 {
     wxSize size;
 
 {
     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));
     }
     {
         size = wxMSWButton::ComputeBestSize(const_cast<wxButton *>(this));
     }
@@ -677,6 +679,14 @@ wxSize wxButtonBase::GetDefaultSize()
 // ----------------------------------------------------------------------------
 
 /*
 // ----------------------------------------------------------------------------
 
 /*
+   The comment below and all this code is probably due to not using WM_NEXTDLGCTL
+   message when changing focus (but just SetFocus() which is not enough), see
+   http://blogs.msdn.com/oldnewthing/archive/2004/08/02/205624.aspx for the
+   full explanation.
+
+   TODO: Do use WM_NEXTDLGCTL and get rid of all this code.
+
+
    "Everything you ever wanted to know about the default buttons" or "Why do we
    have to do all this?"
 
    "Everything you ever wanted to know about the default buttons" or "Why do we
    have to do all this?"