uxtheme: Partial implementation of DrawThemeTextEx.

This commit is contained in:
Nikolay Sivov 2015-07-02 00:14:21 +03:00 committed by Alexandre Julliard
parent d86f2af3b6
commit 2bb581b9b7
3 changed files with 76 additions and 10 deletions

View File

@ -1633,8 +1633,29 @@ HRESULT WINAPI DrawThemeIcon(HTHEME hTheme, HDC hdc, int iPartId, int iStateId,
* DrawThemeText (UXTHEME.@)
*/
HRESULT WINAPI DrawThemeText(HTHEME hTheme, HDC hdc, int iPartId, int iStateId,
LPCWSTR pszText, int iCharCount, DWORD dwTextFlags,
DWORD dwTextFlags2, const RECT *pRect)
LPCWSTR pszText, int iCharCount, DWORD flags,
DWORD flags2, const RECT *pRect)
{
DTTOPTS opts;
RECT rt;
TRACE("%d %d\n", iPartId, iStateId);
CopyRect(&rt, pRect);
opts.dwSize = sizeof(opts);
if (flags2 & DTT_GRAYED) {
opts.dwFlags = DTT_TEXTCOLOR;
opts.crText = GetSysColor(COLOR_GRAYTEXT);
}
return DrawThemeTextEx(hTheme, hdc, iPartId, iStateId, pszText, iCharCount, flags, &rt, &opts);
}
/***********************************************************************
* DrawThemeTextEx (UXTHEME.@)
*/
HRESULT WINAPI DrawThemeTextEx(HTHEME hTheme, HDC hdc, int iPartId, int iStateId,
LPCWSTR pszText, int iCharCount, DWORD flags, RECT *rect, const DTTOPTS *options)
{
HRESULT hr;
HFONT hFont = NULL;
@ -1643,31 +1664,35 @@ HRESULT WINAPI DrawThemeText(HTHEME hTheme, HDC hdc, int iPartId, int iStateId,
COLORREF textColor;
COLORREF oldTextColor;
int oldBkMode;
RECT rt;
TRACE("%d %d: stub\n", iPartId, iStateId);
TRACE("%p %p %d %d %s:%d 0x%08x %p %p\n", hTheme, hdc, iPartId, iStateId,
debugstr_wn(pszText, iCharCount), iCharCount, flags, rect, options);
if(!hTheme)
return E_HANDLE;
if (options->dwFlags & ~DTT_TEXTCOLOR)
FIXME("unsupported flags 0x%08x\n", options->dwFlags);
hr = GetThemeFont(hTheme, hdc, iPartId, iStateId, TMT_FONT, &logfont);
if(SUCCEEDED(hr)) {
hFont = CreateFontIndirectW(&logfont);
if(!hFont)
TRACE("Failed to create font\n");
}
CopyRect(&rt, pRect);
if(hFont)
oldFont = SelectObject(hdc, hFont);
if(dwTextFlags2 & DTT_GRAYED)
textColor = GetSysColor(COLOR_GRAYTEXT);
if (options->dwFlags & DTT_TEXTCOLOR)
textColor = options->crText;
else {
if(FAILED(GetThemeColor(hTheme, iPartId, iStateId, TMT_TEXTCOLOR, &textColor)))
textColor = GetTextColor(hdc);
}
oldTextColor = SetTextColor(hdc, textColor);
oldBkMode = SetBkMode(hdc, TRANSPARENT);
DrawTextW(hdc, pszText, iCharCount, &rt, dwTextFlags);
DrawTextW(hdc, pszText, iCharCount, rect, flags);
SetBkMode(hdc, oldBkMode);
SetTextColor(hdc, oldTextColor);

View File

@ -58,6 +58,7 @@
@ stdcall DrawThemeIcon(ptr ptr long long ptr ptr long)
@ stdcall DrawThemeParentBackground(ptr ptr ptr)
@ stdcall DrawThemeText(ptr ptr long long wstr long long long ptr)
@ stdcall DrawThemeTextEx(ptr ptr long long wstr long long ptr ptr)
@ stdcall EnableThemeDialogTexture(ptr long)
@ stdcall EnableTheming(long)
@ stdcall EndBufferedAnimation(ptr long)

View File

@ -53,6 +53,46 @@ HRESULT WINAPI DrawThemeParentBackground(HWND,HDC,RECT*);
HRESULT WINAPI DrawThemeText(HTHEME,HDC,int,int,LPCWSTR,int,DWORD,DWORD,
const RECT*);
/* 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
typedef int (WINAPI *DTT_CALLBACK_PROC)(HDC,LPWSTR,int,RECT*,UINT,LPARAM);
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 DrawThemeTextEx(HTHEME,HDC,int,int,LPCWSTR,int,DWORD,RECT*,
const DTTOPTS*);
#define ETDT_DISABLE 0x00000001
#define ETDT_ENABLE 0x00000002
#define ETDT_USETABTEXTURE 0x00000004