From b6a75ff0b2c3ca7ff763b64d8e444b16a380018b Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 15 Jun 2016 01:09:55 +0200 Subject: [PATCH] Don't pass nor use wxCONTROL_FOCUSED in wxRenderer::DrawItemText() It doesn't make much sense to always use wxCONTROL_FOCUSED in wxDataViewCtrl code whenever wxDATAVIEW_CELL_SELECTED state bit is set, wxCONTROL_SELECTED seems to be enough and is with the native MSW wxRenderer implementation which doesn't even test for wxCONTROL_FOCUSED anyhow, while the generic one did and didn't use the correct colour unless it was set. No real changes, but this will make upcoming commits more straightforward and already simplifies the code a little bit. --- src/common/datavcmn.cpp | 2 +- src/generic/renderg.cpp | 9 +-------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/common/datavcmn.cpp b/src/common/datavcmn.cpp index e4e5521bd8..f8dcfee354 100644 --- a/src/common/datavcmn.cpp +++ b/src/common/datavcmn.cpp @@ -1005,7 +1005,7 @@ wxDataViewCustomRendererBase::RenderText(const wxString& text, int flags = 0; if ( state & wxDATAVIEW_CELL_SELECTED ) - flags |= wxCONTROL_SELECTED | wxCONTROL_FOCUSED; + flags |= wxCONTROL_SELECTED; if ( !GetOwner()->GetOwner()->IsEnabled() ) flags |= wxCONTROL_DISABLED; diff --git a/src/generic/renderg.cpp b/src/generic/renderg.cpp index b76c96b9bf..1961141fc4 100644 --- a/src/generic/renderg.cpp +++ b/src/generic/renderg.cpp @@ -938,14 +938,7 @@ wxRendererGeneric::DrawItemText(wxWindow* WXUNUSED(win), wxColour textColour; if ( flags & wxCONTROL_SELECTED ) { - if ( flags & wxCONTROL_FOCUSED ) - { - textColour = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT); - } - else // !focused - { - textColour = wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOXTEXT); - } + textColour = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT); } else if ( flags & wxCONTROL_DISABLED ) {