2 * wxuxthem.h : wxWindows support for Microsoft Windows XP Theme library
4 * Modified to work with almost all Win32 compilers
5 * Compiler must support Unicode, the __cdecl calling convention, and the
6 * __stdcall calling convention
10 #define _WX_UXTHEME_H_
13 #pragma interface "uxtheme.cpp"
16 // Use wxModule approach to initialization.
17 #define WXU_USE_WXMODULE 1
20 typedef struct _WXUOSVERSIONINFOEXW
{
21 WXDWORD dwOSVersionInfoSize
;
22 WXDWORD dwMajorVersion
;
23 WXDWORD dwMinorVersion
;
24 WXDWORD dwBuildNumber
;
26 wchar_t szCSDVersion
[ 128 ]; // Maintenance string for PSS usage
27 unsigned short wServicePackMajor
;
28 unsigned short wServicePackMinor
;
29 unsigned short wSuiteMask
;
30 unsigned char wProductType
;
31 unsigned char wReserved
;
32 } WXUOSVERSIONINFOEXW
, *PWXUOSVERSIONINFOEXW
, *LPWXUOSVERSIONINFOEXW
;
33 #define WXUOSVERSIONINFOEX WXUOSVERSIONINFOEXW
34 #define PWXUOSVERSIONINFOEX PWXUOSVERSIONINFOEXW
35 #define LPWXUOSVERSIONINFOEX LPWXUOSVERSIONINFOEXW
37 typedef struct _WXUOSVERSIONINFOEXA
{
38 WXDWORD dwOSVersionInfoSize
;
39 WXDWORD dwMajorVersion
;
40 WXDWORD dwMinorVersion
;
41 WXDWORD dwBuildNumber
;
43 char szCSDVersion
[128]; // Maintenance string for PSS usage
44 unsigned short wServicePackMajor
;
45 unsigned short wServicePackMinor
;
46 unsigned short wSuiteMask
;
47 unsigned char wProductType
;
48 unsigned char wReserved
;
49 } WXUOSVERSIONINFOEXA
, *PWXUOSVERSIONINFOEXA
, *LPWXUOSVERSIONINFOEXA
;
50 #define WXUOSVERSIONINFOEX WXUOSVERSIONINFOEXA
51 #define PWXUOSVERSIONINFOEX PWXUOSVERSIONINFOEXA
52 #define LPWXUOSVERSIONINFOEX LPWXUOSVERSIONINFOEXA
57 typedef struct tagWXURECT
65 typedef void* WXHTHEME
;
66 typedef long WXUHRESULT
;
67 typedef WXHTHEME (__stdcall
*PFNWXUOPENTHEMEDATA
)(WXHWND
, const wchar_t *) ;
68 typedef WXUHRESULT (__stdcall
*PFNWXUCLOSETHEMEDATA
)(WXHTHEME
) ;
69 typedef WXUHRESULT (__stdcall
*PFNWXUDRAWTHEMEBACKGROUND
)(WXHTHEME
, WXHDC
,
70 int, int, const WXURECT
*, const WXURECT
*) ;
71 #define WXU_DTT_GRAYED 0x1
72 typedef WXUHRESULT (__stdcall
*PFNWXUDRAWTHEMETEXT
)(WXHTHEME
, WXHDC
, int,
73 int, const wchar_t *, int, DWORD
,
74 DWORD
, const WXURECT
*) ;
75 typedef WXUHRESULT (__stdcall
*PFNWXUGETTHEMEBACKGROUNDCONTENTRECT
)(WXHTHEME
, WXHDC
,
76 int, int, const WXURECT
*, WXURECT
*) ;
77 typedef WXUHRESULT (__stdcall
*PFNWXUGETTHEMEBACKGROUNDEXTENT
)(WXHTHEME
, WXHDC
, int, int,
78 const WXURECT
*, WXURECT
*) ;
82 WXU_TS_MIN
, // minimum size
83 WXU_TS_TRUE
, // size without stretching
84 WXU_TS_DRAW
// size that theme mgr will use to draw part
87 typedef struct tagWXUSIZE
93 typedef struct tagWXUTEXTMETRIC
98 long tmInternalLeading
;
99 long tmExternalLeading
;
104 long tmDigitizedAspectX
;
105 long tmDigitizedAspectY
;
108 wchar_t tmDefaultChar
;
110 unsigned char tmItalic
;
111 unsigned char tmUnderlined
;
112 unsigned char tmStruckOut
;
113 unsigned char tmPitchAndFamily
;
114 unsigned char tmCharSet
;
117 typedef WXUHRESULT (__stdcall
*PFNWXUGETTHEMEPARTSIZE
)(WXHTHEME
, WXHDC
, int, int, const WXURECT
*,
118 enum WXUTHEMESIZE
, WXUSIZE
*) ;
119 typedef WXUHRESULT (__stdcall
*PFNWXUGETTHEMETEXTEXTENT
)(WXHTHEME
, WXHDC
, int, int, const wchar_t *,
120 int, WXDWORD
, const WXURECT
*, WXURECT
*) ;
121 typedef WXUHRESULT (__stdcall
*PFNWXUGETTHEMETEXTMETRICS
)(WXHTHEME
, WXHDC
,
122 int, int, WXUTEXTMETRIC
*);
123 typedef WXUHRESULT (__stdcall
*PFNWXUGETTHEMEBACKGROUNDREGION
)(WXHTHEME
, WXHDC
,
124 int, int, const WXURECT
*, WXHRGN
*) ;
126 #define WXU_HTTB_BACKGROUNDSEG 0x0000
127 #define WXU_HTTB_FIXEDBORDER 0x0002
128 #define WXU_HTTB_CAPTION 0x0004
129 #define WXU_HTTB_RESIZINGBORDER_LEFT 0x0010
130 #define WXU_HTTB_RESIZINGBORDER_TOP 0x0020
131 #define WXU_HTTB_RESIZINGBORDER_RIGHT 0x0040
132 #define WXU_HTTB_RESIZINGBORDER_BOTTOM 0x0080
133 #define WXU_HTTB_RESIZINGBORDER 0x00F0
134 #define WXU_HTTB_SIZINGTEMPLATE 0x0100
135 #define WXU_HTTB_SYSTEMSIZINGMARGINS 0x0200
137 typedef struct tagWXUPOINT
143 typedef WXUHRESULT (__stdcall
*PFNWXUHITTESTTHEMEBACKGROUND
)(WXHTHEME
, WXHDC
, int,
144 int, WXDWORD
, const WXURECT
*, WXHRGN
,
145 WXUPOINT
, unsigned short *) ;
146 typedef WXUHRESULT (__stdcall
*PFNWXUDRAWTHEMEEDGE
)(WXHTHEME
, WXHDC
, int, int,
147 const WXURECT
*, unsigned int, unsigned int, WXURECT
*);
148 typedef WXUHRESULT (__stdcall
*PFNWXUDRAWTHEMEICON
)(WXHTHEME
, WXHDC
, int, int,
149 const WXURECT
*, WXHIMAGELIST
, int) ;
150 typedef WXUBOOL (__stdcall
*PFNWXUISTHEMEPARTDEFINED
)(WXHTHEME
, int, int) ;
151 typedef WXUBOOL (__stdcall
*PFNWXUISTHEMEBACKGROUNDPARTIALLYTRANSPARENT
)(WXHTHEME
, int, int) ;
152 typedef WXUHRESULT (__stdcall
*PFNWXUGETTHEMECOLOR
)(WXHTHEME
, int, int, int, WXCOLORREF
*) ;
153 typedef WXUHRESULT (__stdcall
*PFNWXUGETTHEMEMETRIC
)(WXHTHEME
, WXHDC
, int,
155 typedef WXUHRESULT (__stdcall
*PFNWXUGETTHEMESTRING
)(WXHTHEME
, int,
156 int, int, wchar_t *, int) ;
157 typedef WXUHRESULT (__stdcall
*PFNWXUGETTHEMEBOOL
)(WXHTHEME
, int, int, int, WXUBOOL
*) ;
158 typedef WXUHRESULT (__stdcall
*PFNWXUGETTHEMEINT
)(WXHTHEME
, int, int, int, int *) ;
159 typedef WXUHRESULT (__stdcall
*PFNWXUGETTHEMEENUMVALUE
)(WXHTHEME
, int, int, int, int *) ;
160 typedef WXUHRESULT (__stdcall
*PFNWXUGETTHEMEPOSITION
)(WXHTHEME
, int, int, int, WXUPOINT
*) ;
161 typedef struct tagWXULOGFONT
168 unsigned char lfItalic
;
169 unsigned char lfUnderline
;
170 unsigned char lfStrikeOut
;
171 unsigned char lfCharSet
;
172 unsigned char lfOutPrecision
;
173 unsigned char lfClipPrecision
;
174 unsigned char lfQuality
;
175 unsigned char lfPitchAndFamily
;
176 wchar_t lfFaceName
[32];
178 typedef WXUHRESULT (__stdcall
*PFNWXUGETTHEMEFONT
)(WXHTHEME
, WXHDC
, int, int, int, WXULOGFONT
*) ;
179 typedef WXUHRESULT (__stdcall
*PFNWXUGETTHEMERECT
)(WXHTHEME
, int, int, int, WXURECT
*) ;
180 typedef struct _WXUMARGINS
182 int cxLeftWidth
; // width of left border that retains its size
183 int cxRightWidth
; // width of right border that retains its size
184 int cyTopHeight
; // height of top border that retains its size
185 int cyBottomHeight
; // height of bottom border that retains its size
186 } WXUMARGINS
, *PWXUMARGINS
;
187 typedef WXUHRESULT (__stdcall
*PFNWXUGETTHEMEMARGINS
)(WXHTHEME
, WXHDC
, int,
188 int, int, WXURECT
*, WXUMARGINS
*) ;
190 #define WXU_MAX_INTLIST_COUNT 10
191 typedef struct _WXUINTLIST
193 int iValueCount
; // number of values in iValues
194 int iValues
[WXU_MAX_INTLIST_COUNT
];
195 } WXUINTLIST
, *PWXUINTLIST
;
196 typedef WXUHRESULT (__stdcall
*PFNWXUGETTHEMEINTLIST
)(WXHTHEME
, int,
197 int, int, WXUINTLIST
*) ;
199 enum WXUPROPERTYORIGIN
201 WXU_PO_STATE
, // property was found in the state section
202 WXU_PO_PART
, // property was found in the part section
203 WXU_PO_CLASS
, // property was found in the class section
204 WXU_PO_GLOBAL
, // property was found in [globals] section
205 WXU_PO_NOTFOUND
// property was not found
208 typedef WXUHRESULT (__stdcall
*PFNWXUGETTHEMEPROPERTYORIGIN
)(WXHTHEME
, int,
209 int, int, enum WXUPROPERTYORIGIN
*) ;
210 typedef WXUHRESULT (__stdcall
*PFNWXUSETWINDOWTHEME
)(WXHWND
, const wchar_t*, const wchar_t *) ;
211 typedef WXUHRESULT (__stdcall
*PFNWXUGETTHEMEFILENAME
)(WXHTHEME
, int, int, int, wchar_t *, int) ;
212 typedef WXCOLORREF (__stdcall
*PFNWXUGETTHEMESYSCOLOR
)(WXHTHEME
, int) ;
213 typedef WXHBRUSH (__stdcall
*PFNWXUGETTHEMESYSCOLORBRUSH
)(WXHTHEME
, int) ;
214 typedef WXUBOOL (__stdcall
*PFNWXUGETTHEMESYSBOOL
)(WXHTHEME
, int) ;
215 typedef int (__stdcall
*PFNWXUGETTHEMESYSSIZE
)(WXHTHEME
, int) ;
216 typedef WXUHRESULT (__stdcall
*PFNWXUGETTHEMESYSFONT
)(WXHTHEME
, int, WXULOGFONT
*) ;
217 typedef WXUHRESULT (__stdcall
*PFNWXUGETTHEMESYSSTRING
)(WXHTHEME
, int, wchar_t *, int) ;
218 typedef WXUHRESULT (__stdcall
*PFNWXUGETTHEMESYSINT
)(WXHTHEME
, int, int *) ;
219 typedef WXUBOOL (__stdcall
*PFNWXUISTHEMEACTIVE
)() ;
220 typedef WXUBOOL (__stdcall
*PFNWXUISAPPTHEMED
)() ;
221 typedef WXHTHEME (__stdcall
*PFNWXUGETWINDOWTHEME
)(WXHWND
) ;
223 #define WXU_ETDT_DISABLE 0x00000001
224 #define WXU_ETDT_ENABLE 0x00000002
225 #define WXU_ETDT_USETABTEXTURE 0x00000004
226 #define WXU_ETDT_ENABLETAB 0x00000006
228 typedef WXUHRESULT (__stdcall
*PFNWXUENABLETHEMEDIALOGTEXTURE
)(WXHWND
, WXDWORD
) ;
229 typedef WXUBOOL (__stdcall
*PFNWXUISTHEMEDIALOGTEXTUREENABLED
)(WXHWND
) ;
231 #define WXU_STAP_ALLOW_NONCLIENT 1
232 #define WXU_STAP_ALLOW_CONTROLS 2
233 #define WXU_STAP_ALLOW_WEBCONTENT 4
235 typedef WXDWORD (__stdcall
*PFNWXUGETTHEMEAPPPROPERTIES
)() ;
236 typedef void (__stdcall
*PFNWXUSETTHEMEAPPPROPERTIES
)(WXDWORD
) ;
237 typedef WXUHRESULT (__stdcall
*PFNWXUGETCURRENTTHEMENAME
)(wchar_t *, int,
238 wchar_t *, int, wchar_t *, int) ;
240 #define WXU_SZ_THDOCPROP_DISPLAYNAME L"DisplayName"
241 #define WXU_SZ_THDOCPROP_CANONICALNAME L"ThemeName"
242 #define WXU_SZ_THDOCPROP_TOOLTIP L"ToolTip"
243 #define WXU_SZ_THDOCPROP_AUTHOR L"author"
245 typedef WXUHRESULT (__stdcall
*PFNWXUGETTHEMEDOCUMENTATIONPROPERTY
)(const wchar_t *,
246 const wchar_t *, wchar_t *, int) ;
247 typedef WXUHRESULT (__stdcall
*PFNWXUDRAWTHEMEPARENTBACKGROUND
)(WXHWND
, WXHDC
, WXURECT
*) ;
248 typedef WXUHRESULT (__stdcall
*PFNWXUENABLETHEMING
)(WXUBOOL
) ;
250 class WXDLLEXPORT wxUxThemeEngine
257 bool IsInitialized() const { return m_bIsInitialized
; }
260 bool m_bIsInitialized
;
261 HINSTANCE m_hInstUXThemeDLL
;
264 static wxUxThemeEngine
* wxInitUxThemeEngine() ;
265 static wxUxThemeEngine
* Get() ;
267 void ResetFunctionPointers() ;
269 PFNWXUOPENTHEMEDATA m_pfnOpenThemeData
;
270 PFNWXUCLOSETHEMEDATA m_pfnCloseThemeData
;
271 PFNWXUDRAWTHEMEBACKGROUND m_pfnDrawThemeBackground
;
272 PFNWXUDRAWTHEMETEXT m_pfnDrawThemeText
;
273 PFNWXUGETTHEMEBACKGROUNDCONTENTRECT m_pfnGetThemeBackgroundContentRect
;
274 PFNWXUGETTHEMEBACKGROUNDEXTENT m_pfnGetThemeBackgroundExtent
;
275 PFNWXUGETTHEMEPARTSIZE m_pfnGetThemePartSize
;
276 PFNWXUGETTHEMETEXTEXTENT m_pfnGetThemeTextExtent
;
277 PFNWXUGETTHEMETEXTMETRICS m_pfnGetThemeTextMetrics
;
278 PFNWXUGETTHEMEBACKGROUNDREGION m_pfnGetThemeBackgroundRegion
;
279 PFNWXUHITTESTTHEMEBACKGROUND m_pfnHitTestThemeBackground
;
280 PFNWXUDRAWTHEMEEDGE m_pfnDrawThemeEdge
;
281 PFNWXUDRAWTHEMEICON m_pfnDrawThemeIcon
;
282 PFNWXUISTHEMEPARTDEFINED m_pfnIsThemePartDefined
;
283 PFNWXUISTHEMEBACKGROUNDPARTIALLYTRANSPARENT m_pfnIsThemeBackgroundPartiallyTransparent
;
284 PFNWXUGETTHEMECOLOR m_pfnGetThemeColor
;
285 PFNWXUGETTHEMEMETRIC m_pfnGetThemeMetric
;
286 PFNWXUGETTHEMESTRING m_pfnGetThemeString
;
287 PFNWXUGETTHEMEBOOL m_pfnGetThemeBool
;
288 PFNWXUGETTHEMEINT m_pfnGetThemeInt
;
289 PFNWXUGETTHEMEENUMVALUE m_pfnGetThemeEnumValue
;
290 PFNWXUGETTHEMEPOSITION m_pfnGetThemePosition
;
291 PFNWXUGETTHEMEFONT m_pfnGetThemeFont
;
292 PFNWXUGETTHEMERECT m_pfnGetThemeRect
;
293 PFNWXUGETTHEMEMARGINS m_pfnGetThemeMargins
;
294 PFNWXUGETTHEMEINTLIST m_pfnGetThemeIntList
;
295 PFNWXUGETTHEMEPROPERTYORIGIN m_pfnGetThemePropertyOrigin
;
296 PFNWXUSETWINDOWTHEME m_pfnSetWindowTheme
;
297 PFNWXUGETTHEMEFILENAME m_pfnGetThemeFilename
;
298 PFNWXUGETTHEMESYSCOLOR m_pfnGetThemeSysColor
;
299 PFNWXUGETTHEMESYSCOLORBRUSH m_pfnGetThemeSysColorBrush
;
300 PFNWXUGETTHEMESYSBOOL m_pfnGetThemeSysBool
;
301 PFNWXUGETTHEMESYSSIZE m_pfnGetThemeSysSize
;
302 PFNWXUGETTHEMESYSFONT m_pfnGetThemeSysFont
;
303 PFNWXUGETTHEMESYSSTRING m_pfnGetThemeSysString
;
304 PFNWXUGETTHEMESYSINT m_pfnGetThemeSysInt
;
305 PFNWXUISTHEMEACTIVE m_pfnIsThemeActive
;
306 PFNWXUISAPPTHEMED m_pfnIsAppThemed
;
307 PFNWXUGETWINDOWTHEME m_pfnGetWindowTheme
;
308 PFNWXUENABLETHEMEDIALOGTEXTURE m_pfnEnableThemeDialogTexture
;
309 PFNWXUISTHEMEDIALOGTEXTUREENABLED m_pfnIsThemeDialogTextureEnabled
;
310 PFNWXUGETTHEMEAPPPROPERTIES m_pfnGetThemeAppProperties
;
311 PFNWXUSETTHEMEAPPPROPERTIES m_pfnSetThemeAppProperties
;
312 PFNWXUGETCURRENTTHEMENAME m_pfnGetCurrentThemeName
;
313 PFNWXUGETTHEMEDOCUMENTATIONPROPERTY m_pfnGetThemeDocumentationProperty
;
314 PFNWXUDRAWTHEMEPARENTBACKGROUND m_pfnDrawThemeParentBackground
;
315 PFNWXUENABLETHEMING m_pfnEnableTheming
;
318 WXDLLEXPORT_DATA(extern wxUxThemeEngine
*) g_pThemeEngine
;
320 WXDLLEXPORT BOOL
wxCanUseInitThemeEngine() ;
322 #if !defined(WXU_USE_WXMODULE)
323 WXDLLEXPORT BOOL
wxUxInitThemeEngine() ;