[UXTHEME] Import DrawThemeTextEx() function from Wine (part of #6622)

This is a Vista+ function, but it exists in Windows XP/2003 internally
and used for drawing "Window Text" with a shadow in DrawNCPreview().

And DrawThemeText() now acts as wrapper on top of it. CORE-5991
This commit is contained in:
Ethan Rodensky 2024-03-14 14:00:52 -04:00 committed by Stanislav Motylkov
parent bc8c7d185d
commit d4dc0cb545
2 changed files with 106 additions and 9 deletions

View file

@ -15,6 +15,24 @@ extern "C" {
#define DTBG_COMPUTINGREGION 0x00000010
#define DTBG_MIRRORDC 0x00000020
#define DTT_GRAYED 0x00000001
/* DTTOPTS.dwFlags bits */
#define DTT_TEXTCOLOR 0x00000001
#define DTT_BORDERCOLOR 0x00000002
#define DTT_SHADOWCOLOR 0x00000004
#define DTT_SHADOWTYPE 0x00000008
#define DTT_SHADOWOFFSET 0x00000010
#define DTT_BORDERSIZE 0x00000020
#define DTT_FONTPROP 0x00000040
#define DTT_COLORPROP 0x00000080
#define DTT_STATEID 0x00000100
#define DTT_CALCRECT 0x00000200
#define DTT_APPLYOVERLAY 0x00000400
#define DTT_GLOWSIZE 0x00000800
#define DTT_CALLBACK 0x00001000
#define DTT_COMPOSITED 0x00002000
#define DTT_VALIDBITS 0x00003fff
#define ETDT_DISABLE 0x00000001
#define ETDT_ENABLE 0x00000002
#define ETDT_USETABTEXTURE 0x00000004
@ -39,6 +57,7 @@ extern "C" {
typedef HANDLE HPAINTBUFFER;
typedef HANDLE HTHEME;
typedef int (WINAPI *DTT_CALLBACK_PROC)(HDC,LPWSTR,int,RECT*,UINT,LPARAM);
typedef enum _BP_BUFFERFORMAT
{
@ -90,6 +109,24 @@ typedef struct _MARGINS {
int cyBottomHeight;
} MARGINS, *PMARGINS;
typedef struct _DTTOPTS {
DWORD dwSize;
DWORD dwFlags;
COLORREF crText;
COLORREF crBorder;
COLORREF crShadow;
int iTextShadowType;
POINT ptShadowOffset;
int iBorderSize;
int iFontPropId;
int iColorPropId;
int iStateId;
BOOL fApplyOverlay;
int iGlowSize;
DTT_CALLBACK_PROC pfnDrawTextCallback;
LPARAM lParam;
} DTTOPTS, *PDTTOPTS;
HRESULT WINAPI CloseThemeData(HTHEME);
HRESULT WINAPI DrawThemeBackground(HTHEME,HDC,int,int,const RECT*,const RECT*);
HRESULT WINAPI DrawThemeBackgroundEx(HTHEME,HDC,int,int,const RECT*,const DTBGOPTS*);
@ -139,6 +176,22 @@ HTHEME WINAPI OpenThemeData(HWND,LPCWSTR);
HTHEME WINAPI OpenThemeDataEx(HWND,LPCWSTR,DWORD);
void WINAPI SetThemeAppProperties(DWORD);
HRESULT WINAPI SetWindowTheme(HWND,LPCWSTR,LPCWSTR);
/* Undocumented and not exported in Windows XP/2003
* In public headers since Vista+ */
HRESULT
WINAPI
DrawThemeTextEx(
_In_ HTHEME hTheme,
_In_ HDC hdc,
_In_ int iPartId,
_In_ int iStateId,
_In_ LPCWSTR pszText,
_In_ int iCharCount,
_In_ DWORD dwTextFlags,
_Inout_ LPRECT pRect,
_In_ const DTTOPTS *options
);
#endif
#ifdef __cplusplus