]> git.saurik.com Git - wxWidgets.git/commitdiff
getting text colour using the themes API doesn't seem to work, revert to using the...
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 12 May 2007 03:16:12 +0000 (03:16 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 12 May 2007 03:16:12 +0000 (03:16 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45988 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/combo.cpp

index 6ffbb31861b19771f222bdfec4522969bcc0696d..3ddde4f0af242728cbd0063657ef269c93ee166d 100644 (file)
@@ -216,29 +216,36 @@ wxComboCtrl::~wxComboCtrl()
 
 void wxComboCtrl::OnThemeChange()
 {
-    wxUxThemeEngine* theme = wxUxThemeEngine::GetIfActive();
+    // there doesn't seem to be any way to get the text colour using themes
+    // API: TMT_TEXTCOLOR doesn't work neither for EDIT nor COMBOBOX
+    SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
+
+    wxUxThemeEngine * const theme = wxUxThemeEngine::GetIfActive();
     if ( theme )
     {
+        // NB: use EDIT, not COMBOBOX (the latter works in XP but not Vista)
         wxUxThemeHandle hTheme(this, L"EDIT");
-
         COLORREF col;
-        HRESULT hr = theme->GetThemeColor(hTheme,EP_EDITTEXT,ETS_NORMAL,TMT_FILLCOLOR,&col);
-        if ( FAILED(hr) )
-            wxLogApiError(_T("GetThemeColor(EDIT, EP_EDITTEXT, ETS_NORMAL, TMT_FILLCOLOR)"), hr);
-        else
+        HRESULT hr = theme->GetThemeColor
+                            (
+                                hTheme,
+                                EP_EDITTEXT,
+                                ETS_NORMAL,
+                                TMT_FILLCOLOR,
+                                &col
+                            );
+        if ( SUCCEEDED(hr) )
+        {
             SetBackgroundColour(wxRGBToColour(col));
 
-        hr = theme->GetThemeColor(hTheme,EP_EDITTEXT,ETS_NORMAL,TMT_TEXTCOLOR,&col);
-        if ( FAILED(hr) )
-            wxLogApiError(_T("GetThemeColor(EDIT, EP_EDITTEXT, ETS_NORMAL, TMT_TEXTCOLOR)"), hr);
-        else
-            SetForegroundColour(wxRGBToColour(col));
-    }
-    else
-    {
-        SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
-        SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
+            // skip the call below
+            return;
+        }
+
+        wxLogApiError(_T("GetThemeColor(EDIT, ETS_NORMAL, TMT_FILLCOLOR)"), hr);
     }
+
+    SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
 }
 
 void wxComboCtrl::OnResize()