1/**
2 * This file has no copyright assigned and is placed in the Public Domain.
3 * This file is part of the mingw-w64 runtime package.
4 * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5 */
6#ifndef _UXTHEME_H_
7#define _UXTHEME_H_
8
9#include <commctrl.h>
10
11#ifndef THEMEAPI
12#if !defined(_UXTHEME_)
13#define THEMEAPI EXTERN_C DECLSPEC_IMPORT HRESULT WINAPI
14#define THEMEAPI_(type) EXTERN_C DECLSPEC_IMPORT type WINAPI
15#else
16#define THEMEAPI STDAPI
17#define THEMEAPI_(type) STDAPI_(type)
18#endif
19#endif
20
21typedef HANDLE HTHEME;
22
23#if (NTDDI_VERSION >= NTDDI_WIN7)
24WINBOOL WINAPI BeginPanningFeedback(HWND hwnd);
25WINBOOL WINAPI UpdatePanningFeedback(HWND hwnd,LONG lTotalOverpanOffsetX,LONG lTotalOverpanOffsetY,WINBOOL fInInertia);
26WINBOOL WINAPI EndPanningFeedback(HWND hwnd,WINBOOL fAnimateBack);
27#endif
28
29#if _WIN32_WINNT >= 0x0600
30
31#define GBF_DIRECT 0x00000001
32#define GBF_COPY 0x00000002
33#define GBF_VALIDBITS (GBF_DIRECT | GBF_COPY)
34
35THEMEAPI GetThemeBitmap(HTHEME hTheme,int iPartId,int iStateId,int iPropId,ULONG dwFlags,HBITMAP *phBitmap);
36THEMEAPI GetThemeStream(HTHEME hTheme,int iPartId,int iStateId,int iPropId,VOID **ppvStream,DWORD *pcbStream,HINSTANCE hInst);
37THEMEAPI GetThemeTransitionDuration(HTHEME hTheme,int iPartId,int iStateIdFrom,int iStateIdTo,int iPropId,DWORD *pdwDuration);
38
39DECLARE_HANDLE(HPAINTBUFFER);
40
41typedef enum _BP_BUFFERFORMAT {
42    BPBF_COMPATIBLEBITMAP, BPBF_DIB, BPBF_TOPDOWNDIB, BPBF_TOPDOWNMONODIB
43} BP_BUFFERFORMAT;
44
45#define BPPF_ERASE     0x00000001
46#define BPPF_NOCLIP    0x00000002
47#define BPPF_NONCLIENT 0x00000004
48
49typedef struct _BP_PAINTPARAMS {
50    DWORD cbSize;
51    DWORD dwFlags;
52    const RECT *prcExclude;
53    const BLENDFUNCTION *pBlendFunction;
54} BP_PAINTPARAMS, *PBP_PAINTPARAMS;
55
56THEMEAPI_(HPAINTBUFFER) BeginBufferedPaint(HDC hdcTarget,const RECT *prcTarget,BP_BUFFERFORMAT dwFormat,BP_PAINTPARAMS *pPaintParams,HDC *phdc);
57THEMEAPI_(HRESULT) EndBufferedPaint(HPAINTBUFFER hBufferedPaint,WINBOOL fUpdateTarget);
58THEMEAPI_(HRESULT) GetBufferedPaintTargetRect(HPAINTBUFFER hBufferedPaint,RECT *prc);
59THEMEAPI_(HDC) GetBufferedPaintTargetDC(HPAINTBUFFER hBufferedPaint);
60THEMEAPI_(HDC) GetBufferedPaintDC(HPAINTBUFFER hBufferedPaint);
61THEMEAPI_(HRESULT) GetBufferedPaintBits(HPAINTBUFFER hBufferedPaint,RGBQUAD **ppbBuffer,int *pcxRow);
62THEMEAPI_(HRESULT) BufferedPaintClear(HPAINTBUFFER hBufferedPaint,const RECT *prc);
63THEMEAPI_(HRESULT) BufferedPaintSetAlpha(HPAINTBUFFER hBufferedPaint,const RECT *prc,BYTE alpha);
64THEMEAPI_(HRESULT) BufferedPaintInit(VOID);
65THEMEAPI_(HRESULT) BufferedPaintUnInit(VOID);
66
67DECLARE_HANDLE(HANIMATIONBUFFER);
68
69typedef enum _BP_ANIMATIONSTYLE {
70    BPAS_NONE, BPAS_LINEAR, BPAS_CUBIC, BPAS_SINE
71} BP_ANIMATIONSTYLE;
72
73typedef struct _BP_ANIMATIONPARAMS {
74    DWORD cbSize;
75    DWORD  dwFlags;
76    BP_ANIMATIONSTYLE style;
77    DWORD dwDuration;
78} BP_ANIMATIONPARAMS, *PBP_ANIMATIONPARAMS;
79
80THEMEAPI_(HANIMATIONBUFFER) BeginBufferedAnimation(HWND hwnd,HDC hdcTarget,const RECT *rcTarget,BP_BUFFERFORMAT dwFormat,BP_PAINTPARAMS *pPaintParams,BP_ANIMATIONPARAMS *pAnimationParams,HDC *phdcFrom,HDC *phdcTo);
81THEMEAPI EndBufferedAnimation(HANIMATIONBUFFER hbpAnimation,WINBOOL fUpdateTarget);
82THEMEAPI_(WINBOOL) BufferedPaintRenderAnimation(HWND hwnd,HDC hdcTarget);
83THEMEAPI BufferedPaintStopAllAnimations(HWND hwnd);
84THEMEAPI_(WINBOOL) IsCompositionActive(void);
85
86typedef enum WINDOWTHEMEATTRIBUTETYPE {
87    WTA_NONCLIENT = 1
88} WINDOWTHEMEATTRIBUTETYPE;
89
90typedef struct WTA_OPTIONS {
91    DWORD dwFlags;
92    DWORD dwMask;
93} WTA_OPTIONS, *PWTA_OPTIONS;
94
95#define WTNCA_NODRAWCAPTION 0x00000001
96#define WTNCA_NODRAWICON 0x00000002
97#define WTNCA_NOSYSMENU 0x00000004
98#define WTNCA_NOMIRRORHELP 0x00000008
99#define WTNCA_VALIDBITS (WTNCA_NODRAWCAPTION | WTNCA_NODRAWICON | WTNCA_NOSYSMENU | WTNCA_NOMIRRORHELP)
100
101THEMEAPI SetWindowThemeAttribute(HWND hwnd,enum WINDOWTHEMEATTRIBUTETYPE eAttribute,PVOID pvAttribute,DWORD cbAttribute);
102
103static __inline HRESULT SetWindowThemeNonClientAttributes(HWND hwnd,DWORD dwMask,DWORD dwAttributes)
104{
105    WTA_OPTIONS wta = { dwAttributes, dwMask };
106    return SetWindowThemeAttribute(hwnd, WTA_NONCLIENT, &wta, sizeof(WTA_OPTIONS));
107}
108
109#endif
110
111THEMEAPI_(HTHEME) OpenThemeData(HWND hwnd,LPCWSTR pszClassList);
112
113#if (_WIN32_WINNT >= 0x0600)
114#define OTD_FORCE_RECT_SIZING 0x00000001
115#define OTD_NONCLIENT 0x00000002
116#define OTD_VALIDBITS (OTD_FORCE_RECT_SIZING | OTD_NONCLIENT)
117THEMEAPI_(HTHEME) OpenThemeDataEx(HWND hwnd,LPCWSTR pszClassList,DWORD dwFlags);
118#endif
119
120THEMEAPI CloseThemeData(HTHEME hTheme);
121THEMEAPI DrawThemeBackground(HTHEME hTheme,HDC hdc,int iPartId,int iStateId,const RECT *pRect,const RECT *pClipRect);
122
123#define DTT_GRAYED 0x1
124
125THEMEAPI DrawThemeText(HTHEME hTheme,HDC hdc,int iPartId,int iStateId,LPCWSTR pszText,int iCharCount,DWORD dwTextFlags,DWORD dwTextFlags2,const RECT *pRect);
126
127#if (_WIN32_WINNT >= 0x0600)
128
129#define DTT_TEXTCOLOR (__MSABI_LONG(1U) << 0)
130#define DTT_BORDERCOLOR (__MSABI_LONG(1U) << 1)
131#define DTT_SHADOWCOLOR (__MSABI_LONG(1U) << 2)
132#define DTT_SHADOWTYPE (__MSABI_LONG(1U) << 3)
133#define DTT_SHADOWOFFSET (__MSABI_LONG(1U) << 4)
134#define DTT_BORDERSIZE (__MSABI_LONG(1U) << 5)
135#define DTT_FONTPROP (__MSABI_LONG(1U) << 6)
136#define DTT_COLORPROP (__MSABI_LONG(1U) << 7)
137#define DTT_STATEID (__MSABI_LONG(1U) << 8)
138#define DTT_CALCRECT (__MSABI_LONG(1U) << 9)
139#define DTT_APPLYOVERLAY (__MSABI_LONG(1U) << 10)
140#define DTT_GLOWSIZE (__MSABI_LONG(1U) << 11)
141#define DTT_CALLBACK (__MSABI_LONG(1U) << 12)
142#define DTT_COMPOSITED (__MSABI_LONG(1U) << 13)
143#define DTT_VALIDBITS (DTT_TEXTCOLOR | DTT_BORDERCOLOR | DTT_SHADOWCOLOR | DTT_SHADOWTYPE | DTT_SHADOWOFFSET | DTT_BORDERSIZE | \
144                       DTT_FONTPROP | DTT_COLORPROP | DTT_STATEID | DTT_CALCRECT | DTT_APPLYOVERLAY | DTT_GLOWSIZE | DTT_COMPOSITED)
145
146typedef int (WINAPI *DTT_CALLBACK_PROC)(HDC hdc,LPWSTR pszText,int cchText,LPRECT prc,UINT dwFlags,LPARAM lParam);
147
148typedef struct _DTTOPTS {
149    DWORD dwSize;
150    DWORD dwFlags;
151    COLORREF crText;
152    COLORREF crBorder;
153    COLORREF crShadow;
154    int iTextShadowType;
155    POINT ptShadowOffset;
156    int iBorderSize;
157    int iFontPropId;
158    int iColorPropId;
159    int iStateId;
160    WINBOOL fApplyOverlay;
161    int iGlowSize;
162    DTT_CALLBACK_PROC pfnDrawTextCallback;
163    LPARAM lParam;
164} DTTOPTS, *PDTTOPTS;
165
166THEMEAPI DrawThemeTextEx(HTHEME hTheme,HDC hdc,int iPartId,int iStateId,LPCWSTR pszText,int iCharCount,DWORD dwFlags,LPRECT pRect,const DTTOPTS *pOptions);
167#endif
168
169THEMEAPI GetThemeBackgroundContentRect(HTHEME hTheme,HDC hdc,int iPartId,int iStateId,const RECT *pBoundingRect,RECT *pContentRect);
170THEMEAPI GetThemeBackgroundExtent(HTHEME hTheme,HDC hdc,int iPartId,int iStateId,const RECT *pContentRect,RECT *pExtentRect);
171
172typedef enum THEMESIZE {
173  TS_MIN,TS_TRUE,TS_DRAW
174} THEMESIZE;
175
176THEMEAPI GetThemePartSize(HTHEME hTheme,HDC hdc,int iPartId,int iStateId,RECT *prc,enum THEMESIZE eSize,SIZE *psz);
177THEMEAPI GetThemeTextExtent(HTHEME hTheme,HDC hdc,int iPartId,int iStateId,LPCWSTR pszText,int iCharCount,DWORD dwTextFlags,const RECT *pBoundingRect,RECT *pExtentRect);
178THEMEAPI GetThemeTextMetrics(HTHEME hTheme,HDC hdc,int iPartId,int iStateId,TEXTMETRIC *ptm);
179THEMEAPI GetThemeBackgroundRegion(HTHEME hTheme,HDC hdc,int iPartId,int iStateId,const RECT *pRect,HRGN *pRegion);
180
181#define HTTB_BACKGROUNDSEG 0x0000
182#define HTTB_FIXEDBORDER 0x0002
183#define HTTB_CAPTION 0x0004
184#define HTTB_RESIZINGBORDER_LEFT 0x0010
185#define HTTB_RESIZINGBORDER_TOP 0x0020
186#define HTTB_RESIZINGBORDER_RIGHT 0x0040
187#define HTTB_RESIZINGBORDER_BOTTOM 0x0080
188
189#define HTTB_RESIZINGBORDER (HTTB_RESIZINGBORDER_LEFT|HTTB_RESIZINGBORDER_TOP| HTTB_RESIZINGBORDER_RIGHT|HTTB_RESIZINGBORDER_BOTTOM)
190
191#define HTTB_SIZINGTEMPLATE 0x0100
192#define HTTB_SYSTEMSIZINGMARGINS 0x0200
193
194THEMEAPI HitTestThemeBackground(HTHEME hTheme,HDC hdc,int iPartId,int iStateId,DWORD dwOptions,const RECT *pRect,HRGN hrgn,POINT ptTest,WORD *pwHitTestCode);
195THEMEAPI DrawThemeEdge(HTHEME hTheme,HDC hdc,int iPartId,int iStateId,const RECT *pDestRect,UINT uEdge,UINT uFlags,RECT *pContentRect);
196THEMEAPI DrawThemeIcon(HTHEME hTheme,HDC hdc,int iPartId,int iStateId,const RECT *pRect,HIMAGELIST himl,int iImageIndex);
197THEMEAPI_(WINBOOL) IsThemePartDefined(HTHEME hTheme,int iPartId,int iStateId);
198THEMEAPI_(WINBOOL) IsThemeBackgroundPartiallyTransparent(HTHEME hTheme,int iPartId,int iStateId);
199THEMEAPI GetThemeColor(HTHEME hTheme,int iPartId,int iStateId,int iPropId,COLORREF *pColor);
200THEMEAPI GetThemeMetric(HTHEME hTheme,HDC hdc,int iPartId,int iStateId,int iPropId,int *piVal);
201THEMEAPI GetThemeString(HTHEME hTheme,int iPartId,int iStateId,int iPropId,LPWSTR pszBuff,int cchMaxBuffChars);
202THEMEAPI GetThemeBool(HTHEME hTheme,int iPartId,int iStateId,int iPropId,WINBOOL *pfVal);
203THEMEAPI GetThemeInt(HTHEME hTheme,int iPartId,int iStateId,int iPropId,int *piVal);
204THEMEAPI GetThemeEnumValue(HTHEME hTheme,int iPartId,int iStateId,int iPropId,int *piVal);
205THEMEAPI GetThemePosition(HTHEME hTheme,int iPartId,int iStateId,int iPropId,POINT *pPoint);
206THEMEAPI GetThemeFont(HTHEME hTheme,HDC hdc,int iPartId,int iStateId,int iPropId,LOGFONT *pFont);
207THEMEAPI GetThemeRect(HTHEME hTheme,int iPartId,int iStateId,int iPropId,RECT *pRect);
208
209typedef struct _MARGINS {
210  int cxLeftWidth;
211  int cxRightWidth;
212  int cyTopHeight;
213  int cyBottomHeight;
214} MARGINS,*PMARGINS;
215
216THEMEAPI GetThemeMargins(HTHEME hTheme,HDC hdc,int iPartId,int iStateId,int iPropId,RECT *prc,MARGINS *pMargins);
217
218#if (_WIN32_WINNT >= 0x0600)
219#define MAX_INTLIST_COUNT 402
220#else
221#define MAX_INTLIST_COUNT 10
222#endif
223
224typedef struct _INTLIST {
225  int iValueCount;
226  int iValues[MAX_INTLIST_COUNT];
227} INTLIST,*PINTLIST;
228
229THEMEAPI GetThemeIntList(HTHEME hTheme,int iPartId,int iStateId,int iPropId,INTLIST *pIntList);
230
231typedef enum PROPERTYORIGIN {
232  PO_STATE,PO_PART,PO_CLASS,PO_GLOBAL,PO_NOTFOUND
233} PROPERTYORIGIN;
234
235THEMEAPI GetThemePropertyOrigin(HTHEME hTheme,int iPartId,int iStateId,int iPropId,enum PROPERTYORIGIN *pOrigin);
236THEMEAPI SetWindowTheme(HWND hwnd,LPCWSTR pszSubAppName,LPCWSTR pszSubIdList);
237THEMEAPI GetThemeFilename(HTHEME hTheme,int iPartId,int iStateId,int iPropId,LPWSTR pszThemeFileName,int cchMaxBuffChars);
238THEMEAPI_(COLORREF) GetThemeSysColor(HTHEME hTheme,int iColorId);
239THEMEAPI_(HBRUSH) GetThemeSysColorBrush(HTHEME hTheme,int iColorId);
240THEMEAPI_(WINBOOL) GetThemeSysBool(HTHEME hTheme,int iBoolId);
241THEMEAPI_(int) GetThemeSysSize(HTHEME hTheme,int iSizeId);
242THEMEAPI GetThemeSysFont(HTHEME hTheme,int iFontId,LOGFONT *plf);
243THEMEAPI GetThemeSysString(HTHEME hTheme,int iStringId,LPWSTR pszStringBuff,int cchMaxStringChars);
244THEMEAPI GetThemeSysInt(HTHEME hTheme,int iIntId,int *piValue);
245THEMEAPI_(WINBOOL) IsThemeActive();
246THEMEAPI_(WINBOOL) IsAppThemed();
247THEMEAPI_(HTHEME) GetWindowTheme(HWND hwnd);
248
249#define ETDT_DISABLE 0x00000001
250#define ETDT_ENABLE 0x00000002
251#define ETDT_USETABTEXTURE 0x00000004
252#define ETDT_ENABLETAB (ETDT_ENABLE | ETDT_USETABTEXTURE)
253#if (_WIN32_WINNT >= 0x0600)
254#define ETDT_USEAEROWIZARDTABTEXTURE 0x00000008
255#define ETDT_ENABLEAEROWIZARDTAB (ETDT_ENABLE | ETDT_USEAEROWIZARDTABTEXTURE)
256#define ETDT_VALIDBITS (ETDT_DISABLE | ETDT_ENABLE | ETDT_USETABTEXTURE | ETDT_USEAEROWIZARDTABTEXTURE)
257#endif
258
259THEMEAPI EnableThemeDialogTexture(HWND hwnd,DWORD dwFlags);
260THEMEAPI_(WINBOOL) IsThemeDialogTextureEnabled(HWND hwnd);
261
262#define STAP_ALLOW_NONCLIENT (1 << 0)
263#define STAP_ALLOW_CONTROLS (1 << 1)
264#define STAP_ALLOW_WEBCONTENT (1 << 2)
265
266THEMEAPI_(DWORD) GetThemeAppProperties();
267THEMEAPI_(void) SetThemeAppProperties(DWORD dwFlags);
268THEMEAPI GetCurrentThemeName(LPWSTR pszThemeFileName,int cchMaxNameChars,LPWSTR pszColorBuff,int cchMaxColorChars,LPWSTR pszSizeBuff,int cchMaxSizeChars);
269
270#define SZ_THDOCPROP_DISPLAYNAME L"DisplayName"
271#define SZ_THDOCPROP_CANONICALNAME L"ThemeName"
272#define SZ_THDOCPROP_TOOLTIP L"ToolTip"
273#define SZ_THDOCPROP_AUTHOR L"author"
274
275THEMEAPI GetThemeDocumentationProperty(LPCWSTR pszThemeName,LPCWSTR pszPropertyName,LPWSTR pszValueBuff,int cchMaxValChars);
276THEMEAPI DrawThemeParentBackground(HWND hwnd,HDC hdc,RECT *prc);
277
278#if (_WIN32_WINNT >= 0x0600)
279#define DTPB_WINDOWDC 0x00000001
280#define DTPB_USECTLCOLORSTATIC 0x00000002
281#define DTPB_USEERASEBKGND 0x00000004
282
283THEMEAPI DrawThemeParentBackgroundEx(HWND hwnd,HDC hdc,DWORD dwFlags,const RECT *prc);
284#endif
285
286THEMEAPI EnableTheming(WINBOOL fEnable);
287
288#define DTBG_CLIPRECT 0x00000001
289#define DTBG_DRAWSOLID 0x00000002
290#define DTBG_OMITBORDER 0x00000004
291#define DTBG_OMITCONTENT 0x00000008
292#define DTBG_COMPUTINGREGION 0x00000010
293#define DTBG_MIRRORDC 0x00000020
294#define DTBG_NOMIRROR 0x00000040
295#define DTBG_VALIDBITS (DTBG_CLIPRECT | DTBG_DRAWSOLID | DTBG_OMITBORDER | DTBG_OMITCONTENT | DTBG_COMPUTINGREGION | DTBG_MIRRORDC | DTBG_NOMIRROR)
296
297typedef struct _DTBGOPTS {
298  DWORD dwSize;
299  DWORD dwFlags;
300  RECT rcClip;
301} DTBGOPTS,*PDTBGOPTS;
302
303THEMEAPI DrawThemeBackgroundEx(HTHEME hTheme,HDC hdc,int iPartId,int iStateId,const RECT *pRect,const DTBGOPTS *pOptions);
304#endif
305