Disable Vista/Win7-style wxComboCtrl rendering in wx2.8 by default (define wxUSE_COMBOCTRL_VISTA_RENDERING=1 to enable it), as it may cause subtle drawing bugs with custom wxComboCtrls

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@64411 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Jaakko Salli
2010-05-27 15:02:42 +00:00
parent 61f86808d1
commit 89e1f57475
2 changed files with 24 additions and 4 deletions

View File

@@ -98,8 +98,6 @@ All (GUI):
wxMSW:
- Backported improved wxOwnerDrawnComboBox and wxComboCtrl appearance under
Windows Vista/7.
- wxOwnerDrawnComboBox and wxComboCtrl with wxCB_READONLY window style now
have more native-like focus indicator rendering.

View File

@@ -43,6 +43,16 @@
#include "wx/msw/uxtheme.h"
#endif
//
// Define wxUSE_COMBOCTRL_VISTA_RENDERING as 1 to have read-only wxComboCtrl
// and wxOwnerDrawnComboBox appear much nicer on Win Vista/7. Disabled by
// default as this may cause some subtle rendering bugs with custom
// wxComboCtrls.
//
#ifndef wxUSE_COMBOCTRL_VISTA_RENDERING
#define wxUSE_COMBOCTRL_VISTA_RENDERING 0
#endif
// Change to #if 1 to include tmschema.h for easier testing of theme
// parameters.
#if 0
@@ -514,7 +524,11 @@ void wxComboCtrl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) )
#if wxUSE_UXTHEME
if ( hTheme )
{
#if wxUSE_COMBOCTRL_VISTA_RENDERING
const bool useVistaComboBox = ::wxGetWinVersion() >= wxWinVersion_Vista;
#else
const bool useVistaComboBox = false;
#endif
RECT rFull;
wxCopyRectToRECT(borderRect, rFull);
@@ -554,12 +568,17 @@ void wxComboCtrl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) )
int comboBoxPart = 0; // For XP, use the 'default' part
RECT* rUseForBg = &rBorder;
bool drawFullButton = false;
int bgState = butState;
const bool isFocused = (FindFocus() == GetMainWindowOfCompositeControl()) ? true : false;
#if wxUSE_COMBOCTRL_VISTA_RENDERING
bool drawFullButton = false;
if ( useVistaComboBox )
{
const bool isFocused =
(FindFocus() == GetMainWindowOfCompositeControl()) ?
true : false;
// FIXME: Either SetBackgroundColour or GetBackgroundColour
// doesn't work under Vista, so here's a temporary
// workaround.
@@ -591,6 +610,7 @@ void wxComboCtrl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) )
bgState = CBB_NORMAL;
}
}
#endif
//
// Draw parent's background, if necessary
@@ -627,6 +647,7 @@ void wxComboCtrl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) )
int butPart = CP_DROPDOWNBUTTON;
#if wxUSE_COMBOCTRL_VISTA_RENDERING
if ( useVistaComboBox )
{
if ( drawFullButton )
@@ -644,6 +665,7 @@ void wxComboCtrl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) )
butPart = CP_DROPDOWNBUTTONLEFT;
}
#endif
theme->DrawThemeBackground( hTheme, hDc, butPart, butState, &rButton, NULL );
}
else if ( useVistaComboBox &&