]> git.saurik.com Git - wxWidgets.git/commitdiff
GetBoundingRect() is supposed to return the logical coordinates, even in !textOnly...
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 6 Apr 2006 14:27:34 +0000 (14:27 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 6 Apr 2006 14:27:34 +0000 (14:27 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38604 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/latex/wx/treectrl.tex
src/generic/treectlg.cpp

index 176a03890563ed223c03e6502c852c4cf2ac412e..ad174cb31a03e1a239e3676720a0149365fb7950 100644 (file)
@@ -340,9 +340,13 @@ only the rectangle around the item's label will be returned, otherwise the
 item's image is also taken into account.
 
 The return value is {\tt true} if the rectangle was successfully retrieved or {\tt false}
-if it was not (in this case {\it rect} is not changed) - for example, if the
+if it was not (in this case {\it rect} is not changed) -- for example, if the
 item is currently invisible.
 
+Notice that the rectangle coordinates are logical, not physical ones. So, for
+example, the x coordinate may be negative if the tree has a horizontal
+scrollbar and its position is not $0$.
+
 \pythonnote{The wxPython version of this method requires only the
 {\tt item} and {\tt textOnly} parameters.  The return value is either a
 {\tt wxRect} object or {\tt None}.}
index 25576d2fb7e1759a739199d8e71f6ec9dec282ec..31b1d054a66d0f089c623b84c343ee9aa3077fa0 100644 (file)
@@ -2887,12 +2887,9 @@ bool wxGenericTreeCtrl::GetBoundingRect(const wxTreeItemId& item,
 
     wxGenericTreeItem *i = (wxGenericTreeItem*) item.m_pItem;
 
-    int startX, startY;
-    GetViewStart(& startX, & startY);
-
     if ( textOnly )
     {
-        rect.x = i->GetX() - startX*PIXELS_PER_UNIT;
+        rect.x = i->GetX();
         rect.width = i->GetWidth();
 
         if ( m_imageListNormal )
@@ -2908,9 +2905,16 @@ bool wxGenericTreeCtrl::GetBoundingRect(const wxTreeItemId& item,
         rect.width = GetClientSize().x;
     }
 
-    rect.y = i->GetY() - startY*PIXELS_PER_UNIT;
+    rect.y = i->GetY();
     rect.height = GetLineHeight(i);
 
+    // we have to return the logical coordinates, not physical ones
+    int startX, startY;
+    GetViewStart(& startX, & startY);
+
+    rect.x -= startX*PIXELS_PER_UNIT;
+    rect.y -= startY*PIXELS_PER_UNIT;
+
     return true;
 }