]>
Commit | Line | Data |
---|---|---|
0d1cb8cb JS |
1 | /* |
2 | * wxuxthem.h : wxWindows support for Microsoft Windows XP Theme library | |
3 | * (uxtheme.dll) | |
4 | * Modified to work with almost all Win32 compilers | |
5 | * Compiler must support Unicode, the __cdecl calling convention, and the | |
6 | * __stdcall calling convention | |
7 | */ | |
8 | ||
9 | #ifndef _WX_UXTHEME_H_ | |
10 | #define _WX_UXTHEME_H_ | |
11 | ||
12 | // Use wxModule approach to initialization. | |
13 | #define WXU_USE_WXMODULE 1 | |
14 | ||
15 | #if wxUSE_UNICODE | |
16 | typedef struct _WXUOSVERSIONINFOEXW { | |
17 | WXDWORD dwOSVersionInfoSize; | |
18 | WXDWORD dwMajorVersion; | |
19 | WXDWORD dwMinorVersion; | |
20 | WXDWORD dwBuildNumber; | |
21 | WXDWORD dwPlatformId; | |
22 | wchar_t szCSDVersion[ 128 ]; // Maintenance string for PSS usage | |
23 | unsigned short wServicePackMajor; | |
24 | unsigned short wServicePackMinor; | |
25 | unsigned short wSuiteMask; | |
26 | unsigned char wProductType; | |
27 | unsigned char wReserved; | |
28 | } WXUOSVERSIONINFOEXW, *PWXUOSVERSIONINFOEXW, *LPWXUOSVERSIONINFOEXW; | |
29 | #define WXUOSVERSIONINFOEX WXUOSVERSIONINFOEXW | |
30 | #define PWXUOSVERSIONINFOEX PWXUOSVERSIONINFOEXW | |
31 | #define LPWXUOSVERSIONINFOEX LPWXUOSVERSIONINFOEXW | |
32 | #else | |
33 | typedef struct _WXUOSVERSIONINFOEXA { | |
34 | WXDWORD dwOSVersionInfoSize; | |
35 | WXDWORD dwMajorVersion; | |
36 | WXDWORD dwMinorVersion; | |
37 | WXDWORD dwBuildNumber; | |
38 | WXDWORD dwPlatformId; | |
39 | char szCSDVersion [128]; // Maintenance string for PSS usage | |
40 | unsigned short wServicePackMajor; | |
41 | unsigned short wServicePackMinor; | |
42 | unsigned short wSuiteMask; | |
43 | unsigned char wProductType; | |
44 | unsigned char wReserved; | |
45 | } WXUOSVERSIONINFOEXA, *PWXUOSVERSIONINFOEXA, *LPWXUOSVERSIONINFOEXA; | |
46 | #define WXUOSVERSIONINFOEX WXUOSVERSIONINFOEXA | |
47 | #define PWXUOSVERSIONINFOEX PWXUOSVERSIONINFOEXA | |
48 | #define LPWXUOSVERSIONINFOEX LPWXUOSVERSIONINFOEXA | |
49 | #endif | |
50 | ||
51 | typedef int WXUBOOL ; | |
52 | ||
53 | typedef struct tagWXURECT | |
54 | { | |
55 | long left; | |
56 | long top; | |
57 | long right; | |
58 | long bottom; | |
59 | } WXURECT ; | |
60 | ||
61 | typedef void* WXHTHEME; | |
62 | typedef long WXUHRESULT; | |
63 | typedef WXHTHEME (__stdcall *PFNWXUOPENTHEMEDATA)(WXHWND, const wchar_t *) ; | |
64 | typedef WXUHRESULT (__stdcall *PFNWXUCLOSETHEMEDATA)(WXHTHEME) ; | |
65 | typedef WXUHRESULT (__stdcall *PFNWXUDRAWTHEMEBACKGROUND)(WXHTHEME, WXHDC, | |
66 | int, int, const WXURECT *, const WXURECT *) ; | |
67 | #define WXU_DTT_GRAYED 0x1 | |
68 | typedef WXUHRESULT (__stdcall *PFNWXUDRAWTHEMETEXT)(WXHTHEME, WXHDC, int, | |
69 | int, const wchar_t *, int, DWORD, | |
70 | DWORD, const WXURECT *) ; | |
71 | typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEBACKGROUNDCONTENTRECT)(WXHTHEME, WXHDC, | |
72 | int, int, const WXURECT *, WXURECT *) ; | |
73 | typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEBACKGROUNDEXTENT)(WXHTHEME, WXHDC, int, int, | |
74 | const WXURECT *, WXURECT *) ; | |
75 | ||
76 | typedef enum WXUTHEMESIZE | |
77 | { | |
78 | WXU_TS_MIN, // minimum size | |
79 | WXU_TS_TRUE, // size without stretching | |
80 | WXU_TS_DRAW, // size that theme mgr will use to draw part | |
81 | }; | |
82 | ||
83 | typedef struct tagWXUSIZE | |
84 | { | |
85 | long cx; | |
86 | long cy; | |
87 | } WXUSIZE ; | |
88 | ||
89 | typedef struct tagWXUTEXTMETRIC | |
90 | { | |
91 | long tmHeight; | |
92 | long tmAscent; | |
93 | long tmDescent; | |
94 | long tmInternalLeading; | |
95 | long tmExternalLeading; | |
96 | long tmAveCharWidth; | |
97 | long tmMaxCharWidth; | |
98 | long tmWeight; | |
99 | long tmOverhang; | |
100 | long tmDigitizedAspectX; | |
101 | long tmDigitizedAspectY; | |
102 | wchar_t tmFirstChar; | |
103 | wchar_t tmLastChar; | |
104 | wchar_t tmDefaultChar; | |
105 | wchar_t tmBreakChar; | |
106 | unsigned char tmItalic; | |
107 | unsigned char tmUnderlined; | |
108 | unsigned char tmStruckOut; | |
109 | unsigned char tmPitchAndFamily; | |
110 | unsigned char tmCharSet; | |
111 | } WXUTEXTMETRIC; | |
112 | ||
113 | typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEPARTSIZE)(WXHTHEME, WXHDC, int, int, const WXURECT *, | |
114 | enum WXUTHEMESIZE, WXUSIZE *) ; | |
115 | typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMETEXTEXTENT)(WXHTHEME, WXHDC, int, int, const wchar_t *, | |
116 | int, WXDWORD, const WXURECT *, WXURECT *) ; | |
117 | typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMETEXTMETRICS)(WXHTHEME, WXHDC, | |
118 | int, int, WXUTEXTMETRIC*); | |
119 | typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEBACKGROUNDREGION)(WXHTHEME, WXHDC, | |
120 | int, int, const WXURECT *, WXHRGN *) ; | |
121 | ||
122 | #define WXU_HTTB_BACKGROUNDSEG 0x0000 | |
123 | #define WXU_HTTB_FIXEDBORDER 0x0002 | |
124 | #define WXU_HTTB_CAPTION 0x0004 | |
125 | #define WXU_HTTB_RESIZINGBORDER_LEFT 0x0010 | |
126 | #define WXU_HTTB_RESIZINGBORDER_TOP 0x0020 | |
127 | #define WXU_HTTB_RESIZINGBORDER_RIGHT 0x0040 | |
128 | #define WXU_HTTB_RESIZINGBORDER_BOTTOM 0x0080 | |
129 | #define WXU_HTTB_RESIZINGBORDER 0x00F0 | |
130 | #define WXU_HTTB_SIZINGTEMPLATE 0x0100 | |
131 | #define WXU_HTTB_SYSTEMSIZINGMARGINS 0x0200 | |
132 | ||
133 | typedef struct tagWXUPOINT | |
134 | { | |
135 | long x; | |
136 | long y; | |
137 | } WXUPOINT ; | |
138 | ||
139 | typedef WXUHRESULT (__stdcall *PFNWXUHITTESTTHEMEBACKGROUND)(WXHTHEME, WXHDC, int, | |
140 | int, WXDWORD, const WXURECT *, WXHRGN, | |
141 | WXUPOINT, unsigned short *) ; | |
142 | typedef WXUHRESULT (__stdcall *PFNWXUDRAWTHEMEEDGE)(WXHTHEME, WXHDC, int, int, | |
143 | const WXURECT *, unsigned int, unsigned int, WXURECT *); | |
144 | typedef WXUHRESULT (__stdcall *PFNWXUDRAWTHEMEICON)(WXHTHEME, WXHDC, int, int, | |
145 | const WXURECT *, WXHIMAGELIST, int) ; | |
146 | typedef WXUBOOL (__stdcall *PFNWXUISTHEMEPARTDEFINED)(WXHTHEME, int, int) ; | |
147 | typedef WXUBOOL (__stdcall *PFNWXUISTHEMEBACKGROUNDPARTIALLYTRANSPARENT)(WXHTHEME, int, int) ; | |
148 | typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMECOLOR)(WXHTHEME, int, int, int, WXCOLORREF) ; | |
149 | typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEMETRIC)(WXHTHEME, WXHDC, int, | |
150 | int, int, int *) ; | |
151 | typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMESTRING)(WXHTHEME, int, | |
152 | int, int, wchar_t *, int) ; | |
153 | typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEBOOL)(WXHTHEME, int, int, int, WXUBOOL *) ; | |
154 | typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEINT)(WXHTHEME, int, int, int, int *) ; | |
155 | typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEENUMVALUE)(WXHTHEME, int, int, int, int *) ; | |
156 | typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEPOSITION)(WXHTHEME, int, int, int, WXUPOINT *) ; | |
157 | typedef struct tagWXULOGFONT | |
158 | { | |
159 | long lfHeight; | |
160 | long lfWidth; | |
161 | long lfEscapement; | |
162 | long lfOrientation; | |
163 | long lfWeight; | |
164 | unsigned char lfItalic; | |
165 | unsigned char lfUnderline; | |
166 | unsigned char lfStrikeOut; | |
167 | unsigned char lfCharSet; | |
168 | unsigned char lfOutPrecision; | |
169 | unsigned char lfClipPrecision; | |
170 | unsigned char lfQuality; | |
171 | unsigned char lfPitchAndFamily; | |
172 | wchar_t lfFaceName[32]; | |
173 | } WXULOGFONT ; | |
174 | typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEFONT)(WXHTHEME, WXHDC, int, int, int, WXULOGFONT *) ; | |
175 | typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMERECT)(WXHTHEME, int, int, int, WXURECT *) ; | |
176 | typedef struct _WXUMARGINS | |
177 | { | |
178 | int cxLeftWidth; // width of left border that retains its size | |
179 | int cxRightWidth; // width of right border that retains its size | |
180 | int cyTopHeight; // height of top border that retains its size | |
181 | int cyBottomHeight; // height of bottom border that retains its size | |
182 | } WXUMARGINS, *PWXUMARGINS; | |
183 | typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEMARGINS)(WXHTHEME, WXHDC, int, | |
184 | int, int, WXURECT *, WXUMARGINS *) ; | |
185 | ||
186 | #define WXU_MAX_INTLIST_COUNT 10 | |
187 | typedef struct _WXUINTLIST | |
188 | { | |
189 | int iValueCount; // number of values in iValues | |
190 | int iValues[WXU_MAX_INTLIST_COUNT]; | |
191 | } WXUINTLIST, *PWXUINTLIST; | |
192 | typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEINTLIST)(WXHTHEME, int, | |
193 | int, int, WXUINTLIST*) ; | |
194 | typedef enum WXUPROPERTYORIGIN | |
195 | { | |
196 | WXU_PO_STATE, // property was found in the state section | |
197 | WXU_PO_PART, // property was found in the part section | |
198 | WXU_PO_CLASS, // property was found in the class section | |
199 | WXU_PO_GLOBAL, // property was found in [globals] section | |
200 | WXU_PO_NOTFOUND // property was not found | |
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 WXUBOOL (__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 WXUBOOL (__stdcall *PFNWXUISTHEMEACTIVE)() ; | |
214 | typedef WXUBOOL (__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 WXUBOOL (__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, WXURECT *) ; | |
242 | typedef WXUHRESULT (__stdcall *PFNWXUENABLETHEMING)(WXUBOOL) ; | |
243 | ||
244 | class wxUxThemeEngine | |
245 | { | |
246 | private: | |
247 | wxUxThemeEngine() ; | |
248 | ||
249 | public: | |
250 | ~wxUxThemeEngine() ; | |
251 | bool IsInitialized() const { return m_bIsInitialized ; } | |
252 | ||
253 | private: | |
254 | bool m_bIsInitialized ; | |
255 | HINSTANCE m_hInstUXThemeDLL ; | |
256 | ||
257 | public: | |
258 | static wxUxThemeEngine* wxInitUxThemeEngine() ; | |
259 | protected: | |
260 | void ResetFunctionPointers() ; | |
261 | public: | |
262 | PFNWXUOPENTHEMEDATA m_pfnOpenThemeData ; | |
263 | PFNWXUCLOSETHEMEDATA m_pfnCloseThemeData ; | |
264 | PFNWXUDRAWTHEMEBACKGROUND m_pfnDrawThemeBackground ; | |
265 | PFNWXUDRAWTHEMETEXT m_pfnDrawThemeText ; | |
266 | PFNWXUGETTHEMEBACKGROUNDCONTENTRECT m_pfnGetThemeBackgroundContentRect ; | |
267 | PFNWXUGETTHEMEBACKGROUNDEXTENT m_pfnGetThemeBackgroundExtent ; | |
268 | PFNWXUGETTHEMEPARTSIZE m_pfnGetThemePartSize ; | |
269 | PFNWXUGETTHEMETEXTEXTENT m_pfnGetThemeTextExtent ; | |
270 | PFNWXUGETTHEMETEXTMETRICS m_pfnGetThemeTextMetrics ; | |
271 | PFNWXUGETTHEMEBACKGROUNDREGION m_pfnGetThemeBackgroundRegion ; | |
272 | PFNWXUHITTESTTHEMEBACKGROUND m_pfnHitTestThemeBackground ; | |
273 | PFNWXUDRAWTHEMEEDGE m_pfnDrawThemeEdge ; | |
274 | PFNWXUDRAWTHEMEICON m_pfnDrawThemeIcon ; | |
275 | PFNWXUISTHEMEPARTDEFINED m_pfnIsThemePartDefined ; | |
276 | PFNWXUISTHEMEBACKGROUNDPARTIALLYTRANSPARENT m_pfnIsThemeBackgroundPartiallyTransparent ; | |
277 | PFNWXUGETTHEMECOLOR m_pfnGetThemeColor ; | |
278 | PFNWXUGETTHEMEMETRIC m_pfnGetThemeMetric ; | |
279 | PFNWXUGETTHEMESTRING m_pfnGetThemeString ; | |
280 | PFNWXUGETTHEMEBOOL m_pfnGetThemeBool ; | |
281 | PFNWXUGETTHEMEINT m_pfnGetThemeInt ; | |
282 | PFNWXUGETTHEMEENUMVALUE m_pfnGetThemeEnumValue ; | |
283 | PFNWXUGETTHEMEPOSITION m_pfnGetThemePosition ; | |
284 | PFNWXUGETTHEMEFONT m_pfnGetThemeFont ; | |
285 | PFNWXUGETTHEMERECT m_pfnGetThemeRect ; | |
286 | PFNWXUGETTHEMEMARGINS m_pfnGetThemeMargins ; | |
287 | PFNWXUGETTHEMEINTLIST m_pfnGetThemeIntList ; | |
288 | PFNWXUGETTHEMEPROPERTYORIGIN m_pfnGetThemePropertyOrigin ; | |
289 | PFNWXUSETWINDOWTHEME m_pfnSetWindowTheme ; | |
290 | PFNWXUGETTHEMEFILENAME m_pfnGetThemeFilename ; | |
291 | PFNWXUGETTHEMESYSCOLOR m_pfnGetThemeSysColor ; | |
292 | PFNWXUGETTHEMESYSCOLORBRUSH m_pfnGetThemeSysColorBrush ; | |
293 | PFNWXUGETTHEMESYSBOOL m_pfnGetThemeSysBool ; | |
294 | PFNWXUGETTHEMESYSSIZE m_pfnGetThemeSysSize ; | |
295 | PFNWXUGETTHEMESYSFONT m_pfnGetThemeSysFont ; | |
296 | PFNWXUGETTHEMESYSSTRING m_pfnGetThemeSysString ; | |
297 | PFNWXUGETTHEMESYSINT m_pfnGetThemeSysInt ; | |
298 | PFNWXUISTHEMEACTIVE m_pfnIsThemeActive ; | |
299 | PFNWXUISAPPTHEMED m_pfnIsAppThemed ; | |
300 | PFNWXUGETWINDOWTHEME m_pfnGetWindowTheme ; | |
301 | PFNWXUENABLETHEMEDIALOGTEXTURE m_pfnEnableThemeDialogTexture ; | |
302 | PFNWXUISTHEMEDIALOGTEXTUREENABLED m_pfnIsThemeDialogTextureEnabled ; | |
303 | PFNWXUGETTHEMEAPPPROPERTIES m_pfnGetThemeAppProperties ; | |
304 | PFNWXUSETTHEMEAPPPROPERTIES m_pfnSetThemeAppProperties ; | |
305 | PFNWXUGETCURRENTTHEMENAME m_pfnGetCurrentThemeName ; | |
306 | PFNWXUGETTHEMEDOCUMENTATIONPROPERTY m_pfnGetThemeDocumentationProperty ; | |
307 | PFNWXUDRAWTHEMEPARENTBACKGROUND m_pfnDrawThemeParentBackground ; | |
308 | PFNWXUENABLETHEMING m_pfnEnableTheming ; | |
309 | }; | |
310 | ||
311 | extern wxUxThemeEngine* g_pThemeEngine ; | |
312 | ||
313 | BOOL wxCanUseInitThemeEngine() ; | |
314 | ||
315 | #if !defined(WXU_USE_WXMODULE) | |
316 | BOOL wxUxInitThemeEngine() ; | |
317 | #endif | |
318 | ||
319 | #endif | |
320 |