fixed SetBestSize() by restoring its old behaviour (undid 1.94.2.1 change and added comments about why the actual code is right)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@17943 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -988,16 +988,21 @@ protected:
|
|||||||
// smarter SetSize / convenience function for expanding wxDefaultSize.
|
// smarter SetSize / convenience function for expanding wxDefaultSize.
|
||||||
// Note that it does not influence the value returned by GetBestSize
|
// Note that it does not influence the value returned by GetBestSize
|
||||||
// at all.
|
// at all.
|
||||||
//
|
|
||||||
// FIXME: Can't we just make this the behaviour of SetSize when
|
|
||||||
// wxSIZE_AUTO_* is in play and do away with this (undocumented)
|
|
||||||
// method altogether?
|
|
||||||
|
|
||||||
void SetBestSize(const wxSize& size)
|
void SetBestSize(const wxSize& size)
|
||||||
{
|
{
|
||||||
wxSize best( DoGetBestSize() );
|
// the size only needs to be changed if the current size is incomplete,
|
||||||
|
// i.e. one of the components was specified as default -- so if both
|
||||||
|
// were given, simply don't do anything
|
||||||
|
if ( size.x == -1 || size.y == -1 )
|
||||||
|
{
|
||||||
|
wxSize sizeBest = DoGetBestSize();
|
||||||
|
if ( size.x != -1 )
|
||||||
|
sizeBest.x = size.x;
|
||||||
|
if ( size.y != -1 )
|
||||||
|
sizeBest.y = size.y;
|
||||||
|
|
||||||
SetSize( wxMax( size.x, best.x ), wxMax( size.y, best.y ) );
|
SetSize(sizeBest);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// more pure virtual functions
|
// more pure virtual functions
|
||||||
|
Reference in New Issue
Block a user