]> git.saurik.com Git - wxWidgets.git/commitdiff
Applied a modification of Patch #704995 which changes how the lines
authorRobin Dunn <robin@alldunn.com>
Wed, 19 Mar 2003 01:01:14 +0000 (01:01 +0000)
committerRobin Dunn <robin@alldunn.com>
Wed, 19 Mar 2003 01:01:14 +0000 (01:01 +0000)
are drawn such that only the visible portions are drawn.  This is
because (I think) if the length of the line is > 32k then on at least
Win9x and GTK 1.2 the line will wrap around to the other end of the
tree ctrl...

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19608 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/generic/treectlg.cpp

index caad650e5155efed594d525fc76983959b35d6d2..3c45e0461d6dfb671990f1d2d72d45f9821db754 100644 (file)
@@ -2385,7 +2385,23 @@ void wxGenericTreeCtrl::PaintLevel( wxGenericTreeItem *item, wxDC &dc, int level
                 // draw line down to last child
                 oldY += GetLineHeight(children[n-1])>>1;
                 if (HasButtons()) y_mid += 5;
-                dc.DrawLine(x, y_mid, x, oldY);
+
+                // Only draw the portion of the line that is visible, in case it is huge
+                wxCoord        xOrigin=0, yOrigin=0, width, height;
+                dc.GetDeviceOrigin(&xOrigin, &yOrigin);
+                yOrigin = abs(yOrigin);
+                GetClientSize(&width, &height);
+
+                // Move end points to the begining/end of the view?
+                if (y_mid < yOrigin)
+                    y_mid = yOrigin;
+                if (oldY > yOrigin + height)
+                    oldY = yOrigin + height;
+
+                // after the adjustments if y_mid is larger than oldY then the line
+                // isn't visible at all so don't draw anything
+                if (y_mid < oldY)
+                    dc.DrawLine(x, y_mid, x, oldY);
             }
         }
     }