Always correctly invalid best size when bitmap changes.

Previously it was done only when the initial bitmap was set, not when it was
subsequently changed.

Closes #11018.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61509 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2009-07-23 23:01:10 +00:00
parent 9a83f86094
commit e431c7df61

View File

@@ -959,16 +959,18 @@ void wxButton::DoSetBitmap(const wxBitmap& bitmap, State which)
m_imageData = new wxODButtonImageData(this, bitmap); m_imageData = new wxODButtonImageData(this, bitmap);
MakeOwnerDrawn(); MakeOwnerDrawn();
} }
// if a bitmap was assigned to the bitmap, its best size must be
// changed to account for it
InvalidateBestSize();
} }
else else
{ {
m_imageData->SetBitmap(bitmap, which); 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(); Refresh();
} }