]> git.saurik.com Git - wxWidgets.git/commitdiff
wxTreeCtrl::GetBoundRect() implemented
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 27 Feb 1999 14:38:46 +0000 (14:38 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 27 Feb 1999 14:38:46 +0000 (14:38 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1815 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/msw/treectrl.h
src/msw/treectrl.cpp

index 3864830c013cd86016c0f0455f84154c2c2a408e..51e1e02d3c1e87d8206ec8db37e1914850207c49 100644 (file)
@@ -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;
 
index f174a3d0212571b491384b8dc96132f132adb907..9c346d609863b449156f48a25e77a428a7e810a2 100644 (file)
@@ -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)