1 /////////////////////////////////////////////////////////////////////////////
\r
2 // Copyright (C) 2001-2002 by Pål Kristian Tønder
\r
4 // Distribute and change freely, except: don't remove my name from the source
\r
6 // No warrantee of any kind, express or implied, is included with this
\r
7 // software; use at your own risk, responsibility for damages (if any) to
\r
8 // anyone resulting from the use of this software rests entirely with the
\r
11 // Heavily based on the CVisualStyleXP class of David Yuheng Zhao. The difference
\r
12 // is that the dll is global and the HTHEME handle is wrapped. The HTHEME handle is
\r
13 // automatically released as the object is deleted. All API functions not directly
\r
14 // related to a HTHEME instance are realized as static methods. To optimize the
\r
15 // execution speed, static function pointers are used. During execution, either
\r
16 // the actual function or the failure function is assigned to the static function
\r
17 // pointer, which is used from there on.
\r
19 // To explicitly Release the dll, call the static Release method. To check whether
\r
20 // Theming is available, that is, if the platform is XP or newer, use the static
\r
21 // method IsAvailable
\r
23 // If you have any questions, I can be reached as follows:
\r
24 // pal.k.tonder@powel.no
\r
28 // Instead of calling the API directly,
\r
29 // HTHEME hTheme = OpenThemeData(...);
\r
30 // if(hTheme == NULL) {
\r
31 // // draw old fashion way
\r
34 // DrawThemeBackground(hTheme, ...);
\r
36 // [more method calls]
\r
38 // CloseThemeData(hTheme);
\r
41 // use a variable of the CXPTheme class
\r
42 // CXPTheme theme(...);
\r
44 // // draw old fashion way
\r
47 // theme.DrawBackground(...);
\r
49 // [more method calls]
\r
53 // A couple of convenient operator overloads are provided::
\r
54 // - operator HTHEME for accessing the HTHEME handle
\r
55 // - operator ! for checking if HTHEME handle is valid
\r
57 /////////////////////////////////////////////////////////////////////////////
\r
59 #include "XPTheme.h"
\r
61 // Initializing static members
\r
62 BOOL CXPTheme::m_bLoaded = FALSE;
\r
63 HMODULE CXPTheme::m_hThemeDll = NULL;
\r
65 CXPTheme::PFNOPENTHEMEDATA CXPTheme::m_pOpenThemeData = NULL;
\r
66 CXPTheme::PFNCLOSETHEMEDATA CXPTheme::m_pCloseThemeData = NULL;
\r
67 CXPTheme::PFNDRAWTHEMEBACKGROUND CXPTheme::m_pDrawThemeBackground = NULL;
\r
68 CXPTheme::PFNDRAWTHEMETEXT CXPTheme::m_pDrawThemeText = NULL;
\r
69 CXPTheme::PFNGETTHEMEBACKGROUNDCONTENTRECT CXPTheme::m_pGetThemeBackgroundContentRect = NULL;
\r
70 CXPTheme::PFNGETTHEMEBACKGROUNDEXTENT CXPTheme::m_pGetThemeBackgroundExtent = NULL;
\r
71 CXPTheme::PFNGETTHEMEPARTSIZE CXPTheme::m_pGetThemePartSize = NULL;
\r
72 CXPTheme::PFNGETTHEMETEXTEXTENT CXPTheme::m_pGetThemeTextExtent = NULL;
\r
73 CXPTheme::PFNGETTHEMETEXTMETRICS CXPTheme::m_pGetThemeTextMetrics = NULL;
\r
74 CXPTheme::PFNGETTHEMEBACKGROUNDREGION CXPTheme::m_pGetThemeBackgroundRegion = NULL;
\r
75 CXPTheme::PFNHITTESTTHEMEBACKGROUND CXPTheme::m_pHitTestThemeBackground = NULL;
\r
76 CXPTheme::PFNDRAWTHEMEEDGE CXPTheme::m_pDrawThemeEdge = NULL;
\r
77 CXPTheme::PFNDRAWTHEMEICON CXPTheme::m_pDrawThemeIcon = NULL;
\r
78 CXPTheme::PFNISTHEMEPARTDEFINED CXPTheme::m_pIsThemePartDefined = NULL;
\r
79 CXPTheme::PFNISTHEMEBACKGROUNDPARTIALLYTRANSPARENT CXPTheme::m_pIsThemeBackgroundPartiallyTransparent = NULL;
\r
80 CXPTheme::PFNGETTHEMECOLOR CXPTheme::m_pGetThemeColor = NULL;
\r
81 CXPTheme::PFNGETTHEMEMETRIC CXPTheme::m_pGetThemeMetric = NULL;
\r
82 CXPTheme::PFNGETTHEMESTRING CXPTheme::m_pGetThemeString = NULL;
\r
83 CXPTheme::PFNGETTHEMEBOOL CXPTheme::m_pGetThemeBool = NULL;
\r
84 CXPTheme::PFNGETTHEMEINT CXPTheme::m_pGetThemeInt = NULL;
\r
85 CXPTheme::PFNGETTHEMEENUMVALUE CXPTheme::m_pGetThemeEnumValue = NULL;
\r
86 CXPTheme::PFNGETTHEMEPOSITION CXPTheme::m_pGetThemePosition = NULL;
\r
87 CXPTheme::PFNGETTHEMEFONT CXPTheme::m_pGetThemeFont = NULL;
\r
88 CXPTheme::PFNGETTHEMERECT CXPTheme::m_pGetThemeRect = NULL;
\r
89 CXPTheme::PFNGETTHEMEMARGINS CXPTheme::m_pGetThemeMargins = NULL;
\r
90 CXPTheme::PFNGETTHEMEINTLIST CXPTheme::m_pGetThemeIntList = NULL;
\r
91 CXPTheme::PFNGETTHEMEPROPERTYORIGIN CXPTheme::m_pGetThemePropertyOrigin = NULL;
\r
92 CXPTheme::PFNSETWINDOWTHEME CXPTheme::m_pSetWindowTheme = NULL;
\r
93 CXPTheme::PFNGETTHEMEFILENAME CXPTheme::m_pGetThemeFilename = NULL;
\r
94 CXPTheme::PFNGETTHEMESYSCOLOR CXPTheme::m_pGetThemeSysColor = NULL;
\r
95 CXPTheme::PFNGETTHEMESYSCOLORBRUSH CXPTheme::m_pGetThemeSysColorBrush = NULL;
\r
96 CXPTheme::PFNGETTHEMESYSBOOL CXPTheme::m_pGetThemeSysBool = NULL;
\r
97 CXPTheme::PFNGETTHEMESYSSIZE CXPTheme::m_pGetThemeSysSize = NULL;
\r
98 CXPTheme::PFNGETTHEMESYSFONT CXPTheme::m_pGetThemeSysFont = NULL;
\r
99 CXPTheme::PFNGETTHEMESYSSTRING CXPTheme::m_pGetThemeSysString = NULL;
\r
100 CXPTheme::PFNGETTHEMESYSINT CXPTheme::m_pGetThemeSysInt = NULL;
\r
101 CXPTheme::PFNISTHEMEACTIVE CXPTheme::m_pIsThemeActive = NULL;
\r
102 CXPTheme::PFNISAPPTHEMED CXPTheme::m_pIsAppThemed = NULL;
\r
103 CXPTheme::PFNGETWINDOWTHEME CXPTheme::m_pGetWindowTheme = NULL;
\r
104 CXPTheme::PFNENABLETHEMEDIALOGTEXTURE CXPTheme::m_pEnableThemeDialogTexture = NULL;
\r
105 CXPTheme::PFNISTHEMEDIALOGTEXTUREENABLED CXPTheme::m_pIsThemeDialogTextureEnabled = NULL;
\r
106 CXPTheme::PFNGETTHEMEAPPPROPERTIES CXPTheme::m_pGetThemeAppProperties = NULL;
\r
107 CXPTheme::PFNSETTHEMEAPPPROPERTIES CXPTheme::m_pSetThemeAppProperties = NULL;
\r
108 CXPTheme::PFNGETCURRENTTHEMENAME CXPTheme::m_pGetCurrentThemeName = NULL;
\r
109 CXPTheme::PFNGETTHEMEDOCUMENTATIONPROPERTY CXPTheme::m_pGetThemeDocumentationProperty = NULL;
\r
110 CXPTheme::PFNDRAWTHEMEPARENTBACKGROUND CXPTheme::m_pDrawThemeParentBackground = NULL;
\r
111 CXPTheme::PFNENABLETHEMING CXPTheme::m_pEnableTheming = NULL;
\r
114 CXPTheme::CXPTheme(void) : m_hTheme(NULL)
\r
118 CXPTheme::CXPTheme(HTHEME hTheme)
\r
123 CXPTheme::CXPTheme(HWND hwnd, LPCWSTR pszClassList)
\r
126 Open(hwnd, pszClassList);
\r
130 CXPTheme::~CXPTheme(void)
\r
135 void CXPTheme::Attach(HTHEME hTheme)
\r
141 HTHEME CXPTheme::Detach()
\r
143 HTHEME hTheme = m_hTheme;
\r
148 CXPTheme::operator HTHEME() const
\r
153 bool CXPTheme::operator !() const
\r
155 return (m_hTheme == NULL);
\r
158 BOOL CXPTheme::IsAvailable()
\r
160 if (m_hThemeDll == NULL && !m_bLoaded) {
\r
161 m_hThemeDll = LoadLibrary(_T("UxTheme.dll"));
\r
164 return m_hThemeDll != NULL;
\r
167 void CXPTheme::Release(void)
\r
169 if (m_hThemeDll != NULL) {
\r
170 FreeLibrary(m_hThemeDll);
\r
171 m_hThemeDll = NULL;
\r
174 // Set all function pointers to NULL
\r
175 m_pOpenThemeData = NULL;
\r
176 m_pCloseThemeData = NULL;
\r
177 m_pDrawThemeBackground = NULL;
\r
178 m_pDrawThemeText = NULL;
\r
179 m_pGetThemeBackgroundContentRect = NULL;
\r
180 m_pGetThemeBackgroundExtent = NULL;
\r
181 m_pGetThemePartSize = NULL;
\r
182 m_pGetThemeTextExtent = NULL;
\r
183 m_pGetThemeTextMetrics = NULL;
\r
184 m_pGetThemeBackgroundRegion = NULL;
\r
185 m_pHitTestThemeBackground = NULL;
\r
186 m_pDrawThemeEdge = NULL;
\r
187 m_pDrawThemeIcon = NULL;
\r
188 m_pIsThemePartDefined = NULL;
\r
189 m_pIsThemeBackgroundPartiallyTransparent = NULL;
\r
190 m_pGetThemeColor = NULL;
\r
191 m_pGetThemeMetric = NULL;
\r
192 m_pGetThemeString = NULL;
\r
193 m_pGetThemeBool = NULL;
\r
194 m_pGetThemeInt = NULL;
\r
195 m_pGetThemeEnumValue = NULL;
\r
196 m_pGetThemePosition = NULL;
\r
197 m_pGetThemeFont = NULL;
\r
198 m_pGetThemeRect = NULL;
\r
199 m_pGetThemeMargins = NULL;
\r
200 m_pGetThemeIntList = NULL;
\r
201 m_pGetThemePropertyOrigin = NULL;
\r
202 m_pSetWindowTheme = NULL;
\r
203 m_pGetThemeFilename = NULL;
\r
204 m_pGetThemeSysColor = NULL;
\r
205 m_pGetThemeSysColorBrush = NULL;
\r
206 m_pGetThemeSysBool = NULL;
\r
207 m_pGetThemeSysSize = NULL;
\r
208 m_pGetThemeSysFont = NULL;
\r
209 m_pGetThemeSysString = NULL;
\r
210 m_pGetThemeSysInt = NULL;
\r
211 m_pIsThemeActive = NULL;
\r
212 m_pIsAppThemed = NULL;
\r
213 m_pGetWindowTheme = NULL;
\r
214 m_pEnableThemeDialogTexture = NULL;
\r
215 m_pIsThemeDialogTextureEnabled = NULL;
\r
216 m_pGetThemeAppProperties = NULL;
\r
217 m_pSetThemeAppProperties = NULL;
\r
218 m_pGetCurrentThemeName = NULL;
\r
219 m_pGetThemeDocumentationProperty = NULL;
\r
220 m_pDrawThemeParentBackground = NULL;
\r
221 m_pEnableTheming = NULL;
\r
225 void* CXPTheme::GetProc(LPCSTR szProc, void* pfnFail)
\r
227 void* pRet = pfnFail;
\r
228 if (m_hThemeDll == NULL && !m_bLoaded) {
\r
229 m_hThemeDll = LoadLibrary(_T("UxTheme.dll"));
\r
232 if (m_hThemeDll != NULL)
\r
233 pRet = GetProcAddress(m_hThemeDll, szProc);
\r
237 BOOL CXPTheme::Open(HWND hwnd, LPCWSTR pszClassList)
\r
239 // Close before opening
\r
241 if(m_pOpenThemeData == NULL)
\r
242 m_pOpenThemeData = (CXPTheme::PFNOPENTHEMEDATA)GetProc("OpenThemeData", (void*)OpenThemeDataFail);
\r
243 m_hTheme = (*m_pOpenThemeData)(hwnd, pszClassList);
\r
244 return m_hTheme != NULL;
\r
247 void CXPTheme::Close()
\r
249 if(m_hTheme != NULL) {
\r
250 if(m_pCloseThemeData == NULL)
\r
251 m_pCloseThemeData = (CXPTheme::PFNCLOSETHEMEDATA)GetProc("CloseThemeData", (void*)CloseThemeDataFail);
\r
252 (*m_pCloseThemeData)(m_hTheme);
\r
257 HRESULT CXPTheme::DrawBackground(HDC hdc, int iPartId, int iStateId, const RECT *pRect, const RECT *pClipRect)
\r
259 if(m_pDrawThemeBackground == NULL)
\r
260 m_pDrawThemeBackground =
\r
261 (CXPTheme::PFNDRAWTHEMEBACKGROUND)GetProc("DrawThemeBackground", (void*)DrawThemeBackgroundFail);
\r
262 return (*m_pDrawThemeBackground)(m_hTheme, hdc, iPartId, iStateId, pRect, pClipRect);
\r
266 HRESULT CXPTheme::DrawText(HDC hdc, int iPartId,
\r
267 int iStateId, LPCWSTR pszText, int iCharCount, DWORD dwTextFlags,
\r
268 DWORD dwTextFlags2, const RECT *pRect)
\r
270 if(m_pDrawThemeText == NULL)
\r
271 m_pDrawThemeText = (CXPTheme::PFNDRAWTHEMETEXT)GetProc("DrawThemeText", (void*)DrawThemeTextFail);
\r
272 return (*m_pDrawThemeText)(m_hTheme, hdc, iPartId, iStateId, pszText, iCharCount, dwTextFlags, dwTextFlags2, pRect);
\r
274 HRESULT CXPTheme::GetBackgroundContentRect( HDC hdc,
\r
275 int iPartId, int iStateId, const RECT *pBoundingRect,
\r
276 RECT *pContentRect)
\r
278 if(m_pGetThemeBackgroundContentRect == NULL)
\r
279 m_pGetThemeBackgroundContentRect = (CXPTheme::PFNGETTHEMEBACKGROUNDCONTENTRECT)GetProc("GetThemeBackgroundContentRect", (void*)GetThemeBackgroundContentRectFail);
\r
280 return (*m_pGetThemeBackgroundContentRect)(m_hTheme, hdc, iPartId, iStateId, pBoundingRect, pContentRect);
\r
282 HRESULT CXPTheme::GetBackgroundExtent( HDC hdc,
\r
283 int iPartId, int iStateId, const RECT *pContentRect,
\r
286 if(m_pGetThemeBackgroundExtent == NULL)
\r
287 m_pGetThemeBackgroundExtent = (CXPTheme::PFNGETTHEMEBACKGROUNDEXTENT)GetProc("GetThemeBackgroundExtent", (void*)GetThemeBackgroundExtentFail);
\r
288 return (*m_pGetThemeBackgroundExtent)(m_hTheme, hdc, iPartId, iStateId, pContentRect, pExtentRect);
\r
290 HRESULT CXPTheme::GetPartSize(HDC hdc, int iPartId, int iStateId, RECT * pRect, enum THEMESIZE eSize, SIZE *psz)
\r
292 if(m_pGetThemePartSize == NULL)
\r
293 m_pGetThemePartSize =
\r
294 (CXPTheme::PFNGETTHEMEPARTSIZE)GetProc("GetThemePartSize", (void*)GetThemePartSizeFail);
\r
295 return (*m_pGetThemePartSize)(m_hTheme, hdc, iPartId, iStateId, pRect, eSize, psz);
\r
298 HRESULT CXPTheme::GetTextExtent(HDC hdc, int iPartId, int iStateId, LPCWSTR pszText, int iCharCount,
\r
299 DWORD dwTextFlags, const RECT *pBoundingRect,
\r
302 if(m_pGetThemeTextExtent == NULL)
\r
303 m_pGetThemeTextExtent = (CXPTheme::PFNGETTHEMETEXTEXTENT)GetProc("GetThemeTextExtent", (void*)GetThemeTextExtentFail);
\r
304 return (*m_pGetThemeTextExtent)(m_hTheme, hdc, iPartId, iStateId, pszText, iCharCount, dwTextFlags, pBoundingRect, pExtentRect);
\r
307 HRESULT CXPTheme::GetTextMetrics(HDC hdc, int iPartId, int iStateId, TEXTMETRIC* ptm)
\r
309 if(m_pGetThemeTextMetrics == NULL)
\r
310 m_pGetThemeTextMetrics = (CXPTheme::PFNGETTHEMETEXTMETRICS)GetProc("GetThemeTextMetrics", (void*)GetThemeTextMetricsFail);
\r
311 return (*m_pGetThemeTextMetrics)(m_hTheme, hdc, iPartId, iStateId, ptm);
\r
314 HRESULT CXPTheme::GetBackgroundRegion(HDC hdc, int iPartId, int iStateId, const RECT *pRect, HRGN *pRegion)
\r
316 if(m_pGetThemeBackgroundRegion == NULL)
\r
317 m_pGetThemeBackgroundRegion = (CXPTheme::PFNGETTHEMEBACKGROUNDREGION)GetProc("GetThemeBackgroundRegion", (void*)GetThemeBackgroundRegionFail);
\r
318 return (*m_pGetThemeBackgroundRegion)(m_hTheme, hdc, iPartId, iStateId, pRect, pRegion);
\r
321 HRESULT CXPTheme::HitTestBackground(HDC hdc, int iPartId, int iStateId, DWORD dwOptions, const RECT *pRect, HRGN hrgn,
\r
322 POINT ptTest, WORD *pwHitTestCode)
\r
324 if(m_pHitTestThemeBackground == NULL)
\r
325 m_pHitTestThemeBackground = (CXPTheme::PFNHITTESTTHEMEBACKGROUND)GetProc("HitTestThemeBackground", (void*)HitTestThemeBackgroundFail);
\r
326 return (*m_pHitTestThemeBackground)(m_hTheme, hdc, iPartId, iStateId, dwOptions, pRect, hrgn, ptTest, pwHitTestCode);
\r
329 HRESULT CXPTheme::DrawEdge(HDC hdc, int iPartId, int iStateId,
\r
330 const RECT *pDestRect, UINT uEdge, UINT uFlags, RECT *pContentRect)
\r
332 if(m_pDrawThemeEdge == NULL)
\r
333 m_pDrawThemeEdge = (CXPTheme::PFNDRAWTHEMEEDGE)GetProc("DrawThemeEdge", (void*)DrawThemeEdgeFail);
\r
334 return (*m_pDrawThemeEdge)(m_hTheme, hdc, iPartId, iStateId, pDestRect, uEdge, uFlags, pContentRect);
\r
337 HRESULT CXPTheme::DrawIcon(HDC hdc, int iPartId,
\r
338 int iStateId, const RECT *pRect, HIMAGELIST himl, int iImageIndex)
\r
340 if(m_pDrawThemeIcon == NULL)
\r
341 m_pDrawThemeIcon = (CXPTheme::PFNDRAWTHEMEICON)GetProc("DrawThemeIcon", (void*)DrawThemeIconFail);
\r
342 return (*m_pDrawThemeIcon)(m_hTheme, hdc, iPartId, iStateId, pRect, himl, iImageIndex);
\r
345 BOOL CXPTheme::IsPartDefined(int iPartId, int iStateId)
\r
347 if(m_pIsThemePartDefined == NULL)
\r
348 m_pIsThemePartDefined = (CXPTheme::PFNISTHEMEPARTDEFINED)GetProc("IsThemePartDefined", (void*)IsThemePartDefinedFail);
\r
349 return (*m_pIsThemePartDefined)(m_hTheme, iPartId, iStateId);
\r
352 BOOL CXPTheme::IsBackgroundPartiallyTransparent(int iPartId, int iStateId)
\r
354 if(m_pIsThemeBackgroundPartiallyTransparent == NULL)
\r
355 m_pIsThemeBackgroundPartiallyTransparent = (CXPTheme::PFNISTHEMEBACKGROUNDPARTIALLYTRANSPARENT)GetProc("IsThemeBackgroundPartiallyTransparent", (void*)IsThemeBackgroundPartiallyTransparentFail);
\r
356 return (*m_pIsThemeBackgroundPartiallyTransparent)(m_hTheme, iPartId, iStateId);
\r
359 HRESULT CXPTheme::GetColor(int iPartId, int iStateId, int iPropId, COLORREF *pColor)
\r
361 if(m_pGetThemeColor == NULL)
\r
362 m_pGetThemeColor = (CXPTheme::PFNGETTHEMECOLOR)GetProc("GetThemeColor", (void*)GetThemeColorFail);
\r
363 return (*m_pGetThemeColor)(m_hTheme, iPartId, iStateId, iPropId, pColor);
\r
366 HRESULT CXPTheme::GetMetric(HDC hdc, int iPartId, int iStateId, int iPropId, int *piVal)
\r
368 if(m_pGetThemeMetric == NULL)
\r
369 m_pGetThemeMetric = (CXPTheme::PFNGETTHEMEMETRIC)GetProc("GetThemeMetric", (void*)GetThemeMetricFail);
\r
370 return (*m_pGetThemeMetric)(m_hTheme, hdc, iPartId, iStateId, iPropId, piVal);
\r
373 HRESULT CXPTheme::GetString(int iPartId, int iStateId, int iPropId, LPWSTR pszBuff, int cchMaxBuffChars)
\r
375 if(m_pGetThemeString == NULL)
\r
376 m_pGetThemeString = (CXPTheme::PFNGETTHEMESTRING)GetProc("GetThemeString", (void*)GetThemeStringFail);
\r
377 return (*m_pGetThemeString)(m_hTheme, iPartId, iStateId, iPropId, pszBuff, cchMaxBuffChars);
\r
380 HRESULT CXPTheme::GetBool(int iPartId, int iStateId, int iPropId, BOOL *pfVal)
\r
382 if(m_pGetThemeBool == NULL)
\r
383 m_pGetThemeBool = (CXPTheme::PFNGETTHEMEBOOL)GetProc("GetThemeBool", (void*)GetThemeBoolFail);
\r
384 return (*m_pGetThemeBool)(m_hTheme, iPartId, iStateId, iPropId, pfVal);
\r
387 HRESULT CXPTheme::GetInt(int iPartId, int iStateId, int iPropId, int *piVal)
\r
389 if(m_pGetThemeInt == NULL)
\r
390 m_pGetThemeInt = (CXPTheme::PFNGETTHEMEINT)GetProc("GetThemeInt", (void*)GetThemeIntFail);
\r
391 return (*m_pGetThemeInt)(m_hTheme, iPartId, iStateId, iPropId, piVal);
\r
394 HRESULT CXPTheme::GetEnumValue(int iPartId, int iStateId, int iPropId, int *piVal)
\r
396 if(m_pGetThemeEnumValue == NULL)
\r
397 m_pGetThemeEnumValue = (CXPTheme::PFNGETTHEMEENUMVALUE)GetProc("GetThemeEnumValue", (void*)GetThemeEnumValueFail);
\r
398 return (*m_pGetThemeEnumValue)(m_hTheme, iPartId, iStateId, iPropId, piVal);
\r
401 HRESULT CXPTheme::GetPosition(int iPartId, int iStateId, int iPropId, POINT *pPoint)
\r
403 if(m_pGetThemePosition == NULL)
\r
404 m_pGetThemePosition = (CXPTheme::PFNGETTHEMEPOSITION)GetProc("GetThemePosition", (void*)GetThemePositionFail);
\r
405 return (*m_pGetThemePosition)(m_hTheme, iPartId, iStateId, iPropId, pPoint);
\r
408 HRESULT CXPTheme::GetFont( HDC hdc, int iPartId,
\r
409 int iStateId, int iPropId, LOGFONT *pFont)
\r
411 if(m_pGetThemeFont == NULL)
\r
412 m_pGetThemeFont = (CXPTheme::PFNGETTHEMEFONT)GetProc("GetThemeFont", (void*)GetThemeFontFail);
\r
413 return (*m_pGetThemeFont)(m_hTheme, hdc, iPartId, iStateId, iPropId, pFont);
\r
416 HRESULT CXPTheme::GetRect(int iPartId, int iStateId, int iPropId, RECT *pRect)
\r
418 if(m_pGetThemeRect == NULL)
\r
419 m_pGetThemeRect = (CXPTheme::PFNGETTHEMERECT)GetProc("GetThemeRect", (void*)GetThemeRectFail);
\r
420 return (*m_pGetThemeRect)(m_hTheme, iPartId, iStateId, iPropId, pRect);
\r
423 HRESULT CXPTheme::GetMargins( HDC hdc, int iPartId,
\r
424 int iStateId, int iPropId, RECT *prc, MARGINS *pMargins)
\r
426 if(m_pGetThemeMargins == NULL)
\r
427 m_pGetThemeMargins = (CXPTheme::PFNGETTHEMEMARGINS)GetProc("GetThemeMargins", (void*)GetThemeMarginsFail);
\r
428 return (*m_pGetThemeMargins)(m_hTheme, hdc, iPartId, iStateId, iPropId, prc, pMargins);
\r
431 HRESULT CXPTheme::GetIntList(int iPartId, int iStateId, int iPropId, INTLIST *pIntList)
\r
433 if(m_pGetThemeIntList == NULL)
\r
434 m_pGetThemeIntList = (CXPTheme::PFNGETTHEMEINTLIST)GetProc("GetThemeIntList", (void*)GetThemeIntListFail);
\r
435 return (*m_pGetThemeIntList)(m_hTheme, iPartId, iStateId, iPropId, pIntList);
\r
438 HRESULT CXPTheme::GetPropertyOrigin(int iPartId, int iStateId, int iPropId, enum PROPERTYORIGIN *pOrigin)
\r
440 if(m_pGetThemePropertyOrigin == NULL)
\r
441 m_pGetThemePropertyOrigin = (CXPTheme::PFNGETTHEMEPROPERTYORIGIN)GetProc("GetThemePropertyOrigin", (void*)GetThemePropertyOriginFail);
\r
442 return (*m_pGetThemePropertyOrigin)(m_hTheme, iPartId, iStateId, iPropId, pOrigin);
\r
445 HRESULT CXPTheme::SetWindowTheme(HWND hwnd, LPCWSTR pszSubAppName,
\r
446 LPCWSTR pszSubIdList)
\r
448 if(m_pSetWindowTheme == NULL)
\r
449 m_pSetWindowTheme = (CXPTheme::PFNSETWINDOWTHEME)GetProc("SetWindowTheme", (void*)SetWindowThemeFail);
\r
450 return (*m_pSetWindowTheme)(hwnd, pszSubAppName, pszSubIdList);
\r
453 HRESULT CXPTheme::GetFilename(int iPartId,
\r
454 int iStateId, int iPropId, LPWSTR pszThemeFileName, int cchMaxBuffChars)
\r
456 if(m_pGetThemeFilename == NULL)
\r
457 m_pGetThemeFilename = (CXPTheme::PFNGETTHEMEFILENAME)GetProc("GetThemeFilename", (void*)GetThemeFilenameFail);
\r
458 return (*m_pGetThemeFilename)(m_hTheme, iPartId, iStateId, iPropId, pszThemeFileName, cchMaxBuffChars);
\r
461 COLORREF CXPTheme::GetSysColor(int iColorId)
\r
463 if(m_pGetThemeSysColor == NULL)
\r
464 m_pGetThemeSysColor = (CXPTheme::PFNGETTHEMESYSCOLOR)GetProc("GetThemeSysColor", (void*)GetThemeSysColorFail);
\r
465 return (*m_pGetThemeSysColor)(m_hTheme, iColorId);
\r
468 HBRUSH CXPTheme::GetSysColorBrush(int iColorId)
\r
470 if(m_pGetThemeSysColorBrush == NULL)
\r
471 m_pGetThemeSysColorBrush = (CXPTheme::PFNGETTHEMESYSCOLORBRUSH)GetProc("GetThemeSysColorBrush", (void*)GetThemeSysColorBrushFail);
\r
472 return (*m_pGetThemeSysColorBrush)(m_hTheme, iColorId);
\r
475 BOOL CXPTheme::GetSysBool(int iBoolId)
\r
477 if(m_pGetThemeSysBool == NULL)
\r
478 m_pGetThemeSysBool = (CXPTheme::PFNGETTHEMESYSBOOL)GetProc("GetThemeSysBool", (void*)GetThemeSysBoolFail);
\r
479 return (*m_pGetThemeSysBool)(m_hTheme, iBoolId);
\r
482 int CXPTheme::GetSysSize(int iSizeId)
\r
484 if(m_pGetThemeSysSize == NULL)
\r
485 m_pGetThemeSysSize = (CXPTheme::PFNGETTHEMESYSSIZE)GetProc("GetThemeSysSize", (void*)GetThemeSysSizeFail);
\r
486 return (*m_pGetThemeSysSize)(m_hTheme, iSizeId);
\r
489 HRESULT CXPTheme::GetSysFont(int iFontId, LOGFONT *plf)
\r
491 if(m_pGetThemeSysFont == NULL)
\r
492 m_pGetThemeSysFont = (CXPTheme::PFNGETTHEMESYSFONT)GetProc("GetThemeSysFont", (void*)GetThemeSysFontFail);
\r
493 return (*m_pGetThemeSysFont)(m_hTheme, iFontId, plf);
\r
496 HRESULT CXPTheme::GetSysString(int iStringId,
\r
497 LPWSTR pszStringBuff, int cchMaxStringChars)
\r
499 if(m_pGetThemeSysString == NULL)
\r
500 m_pGetThemeSysString = (CXPTheme::PFNGETTHEMESYSSTRING)GetProc("GetThemeSysString", (void*)GetThemeSysStringFail);
\r
501 return (*m_pGetThemeSysString)(m_hTheme, iStringId, pszStringBuff, cchMaxStringChars);
\r
504 HRESULT CXPTheme::GetSysInt(int iIntId, int *piValue)
\r
506 if(m_pGetThemeSysInt == NULL)
\r
507 m_pGetThemeSysInt = (CXPTheme::PFNGETTHEMESYSINT)GetProc("GetThemeSysInt", (void*)GetThemeSysIntFail);
\r
508 return (*m_pGetThemeSysInt)(m_hTheme, iIntId, piValue);
\r
511 BOOL CXPTheme::IsActive()
\r
513 if(m_pIsThemeActive == NULL)
\r
514 m_pIsThemeActive = (CXPTheme::PFNISTHEMEACTIVE)GetProc("IsThemeActive", (void*)IsThemeActiveFail);
\r
515 return (*m_pIsThemeActive)();
\r
518 BOOL CXPTheme::IsAppThemed()
\r
520 if(m_pIsAppThemed == NULL)
\r
521 m_pIsAppThemed = (CXPTheme::PFNISAPPTHEMED)GetProc("IsAppThemed", (void*)IsAppThemedFail);
\r
522 return (*m_pIsAppThemed)();
\r
525 HTHEME CXPTheme::GetWindowTheme(HWND hwnd)
\r
527 if(m_pGetWindowTheme == NULL)
\r
528 m_pGetWindowTheme = (CXPTheme::PFNGETWINDOWTHEME)GetProc("GetWindowTheme", (void*)GetWindowThemeFail);
\r
529 return (*m_pGetWindowTheme)(hwnd);
\r
532 HRESULT CXPTheme::EnableDialogTexture(HWND hwnd, DWORD dwFlags)
\r
534 if(m_pEnableThemeDialogTexture == NULL)
\r
535 m_pEnableThemeDialogTexture = (CXPTheme::PFNENABLETHEMEDIALOGTEXTURE)GetProc("EnableThemeDialogTexture", (void*)EnableThemeDialogTextureFail);
\r
536 return (*m_pEnableThemeDialogTexture)(hwnd, dwFlags);
\r
539 BOOL CXPTheme::IsDialogTextureEnabled(HWND hwnd)
\r
541 if(m_pIsThemeDialogTextureEnabled == NULL)
\r
542 m_pIsThemeDialogTextureEnabled = (CXPTheme::PFNISTHEMEDIALOGTEXTUREENABLED)GetProc("IsThemeDialogTextureEnabled", (void*)IsThemeDialogTextureEnabledFail);
\r
543 return (*m_pIsThemeDialogTextureEnabled)(hwnd);
\r
546 DWORD CXPTheme::GetAppProperties()
\r
548 if(m_pGetThemeAppProperties == NULL)
\r
549 m_pGetThemeAppProperties = (CXPTheme::PFNGETTHEMEAPPPROPERTIES)GetProc("GetThemeAppProperties", (void*)GetThemeAppPropertiesFail);
\r
550 return (*m_pGetThemeAppProperties)();
\r
553 void CXPTheme::SetAppProperties(DWORD dwFlags)
\r
555 if(m_pSetThemeAppProperties == NULL)
\r
556 m_pSetThemeAppProperties = (CXPTheme::PFNSETTHEMEAPPPROPERTIES)GetProc("SetThemeAppProperties", (void*)SetThemeAppPropertiesFail);
\r
557 (*m_pSetThemeAppProperties)(dwFlags);
\r
560 HRESULT CXPTheme::GetCurrentName(
\r
561 LPWSTR pszThemeFileName, int cchMaxNameChars,
\r
562 LPWSTR pszColorBuff, int cchMaxColorChars,
\r
563 LPWSTR pszSizeBuff, int cchMaxSizeChars)
\r
565 if(m_pGetCurrentThemeName == NULL)
\r
566 m_pGetCurrentThemeName = (CXPTheme::PFNGETCURRENTTHEMENAME)GetProc("GetCurrentThemeName", (void*)GetCurrentThemeNameFail);
\r
567 return (*m_pGetCurrentThemeName)(pszThemeFileName, cchMaxNameChars, pszColorBuff, cchMaxColorChars, pszSizeBuff, cchMaxSizeChars);
\r
570 HRESULT CXPTheme::GetDocumentationProperty(LPCWSTR pszThemeName,
\r
571 LPCWSTR pszPropertyName, LPWSTR pszValueBuff, int cchMaxValChars)
\r
573 if(m_pGetThemeDocumentationProperty == NULL)
\r
574 m_pGetThemeDocumentationProperty = (CXPTheme::PFNGETTHEMEDOCUMENTATIONPROPERTY)GetProc("GetThemeDocumentationProperty", (void*)GetThemeDocumentationPropertyFail);
\r
575 return (*m_pGetThemeDocumentationProperty)(pszThemeName, pszPropertyName, pszValueBuff, cchMaxValChars);
\r
579 HRESULT CXPTheme::DrawParentBackground(HWND hwnd, HDC hdc, RECT* prc)
\r
581 if(m_pDrawThemeParentBackground == NULL)
\r
582 m_pDrawThemeParentBackground = (CXPTheme::PFNDRAWTHEMEPARENTBACKGROUND)GetProc("DrawThemeParentBackground", (void*)DrawThemeParentBackgroundFail);
\r
583 return (*m_pDrawThemeParentBackground)(hwnd, hdc, prc);
\r
586 HRESULT CXPTheme::EnableTheming(BOOL fEnable)
\r
588 if(m_pEnableTheming == NULL)
\r
589 m_pEnableTheming = (CXPTheme::PFNENABLETHEMING)GetProc("EnableTheming", (void*)EnableThemingFail);
\r
590 return (*m_pEnableTheming)(fEnable);
\r