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:
@@ -5,7 +5,7 @@
|
|||||||
// Created: 01/02/97
|
// Created: 01/02/97
|
||||||
// Id:
|
// Id:
|
||||||
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
|
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -212,8 +212,7 @@ long wxGenericTreeItem::HitTest( const wxPoint& point, int &flags )
|
|||||||
(point.x < m_xCross+5) &&
|
(point.x < m_xCross+5) &&
|
||||||
(point.y > m_yCross-5) &&
|
(point.y > m_yCross-5) &&
|
||||||
(point.y < m_yCross+5) &&
|
(point.y < m_yCross+5) &&
|
||||||
(m_hasChildren)
|
(m_hasChildren))
|
||||||
)
|
|
||||||
{
|
{
|
||||||
flags = wxTREE_HITTEST_ONITEMBUTTON;
|
flags = wxTREE_HITTEST_ONITEMBUTTON;
|
||||||
return m_itemId;
|
return m_itemId;
|
||||||
@@ -557,8 +556,8 @@ bool wxTreeCtrl::ExpandItem( const long item, const int action )
|
|||||||
{
|
{
|
||||||
wxGenericTreeItem *child = (wxGenericTreeItem*)node->Data();
|
wxGenericTreeItem *child = (wxGenericTreeItem*)node->Data();
|
||||||
child->SendDelete( this );
|
child->SendDelete( this );
|
||||||
delete node;
|
delete node;
|
||||||
node = i->m_children.First();
|
node = i->m_children.First();
|
||||||
};
|
};
|
||||||
|
|
||||||
int cw = 0;
|
int cw = 0;
|
||||||
@@ -739,14 +738,16 @@ void wxTreeCtrl::PaintLevel( wxGenericTreeItem *item, wxPaintDC &dc, int level,
|
|||||||
|
|
||||||
if (IsExposed( 0, child->m_y-2, 10000, m_lineHeight+4 ))
|
if (IsExposed( 0, child->m_y-2, 10000, m_lineHeight+4 ))
|
||||||
{
|
{
|
||||||
int startX,endX;
|
int startX = horizX,
|
||||||
if ((node->Previous()) || (level != 0))
|
endX = horizX + 10;
|
||||||
startX = horizX; else startX = horizX-10;
|
|
||||||
if (child->HasChildren())
|
if (!(node->Previous()) && (level == 0))
|
||||||
endX = horizX+10; else endX = horizX+30;
|
startX -= 10;
|
||||||
|
if (!child->HasChildren())
|
||||||
|
endX += 20;
|
||||||
dc.DrawLine( startX, y, endX, y );
|
dc.DrawLine( startX, y, endX, y );
|
||||||
|
|
||||||
if (child->HasChildren())
|
if (child->HasChildren())
|
||||||
{
|
{
|
||||||
dc.DrawLine( horizX+20, y, horizX+30, y );
|
dc.DrawLine( horizX+20, y, horizX+30, y );
|
||||||
dc.SetPen( *wxGREY_PEN );
|
dc.SetPen( *wxGREY_PEN );
|
||||||
@@ -759,27 +760,35 @@ void wxTreeCtrl::PaintLevel( wxGenericTreeItem *item, wxPaintDC &dc, int level,
|
|||||||
|
|
||||||
if (child->HasHilight())
|
if (child->HasHilight())
|
||||||
{
|
{
|
||||||
dc.SetTextForeground( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_HIGHLIGHTTEXT ) );
|
dc.SetTextForeground( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_HIGHLIGHTTEXT ) );
|
||||||
dc.SetBrush( *m_hilightBrush );
|
#if 0 // VZ: this code leaves horizontal stripes when item is unselected
|
||||||
if (m_hasFocus)
|
dc.SetBrush( *m_hilightBrush );
|
||||||
dc.SetPen( wxBLACK_PEN );
|
if (m_hasFocus)
|
||||||
else
|
dc.SetPen( wxBLACK_PEN );
|
||||||
dc.SetPen( wxTRANSPARENT_PEN );
|
else
|
||||||
long tw = 0;
|
dc.SetPen( wxTRANSPARENT_PEN );
|
||||||
long th = 0;
|
long tw, th;
|
||||||
dc.GetTextExtent( child->m_text, &tw, &th );
|
dc.GetTextExtent( child->m_text, &tw, &th );
|
||||||
dc.DrawRectangle( child->m_x-2, child->m_y-2, tw+4, th+4 );
|
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 );
|
dc.DrawText( child->m_text, child->m_x, child->m_y );
|
||||||
|
|
||||||
if (child->HasHilight())
|
|
||||||
{
|
|
||||||
dc.SetTextForeground( *wxBLACK );
|
|
||||||
dc.SetBrush( *wxWHITE_BRUSH );
|
|
||||||
dc.SetPen( *wxBLACK_PEN );
|
|
||||||
};
|
|
||||||
|
|
||||||
|
#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;
|
y += m_lineHeight;
|
||||||
@@ -837,7 +846,8 @@ void wxTreeCtrl::OnMouse( const wxMouseEvent &event )
|
|||||||
|
|
||||||
int flag = 0;
|
int flag = 0;
|
||||||
long id = HitTest( wxPoint(x,y), flag );
|
long id = HitTest( wxPoint(x,y), flag );
|
||||||
if (id == -1) return;
|
if (id == -1)
|
||||||
|
return;
|
||||||
wxGenericTreeItem *item = FindItem( id );
|
wxGenericTreeItem *item = FindItem( id );
|
||||||
|
|
||||||
if (!item) return;
|
if (!item) return;
|
||||||
@@ -857,7 +867,8 @@ void wxTreeCtrl::OnMouse( const wxMouseEvent &event )
|
|||||||
m_current->SendSelected( this );
|
m_current->SendSelected( this );
|
||||||
};
|
};
|
||||||
|
|
||||||
if (event.LeftDClick()) m_current->SendKeyDown( this );
|
if (event.LeftDClick())
|
||||||
|
m_current->SendKeyDown( this );
|
||||||
|
|
||||||
if (flag == wxTREE_HITTEST_ONITEMBUTTON)
|
if (flag == wxTREE_HITTEST_ONITEMBUTTON)
|
||||||
{
|
{
|
||||||
@@ -875,11 +886,13 @@ void wxTreeCtrl::CalculateLevel( wxGenericTreeItem *item, wxPaintDC &dc, int lev
|
|||||||
wxGenericTreeItem *child = (wxGenericTreeItem *)node->Data();
|
wxGenericTreeItem *child = (wxGenericTreeItem *)node->Data();
|
||||||
dc.SetPen( m_dottedPen );
|
dc.SetPen( m_dottedPen );
|
||||||
|
|
||||||
int startX,endX;
|
int startX = horizX,
|
||||||
if ((node->Previous()) || (level != 0))
|
endX = horizX + 10;
|
||||||
startX = horizX; else startX = horizX-10;
|
|
||||||
if (child->HasChildren())
|
if (!node->Previous() && (level == 0))
|
||||||
endX = horizX+10; else endX = horizX+30;
|
startX -= 10;
|
||||||
|
if (!child->HasChildren())
|
||||||
|
endX += 20;
|
||||||
|
|
||||||
child->m_x = horizX+33;
|
child->m_x = horizX+33;
|
||||||
child->m_y = y-m_lineHeight/3-2;
|
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)
|
void wxTreeCtrl::CalculatePositions(void)
|
||||||
{
|
{
|
||||||
if (!m_anchor) return;
|
if (!m_anchor)
|
||||||
|
return;
|
||||||
|
|
||||||
wxClientDC dc(this);
|
wxClientDC dc(this);
|
||||||
PrepareDC( dc );
|
PrepareDC( dc );
|
||||||
|
Reference in New Issue
Block a user