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.
This commit is contained in:
Vadim Zeitlin 2016-06-15 01:09:55 +02:00
parent acd77439f9
commit b6a75ff0b2
2 changed files with 2 additions and 9 deletions

View File

@ -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;

View File

@ -937,16 +937,9 @@ wxRendererGeneric::DrawItemText(wxWindow* WXUNUSED(win),
// Determine text color
wxColour textColour;
if ( flags & wxCONTROL_SELECTED )
{
if ( flags & wxCONTROL_FOCUSED )
{
textColour = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT);
}
else // !focused
{
textColour = wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOXTEXT);
}
}
else if ( flags & wxCONTROL_DISABLED )
{
textColour = wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT);