fixes redraw bug which was leaving a horizontal strip under the tree item
after it was unselected (in wxGTK) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@158 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -212,8 +212,7 @@ long wxGenericTreeItem::HitTest( const wxPoint& point, int &flags )
|
||||
(point.x < m_xCross+5) &&
|
||||
(point.y > m_yCross-5) &&
|
||||
(point.y < m_yCross+5) &&
|
||||
(m_hasChildren)
|
||||
)
|
||||
(m_hasChildren))
|
||||
{
|
||||
flags = wxTREE_HITTEST_ONITEMBUTTON;
|
||||
return m_itemId;
|
||||
@@ -739,11 +738,13 @@ void wxTreeCtrl::PaintLevel( wxGenericTreeItem *item, wxPaintDC &dc, int level,
|
||||
|
||||
if (IsExposed( 0, child->m_y-2, 10000, m_lineHeight+4 ))
|
||||
{
|
||||
int startX,endX;
|
||||
if ((node->Previous()) || (level != 0))
|
||||
startX = horizX; else startX = horizX-10;
|
||||
if (child->HasChildren())
|
||||
endX = horizX+10; else endX = horizX+30;
|
||||
int startX = horizX,
|
||||
endX = horizX + 10;
|
||||
|
||||
if (!(node->Previous()) && (level == 0))
|
||||
startX -= 10;
|
||||
if (!child->HasChildren())
|
||||
endX += 20;
|
||||
dc.DrawLine( startX, y, endX, y );
|
||||
|
||||
if (child->HasChildren())
|
||||
@@ -760,26 +761,34 @@ void wxTreeCtrl::PaintLevel( wxGenericTreeItem *item, wxPaintDC &dc, int level,
|
||||
if (child->HasHilight())
|
||||
{
|
||||
dc.SetTextForeground( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_HIGHLIGHTTEXT ) );
|
||||
#if 0 // VZ: this code leaves horizontal stripes when item is unselected
|
||||
dc.SetBrush( *m_hilightBrush );
|
||||
if (m_hasFocus)
|
||||
dc.SetPen( wxBLACK_PEN );
|
||||
else
|
||||
dc.SetPen( wxTRANSPARENT_PEN );
|
||||
long tw = 0;
|
||||
long th = 0;
|
||||
long tw, th;
|
||||
dc.GetTextExtent( child->m_text, &tw, &th );
|
||||
dc.DrawRectangle( child->m_x-2, child->m_y-2, tw+4, th+4 );
|
||||
};
|
||||
#else
|
||||
int modeOld = dc.GetBackgroundMode();
|
||||
dc.SetTextBackground( *wxBLACK );
|
||||
dc.SetBackgroundMode(wxSOLID);
|
||||
#endif // 0
|
||||
|
||||
dc.DrawText( child->m_text, child->m_x, child->m_y );
|
||||
|
||||
if (child->HasHilight())
|
||||
{
|
||||
dc.SetTextForeground( *wxBLACK );
|
||||
dc.SetBrush( *wxWHITE_BRUSH );
|
||||
#if 0 // VZ: same as above
|
||||
dc.SetPen( *wxBLACK_PEN );
|
||||
};
|
||||
|
||||
#else
|
||||
dc.SetBackgroundMode(modeOld);
|
||||
dc.SetTextBackground( *wxWHITE );
|
||||
dc.SetBrush( *wxWHITE_BRUSH );
|
||||
#endif
|
||||
dc.SetTextForeground( *wxBLACK );
|
||||
}
|
||||
else
|
||||
dc.DrawText( child->m_text, child->m_x, child->m_y );
|
||||
};
|
||||
|
||||
y += m_lineHeight;
|
||||
@@ -837,7 +846,8 @@ void wxTreeCtrl::OnMouse( const wxMouseEvent &event )
|
||||
|
||||
int flag = 0;
|
||||
long id = HitTest( wxPoint(x,y), flag );
|
||||
if (id == -1) return;
|
||||
if (id == -1)
|
||||
return;
|
||||
wxGenericTreeItem *item = FindItem( id );
|
||||
|
||||
if (!item) return;
|
||||
@@ -857,7 +867,8 @@ void wxTreeCtrl::OnMouse( const wxMouseEvent &event )
|
||||
m_current->SendSelected( this );
|
||||
};
|
||||
|
||||
if (event.LeftDClick()) m_current->SendKeyDown( this );
|
||||
if (event.LeftDClick())
|
||||
m_current->SendKeyDown( this );
|
||||
|
||||
if (flag == wxTREE_HITTEST_ONITEMBUTTON)
|
||||
{
|
||||
@@ -875,11 +886,13 @@ void wxTreeCtrl::CalculateLevel( wxGenericTreeItem *item, wxPaintDC &dc, int lev
|
||||
wxGenericTreeItem *child = (wxGenericTreeItem *)node->Data();
|
||||
dc.SetPen( m_dottedPen );
|
||||
|
||||
int startX,endX;
|
||||
if ((node->Previous()) || (level != 0))
|
||||
startX = horizX; else startX = horizX-10;
|
||||
if (child->HasChildren())
|
||||
endX = horizX+10; else endX = horizX+30;
|
||||
int startX = horizX,
|
||||
endX = horizX + 10;
|
||||
|
||||
if (!node->Previous() && (level == 0))
|
||||
startX -= 10;
|
||||
if (!child->HasChildren())
|
||||
endX += 20;
|
||||
|
||||
child->m_x = horizX+33;
|
||||
child->m_y = y-m_lineHeight/3-2;
|
||||
@@ -895,7 +908,8 @@ void wxTreeCtrl::CalculateLevel( wxGenericTreeItem *item, wxPaintDC &dc, int lev
|
||||
|
||||
void wxTreeCtrl::CalculatePositions(void)
|
||||
{
|
||||
if (!m_anchor) return;
|
||||
if (!m_anchor)
|
||||
return;
|
||||
|
||||
wxClientDC dc(this);
|
||||
PrepareDC( dc );
|
||||
|
Reference in New Issue
Block a user