From 8a462d4ee12820a8ee404eef060e5cd406ba3f09 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 19 Nov 2004 17:17:00 +0000 Subject: [PATCH] added GetIfActive() method returning non-NULL engine only if themes are not only available, but really use git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30630 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/msw/uxtheme.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/include/wx/msw/uxtheme.h b/include/wx/msw/uxtheme.h index 7d5548bff4..f7578a9746 100644 --- a/include/wx/msw/uxtheme.h +++ b/include/wx/msw/uxtheme.h @@ -261,6 +261,10 @@ public: // get the theme engine or NULL if themes are not available static wxUxThemeEngine *Get(); + // get the theme enging or NULL if themes are not available or not used for + // this application + static wxUxThemeEngine *GetIfActive(); + // all uxtheme.dll functions wxUX_THEME_DECLARE(PFNWXUOPENTHEMEDATA, OpenThemeData) wxUX_THEME_DECLARE(PFNWXUCLOSETHEMEDATA, CloseThemeData) @@ -343,6 +347,14 @@ private: DECLARE_NO_COPY_CLASS(wxUxThemeEngine) }; +/* static */ inline wxUxThemeEngine *wxUxThemeEngine::GetIfActive() +{ + wxUxThemeEngine *engine = Get(); + return engine && engine->IsAppThemed() && engine->IsThemeActive() + ? engine + : NULL; +} + #if !wxUSE_UXTHEME /* static */ inline wxUxThemeEngine *wxUxThemeEngine::Get() @@ -350,6 +362,11 @@ private: return NULL; } +/* static */ inline wxUxThemeEngine *wxUxThemeEngine::GetIfActive() +{ + return NULL; +} + #endif // !wxUSE_UXTHEME // ---------------------------------------------------------------------------- -- 2.45.2