]> git.saurik.com Git - wxWidgets.git/commitdiff
Fix wxOwnerDrawnComboBox background on with classic theme.
authorVáclav Slavík <vslavik@fastmail.fm>
Sun, 6 May 2012 13:10:34 +0000 (13:10 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Sun, 6 May 2012 13:10:34 +0000 (13:10 +0000)
In wxMSW, if the classic theme was used, read-only wxOwnerDrawnComboBox
had gray background, but native look should be the same for both
editable and read-only combo boxes: white text entry-like rectangle.

Apparently, a similar problem existed with non-classic themes too
before, as there was a workaround in place. Fixed by moving the
workaround into code used by both themed and classic rendering.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71367 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/combo.cpp

index 51bad16e5cf49e3545a9c46499f299eb44d9ff65..f6c705008c6ac9865f785623081f3d0c5f451439 100644 (file)
@@ -420,6 +420,8 @@ void wxComboCtrl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) )
 {
     // TODO: Convert drawing in this function to Windows API Code
 
+    const bool useVistaComboBox = ::wxGetWinVersion() >= wxWinVersion_Vista;
+
     wxSize sz = GetClientSize();
     wxDC* dcPtr = wxAutoBufferedPaintDCFactory(this);
     wxDC& dc = *dcPtr;
@@ -428,6 +430,14 @@ void wxComboCtrl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) )
     wxRect rectTextField = m_tcArea;
     wxColour bgCol = GetBackgroundColour();
 
+    // FIXME: Either SetBackgroundColour or GetBackgroundColour
+    //        doesn't work under Vista, so here's a temporary
+    //        workaround.
+    //        In the theme-less rendering code below, this fixes incorrect
+    //        background on read-only comboboxes (they are gray, but should be
+    //        white).
+    bgCol = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
+
 #if wxUSE_UXTHEME
     const bool isEnabled = IsThisEnabled();
 
@@ -455,8 +465,6 @@ void wxComboCtrl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) )
 #if wxUSE_UXTHEME
     if ( hTheme )
     {
-        const bool useVistaComboBox = ::wxGetWinVersion() >= wxWinVersion_Vista;
-
         RECT rFull;
         wxCopyRectToRECT(borderRect, rFull);
 
@@ -502,11 +510,6 @@ void wxComboCtrl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) )
 
         if ( useVistaComboBox )
         {
-            // FIXME: Either SetBackgroundColour or GetBackgroundColour
-            //        doesn't work under Vista, so here's a temporary
-            //        workaround.
-            bgCol = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
-
             // Draw the entire control as a single button?
             if ( !isNonStdButton )
             {