- semiOldY+=GetLineHeight(children[--n])/2;
- if (drawLines)
- dc.DrawLine( horizX+m_indent, oldY+5, horizX+m_indent, semiOldY );
+ int n = 0, oldY;
+ ++level;
+ do {
+ oldY = y;
+ PaintLevel(children[n], dc, level, y);
+ } while (++n < count);
+
+ if (!HasFlag(wxTR_NO_LINES) && count > 0)
+ {
+ // draw line down to last child
+ oldY += GetLineHeight(children[n-1])>>1;
+ if (HasButtons()) y_mid += 5;
+
+ // 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);
+ }