]> git.saurik.com Git - wxWidgets.git/commitdiff
Added first stab at GetBoundingRect for generic tree control
authorJulian Smart <julian@anthemion.co.uk>
Mon, 7 Aug 2000 14:42:48 +0000 (14:42 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Mon, 7 Aug 2000 14:42:48 +0000 (14:42 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@7969 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/generic/treectlg.h
src/generic/treectlg.cpp

index 6b661d238bf5e08bd50a9cceb5c985fca90c0ae7..17e4e295ed360c731f209162c84a19f67ee0a0a1 100644 (file)
@@ -281,6 +281,11 @@ public:
         { int dummy; return HitTest(point, dummy); }
     wxTreeItemId HitTest(const wxPoint& point, int& flags);
 
+        // get the bounding rectangle of the item (or of its label only)
+    bool GetBoundingRect(const wxTreeItemId& item,
+                         wxRect& rect,
+                         bool textOnly = FALSE) const;
+
         // Start editing the item label: this (temporarily) replaces the item
         // with a one line edit control. The item will be selected if it hadn't
         // been before.
index 5a7c1c4c588bdf45783bf9e9875a64f0c832eda2..76bf9030ab17a773e8f93d39a57c6b91817ca2dc 100644 (file)
@@ -2109,6 +2109,27 @@ wxTreeItemId wxGenericTreeCtrl::HitTest(const wxPoint& point, int& flags)
     return m_anchor->HitTest( wxPoint(x, y), this, flags);
 }
 
+// get the bounding rectangle of the item (or of its label only)
+bool wxGenericTreeCtrl::GetBoundingRect(const wxTreeItemId& item,
+                         wxRect& rect,
+                         bool textOnly) const
+{
+    wxCHECK2_MSG( item.IsOk(), FALSE, _T("invalid item in wxGenericTreeCtrl::GetBoundingRect") );
+
+    wxGenericTreeItem *i = (wxGenericTreeItem*) item.m_pItem;
+
+    int startX, startY;
+    GetViewStart(& startX, & startY);
+
+    rect.x = i->GetX() - startX*PIXELS_PER_UNIT; rect.y = i->GetY()*PIXELS_PER_UNIT;
+    rect.width = i->GetWidth(); rect.height = i->GetHeight();
+
+    return TRUE;
+
+    // wxFAIL_MSG(wxT("GetBoundingRect unimplemented"));
+    // return FALSE;
+}
+
 /* **** */
 
 void wxGenericTreeCtrl::Edit( const wxTreeItemId& item )