Fix best size computation for buttons without image and with empty label.

If a button was initially created with an empty label (but without image
neither), its best size was computed and cached as being null. Correct this by
giving the button the default size instead, as expected.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62970 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2009-12-22 15:37:37 +00:00
parent 2ec335db78
commit 4b601a59b5

View File

@ -574,8 +574,10 @@ wxSize wxButton::DoGetBestSize() const
{
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));
}