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:
@@ -98,8 +98,6 @@ All (GUI):
|
|||||||
|
|
||||||
wxMSW:
|
wxMSW:
|
||||||
|
|
||||||
- Backported improved wxOwnerDrawnComboBox and wxComboCtrl appearance under
|
|
||||||
Windows Vista/7.
|
|
||||||
- wxOwnerDrawnComboBox and wxComboCtrl with wxCB_READONLY window style now
|
- wxOwnerDrawnComboBox and wxComboCtrl with wxCB_READONLY window style now
|
||||||
have more native-like focus indicator rendering.
|
have more native-like focus indicator rendering.
|
||||||
|
|
||||||
|
@@ -43,6 +43,16 @@
|
|||||||
#include "wx/msw/uxtheme.h"
|
#include "wx/msw/uxtheme.h"
|
||||||
#endif
|
#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
|
// Change to #if 1 to include tmschema.h for easier testing of theme
|
||||||
// parameters.
|
// parameters.
|
||||||
#if 0
|
#if 0
|
||||||
@@ -514,7 +524,11 @@ void wxComboCtrl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) )
|
|||||||
#if wxUSE_UXTHEME
|
#if wxUSE_UXTHEME
|
||||||
if ( hTheme )
|
if ( hTheme )
|
||||||
{
|
{
|
||||||
|
#if wxUSE_COMBOCTRL_VISTA_RENDERING
|
||||||
const bool useVistaComboBox = ::wxGetWinVersion() >= wxWinVersion_Vista;
|
const bool useVistaComboBox = ::wxGetWinVersion() >= wxWinVersion_Vista;
|
||||||
|
#else
|
||||||
|
const bool useVistaComboBox = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
RECT rFull;
|
RECT rFull;
|
||||||
wxCopyRectToRECT(borderRect, rFull);
|
wxCopyRectToRECT(borderRect, rFull);
|
||||||
@@ -554,12 +568,17 @@ void wxComboCtrl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) )
|
|||||||
int comboBoxPart = 0; // For XP, use the 'default' part
|
int comboBoxPart = 0; // For XP, use the 'default' part
|
||||||
RECT* rUseForBg = &rBorder;
|
RECT* rUseForBg = &rBorder;
|
||||||
|
|
||||||
bool drawFullButton = false;
|
|
||||||
int bgState = butState;
|
int bgState = butState;
|
||||||
const bool isFocused = (FindFocus() == GetMainWindowOfCompositeControl()) ? true : false;
|
|
||||||
|
#if wxUSE_COMBOCTRL_VISTA_RENDERING
|
||||||
|
bool drawFullButton = false;
|
||||||
|
|
||||||
if ( useVistaComboBox )
|
if ( useVistaComboBox )
|
||||||
{
|
{
|
||||||
|
const bool isFocused =
|
||||||
|
(FindFocus() == GetMainWindowOfCompositeControl()) ?
|
||||||
|
true : false;
|
||||||
|
|
||||||
// FIXME: Either SetBackgroundColour or GetBackgroundColour
|
// FIXME: Either SetBackgroundColour or GetBackgroundColour
|
||||||
// doesn't work under Vista, so here's a temporary
|
// doesn't work under Vista, so here's a temporary
|
||||||
// workaround.
|
// workaround.
|
||||||
@@ -591,6 +610,7 @@ void wxComboCtrl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) )
|
|||||||
bgState = CBB_NORMAL;
|
bgState = CBB_NORMAL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// Draw parent's background, if necessary
|
// Draw parent's background, if necessary
|
||||||
@@ -627,6 +647,7 @@ void wxComboCtrl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) )
|
|||||||
|
|
||||||
int butPart = CP_DROPDOWNBUTTON;
|
int butPart = CP_DROPDOWNBUTTON;
|
||||||
|
|
||||||
|
#if wxUSE_COMBOCTRL_VISTA_RENDERING
|
||||||
if ( useVistaComboBox )
|
if ( useVistaComboBox )
|
||||||
{
|
{
|
||||||
if ( drawFullButton )
|
if ( drawFullButton )
|
||||||
@@ -644,6 +665,7 @@ void wxComboCtrl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) )
|
|||||||
butPart = CP_DROPDOWNBUTTONLEFT;
|
butPart = CP_DROPDOWNBUTTONLEFT;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
theme->DrawThemeBackground( hTheme, hDc, butPart, butState, &rButton, NULL );
|
theme->DrawThemeBackground( hTheme, hDc, butPart, butState, &rButton, NULL );
|
||||||
}
|
}
|
||||||
else if ( useVistaComboBox &&
|
else if ( useVistaComboBox &&
|
||||||
|
Reference in New Issue
Block a user