]> git.saurik.com Git - wxWidgets.git/commitdiff
Prefer to use standard selection colour in wxDataViewCustomRenderer.
authorVadim Zeitlin <vadim@wxwidgets.org>
Fri, 6 Nov 2009 20:47:44 +0000 (20:47 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Fri, 6 Nov 2009 20:47:44 +0000 (20:47 +0000)
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

index 74aba29bd9a6fb895dd96f721ce2c0ebf61b5fb7..04924b89dd768188e34d234c48c71ee703d739e2 100644 (file)
@@ -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();