X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/afa6a1a1d9edc25f4fb2ac4b2ef113382801ac5b..b51b78a9c7b50053cdcf4a22d2222500a20eb8ee:/src/generic/treectrl.cpp?ds=inline diff --git a/src/generic/treectrl.cpp b/src/generic/treectrl.cpp index 0f45e548b7..7bdbfe798d 100644 --- a/src/generic/treectrl.cpp +++ b/src/generic/treectrl.cpp @@ -252,14 +252,23 @@ void wxTreeTextCtrl::OnChar( wxKeyEvent &event ) { (*m_accept) = TRUE; (*m_res) = GetValue(); - m_owner->SetFocus(); + + if (!wxPendingDelete.Member(this)) + wxPendingDelete.Append(this); + + if ((*m_accept) && ((*m_res) != m_startValue)) + m_owner->OnRenameAccept(); + return; } if (event.m_keyCode == WXK_ESCAPE) { (*m_accept) = FALSE; (*m_res) = ""; - m_owner->SetFocus(); + + if (!wxPendingDelete.Member(this)) + wxPendingDelete.Append(this); + return; } event.Skip(); @@ -267,9 +276,8 @@ void wxTreeTextCtrl::OnChar( wxKeyEvent &event ) void wxTreeTextCtrl::OnKillFocus( wxFocusEvent &WXUNUSED(event) ) { - if (wxPendingDelete.Member(this)) return; - - wxPendingDelete.Append(this); + if (!wxPendingDelete.Member(this)) + wxPendingDelete.Append(this); if ((*m_accept) && ((*m_res) != m_startValue)) m_owner->OnRenameAccept(); @@ -580,7 +588,7 @@ bool wxTreeCtrl::Create(wxWindow *parent, wxWindowID id, SetValidator( validator ); #endif - SetBackgroundColour( *wxWHITE ); + SetBackgroundColour( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_LISTBOX ) ); // m_dottedPen = wxPen( "grey", 0, wxDOT ); too slow under XFree86 m_dottedPen = wxPen( "grey", 0, 0 ); @@ -1523,12 +1531,17 @@ void wxTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc) int total_h = GetLineHeight(item); - wxColour colBg; - if ( attr && attr->HasBackgroundColour() ) - colBg = attr->GetBackgroundColour(); + if (item->IsSelected()) + dc.SetBrush(*m_hilightBrush); else - colBg = m_backgroundColour; - dc.SetBrush(wxBrush(colBg, wxSOLID)); + { + wxColour colBg; + if ( attr && attr->HasBackgroundColour() ) + colBg = attr->GetBackgroundColour(); + else + colBg = m_backgroundColour; + dc.SetBrush(wxBrush(colBg, wxSOLID)); + } dc.DrawRectangle( item->GetX()-2, item->GetY(), item->GetWidth()+2, total_h ); @@ -1592,15 +1605,12 @@ void wxTreeCtrl::PaintLevel( wxGenericTreeItem *item, wxDC &dc, int level, int & } wxPen *pen = wxTRANSPARENT_PEN; - wxBrush *brush; // FIXME is this really needed? wxColour colText; if ( item->IsSelected() ) { colText = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_HIGHLIGHTTEXT ); - brush = m_hilightBrush; - if ( m_hasFocus ) pen = wxBLACK_PEN; @@ -1612,14 +1622,11 @@ void wxTreeCtrl::PaintLevel( wxGenericTreeItem *item, wxDC &dc, int level, int & colText = attr->GetTextColour(); else colText = *wxBLACK; - - brush = wxWHITE_BRUSH; } // prepare to draw dc.SetTextForeground(colText); dc.SetPen(*pen); - dc.SetBrush(*brush); // draw PaintItem(item, dc);