* Implemented BestSize cache
* Added calls to InvalidateBestSize where things affecting BestSize are modified. There are probably several other places where this still needs to be done... * Added wxWindowBase::GetBestFittingSize that will merge the BestSize into the MinSize, (if any) and return the result. * SetBestFittingSize will now only set the MinSize to the value that was passed to it, without merging in the BestSize git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28010 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -116,6 +116,19 @@ void wxControlBase::InitCommandEvent(wxCommandEvent& event) const
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void wxControlBase::SetLabel( const wxString &label )
|
||||
{
|
||||
InvalidateBestSize();
|
||||
wxWindow::SetLabel(label);
|
||||
}
|
||||
|
||||
bool wxControlBase::SetFont(const wxFont& font)
|
||||
{
|
||||
InvalidateBestSize();
|
||||
return wxWindow::SetFont(font);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxStaticBitmap
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -129,12 +142,15 @@ wxStaticBitmapBase::~wxStaticBitmapBase()
|
||||
|
||||
wxSize wxStaticBitmapBase::DoGetBestSize() const
|
||||
{
|
||||
wxSize best;
|
||||
wxBitmap bmp = GetBitmap();
|
||||
if ( bmp.Ok() )
|
||||
return wxSize(bmp.GetWidth(), bmp.GetHeight());
|
||||
|
||||
// this is completely arbitrary
|
||||
return wxSize(16, 16);
|
||||
best = wxSize(bmp.GetWidth(), bmp.GetHeight());
|
||||
else
|
||||
// this is completely arbitrary
|
||||
best = wxSize(16, 16);
|
||||
CacheBestSize(best);
|
||||
return best;
|
||||
}
|
||||
|
||||
#endif // wxUSE_STATBMP
|
||||
|
Reference in New Issue
Block a user