From 887b919bde47aeab043506e220be25d4d293afaf Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Fri, 25 Feb 2011 09:38:35 +0000 Subject: [PATCH] Added wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT to fix tree and list control selection rendering. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67018 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/settings.h | 1 + interface/wx/settings.h | 7 +++++++ src/generic/listctrl.cpp | 5 ++++- src/generic/treectlg.cpp | 5 ++++- src/gtk/settings.cpp | 6 ++++++ src/gtk1/settings.cpp | 1 + src/motif/settings.cpp | 1 + src/msw/settings.cpp | 5 +++++ src/os2/settings.cpp | 1 + src/osx/carbon/settings.cpp | 1 + src/palmos/settings.cpp | 1 + src/univ/settingsuniv.cpp | 1 + 12 files changed, 33 insertions(+), 2 deletions(-) diff --git a/include/wx/settings.h b/include/wx/settings.h index 8de41ae424..d9c2dd4049 100644 --- a/include/wx/settings.h +++ b/include/wx/settings.h @@ -81,6 +81,7 @@ enum wxSystemColour wxSYS_COLOUR_MENUHILIGHT, wxSYS_COLOUR_MENUBAR, wxSYS_COLOUR_LISTBOXTEXT, + wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT, wxSYS_COLOUR_MAX, diff --git a/interface/wx/settings.h b/interface/wx/settings.h index ef3d4fd317..512b1aa967 100644 --- a/interface/wx/settings.h +++ b/interface/wx/settings.h @@ -109,6 +109,13 @@ enum wxSystemColour */ wxSYS_COLOUR_LISTBOXTEXT, + /** + Text colour for the unfocused selection of list-like controls. + + @since 2.9.1 + */ + wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT, + wxSYS_COLOUR_MAX diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 02b14b51f7..89c08e18c6 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -687,7 +687,10 @@ void wxListLineData::ApplyAttributes(wxDC *dc, else colText = *wxBLACK; #else - colText = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT); + if ( hasFocus ) + colText = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT); + else + colText = wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT); #endif } else if ( attr && attr->HasTextColour() ) diff --git a/src/generic/treectlg.cpp b/src/generic/treectlg.cpp index c3b739e4d3..67e0cf5f63 100644 --- a/src/generic/treectlg.cpp +++ b/src/generic/treectlg.cpp @@ -2759,7 +2759,10 @@ wxGenericTreeCtrl::PaintLevel(wxGenericTreeItem *item, #ifdef __WXMAC__ colText = *wxWHITE; #else - colText = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT); + if (m_hasFocus) + colText = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT); + else + colText = wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT); #endif } else diff --git a/src/gtk/settings.cpp b/src/gtk/settings.cpp index 20e413249f..d4b9201cc6 100644 --- a/src/gtk/settings.cpp +++ b/src/gtk/settings.cpp @@ -189,6 +189,12 @@ wxColour wxSystemSettingsNative::GetColour( wxSystemColour index ) color = wxColor(ListStyle()->text[GTK_STATE_NORMAL]); break; + case wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT: + // This is for the text in a list control (or tree) when the + // item is selected, but not focused + color = wxColor(ListStyle()->text[GTK_STATE_ACTIVE]); + break; + case wxSYS_COLOUR_MENUTEXT: case wxSYS_COLOUR_WINDOWTEXT: case wxSYS_COLOUR_CAPTIONTEXT: diff --git a/src/gtk1/settings.cpp b/src/gtk1/settings.cpp index e8da9443c1..36ba1f63d6 100644 --- a/src/gtk1/settings.cpp +++ b/src/gtk1/settings.cpp @@ -281,6 +281,7 @@ wxColour wxSystemSettingsNative::GetColour( wxSystemColour index ) } return gs_objects.m_colTooltipText; + case wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT: case wxSYS_COLOUR_HIGHLIGHTTEXT: if (!gs_objects.m_colHighlightText.Ok()) { diff --git a/src/motif/settings.cpp b/src/motif/settings.cpp index 9b5b083422..cedbbdf232 100644 --- a/src/motif/settings.cpp +++ b/src/motif/settings.cpp @@ -128,6 +128,7 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index) } } case wxSYS_COLOUR_HIGHLIGHTTEXT: + case wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT: { return *wxWHITE; } diff --git a/src/msw/settings.cpp b/src/msw/settings.cpp index eec4fea1a9..4fbc2299f6 100644 --- a/src/msw/settings.cpp +++ b/src/msw/settings.cpp @@ -133,6 +133,11 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index) // there is no standard colour with this index, map to another one index = wxSYS_COLOUR_WINDOWTEXT; } + else if ( index == wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT) + { + // there is no standard colour with this index, map to another one + index = wxSYS_COLOUR_HIGHLIGHTTEXT; + } else if ( index == wxSYS_COLOUR_LISTBOX ) { // there is no standard colour with this index, map to another one diff --git a/src/os2/settings.cpp b/src/os2/settings.cpp index c3f6e7bc0f..484be7380c 100644 --- a/src/os2/settings.cpp +++ b/src/os2/settings.cpp @@ -172,6 +172,7 @@ wxColour wxSystemSettingsNative::GetColour( break; case wxSYS_COLOUR_HIGHLIGHTTEXT: + case wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT: vSysClr = SYSCLR_HILITEFOREGROUND; break; diff --git a/src/osx/carbon/settings.cpp b/src/osx/carbon/settings.cpp index bc6b13ad73..1bac3eaa5b 100644 --- a/src/osx/carbon/settings.cpp +++ b/src/osx/carbon/settings.cpp @@ -110,6 +110,7 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index) break ; case wxSYS_COLOUR_HIGHLIGHTTEXT : + case wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT : #if wxOSX_USE_COCOA_OR_CARBON { wxColour highlightcolor( wxMacCreateCGColorFromHITheme(-3 /* kThemeBrushPrimaryHighlightColor */) ); diff --git a/src/palmos/settings.cpp b/src/palmos/settings.cpp index e9d5be3f19..ecb01c9bd5 100644 --- a/src/palmos/settings.cpp +++ b/src/palmos/settings.cpp @@ -76,6 +76,7 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index) case wxSYS_COLOUR_INACTIVEBORDER: case wxSYS_COLOUR_APPWORKSPACE: case wxSYS_COLOUR_HIGHLIGHT: + case wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT: case wxSYS_COLOUR_HIGHLIGHTTEXT: case wxSYS_COLOUR_BTNFACE: case wxSYS_COLOUR_BTNSHADOW: diff --git a/src/univ/settingsuniv.cpp b/src/univ/settingsuniv.cpp index a382d39219..8d7ea622ca 100644 --- a/src/univ/settingsuniv.cpp +++ b/src/univ/settingsuniv.cpp @@ -78,6 +78,7 @@ wxColour wxSystemSettings::GetColour(wxSystemColour index) wxColourScheme::MAX /* wxSYS_COLOUR_MENUHILIGHT */, wxColourScheme::MAX /* wxSYS_COLOUR_MENUBAR */, wxColourScheme::CONTROL_TEXT /* wxSYS_COLOUR_LISTBOXTEXT */, + wxColourScheme::HIGHLIGHT_TEXT /* wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT */ }; wxCOMPILE_TIME_ASSERT( WXSIZEOF(s_mapSysToThemeCol) == wxSYS_COLOUR_MAX, -- 2.45.2