Author: gadamopoulos
Date: Mon May 15 15:34:43 2017
New Revision: 74551
URL:
http://svn.reactos.org/svn/reactos?rev=74551&view=rev
Log:
[UXTHEME] -Simplify ThemeDrawCaptionText.
Modified:
trunk/reactos/dll/win32/uxtheme/nonclient.c
Modified: trunk/reactos/dll/win32/uxtheme/nonclient.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/uxtheme/nonclien…
==============================================================================
--- trunk/reactos/dll/win32/uxtheme/nonclient.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/uxtheme/nonclient.c [iso-8859-1] Mon May 15 15:34:43 2017
@@ -109,9 +109,7 @@
return text;
}
-HRESULT WINAPI ThemeDrawCaptionText(HTHEME hTheme, HDC hdc, int iPartId, int iStateId,
- LPCWSTR pszText, int iCharCount, DWORD dwTextFlags,
- DWORD dwTextFlags2, const RECT *pRect, BOOL Active)
+HRESULT WINAPI ThemeDrawCaptionText(PDRAW_CONTEXT pcontext, RECT* pRect, int iPartId, int
iStateId, LPCWSTR pszText)
{
HRESULT hr;
HFONT hFont = NULL;
@@ -119,33 +117,34 @@
LOGFONTW logfont;
COLORREF textColor;
COLORREF oldTextColor;
- int oldBkMode;
- RECT rt;
-
+
hr = GetThemeSysFont(0,TMT_CAPTIONFONT,&logfont);
-
- if(SUCCEEDED(hr)) {
+ if(SUCCEEDED(hr))
hFont = CreateFontIndirectW(&logfont);
- }
- CopyRect(&rt, pRect);
+
if(hFont)
- oldFont = SelectObject(hdc, hFont);
+ oldFont = SelectObject(pcontext->hDC, hFont);
- if(dwTextFlags2 & DTT_GRAYED)
- textColor = GetSysColor(COLOR_GRAYTEXT);
- else if (!Active)
+ if (!pcontext->Active)
textColor = GetSysColor(COLOR_INACTIVECAPTIONTEXT);
else
textColor = GetSysColor(COLOR_CAPTIONTEXT);
-
- oldTextColor = SetTextColor(hdc, textColor);
- oldBkMode = SetBkMode(hdc, TRANSPARENT);
- DrawThemeText(hTheme, hdc, iPartId, iStateId, pszText, iCharCount, dwTextFlags,
dwTextFlags, pRect);
- SetBkMode(hdc, oldBkMode);
- SetTextColor(hdc, oldTextColor);
-
- if(hFont) {
- SelectObject(hdc, oldFont);
+
+ oldTextColor = SetTextColor(pcontext->hDC, textColor);
+ DrawThemeText(pcontext->theme,
+ pcontext->hDC,
+ iPartId,
+ iStateId,
+ pszText,
+ lstrlenW(pszText),
+ DT_VCENTER | DT_SINGLELINE | DT_END_ELLIPSIS,
+ 0,
+ pRect);
+ SetTextColor(pcontext->hDC, oldTextColor);
+
+ if(hFont)
+ {
+ SelectObject(pcontext->hDC, oldFont);
DeleteObject(hFont);
}
return S_OK;
@@ -381,17 +380,7 @@
/* Draw the caption */
if (CaptionText)
{
- /* FIXME: Use DrawThemeTextEx */
- ThemeDrawCaptionText(pcontext->theme,
- pcontext->hDC,
- iPart,
- iState,
- CaptionText,
- lstrlenW(CaptionText),
- DT_VCENTER | DT_SINGLELINE | DT_END_ELLIPSIS,
- 0,
- &rcPart,
- pcontext->Active);
+ ThemeDrawCaptionText(pcontext, &rcPart, iPart, iState, CaptionText);
HeapFree(GetProcessHeap(), 0, CaptionText);
}
}