]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/uxtheme.h
More WinCE mods.
[wxWidgets.git] / include / wx / msw / uxtheme.h
CommitLineData
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
85b43fbf
JS
12#ifdef __GNUG__
13 #pragma interface "uxtheme.cpp"
14#endif
15
0d1cb8cb
JS
16// Use wxModule approach to initialization.
17#define WXU_USE_WXMODULE 1
18
19#if wxUSE_UNICODE
20typedef 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
37typedef 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
55typedef int WXUBOOL ;
56
57typedef struct tagWXURECT
58{
59 long left;
60 long top;
61 long right;
62 long bottom;
63} WXURECT ;
64
65typedef void* WXHTHEME;
66typedef long WXUHRESULT;
67typedef WXHTHEME (__stdcall *PFNWXUOPENTHEMEDATA)(WXHWND, const wchar_t *) ;
68typedef WXUHRESULT (__stdcall *PFNWXUCLOSETHEMEDATA)(WXHTHEME) ;
69typedef WXUHRESULT (__stdcall *PFNWXUDRAWTHEMEBACKGROUND)(WXHTHEME, WXHDC,
70 int, int, const WXURECT *, const WXURECT *) ;
71#define WXU_DTT_GRAYED 0x1
72typedef WXUHRESULT (__stdcall *PFNWXUDRAWTHEMETEXT)(WXHTHEME, WXHDC, int,
73 int, const wchar_t *, int, DWORD,
74 DWORD, const WXURECT *) ;
75typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEBACKGROUNDCONTENTRECT)(WXHTHEME, WXHDC,
76 int, int, const WXURECT *, WXURECT *) ;
77typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEBACKGROUNDEXTENT)(WXHTHEME, WXHDC, int, int,
78 const WXURECT *, WXURECT *) ;
79
85b43fbf 80enum WXUTHEMESIZE
0d1cb8cb
JS
81{
82 WXU_TS_MIN, // minimum size
83 WXU_TS_TRUE, // size without stretching
85b43fbf 84 WXU_TS_DRAW // size that theme mgr will use to draw part
0d1cb8cb
JS
85};
86
87typedef struct tagWXUSIZE
88{
89 long cx;
90 long cy;
91} WXUSIZE ;
92
93typedef 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
117typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEPARTSIZE)(WXHTHEME, WXHDC, int, int, const WXURECT *,
118 enum WXUTHEMESIZE, WXUSIZE *) ;
119typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMETEXTEXTENT)(WXHTHEME, WXHDC, int, int, const wchar_t *,
120 int, WXDWORD, const WXURECT *, WXURECT *) ;
121typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMETEXTMETRICS)(WXHTHEME, WXHDC,
122 int, int, WXUTEXTMETRIC*);
123typedef 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
137typedef struct tagWXUPOINT
138{
139 long x;
140 long y;
141} WXUPOINT ;
142
143typedef WXUHRESULT (__stdcall *PFNWXUHITTESTTHEMEBACKGROUND)(WXHTHEME, WXHDC, int,
144 int, WXDWORD, const WXURECT *, WXHRGN,
145 WXUPOINT, unsigned short *) ;
146typedef WXUHRESULT (__stdcall *PFNWXUDRAWTHEMEEDGE)(WXHTHEME, WXHDC, int, int,
147 const WXURECT *, unsigned int, unsigned int, WXURECT *);
148typedef WXUHRESULT (__stdcall *PFNWXUDRAWTHEMEICON)(WXHTHEME, WXHDC, int, int,
149 const WXURECT *, WXHIMAGELIST, int) ;
150typedef WXUBOOL (__stdcall *PFNWXUISTHEMEPARTDEFINED)(WXHTHEME, int, int) ;
151typedef WXUBOOL (__stdcall *PFNWXUISTHEMEBACKGROUNDPARTIALLYTRANSPARENT)(WXHTHEME, int, int) ;
85b43fbf 152typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMECOLOR)(WXHTHEME, int, int, int, WXCOLORREF*) ;
0d1cb8cb
JS
153typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEMETRIC)(WXHTHEME, WXHDC, int,
154 int, int, int *) ;
155typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMESTRING)(WXHTHEME, int,
156 int, int, wchar_t *, int) ;
157typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEBOOL)(WXHTHEME, int, int, int, WXUBOOL *) ;
158typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEINT)(WXHTHEME, int, int, int, int *) ;
159typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEENUMVALUE)(WXHTHEME, int, int, int, int *) ;
160typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEPOSITION)(WXHTHEME, int, int, int, WXUPOINT *) ;
161typedef 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 ;
178typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEFONT)(WXHTHEME, WXHDC, int, int, int, WXULOGFONT *) ;
179typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMERECT)(WXHTHEME, int, int, int, WXURECT *) ;
180typedef 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;
187typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEMARGINS)(WXHTHEME, WXHDC, int,
188 int, int, WXURECT *, WXUMARGINS *) ;
189
190#define WXU_MAX_INTLIST_COUNT 10
191typedef struct _WXUINTLIST
192{
193 int iValueCount; // number of values in iValues
194 int iValues[WXU_MAX_INTLIST_COUNT];
195} WXUINTLIST, *PWXUINTLIST;
196typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEINTLIST)(WXHTHEME, int,
197 int, int, WXUINTLIST*) ;
85b43fbf
JS
198
199enum WXUPROPERTYORIGIN
0d1cb8cb
JS
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};
85b43fbf 207
0d1cb8cb
JS
208typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEPROPERTYORIGIN)(WXHTHEME, int,
209 int, int, enum WXUPROPERTYORIGIN *) ;
210typedef WXUHRESULT (__stdcall *PFNWXUSETWINDOWTHEME)(WXHWND, const wchar_t*, const wchar_t *) ;
211typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEFILENAME)(WXHTHEME, int, int, int, wchar_t *, int) ;
212typedef WXCOLORREF (__stdcall *PFNWXUGETTHEMESYSCOLOR)(WXHTHEME, int) ;
213typedef WXHBRUSH (__stdcall *PFNWXUGETTHEMESYSCOLORBRUSH)(WXHTHEME, int) ;
214typedef WXUBOOL (__stdcall *PFNWXUGETTHEMESYSBOOL)(WXHTHEME, int) ;
215typedef int (__stdcall *PFNWXUGETTHEMESYSSIZE)(WXHTHEME, int) ;
216typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMESYSFONT)(WXHTHEME, int, WXULOGFONT *) ;
217typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMESYSSTRING)(WXHTHEME, int, wchar_t *, int) ;
218typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMESYSINT)(WXHTHEME, int, int *) ;
219typedef WXUBOOL (__stdcall *PFNWXUISTHEMEACTIVE)() ;
220typedef WXUBOOL (__stdcall *PFNWXUISAPPTHEMED)() ;
221typedef 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
228typedef WXUHRESULT (__stdcall *PFNWXUENABLETHEMEDIALOGTEXTURE)(WXHWND, WXDWORD) ;
229typedef 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
235typedef WXDWORD (__stdcall *PFNWXUGETTHEMEAPPPROPERTIES)() ;
236typedef void (__stdcall *PFNWXUSETTHEMEAPPPROPERTIES)(WXDWORD) ;
237typedef 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
245typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEDOCUMENTATIONPROPERTY)(const wchar_t *,
246 const wchar_t *, wchar_t *, int) ;
247typedef WXUHRESULT (__stdcall *PFNWXUDRAWTHEMEPARENTBACKGROUND)(WXHWND, WXHDC, WXURECT *) ;
248typedef WXUHRESULT (__stdcall *PFNWXUENABLETHEMING)(WXUBOOL) ;
249
85b43fbf 250class WXDLLEXPORT wxUxThemeEngine
0d1cb8cb
JS
251{
252private:
253 wxUxThemeEngine() ;
254
255public:
256 ~wxUxThemeEngine() ;
257 bool IsInitialized() const { return m_bIsInitialized ; }
258
259private:
260 bool m_bIsInitialized ;
261 HINSTANCE m_hInstUXThemeDLL ;
262
263public:
264 static wxUxThemeEngine* wxInitUxThemeEngine() ;
85b43fbf 265 static wxUxThemeEngine* Get() ;
0d1cb8cb
JS
266protected:
267 void ResetFunctionPointers() ;
268public:
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
85b43fbf 318WXDLLEXPORT_DATA(extern wxUxThemeEngine*) g_pThemeEngine ;
0d1cb8cb 319
85b43fbf 320WXDLLEXPORT BOOL wxCanUseInitThemeEngine() ;
0d1cb8cb
JS
321
322#if !defined(WXU_USE_WXMODULE)
85b43fbf 323WXDLLEXPORT BOOL wxUxInitThemeEngine() ;
0d1cb8cb
JS
324#endif
325
326#endif
327