]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/uxtheme.h
MinGW compilation fixes.
[wxWidgets.git] / include / wx / msw / uxtheme.h
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 #ifdef __GNUG__
13 #pragma interface "uxtheme.cpp"
14 #endif
15
16 // Use wxModule approach to initialization.
17 #define WXU_USE_WXMODULE 1
18
19 #if wxUSE_UNICODE
20 typedef struct _WXUOSVERSIONINFOEXW {
21 WXDWORD dwOSVersionInfoSize;
22 WXDWORD dwMajorVersion;
23 WXDWORD dwMinorVersion;
24 WXDWORD dwBuildNumber;
25 WXDWORD dwPlatformId;
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
36 #else
37 typedef struct _WXUOSVERSIONINFOEXA {
38 WXDWORD dwOSVersionInfoSize;
39 WXDWORD dwMajorVersion;
40 WXDWORD dwMinorVersion;
41 WXDWORD dwBuildNumber;
42 WXDWORD dwPlatformId;
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
53 #endif
54
55 typedef int WXUBOOL ;
56
57 typedef struct tagWXURECT
58 {
59 long left;
60 long top;
61 long right;
62 long bottom;
63 } WXURECT ;
64
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 *) ;
79
80 enum WXUTHEMESIZE
81 {
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
85 };
86
87 typedef struct tagWXUSIZE
88 {
89 long cx;
90 long cy;
91 } WXUSIZE ;
92
93 typedef struct tagWXUTEXTMETRIC
94 {
95 long tmHeight;
96 long tmAscent;
97 long tmDescent;
98 long tmInternalLeading;
99 long tmExternalLeading;
100 long tmAveCharWidth;
101 long tmMaxCharWidth;
102 long tmWeight;
103 long tmOverhang;
104 long tmDigitizedAspectX;
105 long tmDigitizedAspectY;
106 wchar_t tmFirstChar;
107 wchar_t tmLastChar;
108 wchar_t tmDefaultChar;
109 wchar_t tmBreakChar;
110 unsigned char tmItalic;
111 unsigned char tmUnderlined;
112 unsigned char tmStruckOut;
113 unsigned char tmPitchAndFamily;
114 unsigned char tmCharSet;
115 } WXUTEXTMETRIC;
116
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 *) ;
125
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
136
137 typedef struct tagWXUPOINT
138 {
139 long x;
140 long y;
141 } WXUPOINT ;
142
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,
154 int, int, 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
162 {
163 long lfHeight;
164 long lfWidth;
165 long lfEscapement;
166 long lfOrientation;
167 long lfWeight;
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];
177 } WXULOGFONT ;
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
181 {
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 *) ;
189
190 #define WXU_MAX_INTLIST_COUNT 10
191 typedef struct _WXUINTLIST
192 {
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*) ;
198
199 enum WXUPROPERTYORIGIN
200 {
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
206 };
207
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) ;
222
223 #define WXU_ETDT_DISABLE 0x00000001
224 #define WXU_ETDT_ENABLE 0x00000002
225 #define WXU_ETDT_USETABTEXTURE 0x00000004
226 #define WXU_ETDT_ENABLETAB 0x00000006
227
228 typedef WXUHRESULT (__stdcall *PFNWXUENABLETHEMEDIALOGTEXTURE)(WXHWND, WXDWORD) ;
229 typedef WXUBOOL (__stdcall *PFNWXUISTHEMEDIALOGTEXTUREENABLED)(WXHWND) ;
230
231 #define WXU_STAP_ALLOW_NONCLIENT 1
232 #define WXU_STAP_ALLOW_CONTROLS 2
233 #define WXU_STAP_ALLOW_WEBCONTENT 4
234
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) ;
239
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"
244
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) ;
249
250 class WXDLLEXPORT wxUxThemeEngine
251 {
252 private:
253 wxUxThemeEngine() ;
254
255 public:
256 ~wxUxThemeEngine() ;
257 bool IsInitialized() const { return m_bIsInitialized ; }
258
259 private:
260 bool m_bIsInitialized ;
261 HINSTANCE m_hInstUXThemeDLL ;
262
263 public:
264 static wxUxThemeEngine* wxInitUxThemeEngine() ;
265 static wxUxThemeEngine* Get() ;
266 protected:
267 void ResetFunctionPointers() ;
268 public:
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 ;
316 };
317
318 WXDLLEXPORT_DATA(extern wxUxThemeEngine*) g_pThemeEngine ;
319
320 WXDLLEXPORT BOOL wxCanUseInitThemeEngine() ;
321
322 #if !defined(WXU_USE_WXMODULE)
323 WXDLLEXPORT BOOL wxUxInitThemeEngine() ;
324 #endif
325
326 #endif
327