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
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();