From aa2444bd9ef48c616e0f518722aa447a1c062d32 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 6 Nov 2009 20:47:44 +0000 Subject: [PATCH] Prefer to use standard selection colour in wxDataViewCustomRenderer. We currently don't allow customizing the background colour of the selected items which is always the system standard colour and so we should also use the system standard selection foreground colour as a combination of a custom foreground and standard background may be completely unreadable. Notice that it is still possible to use custom colour if really needed from a custom renderer by removing wxDATAVIEW_CELL_SELECTED from the flags before calling the base class version of RenderText(). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62565 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/datavgen.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/generic/datavgen.cpp b/src/generic/datavgen.cpp index 74aba29bd9..04924b89dd 100644 --- a/src/generic/datavgen.cpp +++ b/src/generic/datavgen.cpp @@ -727,11 +727,14 @@ wxDataViewCustomRenderer::RenderText(wxDC& dc, int state, int xoffset) { + // override custom foreground with the standard one for the selected items + // because we currently don't allow changing the selection background and + // custom colours may be unreadable on it wxColour col; - if ( attr && attr->HasColour() ) - col = attr->GetColour(); - else if ( state & wxDATAVIEW_CELL_SELECTED ) + if ( state & wxDATAVIEW_CELL_SELECTED ) col = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT); + else if ( attr && attr->HasColour() ) + col = attr->GetColour(); else // use default foreground col = GetOwner()->GetOwner()->GetForegroundColour(); -- 2.47.2