From cc05060c18053ed16ddb5dbc53777e32f4b05af1 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 25 Dec 2008 13:03:24 +0000 Subject: [PATCH] make colours used by list and tree controls more consistent with the system theme settings; also use the correct colour for the status bar (closes #10089) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@57542 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 2 ++ include/wx/settings.h | 1 + src/generic/listctrl.cpp | 2 +- src/generic/statusbr.cpp | 1 + src/generic/treectlg.cpp | 2 +- src/gtk/settings.cpp | 29 +++++++++++++++++++++++++++-- src/gtk1/settings.cpp | 1 + src/mac/carbon/settings.cpp | 1 + src/mac/classic/settings.cpp | 1 + src/msw/settings.cpp | 7 ++++++- 10 files changed, 42 insertions(+), 5 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 286f5b1363..a79288b4af 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -145,6 +145,8 @@ wxMSW/CE: wxGTK: - Fixed printing to use fonts sizes adjustment consistent with wxMSW. +- Make colours used by list, tree and status bar controls more consistent with + the system theme settings (Tim Kosse). 2.8.9 ----- diff --git a/include/wx/settings.h b/include/wx/settings.h index 1adf37246a..93c9bdbd5f 100644 --- a/include/wx/settings.h +++ b/include/wx/settings.h @@ -79,6 +79,7 @@ enum wxSystemColour wxSYS_COLOUR_GRADIENTINACTIVECAPTION, wxSYS_COLOUR_MENUHILIGHT, wxSYS_COLOUR_MENUBAR, + wxSYS_COLOUR_LISTBOXTEXT, wxSYS_COLOUR_MAX }; diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 5d0a1fbda8..4c2c4b3aad 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -5765,7 +5765,7 @@ wxGenericListCtrl::GetClassDefaultAttributes(wxWindowVariant variant) #else wxUnusedVar(variant); wxVisualAttributes attr; - attr.colFg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT); + attr.colFg = wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOXTEXT); attr.colBg = wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOX); attr.font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); return attr; diff --git a/src/generic/statusbr.cpp b/src/generic/statusbr.cpp index 9c59dc1ddc..09801fbd2b 100644 --- a/src/generic/statusbr.cpp +++ b/src/generic/statusbr.cpp @@ -194,6 +194,7 @@ void wxStatusBarGeneric::OnPaint(wxPaintEvent& WXUNUSED(event) ) { wxPaintDC dc(this); + dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT)); #ifdef __WXGTK20__ // Draw grip first if (HasFlag( wxST_SIZEGRIP )) diff --git a/src/generic/treectlg.cpp b/src/generic/treectlg.cpp index 0e7c1e5361..2a2eff5349 100644 --- a/src/generic/treectlg.cpp +++ b/src/generic/treectlg.cpp @@ -3619,7 +3619,7 @@ wxGenericTreeCtrl::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant)) return wxListBox::GetClassDefaultAttributes(variant); #else wxVisualAttributes attr; - attr.colFg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT); + attr.colFg = wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOXTEXT); attr.colBg = wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOX); attr.font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); return attr; diff --git a/src/gtk/settings.cpp b/src/gtk/settings.cpp index 7d82e0929a..e01db52110 100644 --- a/src/gtk/settings.cpp +++ b/src/gtk/settings.cpp @@ -47,7 +47,8 @@ struct wxSystemObjects m_colMenuItemHighlight, m_colTooltip, m_colTooltipText, - m_colMenubarBg; + m_colMenubarBg, + m_colListBoxText; wxFont m_fontSystem; }; @@ -68,6 +69,7 @@ void wxClearGtkSystemObjects() gs_objects.m_colTooltipText = wxColour(); gs_objects.m_colMenubarBg = wxColour(); gs_objects.m_fontSystem = wxNullFont; + gs_objects.m_colListBoxText = wxColour(); } // ---------------------------------------------------------------------------- @@ -89,7 +91,8 @@ enum wxGtkColourType { wxGTK_FG, wxGTK_BG, - wxGTK_BASE + wxGTK_BASE, + wxGTK_TEXT }; // wxSystemSettings::GetColour() helper: get the colours from a GTK+ @@ -152,6 +155,10 @@ static bool GetColourFromGTKWidget(GdkColor& gdkColor, case wxGTK_BASE: gdkColor = def->base[state]; break; + + case wxGTK_TEXT: + gdkColor = def->text[state]; + break; } } @@ -282,6 +289,24 @@ wxColour wxSystemSettingsNative::GetColour( wxSystemColour index ) color = gs_objects.m_colListBox; break; + case wxSYS_COLOUR_LISTBOXTEXT: + if (!gs_objects.m_colListBoxText.Ok()) + { + if ( GetColourFromGTKWidget(gdkColor, + wxGTK_LIST, + GTK_STATE_NORMAL, + wxGTK_TEXT) ) + { + gs_objects.m_colListBoxText = wxColour(gdkColor); + } + else + { + gs_objects.m_colListBoxText = GetColour(wxSYS_COLOUR_WINDOWTEXT); + } + } + color = gs_objects.m_colListBoxText; + 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 b7b1283e83..61a3fac2d6 100644 --- a/src/gtk1/settings.cpp +++ b/src/gtk1/settings.cpp @@ -250,6 +250,7 @@ wxColour wxSystemSettingsNative::GetColour( wxSystemColour index ) case wxSYS_COLOUR_CAPTIONTEXT: case wxSYS_COLOUR_INACTIVECAPTIONTEXT: case wxSYS_COLOUR_BTNTEXT: + case wxSYS_COLOUR_LISTBOXTEXT: if (!gs_objects.m_colBtnText.Ok()) { int red, green, blue; diff --git a/src/mac/carbon/settings.cpp b/src/mac/carbon/settings.cpp index 9b9407cff7..b079486f14 100644 --- a/src/mac/carbon/settings.cpp +++ b/src/mac/carbon/settings.cpp @@ -75,6 +75,7 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index) case wxSYS_COLOUR_CAPTIONTEXT: case wxSYS_COLOUR_INFOTEXT: case wxSYS_COLOUR_INACTIVECAPTIONTEXT: + case wxSYS_COLOUR_LISTBOXTEXT: resultColor = *wxBLACK; break ; diff --git a/src/mac/classic/settings.cpp b/src/mac/classic/settings.cpp index 5e24b61348..5ab1ec0592 100644 --- a/src/mac/classic/settings.cpp +++ b/src/mac/classic/settings.cpp @@ -70,6 +70,7 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index) case wxSYS_COLOUR_CAPTIONTEXT: case wxSYS_COLOUR_INFOTEXT: case wxSYS_COLOUR_INACTIVECAPTIONTEXT: + case wxSYS_COLOUR_LISTBOXTEXT: return *wxBLACK; break ; case wxSYS_COLOUR_HIGHLIGHT: diff --git a/src/msw/settings.cpp b/src/msw/settings.cpp index 85f5a95a47..63eeb9b7ff 100644 --- a/src/msw/settings.cpp +++ b/src/msw/settings.cpp @@ -127,7 +127,12 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index) 0, // MENUBAR (unused) }; - if ( index == wxSYS_COLOUR_LISTBOX ) + if ( index == wxSYS_COLOUR_LISTBOXTEXT) + { + // there is no standard colour with this index, map to another one + index = wxSYS_COLOUR_WINDOWTEXT; + } + else if ( index == wxSYS_COLOUR_LISTBOX ) { // there is no standard colour with this index, map to another one index = wxSYS_COLOUR_WINDOW;