Clarify wxButton::AdjustForBitmapSize() semantics in wxMSW.

This method should only be called if we do have an image, assert (instead of
silently returning) if it's called when we don't.

Also explain in a comment why do we need to call CacheBestSize() only when we
have an image in DoGetBestSize().

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66890 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2011-02-14 22:11:58 +00:00
parent 026e7dcba0
commit 65034d07ed
2 changed files with 7 additions and 4 deletions

View File

@@ -531,8 +531,7 @@ void wxButton::SetLabel(const wxString& label)
void wxButton::AdjustForBitmapSize(wxSize &size) const
{
if ( !m_imageData )
return;
wxCHECK_RET( m_imageData, wxT("shouldn't be called if no image") );
// account for the bitmap size
const wxSize sizeBmp = m_imageData->GetBitmap(State_Normal).GetSize();
@@ -614,6 +613,8 @@ wxSize wxButton::DoGetBestSize() const
{
AdjustForBitmapSize(size);
// The best size has changed so even if it had been already cached by
// ComputeBestSize() call above we still need to update it.
CacheBestSize(size);
}