]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/uxtheme.h
Fix memory leak by letting the base class version handle the
[wxWidgets.git] / include / wx / msw / uxtheme.h
CommitLineData
2d9c0e97
VZ
1///////////////////////////////////////////////////////////////////////////////
2// Name: include/wx/msw/uxtheme.h
3// Purpose: wxUxThemeEngine class: support for XP themes
4// Author:
5// Modified by:
6// Created: 2003
7// RCS-ID: $Id$
77ffb593
JS
8// Copyright: (c) 2003 wxWidgets Dev-Team
9// License: wxWidgets licence
2d9c0e97 10///////////////////////////////////////////////////////////////////////////////
0d1cb8cb
JS
11
12#ifndef _WX_UXTHEME_H_
13#define _WX_UXTHEME_H_
14
12028905 15#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
2d9c0e97 16 #pragma interface "uxtheme.h"
85b43fbf
JS
17#endif
18
2d9c0e97 19#include "wx/defs.h"
0d1cb8cb 20
ca5ccd7e
VZ
21#include "wx/msw/wrapwin.h"
22
0d1cb8cb
JS
23#if wxUSE_UNICODE
24typedef struct _WXUOSVERSIONINFOEXW {
25 WXDWORD dwOSVersionInfoSize;
26 WXDWORD dwMajorVersion;
27 WXDWORD dwMinorVersion;
28 WXDWORD dwBuildNumber;
29 WXDWORD dwPlatformId;
30 wchar_t szCSDVersion[ 128 ]; // Maintenance string for PSS usage
31 unsigned short wServicePackMajor;
32 unsigned short wServicePackMinor;
33 unsigned short wSuiteMask;
34 unsigned char wProductType;
35 unsigned char wReserved;
36} WXUOSVERSIONINFOEXW, *PWXUOSVERSIONINFOEXW, *LPWXUOSVERSIONINFOEXW;
37#define WXUOSVERSIONINFOEX WXUOSVERSIONINFOEXW
38#define PWXUOSVERSIONINFOEX PWXUOSVERSIONINFOEXW
39#define LPWXUOSVERSIONINFOEX LPWXUOSVERSIONINFOEXW
40#else
41typedef struct _WXUOSVERSIONINFOEXA {
42 WXDWORD dwOSVersionInfoSize;
43 WXDWORD dwMajorVersion;
44 WXDWORD dwMinorVersion;
45 WXDWORD dwBuildNumber;
46 WXDWORD dwPlatformId;
47 char szCSDVersion [128]; // Maintenance string for PSS usage
48 unsigned short wServicePackMajor;
49 unsigned short wServicePackMinor;
50 unsigned short wSuiteMask;
51 unsigned char wProductType;
52 unsigned char wReserved;
53} WXUOSVERSIONINFOEXA, *PWXUOSVERSIONINFOEXA, *LPWXUOSVERSIONINFOEXA;
54#define WXUOSVERSIONINFOEX WXUOSVERSIONINFOEXA
55#define PWXUOSVERSIONINFOEX PWXUOSVERSIONINFOEXA
56#define LPWXUOSVERSIONINFOEX LPWXUOSVERSIONINFOEXA
57#endif
58
0d1cb8cb
JS
59typedef void* WXHTHEME;
60typedef long WXUHRESULT;
2d9c0e97
VZ
61typedef WXHTHEME (__stdcall *PFNWXUOPENTHEMEDATA)(WXHWND, const wchar_t *);
62typedef WXUHRESULT (__stdcall *PFNWXUCLOSETHEMEDATA)(WXHTHEME);
0d1cb8cb 63typedef WXUHRESULT (__stdcall *PFNWXUDRAWTHEMEBACKGROUND)(WXHTHEME, WXHDC,
ca5ccd7e 64 int, int, const RECT *, const RECT *);
0d1cb8cb
JS
65#define WXU_DTT_GRAYED 0x1
66typedef WXUHRESULT (__stdcall *PFNWXUDRAWTHEMETEXT)(WXHTHEME, WXHDC, int,
67 int, const wchar_t *, int, DWORD,
ca5ccd7e 68 DWORD, const RECT *);
0d1cb8cb 69typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEBACKGROUNDCONTENTRECT)(WXHTHEME, WXHDC,
ca5ccd7e 70 int, int, const RECT *, RECT *);
0d1cb8cb 71typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEBACKGROUNDEXTENT)(WXHTHEME, WXHDC, int, int,
ca5ccd7e 72 const RECT *, RECT *);
0d1cb8cb 73
85b43fbf 74enum WXUTHEMESIZE
0d1cb8cb
JS
75{
76 WXU_TS_MIN, // minimum size
77 WXU_TS_TRUE, // size without stretching
85b43fbf 78 WXU_TS_DRAW // size that theme mgr will use to draw part
0d1cb8cb
JS
79};
80
81typedef struct tagWXUSIZE
82{
83 long cx;
84 long cy;
2d9c0e97 85} WXUSIZE;
0d1cb8cb
JS
86
87typedef struct tagWXUTEXTMETRIC
88{
89 long tmHeight;
90 long tmAscent;
91 long tmDescent;
92 long tmInternalLeading;
93 long tmExternalLeading;
94 long tmAveCharWidth;
95 long tmMaxCharWidth;
96 long tmWeight;
97 long tmOverhang;
98 long tmDigitizedAspectX;
99 long tmDigitizedAspectY;
100 wchar_t tmFirstChar;
101 wchar_t tmLastChar;
102 wchar_t tmDefaultChar;
103 wchar_t tmBreakChar;
104 unsigned char tmItalic;
105 unsigned char tmUnderlined;
106 unsigned char tmStruckOut;
107 unsigned char tmPitchAndFamily;
108 unsigned char tmCharSet;
109} WXUTEXTMETRIC;
110
ca5ccd7e 111typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEPARTSIZE)(WXHTHEME, WXHDC, int, int, const RECT *,
2d9c0e97 112 enum WXUTHEMESIZE, WXUSIZE *);
0d1cb8cb 113typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMETEXTEXTENT)(WXHTHEME, WXHDC, int, int, const wchar_t *,
ca5ccd7e 114 int, WXDWORD, const RECT *, RECT *);
0d1cb8cb
JS
115typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMETEXTMETRICS)(WXHTHEME, WXHDC,
116 int, int, WXUTEXTMETRIC*);
117typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEBACKGROUNDREGION)(WXHTHEME, WXHDC,
ca5ccd7e 118 int, int, const RECT *, WXHRGN *);
0d1cb8cb
JS
119
120#define WXU_HTTB_BACKGROUNDSEG 0x0000
121#define WXU_HTTB_FIXEDBORDER 0x0002
122#define WXU_HTTB_CAPTION 0x0004
123#define WXU_HTTB_RESIZINGBORDER_LEFT 0x0010
124#define WXU_HTTB_RESIZINGBORDER_TOP 0x0020
125#define WXU_HTTB_RESIZINGBORDER_RIGHT 0x0040
126#define WXU_HTTB_RESIZINGBORDER_BOTTOM 0x0080
127#define WXU_HTTB_RESIZINGBORDER 0x00F0
128#define WXU_HTTB_SIZINGTEMPLATE 0x0100
129#define WXU_HTTB_SYSTEMSIZINGMARGINS 0x0200
130
131typedef struct tagWXUPOINT
132{
133 long x;
134 long y;
2d9c0e97 135} WXUPOINT;
0d1cb8cb
JS
136
137typedef WXUHRESULT (__stdcall *PFNWXUHITTESTTHEMEBACKGROUND)(WXHTHEME, WXHDC, int,
ca5ccd7e 138 int, WXDWORD, const RECT *, WXHRGN,
2d9c0e97 139 WXUPOINT, unsigned short *);
0d1cb8cb 140typedef WXUHRESULT (__stdcall *PFNWXUDRAWTHEMEEDGE)(WXHTHEME, WXHDC, int, int,
ca5ccd7e 141 const RECT *, unsigned int, unsigned int, RECT *);
0d1cb8cb 142typedef WXUHRESULT (__stdcall *PFNWXUDRAWTHEMEICON)(WXHTHEME, WXHDC, int, int,
ca5ccd7e
VZ
143 const RECT *, WXHIMAGELIST, int);
144typedef BOOL (__stdcall *PFNWXUISTHEMEPARTDEFINED)(WXHTHEME, int, int);
145typedef BOOL (__stdcall *PFNWXUISTHEMEBACKGROUNDPARTIALLYTRANSPARENT)(WXHTHEME, int, int);
2d9c0e97 146typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMECOLOR)(WXHTHEME, int, int, int, WXCOLORREF*);
0d1cb8cb 147typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEMETRIC)(WXHTHEME, WXHDC, int,
2d9c0e97 148 int, int, int *);
0d1cb8cb 149typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMESTRING)(WXHTHEME, int,
2d9c0e97 150 int, int, wchar_t *, int);
ca5ccd7e 151typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEBOOL)(WXHTHEME, int, int, int, BOOL *);
2d9c0e97
VZ
152typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEINT)(WXHTHEME, int, int, int, int *);
153typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEENUMVALUE)(WXHTHEME, int, int, int, int *);
154typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEPOSITION)(WXHTHEME, int, int, int, WXUPOINT *);
0d1cb8cb
JS
155typedef struct tagWXULOGFONT
156{
157 long lfHeight;
158 long lfWidth;
159 long lfEscapement;
160 long lfOrientation;
161 long lfWeight;
162 unsigned char lfItalic;
163 unsigned char lfUnderline;
164 unsigned char lfStrikeOut;
165 unsigned char lfCharSet;
166 unsigned char lfOutPrecision;
167 unsigned char lfClipPrecision;
168 unsigned char lfQuality;
169 unsigned char lfPitchAndFamily;
170 wchar_t lfFaceName[32];
2d9c0e97
VZ
171} WXULOGFONT;
172typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEFONT)(WXHTHEME, WXHDC, int, int, int, WXULOGFONT *);
ca5ccd7e 173typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMERECT)(WXHTHEME, int, int, int, RECT *);
0d1cb8cb
JS
174typedef struct _WXUMARGINS
175{
176 int cxLeftWidth; // width of left border that retains its size
177 int cxRightWidth; // width of right border that retains its size
178 int cyTopHeight; // height of top border that retains its size
179 int cyBottomHeight; // height of bottom border that retains its size
180} WXUMARGINS, *PWXUMARGINS;
181typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEMARGINS)(WXHTHEME, WXHDC, int,
ca5ccd7e 182 int, int, RECT *, WXUMARGINS *);
0d1cb8cb
JS
183
184#define WXU_MAX_INTLIST_COUNT 10
185typedef struct _WXUINTLIST
186{
187 int iValueCount; // number of values in iValues
188 int iValues[WXU_MAX_INTLIST_COUNT];
189} WXUINTLIST, *PWXUINTLIST;
190typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEINTLIST)(WXHTHEME, int,
2d9c0e97 191 int, int, WXUINTLIST*);
85b43fbf
JS
192
193enum WXUPROPERTYORIGIN
0d1cb8cb
JS
194{
195 WXU_PO_STATE, // property was found in the state section
196 WXU_PO_PART, // property was found in the part section
197 WXU_PO_CLASS, // property was found in the class section
198 WXU_PO_GLOBAL, // property was found in [globals] section
199 WXU_PO_NOTFOUND // property was not found
200};
85b43fbf 201
0d1cb8cb 202typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEPROPERTYORIGIN)(WXHTHEME, int,
2d9c0e97
VZ
203 int, int, enum WXUPROPERTYORIGIN *);
204typedef WXUHRESULT (__stdcall *PFNWXUSETWINDOWTHEME)(WXHWND, const wchar_t*, const wchar_t *);
205typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEFILENAME)(WXHTHEME, int, int, int, wchar_t *, int);
206typedef WXCOLORREF (__stdcall *PFNWXUGETTHEMESYSCOLOR)(WXHTHEME, int);
207typedef WXHBRUSH (__stdcall *PFNWXUGETTHEMESYSCOLORBRUSH)(WXHTHEME, int);
ca5ccd7e 208typedef BOOL (__stdcall *PFNWXUGETTHEMESYSBOOL)(WXHTHEME, int);
2d9c0e97
VZ
209typedef int (__stdcall *PFNWXUGETTHEMESYSSIZE)(WXHTHEME, int);
210typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMESYSFONT)(WXHTHEME, int, WXULOGFONT *);
211typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMESYSSTRING)(WXHTHEME, int, wchar_t *, int);
212typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMESYSINT)(WXHTHEME, int, int *);
ca5ccd7e
VZ
213typedef BOOL (__stdcall *PFNWXUISTHEMEACTIVE)();
214typedef BOOL (__stdcall *PFNWXUISAPPTHEMED)();
2d9c0e97 215typedef WXHTHEME (__stdcall *PFNWXUGETWINDOWTHEME)(WXHWND);
0d1cb8cb
JS
216
217#define WXU_ETDT_DISABLE 0x00000001
218#define WXU_ETDT_ENABLE 0x00000002
219#define WXU_ETDT_USETABTEXTURE 0x00000004
220#define WXU_ETDT_ENABLETAB 0x00000006
221
2d9c0e97 222typedef WXUHRESULT (__stdcall *PFNWXUENABLETHEMEDIALOGTEXTURE)(WXHWND, WXDWORD);
ca5ccd7e 223typedef BOOL (__stdcall *PFNWXUISTHEMEDIALOGTEXTUREENABLED)(WXHWND);
0d1cb8cb
JS
224
225#define WXU_STAP_ALLOW_NONCLIENT 1
226#define WXU_STAP_ALLOW_CONTROLS 2
227#define WXU_STAP_ALLOW_WEBCONTENT 4
228
2d9c0e97
VZ
229typedef WXDWORD (__stdcall *PFNWXUGETTHEMEAPPPROPERTIES)();
230typedef void (__stdcall *PFNWXUSETTHEMEAPPPROPERTIES)(WXDWORD);
0d1cb8cb 231typedef WXUHRESULT (__stdcall *PFNWXUGETCURRENTTHEMENAME)(wchar_t *, int,
2d9c0e97 232 wchar_t *, int, wchar_t *, int);
0d1cb8cb
JS
233
234#define WXU_SZ_THDOCPROP_DISPLAYNAME L"DisplayName"
235#define WXU_SZ_THDOCPROP_CANONICALNAME L"ThemeName"
236#define WXU_SZ_THDOCPROP_TOOLTIP L"ToolTip"
237#define WXU_SZ_THDOCPROP_AUTHOR L"author"
238
239typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEDOCUMENTATIONPROPERTY)(const wchar_t *,
2d9c0e97 240 const wchar_t *, wchar_t *, int);
ca5ccd7e
VZ
241typedef WXUHRESULT (__stdcall *PFNWXUDRAWTHEMEPARENTBACKGROUND)(WXHWND, WXHDC, RECT *);
242typedef WXUHRESULT (__stdcall *PFNWXUENABLETHEMING)(BOOL);
2d9c0e97
VZ
243
244// ----------------------------------------------------------------------------
245// wxUxThemeEngine: provides all theme functions from uxtheme.dll
246// ----------------------------------------------------------------------------
247
248// we always define this class, even if wxUSE_UXTHEME == 0, but we just make it
249// empty in this case -- this allows to use it elsewhere without any #ifdefs
250#if wxUSE_UXTHEME
251 #include "wx/dynload.h"
252
253 #define wxUX_THEME_DECLARE(type, func) type func;
254#else
255 #define wxUX_THEME_DECLARE(type, func) type func(...) { return 0; }
256#endif
0d1cb8cb 257
85b43fbf 258class WXDLLEXPORT wxUxThemeEngine
0d1cb8cb 259{
0d1cb8cb 260public:
2d9c0e97
VZ
261 // get the theme engine or NULL if themes are not available
262 static wxUxThemeEngine *Get();
263
264 // all uxtheme.dll functions
265 wxUX_THEME_DECLARE(PFNWXUOPENTHEMEDATA, OpenThemeData)
266 wxUX_THEME_DECLARE(PFNWXUCLOSETHEMEDATA, CloseThemeData)
267 wxUX_THEME_DECLARE(PFNWXUDRAWTHEMEBACKGROUND, DrawThemeBackground)
268 wxUX_THEME_DECLARE(PFNWXUDRAWTHEMETEXT, DrawThemeText)
269 wxUX_THEME_DECLARE(PFNWXUGETTHEMEBACKGROUNDCONTENTRECT, GetThemeBackgroundContentRect)
270 wxUX_THEME_DECLARE(PFNWXUGETTHEMEBACKGROUNDEXTENT, GetThemeBackgroundExtent)
271 wxUX_THEME_DECLARE(PFNWXUGETTHEMEPARTSIZE, GetThemePartSize)
272 wxUX_THEME_DECLARE(PFNWXUGETTHEMETEXTEXTENT, GetThemeTextExtent)
273 wxUX_THEME_DECLARE(PFNWXUGETTHEMETEXTMETRICS, GetThemeTextMetrics)
274 wxUX_THEME_DECLARE(PFNWXUGETTHEMEBACKGROUNDREGION, GetThemeBackgroundRegion)
275 wxUX_THEME_DECLARE(PFNWXUHITTESTTHEMEBACKGROUND, HitTestThemeBackground)
276 wxUX_THEME_DECLARE(PFNWXUDRAWTHEMEEDGE, DrawThemeEdge)
277 wxUX_THEME_DECLARE(PFNWXUDRAWTHEMEICON, DrawThemeIcon)
278 wxUX_THEME_DECLARE(PFNWXUISTHEMEPARTDEFINED, IsThemePartDefined)
279 wxUX_THEME_DECLARE(PFNWXUISTHEMEBACKGROUNDPARTIALLYTRANSPARENT, IsThemeBackgroundPartiallyTransparent)
280 wxUX_THEME_DECLARE(PFNWXUGETTHEMECOLOR, GetThemeColor)
281 wxUX_THEME_DECLARE(PFNWXUGETTHEMEMETRIC, GetThemeMetric)
282 wxUX_THEME_DECLARE(PFNWXUGETTHEMESTRING, GetThemeString)
283 wxUX_THEME_DECLARE(PFNWXUGETTHEMEBOOL, GetThemeBool)
284 wxUX_THEME_DECLARE(PFNWXUGETTHEMEINT, GetThemeInt)
285 wxUX_THEME_DECLARE(PFNWXUGETTHEMEENUMVALUE, GetThemeEnumValue)
286 wxUX_THEME_DECLARE(PFNWXUGETTHEMEPOSITION, GetThemePosition)
287 wxUX_THEME_DECLARE(PFNWXUGETTHEMEFONT, GetThemeFont)
288 wxUX_THEME_DECLARE(PFNWXUGETTHEMERECT, GetThemeRect)
289 wxUX_THEME_DECLARE(PFNWXUGETTHEMEMARGINS, GetThemeMargins)
290 wxUX_THEME_DECLARE(PFNWXUGETTHEMEINTLIST, GetThemeIntList)
291 wxUX_THEME_DECLARE(PFNWXUGETTHEMEPROPERTYORIGIN, GetThemePropertyOrigin)
292 wxUX_THEME_DECLARE(PFNWXUSETWINDOWTHEME, SetWindowTheme)
293 wxUX_THEME_DECLARE(PFNWXUGETTHEMEFILENAME, GetThemeFilename)
294 wxUX_THEME_DECLARE(PFNWXUGETTHEMESYSCOLOR, GetThemeSysColor)
295 wxUX_THEME_DECLARE(PFNWXUGETTHEMESYSCOLORBRUSH, GetThemeSysColorBrush)
296 wxUX_THEME_DECLARE(PFNWXUGETTHEMESYSBOOL, GetThemeSysBool)
297 wxUX_THEME_DECLARE(PFNWXUGETTHEMESYSSIZE, GetThemeSysSize)
298 wxUX_THEME_DECLARE(PFNWXUGETTHEMESYSFONT, GetThemeSysFont)
299 wxUX_THEME_DECLARE(PFNWXUGETTHEMESYSSTRING, GetThemeSysString)
300 wxUX_THEME_DECLARE(PFNWXUGETTHEMESYSINT, GetThemeSysInt)
301 wxUX_THEME_DECLARE(PFNWXUISTHEMEACTIVE, IsThemeActive)
302 wxUX_THEME_DECLARE(PFNWXUISAPPTHEMED, IsAppThemed)
303 wxUX_THEME_DECLARE(PFNWXUGETWINDOWTHEME, GetWindowTheme)
304 wxUX_THEME_DECLARE(PFNWXUENABLETHEMEDIALOGTEXTURE, EnableThemeDialogTexture)
305 wxUX_THEME_DECLARE(PFNWXUISTHEMEDIALOGTEXTUREENABLED, IsThemeDialogTextureEnabled)
306 wxUX_THEME_DECLARE(PFNWXUGETTHEMEAPPPROPERTIES, GetThemeAppProperties)
307 wxUX_THEME_DECLARE(PFNWXUSETTHEMEAPPPROPERTIES, SetThemeAppProperties)
308 wxUX_THEME_DECLARE(PFNWXUGETCURRENTTHEMENAME, GetCurrentThemeName)
309 wxUX_THEME_DECLARE(PFNWXUGETTHEMEDOCUMENTATIONPROPERTY, GetThemeDocumentationProperty)
310 wxUX_THEME_DECLARE(PFNWXUDRAWTHEMEPARENTBACKGROUND, DrawThemeParentBackground)
311 wxUX_THEME_DECLARE(PFNWXUENABLETHEMING, EnableTheming)
0d1cb8cb
JS
312
313private:
2d9c0e97
VZ
314 // construcor is private as only Get() can create us and is also trivial as
315 // everything really happens in Initialize()
316 wxUxThemeEngine() { }
0d1cb8cb 317
2d9c0e97
VZ
318 // destructor is private as only Get() and wxUxThemeModule delete us, it is
319 // not virtual as we're not supposed to be derived from
320 ~wxUxThemeEngine() { }
321
322#if wxUSE_UXTHEME
323 // initialize the theme engine: load the DLL, resolve the functions
324 //
325 // return true if we can be used, false if themes are not available
326 bool Initialize();
327
328
329 // uxtheme.dll
330 wxDynamicLibrary m_dllUxTheme;
331
332
333 // the one and only theme engine, initially NULL
334 static wxUxThemeEngine *ms_themeEngine;
335
336 // this is a bool which initially has the value -1 meaning "unknown"
337 static int ms_isThemeEngineAvailable;
338
339 // it must be able to delete us
340 friend class wxUxThemeModule;
341#endif // wxUSE_UXTHEME
342
b3062afd 343 DECLARE_NO_COPY_CLASS(wxUxThemeEngine)
0d1cb8cb
JS
344};
345
2d9c0e97 346#if !wxUSE_UXTHEME
0d1cb8cb 347
2d9c0e97
VZ
348/* static */ inline wxUxThemeEngine *wxUxThemeEngine::Get()
349{
350 return NULL;
351}
0d1cb8cb 352
2d9c0e97 353#endif // !wxUSE_UXTHEME
0d1cb8cb 354
ca5ccd7e
VZ
355// ----------------------------------------------------------------------------
356// wxUxThemeHandle: encapsulates ::Open/CloseThemeData()
357// ----------------------------------------------------------------------------
358
359class wxUxThemeHandle
360{
361public:
362 wxUxThemeHandle(wxWindow *win, const wchar_t *classes)
363 {
364 wxUxThemeEngine *engine = wxUxThemeEngine::Get();
365
85b657c7
VS
366 m_hTheme =
367 engine ? (WXHTHEME)engine->OpenThemeData(win->GetHWND(), classes)
368 : NULL;
ca5ccd7e
VZ
369 }
370
371 operator WXHTHEME() const { return m_hTheme; }
372
373 ~wxUxThemeHandle()
374 {
375 if ( m_hTheme )
376 {
377 wxUxThemeEngine::Get()->CloseThemeData(m_hTheme);
378 }
379 }
380
381private:
382 WXHTHEME m_hTheme;
383
384 DECLARE_NO_COPY_CLASS(wxUxThemeHandle)
385};
386
2d9c0e97 387#endif // _WX_UXTHEME_H_
0d1cb8cb 388