Home | History | Annotate | Download | only in include
      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 
     21 typedef HANDLE HTHEME;
     22 
     23 #if (NTDDI_VERSION >= NTDDI_WIN7)
     24 WINBOOL WINAPI BeginPanningFeedback(HWND hwnd);
     25 WINBOOL WINAPI UpdatePanningFeedback(HWND hwnd,LONG lTotalOverpanOffsetX,LONG lTotalOverpanOffsetY,WINBOOL fInInertia);
     26 WINBOOL 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 
     35 THEMEAPI GetThemeBitmap(HTHEME hTheme,int iPartId,int iStateId,int iPropId,ULONG dwFlags,HBITMAP *phBitmap);
     36 THEMEAPI GetThemeStream(HTHEME hTheme,int iPartId,int iStateId,int iPropId,VOID **ppvStream,DWORD *pcbStream,HINSTANCE hInst);
     37 THEMEAPI GetThemeTransitionDuration(HTHEME hTheme,int iPartId,int iStateIdFrom,int iStateIdTo,int iPropId,DWORD *pdwDuration);
     38 
     39 DECLARE_HANDLE(HPAINTBUFFER);
     40 
     41 typedef 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 
     49 typedef struct _BP_PAINTPARAMS {
     50     DWORD cbSize;
     51     DWORD dwFlags;
     52     const RECT *prcExclude;
     53     const BLENDFUNCTION *pBlendFunction;
     54 } BP_PAINTPARAMS, *PBP_PAINTPARAMS;
     55 
     56 THEMEAPI_(HPAINTBUFFER) BeginBufferedPaint(HDC hdcTarget,const RECT *prcTarget,BP_BUFFERFORMAT dwFormat,BP_PAINTPARAMS *pPaintParams,HDC *phdc);
     57 THEMEAPI_(HRESULT) EndBufferedPaint(HPAINTBUFFER hBufferedPaint,WINBOOL fUpdateTarget);
     58 THEMEAPI_(HRESULT) GetBufferedPaintTargetRect(HPAINTBUFFER hBufferedPaint,RECT *prc);
     59 THEMEAPI_(HDC) GetBufferedPaintTargetDC(HPAINTBUFFER hBufferedPaint);
     60 THEMEAPI_(HDC) GetBufferedPaintDC(HPAINTBUFFER hBufferedPaint);
     61 THEMEAPI_(HRESULT) GetBufferedPaintBits(HPAINTBUFFER hBufferedPaint,RGBQUAD **ppbBuffer,int *pcxRow);
     62 THEMEAPI_(HRESULT) BufferedPaintClear(HPAINTBUFFER hBufferedPaint,const RECT *prc);
     63 THEMEAPI_(HRESULT) BufferedPaintSetAlpha(HPAINTBUFFER hBufferedPaint,const RECT *prc,BYTE alpha);
     64 THEMEAPI_(HRESULT) BufferedPaintInit(VOID);
     65 THEMEAPI_(HRESULT) BufferedPaintUnInit(VOID);
     66 
     67 DECLARE_HANDLE(HANIMATIONBUFFER);
     68 
     69 typedef enum _BP_ANIMATIONSTYLE {
     70     BPAS_NONE, BPAS_LINEAR, BPAS_CUBIC, BPAS_SINE
     71 } BP_ANIMATIONSTYLE;
     72 
     73 typedef struct _BP_ANIMATIONPARAMS {
     74     DWORD cbSize;
     75     DWORD  dwFlags;
     76     BP_ANIMATIONSTYLE style;
     77     DWORD dwDuration;
     78 } BP_ANIMATIONPARAMS, *PBP_ANIMATIONPARAMS;
     79 
     80 THEMEAPI_(HANIMATIONBUFFER) BeginBufferedAnimation(HWND hwnd,HDC hdcTarget,const RECT *rcTarget,BP_BUFFERFORMAT dwFormat,BP_PAINTPARAMS *pPaintParams,BP_ANIMATIONPARAMS *pAnimationParams,HDC *phdcFrom,HDC *phdcTo);
     81 THEMEAPI EndBufferedAnimation(HANIMATIONBUFFER hbpAnimation,WINBOOL fUpdateTarget);
     82 THEMEAPI_(WINBOOL) BufferedPaintRenderAnimation(HWND hwnd,HDC hdcTarget);
     83 THEMEAPI BufferedPaintStopAllAnimations(HWND hwnd);
     84 THEMEAPI_(WINBOOL) IsCompositionActive(void);
     85 
     86 typedef enum WINDOWTHEMEATTRIBUTETYPE {
     87     WTA_NONCLIENT = 1
     88 } WINDOWTHEMEATTRIBUTETYPE;
     89 
     90 typedef 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 
    101 THEMEAPI SetWindowThemeAttribute(HWND hwnd,enum WINDOWTHEMEATTRIBUTETYPE eAttribute,PVOID pvAttribute,DWORD cbAttribute);
    102 
    103 static __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 
    111 THEMEAPI_(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)
    117 THEMEAPI_(HTHEME) OpenThemeDataEx(HWND hwnd,LPCWSTR pszClassList,DWORD dwFlags);
    118 #endif
    119 
    120 THEMEAPI CloseThemeData(HTHEME hTheme);
    121 THEMEAPI DrawThemeBackground(HTHEME hTheme,HDC hdc,int iPartId,int iStateId,const RECT *pRect,const RECT *pClipRect);
    122 
    123 #define DTT_GRAYED 0x1
    124 
    125 THEMEAPI 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 
    146 typedef int (WINAPI *DTT_CALLBACK_PROC)(HDC hdc,LPWSTR pszText,int cchText,LPRECT prc,UINT dwFlags,LPARAM lParam);
    147 
    148 typedef 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 
    166 THEMEAPI DrawThemeTextEx(HTHEME hTheme,HDC hdc,int iPartId,int iStateId,LPCWSTR pszText,int iCharCount,DWORD dwFlags,LPRECT pRect,const DTTOPTS *pOptions);
    167 #endif
    168 
    169 THEMEAPI GetThemeBackgroundContentRect(HTHEME hTheme,HDC hdc,int iPartId,int iStateId,const RECT *pBoundingRect,RECT *pContentRect);
    170 THEMEAPI GetThemeBackgroundExtent(HTHEME hTheme,HDC hdc,int iPartId,int iStateId,const RECT *pContentRect,RECT *pExtentRect);
    171 
    172 typedef enum THEMESIZE {
    173   TS_MIN,TS_TRUE,TS_DRAW
    174 } THEMESIZE;
    175 
    176 THEMEAPI GetThemePartSize(HTHEME hTheme,HDC hdc,int iPartId,int iStateId,RECT *prc,enum THEMESIZE eSize,SIZE *psz);
    177 THEMEAPI GetThemeTextExtent(HTHEME hTheme,HDC hdc,int iPartId,int iStateId,LPCWSTR pszText,int iCharCount,DWORD dwTextFlags,const RECT *pBoundingRect,RECT *pExtentRect);
    178 THEMEAPI GetThemeTextMetrics(HTHEME hTheme,HDC hdc,int iPartId,int iStateId,TEXTMETRIC *ptm);
    179 THEMEAPI 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 
    194 THEMEAPI HitTestThemeBackground(HTHEME hTheme,HDC hdc,int iPartId,int iStateId,DWORD dwOptions,const RECT *pRect,HRGN hrgn,POINT ptTest,WORD *pwHitTestCode);
    195 THEMEAPI DrawThemeEdge(HTHEME hTheme,HDC hdc,int iPartId,int iStateId,const RECT *pDestRect,UINT uEdge,UINT uFlags,RECT *pContentRect);
    196 THEMEAPI DrawThemeIcon(HTHEME hTheme,HDC hdc,int iPartId,int iStateId,const RECT *pRect,HIMAGELIST himl,int iImageIndex);
    197 THEMEAPI_(WINBOOL) IsThemePartDefined(HTHEME hTheme,int iPartId,int iStateId);
    198 THEMEAPI_(WINBOOL) IsThemeBackgroundPartiallyTransparent(HTHEME hTheme,int iPartId,int iStateId);
    199 THEMEAPI GetThemeColor(HTHEME hTheme,int iPartId,int iStateId,int iPropId,COLORREF *pColor);
    200 THEMEAPI GetThemeMetric(HTHEME hTheme,HDC hdc,int iPartId,int iStateId,int iPropId,int *piVal);
    201 THEMEAPI GetThemeString(HTHEME hTheme,int iPartId,int iStateId,int iPropId,LPWSTR pszBuff,int cchMaxBuffChars);
    202 THEMEAPI GetThemeBool(HTHEME hTheme,int iPartId,int iStateId,int iPropId,WINBOOL *pfVal);
    203 THEMEAPI GetThemeInt(HTHEME hTheme,int iPartId,int iStateId,int iPropId,int *piVal);
    204 THEMEAPI GetThemeEnumValue(HTHEME hTheme,int iPartId,int iStateId,int iPropId,int *piVal);
    205 THEMEAPI GetThemePosition(HTHEME hTheme,int iPartId,int iStateId,int iPropId,POINT *pPoint);
    206 THEMEAPI GetThemeFont(HTHEME hTheme,HDC hdc,int iPartId,int iStateId,int iPropId,LOGFONT *pFont);
    207 THEMEAPI GetThemeRect(HTHEME hTheme,int iPartId,int iStateId,int iPropId,RECT *pRect);
    208 
    209 typedef struct _MARGINS {
    210   int cxLeftWidth;
    211   int cxRightWidth;
    212   int cyTopHeight;
    213   int cyBottomHeight;
    214 } MARGINS,*PMARGINS;
    215 
    216 THEMEAPI 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 
    224 typedef struct _INTLIST {
    225   int iValueCount;
    226   int iValues[MAX_INTLIST_COUNT];
    227 } INTLIST,*PINTLIST;
    228 
    229 THEMEAPI GetThemeIntList(HTHEME hTheme,int iPartId,int iStateId,int iPropId,INTLIST *pIntList);
    230 
    231 typedef enum PROPERTYORIGIN {
    232   PO_STATE,PO_PART,PO_CLASS,PO_GLOBAL,PO_NOTFOUND
    233 } PROPERTYORIGIN;
    234 
    235 THEMEAPI GetThemePropertyOrigin(HTHEME hTheme,int iPartId,int iStateId,int iPropId,enum PROPERTYORIGIN *pOrigin);
    236 THEMEAPI SetWindowTheme(HWND hwnd,LPCWSTR pszSubAppName,LPCWSTR pszSubIdList);
    237 THEMEAPI GetThemeFilename(HTHEME hTheme,int iPartId,int iStateId,int iPropId,LPWSTR pszThemeFileName,int cchMaxBuffChars);
    238 THEMEAPI_(COLORREF) GetThemeSysColor(HTHEME hTheme,int iColorId);
    239 THEMEAPI_(HBRUSH) GetThemeSysColorBrush(HTHEME hTheme,int iColorId);
    240 THEMEAPI_(WINBOOL) GetThemeSysBool(HTHEME hTheme,int iBoolId);
    241 THEMEAPI_(int) GetThemeSysSize(HTHEME hTheme,int iSizeId);
    242 THEMEAPI GetThemeSysFont(HTHEME hTheme,int iFontId,LOGFONT *plf);
    243 THEMEAPI GetThemeSysString(HTHEME hTheme,int iStringId,LPWSTR pszStringBuff,int cchMaxStringChars);
    244 THEMEAPI GetThemeSysInt(HTHEME hTheme,int iIntId,int *piValue);
    245 THEMEAPI_(WINBOOL) IsThemeActive();
    246 THEMEAPI_(WINBOOL) IsAppThemed();
    247 THEMEAPI_(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 
    259 THEMEAPI EnableThemeDialogTexture(HWND hwnd,DWORD dwFlags);
    260 THEMEAPI_(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 
    266 THEMEAPI_(DWORD) GetThemeAppProperties();
    267 THEMEAPI_(void) SetThemeAppProperties(DWORD dwFlags);
    268 THEMEAPI 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 
    275 THEMEAPI GetThemeDocumentationProperty(LPCWSTR pszThemeName,LPCWSTR pszPropertyName,LPWSTR pszValueBuff,int cchMaxValChars);
    276 THEMEAPI 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 
    283 THEMEAPI DrawThemeParentBackgroundEx(HWND hwnd,HDC hdc,DWORD dwFlags,const RECT *prc);
    284 #endif
    285 
    286 THEMEAPI 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 
    297 typedef struct _DTBGOPTS {
    298   DWORD dwSize;
    299   DWORD dwFlags;
    300   RECT rcClip;
    301 } DTBGOPTS,*PDTBGOPTS;
    302 
    303 THEMEAPI DrawThemeBackgroundEx(HTHEME hTheme,HDC hdc,int iPartId,int iStateId,const RECT *pRect,const DTBGOPTS *pOptions);
    304 #endif
    305