implemented GetBestSize() (TODO: make this available in generic version as well)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35856 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2005-10-09 13:38:15 +00:00
parent c358ea4147
commit 96d8f9207f
2 changed files with 23 additions and 0 deletions

View File

@ -429,6 +429,9 @@ public:
int GetState(const wxTreeItemId& node);
protected:
virtual wxSize DoGetBestSize() const;
// SetImageList helper
void SetAnyImageList(wxImageList *imageList, int which);

View File

@ -2137,6 +2137,26 @@ bool wxTreeCtrl::GetBoundingRect(const wxTreeItemId& item,
}
}
wxSize wxTreeCtrl::DoGetBestSize() const
{
wxSize size;
wxRect rect;
for ( wxTreeItemId node = GetFirstVisibleItem();
node.IsOk();
node = GetNextVisible(node) )
{
if ( GetBoundingRect(node, rect) )
{
if ( size.x < rect.x + rect.width )
size.x = rect.x + rect.width;
if ( size.y < rect.y + rect.height )
size.y = rect.y + rect.height;
}
}
return size;
}
// ----------------------------------------------------------------------------
// sorting stuff
// ----------------------------------------------------------------------------