From b7f37d6d86b60de81c5aa153550c9a32db7558a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Sun, 6 May 2012 13:10:34 +0000 Subject: [PATCH] Fix wxOwnerDrawnComboBox background on with classic theme. 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 | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/msw/combo.cpp b/src/msw/combo.cpp index 51bad16e5c..f6c705008c 100644 --- a/src/msw/combo.cpp +++ b/src/msw/combo.cpp @@ -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 ) {