///////////////////////////////////////////////////////////////////////////////
// Name: src/msw/uxtheme.cpp
// Purpose: implements wxUxThemeEngine class: support for XP themes
-// Author:
+// Author: John Platts, Vadim Zeitlin
// Modified by:
// Created: 2003
// RCS-ID: $Id$
-// Copyright: (c) 2003 wxWindows Dev-Team
-// License: wxWindows license
+// Copyright: (c) 2003 John Platts, Vadim Zeitlin
+// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
// ============================================================================
// declarations
// ============================================================================
-#ifdef __GNUG__
- #pragma implementation "uxtheme.h"
-#endif
-
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#include "wx/toplevel.h"
#include "wx/string.h"
#include "wx/log.h"
+ #include "wx/module.h"
#endif //WX_PRECOMP
-#include "wx/module.h"
-
#include "wx/msw/uxtheme.h"
// ============================================================================
class wxUxThemeModule : public wxModule
{
public:
- virtual bool OnInit() { return true; }
- virtual void OnExit()
- {
- if ( wxUxThemeEngine::ms_themeEngine )
- {
+ virtual bool OnInit() { return true; }
+ virtual void OnExit()
+ {
+ if ( wxUxThemeEngine::ms_themeEngine )
+ {
// this is probably not necessary right now but try to be careful
// and avoid the problems which we might have if someone ever
// decides to show a message box using the theme engine from
wxUxThemeEngine::ms_themeEngine = NULL;
wxUxThemeEngine::ms_isThemeEngineAvailable = false;
- delete themeEngine;
- }
- }
+ delete themeEngine;
+ }
+ }
- DECLARE_DYNAMIC_CLASS(wxUxThemeModule)
+ DECLARE_DYNAMIC_CLASS(wxUxThemeModule)
};
IMPLEMENT_DYNAMIC_CLASS(wxUxThemeModule, wxModule)
bool wxUxThemeEngine::Initialize()
{
+ if ( wxApp::GetComCtl32Version() < 600 )
+ {
+ // not using theme-aware comctl32.dll anyhow, don't even try to use
+ // themes
+ return false;
+ }
+
// we're prepared to handle the errors
wxLogNull noLog;
- if ( !m_dllUxTheme.Load(_T("uxtheme.dll")) )
+ if ( !m_dllUxTheme.Load(wxT("uxtheme.dll")) )
return false;
#define RESOLVE_UXTHEME_FUNCTION(type, funcname) \
- funcname = (type)m_dllUxTheme.GetSymbol(_T(#funcname)); \
+ funcname = (type)m_dllUxTheme.GetSymbol(wxT(#funcname)); \
if ( !funcname ) \
return false
return true;
}
-// This calls IsAppThemed but also checks the commctrl.dll version
-// for a more reliable answer.
-bool wxUxThemeEngine::IsAppThemedEx()
-{
- static bool g_TestedForTheme = FALSE;
- static bool g_UseTheme = FALSE;
- if (!g_TestedForTheme)
- {
- int commCtrlVersion = wxTheApp->GetComCtl32Version() ;
-
- g_UseTheme = (commCtrlVersion >= 600);
- g_TestedForTheme = TRUE;
- }
- return IsAppThemed() && g_UseTheme;
-}
-
#endif // wxUSE_UXTHEME
-