Removed some warnings in widgets sample

Reduced some flicker in wxNotebook when using
XP controls


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@22413 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2003-07-31 13:59:28 +00:00
parent 055f8a8b28
commit c02e5a31c5
15 changed files with 74 additions and 35 deletions

View File

@@ -485,11 +485,21 @@ bool wxNotebook::InsertPage(int nPage,
_T("notebook pages must have notebook as parent") );
#if wxUSE_UXTHEME && wxUSE_UXTHEME_AUTO
static bool g_TestedForTheme = FALSE;
static bool g_UseTheme = FALSE;
if (!g_TestedForTheme)
{
int commCtrlVersion = wxTheApp->GetComCtl32Version() ;
g_UseTheme = (commCtrlVersion >= 600);
g_TestedForTheme = TRUE;
}
// Automatically apply the theme background,
// changing the colour of the panel to match the
// tab page colour. This won't work well with all
// themes but it's a start.
if (wxUxThemeEngine::Get() && pPage->IsKindOf(CLASSINFO(wxPanel)))
if (g_UseTheme && wxUxThemeEngine::Get() && pPage->IsKindOf(CLASSINFO(wxPanel)))
{
ApplyThemeBackground(pPage, GetThemeBackgroundColour());
}
@@ -848,4 +858,31 @@ void wxNotebook::ApplyThemeBackground(wxWindow* window, const wxColour& colour)
#endif
}
long wxNotebook::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
{
static bool g_TestedForTheme = FALSE;
static bool g_UseTheme = FALSE;
switch ( nMsg )
{
case WM_ERASEBKGND:
{
if (!g_TestedForTheme)
{
int commCtrlVersion = wxTheApp->GetComCtl32Version() ;
g_UseTheme = (commCtrlVersion >= 600);
g_TestedForTheme = TRUE;
}
// If using XP themes, it seems we can get away
// with not drawing a background, which reduces flicker.
if (g_UseTheme)
return TRUE;
}
}
return wxControl::MSWWindowProc(nMsg, wParam, lParam);
}
#endif // wxUSE_NOTEBOOK