]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/button.cpp
Fix discrepancy between different ways of measuring text extents under Mac.
[wxWidgets.git] / src / msw / button.cpp
index 49b84f28496019adcd14c6e1e982978356280dd7..6be8b813b33936274d74708f7bd253535a57af50 100644 (file)
@@ -677,6 +677,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?"
 
@@ -959,16 +967,18 @@ void wxButton::DoSetBitmap(const wxBitmap& bitmap, State which)
             m_imageData = new wxODButtonImageData(this, bitmap);
             MakeOwnerDrawn();
         }
-
-        // if a bitmap was assigned to the bitmap, its best size must be
-        // changed to account for it
-        InvalidateBestSize();
     }
     else
     {
         m_imageData->SetBitmap(bitmap, which);
     }
 
+    // it should be enough to only invalidate the best size when the normal
+    // bitmap changes as all bitmaps assigned to the button should be of the
+    // same size anyhow
+    if ( which == State_Normal )
+        InvalidateBestSize();
+
     Refresh();
 }