From: Vadim Zeitlin Date: Sat, 27 Feb 1999 14:38:46 +0000 (+0000) Subject: wxTreeCtrl::GetBoundRect() implemented X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/f7c832a7867b1cc588fc1ec658c2f20d0b4c81ec?ds=inline wxTreeCtrl::GetBoundRect() implemented git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1815 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/msw/treectrl.h b/include/wx/msw/treectrl.h index 3864830c01..51e1e02d3c 100644 --- a/include/wx/msw/treectrl.h +++ b/include/wx/msw/treectrl.h @@ -410,8 +410,7 @@ public: wxTreeItemId HitTest(const wxPoint& point, int& flags); // get the bounding rectangle of the item (or of its label only) - // @@@ do we really need to expose this functions to the application? - void GetBoundingRect(const wxTreeItemId& item, + bool GetBoundingRect(const wxTreeItemId& item, wxRect& rect, bool textOnly = FALSE) const; diff --git a/src/msw/treectrl.cpp b/src/msw/treectrl.cpp index f174a3d021..9c346d6098 100644 --- a/src/msw/treectrl.cpp +++ b/src/msw/treectrl.cpp @@ -806,9 +806,29 @@ wxTreeItemId wxTreeCtrl::HitTest(const wxPoint& point, int& flags) return wxTreeItemId((WXHTREEITEM) hitTestInfo.hItem); } +bool wxTreeCtrl::GetBoundingRect(const wxTreeItemId& item, + wxRect& rect, + bool textOnly) const +{ + RECT rc; + if ( TreeView_GetItemRect(wxhWnd, (HTREEITEM)(WXHTREEITEM)item, + &rc, textOnly) ) + { + rect = wxRect(wxPoint(rc.left, rc.top), wxPoint(rc.right, rc.bottom)); + + return TRUE; + } + else + { + // couldn't retrieve rect: for example, item isn't visible + return FALSE; + } +} + // ---------------------------------------------------------------------------- // sorting stuff // ---------------------------------------------------------------------------- + static int CALLBACK TreeView_CompareCallback(wxTreeItemData *pItem1, wxTreeItemData *pItem2, wxTreeCtrl *tree)