enable non-top tabs workaround for Vista too (replaces patch 1724221)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46269 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-06-02 13:17:46 +00:00
parent 66160760e1
commit b013c97102
2 changed files with 27 additions and 12 deletions

View File

@@ -159,6 +159,7 @@ wxX11:
wxMSW: wxMSW:
- Added msw.font.no-proof-quality system option, see manual for description - Added msw.font.no-proof-quality system option, see manual for description
- Fix appearance of notebook with non-top tabs under Windows Vista
2.8.4 2.8.4
----- -----

View File

@@ -97,6 +97,20 @@ LRESULT APIENTRY _EXPORT wxNotebookWndProc(HWND hwnd,
#endif // USE_NOTEBOOK_ANTIFLICKER #endif // USE_NOTEBOOK_ANTIFLICKER
// ----------------------------------------------------------------------------
// global functions
// ----------------------------------------------------------------------------
static bool HasTroubleWithNonTopTabs()
{
const int verComCtl32 = wxApp::GetComCtl32Version();
// 600 is XP, 616 is Vista -- and both have a problem with tabs not on top
// (but don't just test for >= 600 as Microsoft might decide to fix it in
// later versions, who knows...)
return verComCtl32 >= 600 && verComCtl32 <= 616;
}
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// event table // event table
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -283,11 +297,11 @@ bool wxNotebook::Create(wxWindow *parent,
#endif #endif
#if !wxUSE_UXTHEME #if !wxUSE_UXTHEME
// ComCtl32 notebook tabs simply don't work unless they're on top if we have uxtheme, we can // ComCtl32 notebook tabs simply don't work unless they're on top if we
// work around it later (after control creation), but if we don't have uxtheme, we have to clear // have uxtheme, we can work around it later (after control creation), but
// those styles // if we have been compiled without uxtheme support, we have to clear those
const int verComCtl32 = wxApp::GetComCtl32Version(); // styles
if ( verComCtl32 == 600 ) if ( HasTroubleWithNonTopTabs() )
{ {
style &= ~(wxBK_BOTTOM | wxBK_LEFT | wxBK_RIGHT); style &= ~(wxBK_BOTTOM | wxBK_LEFT | wxBK_RIGHT);
} }
@@ -360,16 +374,16 @@ bool wxNotebook::Create(wxWindow *parent,
// comctl32.dll 6.0 doesn't support non-top tabs with visual styles (the // comctl32.dll 6.0 doesn't support non-top tabs with visual styles (the
// control is simply not rendered correctly), so we disable themes // control is simply not rendered correctly), so we disable themes
// if possible, otherwise we simply clear the styles. // if possible, otherwise we simply clear the styles.
// It's probably not possible to have UXTHEME without ComCtl32 6 or better, but lets if ( HasTroubleWithNonTopTabs() &&
// check it anyway. (style & (wxBK_BOTTOM | wxBK_LEFT | wxBK_RIGHT)) )
const int verComCtl32 = wxApp::GetComCtl32Version();
if ( verComCtl32 == 600 )
{ {
// check if we use themes at all -- if we don't, we're still okay // check if we use themes at all -- if we don't, we're still okay
if ( wxUxThemeEngine::GetIfActive() && (style & (wxBK_BOTTOM|wxBK_LEFT|wxBK_RIGHT))) if ( wxUxThemeEngine::GetIfActive() )
{ {
wxUxThemeEngine::GetIfActive()->SetWindowTheme((HWND)this->GetHandle(), L"", L""); wxUxThemeEngine::GetIfActive()->SetWindowTheme(GetHwnd(), L"", L"");
SetBackgroundColour(GetThemeBackgroundColour()); //correct the background color for the new non-themed control
// correct the background color for the new non-themed control
SetBackgroundColour(GetThemeBackgroundColour());
} }
} }
#endif // wxUSE_UXTHEME #endif // wxUSE_UXTHEME