]>
Commit | Line | Data |
---|---|---|
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$ | |
8 | // Copyright: (c) 2003 wxWidgets Dev-Team | |
9 | // License: wxWindows licence | |
10 | /////////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_UXTHEME_H_ | |
13 | #define _WX_UXTHEME_H_ | |
14 | ||
15 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) | |
16 | #pragma interface "uxtheme.h" | |
17 | #endif | |
18 | ||
19 | #include "wx/defs.h" | |
20 | ||
21 | #include "wx/msw/wrapwin.h" | |
22 | ||
23 | #if wxUSE_UNICODE | |
24 | typedef 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 | |
41 | typedef 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 | ||
59 | typedef void* WXHTHEME; | |
60 | typedef long WXUHRESULT; | |
61 | typedef WXHTHEME (__stdcall *PFNWXUOPENTHEMEDATA)(WXHWND, const wchar_t *); | |
62 | typedef WXUHRESULT (__stdcall *PFNWXUCLOSETHEMEDATA)(WXHTHEME); | |
63 | typedef WXUHRESULT (__stdcall *PFNWXUDRAWTHEMEBACKGROUND)(WXHTHEME, WXHDC, | |
64 | int, int, const RECT *, const RECT *); | |
65 | #define WXU_DTT_GRAYED 0x1 | |
66 | typedef WXUHRESULT (__stdcall *PFNWXUDRAWTHEMETEXT)(WXHTHEME, WXHDC, int, | |
67 | int, const wchar_t *, int, DWORD, | |
68 | DWORD, const RECT *); | |
69 | typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEBACKGROUNDCONTENTRECT)(WXHTHEME, WXHDC, | |
70 | int, int, const RECT *, RECT *); | |
71 | typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEBACKGROUNDEXTENT)(WXHTHEME, WXHDC, int, int, | |
72 | const RECT *, RECT *); | |
73 | ||
74 | enum WXUTHEMESIZE | |
75 | { | |
76 | WXU_TS_MIN, // minimum size | |
77 | WXU_TS_TRUE, // size without stretching | |
78 | WXU_TS_DRAW // size that theme mgr will use to draw part | |
79 | }; | |
80 | ||
81 | typedef struct tagWXUSIZE | |
82 | { | |
83 | long cx; | |
84 | long cy; | |
85 | } WXUSIZE; | |
86 | ||
87 | typedef 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 | ||
111 | typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEPARTSIZE)(WXHTHEME, WXHDC, int, int, const RECT *, | |
112 | enum WXUTHEMESIZE, WXUSIZE *); | |
113 | typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMETEXTEXTENT)(WXHTHEME, WXHDC, int, int, const wchar_t *, | |
114 | int, WXDWORD, const RECT *, RECT *); | |
115 | typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMETEXTMETRICS)(WXHTHEME, WXHDC, | |
116 | int, int, WXUTEXTMETRIC*); | |
117 | typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEBACKGROUNDREGION)(WXHTHEME, WXHDC, | |
118 | int, int, const RECT *, WXHRGN *); | |
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 | ||
131 | typedef struct tagWXUPOINT | |
132 | { | |
133 | long x; | |
134 | long y; | |
135 | } WXUPOINT; | |
136 | ||
137 | typedef WXUHRESULT (__stdcall *PFNWXUHITTESTTHEMEBACKGROUND)(WXHTHEME, WXHDC, int, | |
138 | int, WXDWORD, const RECT *, WXHRGN, | |
139 | WXUPOINT, unsigned short *); | |
140 | typedef WXUHRESULT (__stdcall *PFNWXUDRAWTHEMEEDGE)(WXHTHEME, WXHDC, int, int, | |
141 | const RECT *, unsigned int, unsigned int, RECT *); | |
142 | typedef WXUHRESULT (__stdcall *PFNWXUDRAWTHEMEICON)(WXHTHEME, WXHDC, int, int, | |
143 | const RECT *, WXHIMAGELIST, int); | |
144 | typedef BOOL (__stdcall *PFNWXUISTHEMEPARTDEFINED)(WXHTHEME, int, int); | |
145 | typedef BOOL (__stdcall *PFNWXUISTHEMEBACKGROUNDPARTIALLYTRANSPARENT)(WXHTHEME, int, int); | |
146 | typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMECOLOR)(WXHTHEME, int, int, int, WXCOLORREF*); | |
147 | typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEMETRIC)(WXHTHEME, WXHDC, int, | |
148 | int, int, int *); | |
149 | typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMESTRING)(WXHTHEME, int, | |
150 | int, int, wchar_t *, int); | |
151 | typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEBOOL)(WXHTHEME, int, int, int, BOOL *); | |
152 | typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEINT)(WXHTHEME, int, int, int, int *); | |
153 | typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEENUMVALUE)(WXHTHEME, int, int, int, int *); | |
154 | typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEPOSITION)(WXHTHEME, int, int, int, WXUPOINT *); | |
155 | typedef 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]; | |
171 | } WXULOGFONT; | |
172 | typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEFONT)(WXHTHEME, WXHDC, int, int, int, WXULOGFONT *); | |
173 | typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMERECT)(WXHTHEME, int, int, int, RECT *); | |
174 | typedef 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; | |
181 | typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEMARGINS)(WXHTHEME, WXHDC, int, | |
182 | int, int, RECT *, WXUMARGINS *); | |
183 | ||
184 | #define WXU_MAX_INTLIST_COUNT 10 | |
185 | typedef struct _WXUINTLIST | |
186 | { | |
187 | int iValueCount; // number of values in iValues | |
188 | int iValues[WXU_MAX_INTLIST_COUNT]; | |
189 | } WXUINTLIST, *PWXUINTLIST; | |
190 | typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEINTLIST)(WXHTHEME, int, | |
191 | int, int, WXUINTLIST*); | |
192 | ||
193 | enum WXUPROPERTYORIGIN | |
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 | }; | |
201 | ||
202 | typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEPROPERTYORIGIN)(WXHTHEME, int, | |
203 | int, int, enum WXUPROPERTYORIGIN *); | |
204 | typedef WXUHRESULT (__stdcall *PFNWXUSETWINDOWTHEME)(WXHWND, const wchar_t*, const wchar_t *); | |
205 | typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEFILENAME)(WXHTHEME, int, int, int, wchar_t *, int); | |
206 | typedef WXCOLORREF (__stdcall *PFNWXUGETTHEMESYSCOLOR)(WXHTHEME, int); | |
207 | typedef WXHBRUSH (__stdcall *PFNWXUGETTHEMESYSCOLORBRUSH)(WXHTHEME, int); | |
208 | typedef BOOL (__stdcall *PFNWXUGETTHEMESYSBOOL)(WXHTHEME, int); | |
209 | typedef int (__stdcall *PFNWXUGETTHEMESYSSIZE)(WXHTHEME, int); | |
210 | typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMESYSFONT)(WXHTHEME, int, WXULOGFONT *); | |
211 | typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMESYSSTRING)(WXHTHEME, int, wchar_t *, int); | |
212 | typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMESYSINT)(WXHTHEME, int, int *); | |
213 | typedef BOOL (__stdcall *PFNWXUISTHEMEACTIVE)(); | |
214 | typedef BOOL (__stdcall *PFNWXUISAPPTHEMED)(); | |
215 | typedef WXHTHEME (__stdcall *PFNWXUGETWINDOWTHEME)(WXHWND); | |
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 | ||
222 | typedef WXUHRESULT (__stdcall *PFNWXUENABLETHEMEDIALOGTEXTURE)(WXHWND, WXDWORD); | |
223 | typedef BOOL (__stdcall *PFNWXUISTHEMEDIALOGTEXTUREENABLED)(WXHWND); | |
224 | ||
225 | #define WXU_STAP_ALLOW_NONCLIENT 1 | |
226 | #define WXU_STAP_ALLOW_CONTROLS 2 | |
227 | #define WXU_STAP_ALLOW_WEBCONTENT 4 | |
228 | ||
229 | typedef WXDWORD (__stdcall *PFNWXUGETTHEMEAPPPROPERTIES)(); | |
230 | typedef void (__stdcall *PFNWXUSETTHEMEAPPPROPERTIES)(WXDWORD); | |
231 | typedef WXUHRESULT (__stdcall *PFNWXUGETCURRENTTHEMENAME)(wchar_t *, int, | |
232 | wchar_t *, int, wchar_t *, int); | |
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 | ||
239 | typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEDOCUMENTATIONPROPERTY)(const wchar_t *, | |
240 | const wchar_t *, wchar_t *, int); | |
241 | typedef WXUHRESULT (__stdcall *PFNWXUDRAWTHEMEPARENTBACKGROUND)(WXHWND, WXHDC, RECT *); | |
242 | typedef WXUHRESULT (__stdcall *PFNWXUENABLETHEMING)(BOOL); | |
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 | |
257 | ||
258 | class WXDLLEXPORT wxUxThemeEngine | |
259 | { | |
260 | public: | |
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) | |
312 | ||
313 | private: | |
314 | // construcor is private as only Get() can create us and is also trivial as | |
315 | // everything really happens in Initialize() | |
316 | wxUxThemeEngine() { } | |
317 | ||
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 | ||
343 | DECLARE_NO_COPY_CLASS(wxUxThemeEngine) | |
344 | }; | |
345 | ||
346 | #if !wxUSE_UXTHEME | |
347 | ||
348 | /* static */ inline wxUxThemeEngine *wxUxThemeEngine::Get() | |
349 | { | |
350 | return NULL; | |
351 | } | |
352 | ||
353 | #endif // !wxUSE_UXTHEME | |
354 | ||
355 | // ---------------------------------------------------------------------------- | |
356 | // wxUxThemeHandle: encapsulates ::Open/CloseThemeData() | |
357 | // ---------------------------------------------------------------------------- | |
358 | ||
359 | class wxUxThemeHandle | |
360 | { | |
361 | public: | |
362 | wxUxThemeHandle(wxWindow *win, const wchar_t *classes) | |
363 | { | |
364 | wxUxThemeEngine *engine = wxUxThemeEngine::Get(); | |
365 | ||
366 | m_hTheme = | |
367 | engine ? (WXHTHEME)engine->OpenThemeData(win->GetHWND(), classes) | |
368 | : NULL; | |
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 | ||
381 | private: | |
382 | WXHTHEME m_hTheme; | |
383 | ||
384 | DECLARE_NO_COPY_CLASS(wxUxThemeHandle) | |
385 | }; | |
386 | ||
387 | #endif // _WX_UXTHEME_H_ | |
388 |