From 726de9de5c19f4295bab377c45cc5cb6f87ec4a1 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Fri, 25 Feb 2011 09:37:28 +0000 Subject: [PATCH] Added wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT to correct tree and list control selection rendering. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@67017 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 2 ++ docs/latex/wx/settings.tex | 3 ++- include/wx/settings.h | 1 + src/cocoa/settings.mm | 1 + src/generic/listctrl.cpp | 12 ++++-------- src/generic/treectlg.cpp | 12 +++--------- src/gtk/settings.cpp | 5 ++++- src/gtk1/settings.cpp | 1 + src/mac/carbon/settings.cpp | 1 + src/motif/settings.cpp | 1 + src/msw/settings.cpp | 5 +++++ src/os2/settings.cpp | 1 + src/palmos/settings.cpp | 1 + src/univ/colschem.cpp | 3 ++- 14 files changed, 29 insertions(+), 20 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index a55436c47f..4bdcf46590 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -150,6 +150,8 @@ wxGTK: - Fix for missing menubar problem under some window managers where menu bar height is reported as 0 when the menu hasn't fully realized yet. Now updates the height during idle time if it is 0, otherwise no menu is shown. +- Improved list control and tree control selection text theme compatibility by adding + wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT colour index. wxUniv: diff --git a/docs/latex/wx/settings.tex b/docs/latex/wx/settings.tex index 3f290a8a30..9dd0dc81fb 100644 --- a/docs/latex/wx/settings.tex +++ b/docs/latex/wx/settings.tex @@ -50,11 +50,12 @@ Returns a system colour. \twocolitem{{\bf wxSYS\_COLOUR\_APPWORKSPACE}}{Background colour MDI applications.} \twocolitem{{\bf wxSYS\_COLOUR\_HIGHLIGHT}}{Item(s) selected in a control.} \twocolitem{{\bf wxSYS\_COLOUR\_HIGHLIGHTTEXT}}{Text of item(s) selected in a control.} +\twocolitem{{\bf wxSYS\_COLOUR\_LISTBOXHIGHLIGHTTEXT}}{Text of the item(s) select in an unfocused list-like control.} \twocolitem{{\bf wxSYS\_COLOUR\_BTNFACE}}{Face shading on push buttons.} \twocolitem{{\bf wxSYS\_COLOUR\_BTNSHADOW}}{Edge shading on push buttons.} \twocolitem{{\bf wxSYS\_COLOUR\_GRAYTEXT}}{Greyed (disabled) text.} \twocolitem{{\bf wxSYS\_COLOUR\_BTNTEXT}}{Text on push buttons.} -\twocolitem{{\bf wxSYS\_COLOUR\_INACTIVECAPTIONTEXT}}{Colour of text in active captions.} +\twocolitem{{\bf wxSYS\_COLOUR\_INACTIVECAPTIONTEXT}}{Colour of text in inactive captions.} \twocolitem{{\bf wxSYS\_COLOUR\_BTNHIGHLIGHT}}{Highlight colour for buttons (same as wxSYS\_COLOUR\_3DHILIGHT).} \twocolitem{{\bf wxSYS\_COLOUR\_3DDKSHADOW}}{Dark shadow for three-dimensional display elements.} \twocolitem{{\bf wxSYS\_COLOUR\_3DLIGHT}}{Light colour for three-dimensional display elements.} diff --git a/include/wx/settings.h b/include/wx/settings.h index 93c9bdbd5f..f1ef63a4ae 100644 --- a/include/wx/settings.h +++ b/include/wx/settings.h @@ -80,6 +80,7 @@ enum wxSystemColour wxSYS_COLOUR_MENUHILIGHT, wxSYS_COLOUR_MENUBAR, wxSYS_COLOUR_LISTBOXTEXT, + wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT, wxSYS_COLOUR_MAX }; diff --git a/src/cocoa/settings.mm b/src/cocoa/settings.mm index 0f6ffb05f0..c64566380e 100644 --- a/src/cocoa/settings.mm +++ b/src/cocoa/settings.mm @@ -75,6 +75,7 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index) return wxColour([NSColor controlShadowColor]); case wxSYS_COLOUR_3DLIGHT: return wxColour([NSColor controlHighlightColor]); + case wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT: case wxSYS_COLOUR_HIGHLIGHTTEXT: return wxColour([NSColor selectedControlTextColor]); case wxSYS_COLOUR_INFOBK: diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 2023642a78..e81df74ddf 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -1428,14 +1428,10 @@ bool wxListLineData::SetAttributes(wxDC *dc, } #else { -#ifdef __WXGTK__ - if (m_owner->HasFocus()) - colText = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT); - else - colText = wxSystemSettings::GetColour(wxSYS_COLOUR_INACTIVECAPTIONTEXT); -#else - colText = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT); -#endif + if (m_owner->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 5c6fccdee2..f6e6a3fd68 100644 --- a/src/generic/treectlg.cpp +++ b/src/generic/treectlg.cpp @@ -2549,16 +2549,10 @@ void wxGenericTreeCtrl::PaintLevel( wxGenericTreeItem *item, wxDC &dc, int level #ifdef __WXMAC__ colText = *wxWHITE; #else - -#ifdef __WXGTK__ - if (m_hasFocus) - colText = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT); - else - colText = wxSystemSettings::GetColour(wxSYS_COLOUR_INACTIVECAPTIONTEXT); -#else + if (m_hasFocus) colText = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT); -#endif - + else + colText = wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT); #endif } else diff --git a/src/gtk/settings.cpp b/src/gtk/settings.cpp index 84821157ac..fb1df1d0a4 100644 --- a/src/gtk/settings.cpp +++ b/src/gtk/settings.cpp @@ -308,8 +308,10 @@ wxColour wxSystemSettingsNative::GetColour( wxSystemColour index ) color = gs_objects.m_colListBoxText; break; - case wxSYS_COLOUR_INACTIVECAPTIONTEXT: + case wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT: { + // This is for the text in a list control (or tree) when the + // item is selected, but not focused if (!gs_objects.m_colListBoxUnfocusedText.Ok()) { if (GetColourFromGTKWidget(gdkColor, wxGTK_LIST, GTK_STATE_ACTIVE, wxGTK_TEXT)) @@ -323,6 +325,7 @@ wxColour wxSystemSettingsNative::GetColour( wxSystemColour index ) case wxSYS_COLOUR_MENUTEXT: case wxSYS_COLOUR_WINDOWTEXT: case wxSYS_COLOUR_CAPTIONTEXT: + case wxSYS_COLOUR_INACTIVECAPTIONTEXT: case wxSYS_COLOUR_BTNTEXT: if (!gs_objects.m_colBtnText.Ok()) { diff --git a/src/gtk1/settings.cpp b/src/gtk1/settings.cpp index 61a3fac2d6..62bab57987 100644 --- a/src/gtk1/settings.cpp +++ b/src/gtk1/settings.cpp @@ -283,6 +283,7 @@ wxColour wxSystemSettingsNative::GetColour( wxSystemColour index ) return gs_objects.m_colTooltipText; case wxSYS_COLOUR_HIGHLIGHTTEXT: + case wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT: if (!gs_objects.m_colHighlightText.Ok()) { wxColour hclr = GetColour(wxSYS_COLOUR_HIGHLIGHT); diff --git a/src/mac/carbon/settings.cpp b/src/mac/carbon/settings.cpp index b079486f14..ecb5f6acd0 100644 --- a/src/mac/carbon/settings.cpp +++ b/src/mac/carbon/settings.cpp @@ -106,6 +106,7 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index) break ; case wxSYS_COLOUR_HIGHLIGHTTEXT : + case wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT : #if 0 && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3) // NB: enable this case as desired resultColor = *wxWHITE ; diff --git a/src/motif/settings.cpp b/src/motif/settings.cpp index 87ade0a057..43389be970 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 63eeb9b7ff..aab5af723c 100644 --- a/src/msw/settings.cpp +++ b/src/msw/settings.cpp @@ -132,6 +132,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 b384ebb034..fd849be9bd 100644 --- a/src/os2/settings.cpp +++ b/src/os2/settings.cpp @@ -172,6 +172,7 @@ wxColour wxSystemSettingsNative::GetColour( vSysClr = SYSCLR_SCROLLBAR; break; + case wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT: case wxSYS_COLOUR_HIGHLIGHTTEXT: vSysClr = SYSCLR_HILITEFOREGROUND; break; 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/colschem.cpp b/src/univ/colschem.cpp index 7d512a17af..e9c50f5446 100644 --- a/src/univ/colschem.cpp +++ b/src/univ/colschem.cpp @@ -84,7 +84,8 @@ wxColour wxSystemSettings::GetColour(wxSystemColour index) wxColourScheme::TITLEBAR_TEXT /* wxSYS_COLOUR_GRADIENTINACTIVECAPTION */, wxColourScheme::SHADOW_DARK /* wxSYS_COLOUR_MENUHILIGHT */, wxColourScheme::CONTROL /* wxSYS_COLOUR_MENUBAR */, - wxColourScheme::CONTROL_TEXT /* wxSYS_COLOUR_LISTBOXTEXT */ + wxColourScheme::CONTROL_TEXT /* wxSYS_COLOUR_LISTBOXTEXT */, + wxColourScheme::HIGHLIGHT_TEXT /* wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT */ }; wxCHECK_MSG( index < (int)WXSIZEOF(s_mapSysToThemeCol), wxNullColour,