]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/treectlg.cpp
Don't scroll the grid when starting a cell editor if it will already
[wxWidgets.git] / src / generic / treectlg.cpp
index 25576d2fb7e1759a739199d8e71f6ec9dec282ec..577ecbc4e1615e58d728763662f142675ac6ec01 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        treectlg.cpp
+// Name:        src/generic/treectlg.cpp
 // Purpose:     generic tree control implementation
 // Author:      Robert Roebling
 // Created:     01/02/97
 
 #if wxUSE_TREECTRL
 
-#include "wx/treebase.h"
 #include "wx/treectrl.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/dcclient.h"
+#endif
+
 #include "wx/generic/treectlg.h"
 #include "wx/timer.h"
 #include "wx/textctrl.h"
 #include "wx/imaglist.h"
 #include "wx/settings.h"
-#include "wx/dcclient.h"
 
 #include "wx/renderer.h"
 
@@ -2323,7 +2326,7 @@ void wxGenericTreeCtrl::PaintLevel( wxGenericTreeItem *item, wxDC &dc, int level
 
     if (IsExposed(exposed_x, exposed_y, 10000, h))  // 10000 = very much
     {
-        wxPen *pen =
+        const wxPen *pen =
 #ifndef __WXMAC__
             // don't draw rect outline if we already have the
             // background color under Mac
@@ -2887,12 +2890,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 +2908,12 @@ 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
+    rect.SetTopLeft(CalcScrolledPosition(rect.GetTopLeft()));
+
     return true;
 }