From d9df970573ca16e3ad84f427fb3fe9be81d24d53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Va=CC=81clav=20Slavi=CC=81k?= Date: Wed, 19 Oct 2016 16:59:07 +0200 Subject: [PATCH] Don't use custom colors in selected wxDVC controls (wxOSX) Don't use custom color attributes or color markup for rendering of selected items' text in wxOSX's wxDataViewCtrl and use the selection text color instead. This is consistent with the other ports and should be done to improve readability (in absence of selection-specific attributes). --- src/osx/cocoa/dataview.mm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/osx/cocoa/dataview.mm b/src/osx/cocoa/dataview.mm index fac25931ab..b146e962f5 100644 --- a/src/osx/cocoa/dataview.mm +++ b/src/osx/cocoa/dataview.mm @@ -2733,7 +2733,7 @@ void wxDataViewRenderer::SetAttr(const wxDataViewItemAttr& attr) //else: can't change font if the cell doesn't have any } - if ( attr.HasColour() ) + if ( attr.HasColour() && ![cell isHighlighted] ) { // we can set font for any cell but only NSTextFieldCell provides // a method for setting text colour so check that this method is @@ -2842,6 +2842,12 @@ bool wxDataViewTextRenderer::MacRender() [par release]; } + if ( [cell isHighlighted] ) + { + [str removeAttribute:NSForegroundColorAttributeName range:NSMakeRange(0, [str length])]; + [str removeAttribute:NSBackgroundColorAttributeName range:NSMakeRange(0, [str length])]; + } + [cell setAttributedStringValue:str]; return true; }