Backported recent wxGenericTreeCtrl fixes

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@19609 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2003-03-19 01:02:45 +00:00
parent bd3b579a5a
commit 003d61a3e6

View File

@@ -291,7 +291,7 @@ private:
short m_images[wxTreeItemIcon_Max];
wxCoord m_x; // (virtual) offset from top
short m_y; // (virtual) offset from left
wxCoord m_y; // (virtual) offset from left
short m_width; // width of this item
unsigned char m_height; // height of this item
@@ -2329,8 +2329,8 @@ void wxGenericTreeCtrl::PaintLevel( wxGenericTreeItem *item, wxDC &dc, int level
MacWindowToRootWindow( & loc_x , & loc_y ) ;
Rect bounds = { loc_y , loc_x , loc_y + 18 , loc_x + 12 } ;
ThemeButtonDrawInfo info = { kThemeStateActive , item->IsExpanded() ? kThemeDisclosureDown : kThemeDisclosureRight ,
kThemeAdornmentNone };
DrawThemeButton( &bounds, kThemeDisclosureButton ,
kThemeAdornmentNone };
DrawThemeButton( &bounds, kThemeDisclosureButton ,
&info , NULL , NULL , NULL , NULL ) ;
#else
if (item->IsExpanded())
@@ -2410,7 +2410,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);
}
}
}