X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9e7642ae0d20232698aeeb6a35b526826b006ab8..0cdd04ad993f86710bc5c9d9c8c12ec25a34ac71:/src/common/treebase.cpp diff --git a/src/common/treebase.cpp b/src/common/treebase.cpp index 4eebd5fa09..08220fa503 100644 --- a/src/common/treebase.cpp +++ b/src/common/treebase.cpp @@ -114,8 +114,10 @@ wxGetBestTreeSize(const wxTreeCtrlBase* treeCtrl, wxTreeItemId id, wxSize& size) if ( treeCtrl->GetBoundingRect(id, rect, true /* just the item */) ) { // Translate to logical position so we get the full extent +#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) rect.x += treeCtrl->GetScrollPos(wxHORIZONTAL); rect.y += treeCtrl->GetScrollPos(wxVERTICAL); +#endif size.IncTo(wxSize(rect.GetRight(), rect.GetBottom())); } @@ -160,7 +162,9 @@ wxSize wxTreeCtrlBase::DoGetBestSize() const else // use precise, if potentially slow, size computation method { // iterate over all items recursively - wxGetBestTreeSize(this, GetRootItem(), size); + wxTreeItemId idRoot = GetRootItem(); + if ( idRoot.IsOk() ) + wxGetBestTreeSize(this, idRoot, size); } // need some minimal size even for empty tree