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
This commit is contained in:
Václav Slavík 2012-05-06 13:10:34 +00:00
parent 25e3f0c69e
commit b7f37d6d86

View 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 )
{