cache the best size in overridden DoGetBestSize()

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43688 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2006-11-27 16:35:06 +00:00
parent 8aa2736f3c
commit b9643cd619

View File

@@ -3651,9 +3651,15 @@ wxSize wxGenericTreeCtrl::DoGetBestSize() const
{
wxSize size = wxTreeCtrlBase::DoGetBestSize();
// The generic control seems to have an implicit border
// there seems to be an implicit extra border around the items, although
// I'm not really sure where does it come from -- but without this, the
// scrollbars appear in a tree with default/best size
size.IncBy(4, 4);
// avoid caching (necessarily arbitrary) default size for empty tree
if ( GetRootItem().IsOk() )
CacheBestSize(size);
return size;
}