don't draw the selected item background if we don't have the focus
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11305 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
42f96a884e
commit
cdb3cffe0e
@ -1787,8 +1787,11 @@ void wxGenericTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc)
|
||||
|
||||
int total_h = GetLineHeight(item);
|
||||
|
||||
if (item->IsSelected())
|
||||
bool paintBg = item->IsSelected() && m_hasFocus;
|
||||
if ( paintBg )
|
||||
{
|
||||
dc.SetBrush(*m_hilightBrush);
|
||||
}
|
||||
else
|
||||
{
|
||||
wxColour colBg;
|
||||
@ -1799,10 +1802,9 @@ void wxGenericTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc)
|
||||
dc.SetBrush(wxBrush(colBg, wxSOLID));
|
||||
}
|
||||
|
||||
int offset = 0;
|
||||
if (HasFlag(wxTR_ROW_LINES)) offset = 1;
|
||||
int offset = HasFlag(wxTR_ROW_LINES) ? 1 : 0;
|
||||
|
||||
if (item->IsSelected() && image != NO_IMAGE)
|
||||
if ( paintBg && image != NO_IMAGE)
|
||||
{
|
||||
// If it's selected, and there's an image, then we should
|
||||
// take care to leave the area under the image painted in the
|
||||
@ -1919,16 +1921,18 @@ void wxGenericTreeCtrl::PaintLevel( wxGenericTreeItem *item, wxDC &dc, int level
|
||||
|
||||
if ( item->IsSelected() )
|
||||
{
|
||||
colText = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_HIGHLIGHTTEXT );
|
||||
pen = wxBLACK_PEN;
|
||||
|
||||
if ( m_hasFocus )
|
||||
{
|
||||
colText = wxSystemSettings::
|
||||
GetSystemColour( wxSYS_COLOUR_HIGHLIGHTTEXT );
|
||||
}
|
||||
|
||||
#ifdef __WXMAC__
|
||||
// no rect outline, we already have the background color
|
||||
pen = wxTRANSPARENT_PEN;
|
||||
#else
|
||||
if ( m_hasFocus )
|
||||
pen = wxBLACK_PEN;
|
||||
#endif
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2075,14 +2079,16 @@ void wxGenericTreeCtrl::OnSetFocus( wxFocusEvent &WXUNUSED(event) )
|
||||
{
|
||||
m_hasFocus = TRUE;
|
||||
|
||||
if (m_current) RefreshLine( m_current );
|
||||
if (m_current)
|
||||
RefreshLine( m_current );
|
||||
}
|
||||
|
||||
void wxGenericTreeCtrl::OnKillFocus( wxFocusEvent &WXUNUSED(event) )
|
||||
{
|
||||
m_hasFocus = FALSE;
|
||||
|
||||
if (m_current) RefreshLine( m_current );
|
||||
if (m_current)
|
||||
RefreshLine( m_current );
|
||||
}
|
||||
|
||||
void wxGenericTreeCtrl::OnChar( wxKeyEvent &event )
|
||||
|
Loading…
Reference in New Issue
Block a user