]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/uxtheme.h
attempt to fix first click problem
[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
12// Use wxModule approach to initialization.
13#define WXU_USE_WXMODULE 1
14
15#if wxUSE_UNICODE
16typedef 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
33typedef 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
51typedef int WXUBOOL ;
52
53typedef struct tagWXURECT
54{
55 long left;
56 long top;
57 long right;
58 long bottom;
59} WXURECT ;
60
61typedef void* WXHTHEME;
62typedef long WXUHRESULT;
63typedef WXHTHEME (__stdcall *PFNWXUOPENTHEMEDATA)(WXHWND, const wchar_t *) ;
64typedef WXUHRESULT (__stdcall *PFNWXUCLOSETHEMEDATA)(WXHTHEME) ;
65typedef WXUHRESULT (__stdcall *PFNWXUDRAWTHEMEBACKGROUND)(WXHTHEME, WXHDC,
66 int, int, const WXURECT *, const WXURECT *) ;
67#define WXU_DTT_GRAYED 0x1
68typedef WXUHRESULT (__stdcall *PFNWXUDRAWTHEMETEXT)(WXHTHEME, WXHDC, int,
69 int, const wchar_t *, int, DWORD,
70 DWORD, const WXURECT *) ;
71typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEBACKGROUNDCONTENTRECT)(WXHTHEME, WXHDC,
72 int, int, const WXURECT *, WXURECT *) ;
73typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEBACKGROUNDEXTENT)(WXHTHEME, WXHDC, int, int,
74 const WXURECT *, WXURECT *) ;
75
76typedef 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
83typedef struct tagWXUSIZE
84{
85 long cx;
86 long cy;
87} WXUSIZE ;
88
89typedef 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
113typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEPARTSIZE)(WXHTHEME, WXHDC, int, int, const WXURECT *,
114 enum WXUTHEMESIZE, WXUSIZE *) ;
115typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMETEXTEXTENT)(WXHTHEME, WXHDC, int, int, const wchar_t *,
116 int, WXDWORD, const WXURECT *, WXURECT *) ;
117typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMETEXTMETRICS)(WXHTHEME, WXHDC,
118 int, int, WXUTEXTMETRIC*);
119typedef 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
133typedef struct tagWXUPOINT
134{
135 long x;
136 long y;
137} WXUPOINT ;
138
139typedef WXUHRESULT (__stdcall *PFNWXUHITTESTTHEMEBACKGROUND)(WXHTHEME, WXHDC, int,
140 int, WXDWORD, const WXURECT *, WXHRGN,
141 WXUPOINT, unsigned short *) ;
142typedef WXUHRESULT (__stdcall *PFNWXUDRAWTHEMEEDGE)(WXHTHEME, WXHDC, int, int,
143 const WXURECT *, unsigned int, unsigned int, WXURECT *);
144typedef WXUHRESULT (__stdcall *PFNWXUDRAWTHEMEICON)(WXHTHEME, WXHDC, int, int,
145 const WXURECT *, WXHIMAGELIST, int) ;
146typedef WXUBOOL (__stdcall *PFNWXUISTHEMEPARTDEFINED)(WXHTHEME, int, int) ;
147typedef WXUBOOL (__stdcall *PFNWXUISTHEMEBACKGROUNDPARTIALLYTRANSPARENT)(WXHTHEME, int, int) ;
148typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMECOLOR)(WXHTHEME, int, int, int, WXCOLORREF) ;
149typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEMETRIC)(WXHTHEME, WXHDC, int,
150 int, int, int *) ;
151typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMESTRING)(WXHTHEME, int,
152 int, int, wchar_t *, int) ;
153typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEBOOL)(WXHTHEME, int, int, int, WXUBOOL *) ;
154typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEINT)(WXHTHEME, int, int, int, int *) ;
155typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEENUMVALUE)(WXHTHEME, int, int, int, int *) ;
156typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEPOSITION)(WXHTHEME, int, int, int, WXUPOINT *) ;
157typedef 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 ;
174typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEFONT)(WXHTHEME, WXHDC, int, int, int, WXULOGFONT *) ;
175typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMERECT)(WXHTHEME, int, int, int, WXURECT *) ;
176typedef 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;
183typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEMARGINS)(WXHTHEME, WXHDC, int,
184 int, int, WXURECT *, WXUMARGINS *) ;
185
186#define WXU_MAX_INTLIST_COUNT 10
187typedef struct _WXUINTLIST
188{
189 int iValueCount; // number of values in iValues
190 int iValues[WXU_MAX_INTLIST_COUNT];
191} WXUINTLIST, *PWXUINTLIST;
192typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEINTLIST)(WXHTHEME, int,
193 int, int, WXUINTLIST*) ;
194typedef 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};
202typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEPROPERTYORIGIN)(WXHTHEME, int,
203 int, int, enum WXUPROPERTYORIGIN *) ;
204typedef WXUHRESULT (__stdcall *PFNWXUSETWINDOWTHEME)(WXHWND, const wchar_t*, const wchar_t *) ;
205typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEFILENAME)(WXHTHEME, int, int, int, wchar_t *, int) ;
206typedef WXCOLORREF (__stdcall *PFNWXUGETTHEMESYSCOLOR)(WXHTHEME, int) ;
207typedef WXHBRUSH (__stdcall *PFNWXUGETTHEMESYSCOLORBRUSH)(WXHTHEME, int) ;
208typedef WXUBOOL (__stdcall *PFNWXUGETTHEMESYSBOOL)(WXHTHEME, int) ;
209typedef int (__stdcall *PFNWXUGETTHEMESYSSIZE)(WXHTHEME, int) ;
210typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMESYSFONT)(WXHTHEME, int, WXULOGFONT *) ;
211typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMESYSSTRING)(WXHTHEME, int, wchar_t *, int) ;
212typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMESYSINT)(WXHTHEME, int, int *) ;
213typedef WXUBOOL (__stdcall *PFNWXUISTHEMEACTIVE)() ;
214typedef WXUBOOL (__stdcall *PFNWXUISAPPTHEMED)() ;
215typedef 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
222typedef WXUHRESULT (__stdcall *PFNWXUENABLETHEMEDIALOGTEXTURE)(WXHWND, WXDWORD) ;
223typedef 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
229typedef WXDWORD (__stdcall *PFNWXUGETTHEMEAPPPROPERTIES)() ;
230typedef void (__stdcall *PFNWXUSETTHEMEAPPPROPERTIES)(WXDWORD) ;
231typedef 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
239typedef WXUHRESULT (__stdcall *PFNWXUGETTHEMEDOCUMENTATIONPROPERTY)(const wchar_t *,
240 const wchar_t *, wchar_t *, int) ;
241typedef WXUHRESULT (__stdcall *PFNWXUDRAWTHEMEPARENTBACKGROUND)(WXHWND, WXHDC, WXURECT *) ;
242typedef WXUHRESULT (__stdcall *PFNWXUENABLETHEMING)(WXUBOOL) ;
243
244class wxUxThemeEngine
245{
246private:
247 wxUxThemeEngine() ;
248
249public:
250 ~wxUxThemeEngine() ;
251 bool IsInitialized() const { return m_bIsInitialized ; }
252
253private:
254 bool m_bIsInitialized ;
255 HINSTANCE m_hInstUXThemeDLL ;
256
257public:
258 static wxUxThemeEngine* wxInitUxThemeEngine() ;
259protected:
260 void ResetFunctionPointers() ;
261public:
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
311extern wxUxThemeEngine* g_pThemeEngine ;
312
313BOOL wxCanUseInitThemeEngine() ;
314
315#if !defined(WXU_USE_WXMODULE)
316BOOL wxUxInitThemeEngine() ;
317#endif
318
319#endif
320