int hasClip = -1;
TRACE("(%p,%p,%p)\n", hwnd, hdc, prc);
+
+ if (!IsWindow(hwnd) || !hdc)
+ return E_HANDLE;
+
+ if (prc && IsBadReadPtr (prc, sizeof(RECT)))
+ return E_POINTER;
+
hParent = GetParent(hwnd);
if(!hParent)
- hParent = hwnd;
+ return S_OK;
+
if(prc) {
- CopyRect(&rt, prc);
+ rt = *prc;
MapWindowPoints(hwnd, hParent, (LPPOINT)&rt, 2);
-
+
clip = CreateRectRgn(0,0,1,1);
hasClip = GetClipRgn(hdc, clip);
if(hasClip == -1)
opts.dwFlags = 0;
if(pClipRect) {
opts.dwFlags |= DTBG_CLIPRECT;
- CopyRect(&opts.rcClip, pClipRect);
+ opts.rcClip = *pClipRect;
}
return DrawThemeBackgroundEx(hTheme, hdc, iPartId, iStateId, pRect, &opts);
}
int sizingtype = ST_STRETCH;
BOOL uniformsizing = FALSE;
- CopyRect(&rcDst, prc);
+ rcDst = *prc;
dstSize.x = rcDst.right-rcDst.left;
dstSize.y = rcDst.bottom-rcDst.top;
}
oldSrc = SelectObject(hdcSrc, bmpSrc);
- CopyRect(&rcDst, pRect);
+ rcDst = *pRect;
get_transparency (hTheme, iPartId, iStateId, hasAlpha, &transparent,
&transparentcolor, FALSE);
GetThemeMargins(hTheme, hdc, iPartId, iStateId, TMT_SIZINGMARGINS, NULL, &sm);
/* Resize source image if destination smaller than margins */
+#ifndef __REACTOS__
+ /* Revert Wine Commit 2b650fa as it breaks themed Explorer Toolbar Separators
+ FIXME: Revisit this when the bug is fixed. CORE-9636 and Wine Bug #38538 */
if (sm.cyTopHeight + sm.cyBottomHeight > dstSize.y || sm.cxLeftWidth + sm.cxRightWidth > dstSize.x) {
if (sm.cyTopHeight + sm.cyBottomHeight > dstSize.y) {
sm.cyTopHeight = MulDiv(sm.cyTopHeight, dstSize.y, srcSize.y);
rcSrc.right = srcSize.x;
rcSrc.bottom = srcSize.y;
}
+#endif /* __REACTOS__ */
hdcDst = hdc;
OffsetViewportOrgEx(hdcDst, rcDst.left, rcDst.top, &org);
DeleteDC(hdcSrc);
if (bmpSrcResized) DeleteObject(bmpSrcResized);
if (hdcOrigSrc) DeleteDC(hdcOrigSrc);
- CopyRect(pRect, &rcDst);
+ *pRect = rcDst;
return hr;
}
HRESULT hr;
RECT rt;
- CopyRect(&rt, pRect);
+ rt = *pRect;
hr = UXTHEME_DrawBorderRectangle(hTheme, hdc, iPartId, iStateId, &rt, pOptions);
if(FAILED(hr))
else
IntersectClipRect(hdc, opts->rcClip.left, opts->rcClip.top, opts->rcClip.right, opts->rcClip.bottom);
}
- CopyRect(&rt, pRect);
+ rt = *pRect;
if(bgtype == BT_IMAGEFILE)
hr = UXTHEME_DrawImageBackground(hTheme, hdc, iPartId, iStateId, &rt, opts);
FIXME("%d %d: stub\n", iPartId, iStateId);
if(!hTheme)
return E_HANDLE;
- return ERROR_CALL_NOT_IMPLEMENTED;
+ return E_NOTIMPL;
}
+typedef int (WINAPI * DRAWSHADOWTEXT)(HDC hdc, LPCWSTR pszText, UINT cch, RECT *prc, DWORD dwFlags,
+ COLORREF crText, COLORREF crShadow, int ixOffset, int iyOffset);
+
/***********************************************************************
* DrawThemeText (UXTHEME.@)
*/
LOGFONTW logfont;
COLORREF textColor;
COLORREF oldTextColor;
+ COLORREF shadowColor;
+ POINT ptShadowOffset;
int oldBkMode;
RECT rt;
-
+ int iShadowType;
+
TRACE("%d %d: stub\n", iPartId, iStateId);
if(!hTheme)
return E_HANDLE;
-
+
hr = GetThemeFont(hTheme, hdc, iPartId, iStateId, TMT_FONT, &logfont);
- if(SUCCEEDED(hr)) {
+ if(SUCCEEDED(hr))
+ {
hFont = CreateFontIndirectW(&logfont);
if(!hFont)
- TRACE("Failed to create font\n");
+ {
+ ERR("Failed to create font\n");
+ }
}
+
CopyRect(&rt, pRect);
if(hFont)
oldFont = SelectObject(hdc, hFont);
-
+
+ oldBkMode = SetBkMode(hdc, TRANSPARENT);
+
if(dwTextFlags2 & DTT_GRAYED)
textColor = GetSysColor(COLOR_GRAYTEXT);
else {
if(FAILED(GetThemeColor(hTheme, iPartId, iStateId, TMT_TEXTCOLOR, &textColor)))
textColor = GetTextColor(hdc);
}
+
+ hr = GetThemeEnumValue(hTheme, iPartId, iStateId, TMT_TEXTSHADOWTYPE, &iShadowType);
+ if (SUCCEEDED(hr))
+ {
+ ERR("Got shadow type %d\n", iShadowType);
+
+ hr = GetThemeColor(hTheme, iPartId, iStateId, TMT_TEXTSHADOWCOLOR, &shadowColor);
+ if (FAILED(hr))
+ {
+ ERR("GetThemeColor failed\n");
+ }
+
+ hr = GetThemePosition(hTheme, iPartId, iStateId, TMT_TEXTSHADOWOFFSET, &ptShadowOffset);
+ if (FAILED(hr))
+ {
+ ERR("GetThemePosition failed\n");
+ }
+
+ if (iShadowType == TST_SINGLE)
+ {
+ oldTextColor = SetTextColor(hdc, shadowColor);
+ OffsetRect(&rt, ptShadowOffset.x, ptShadowOffset.y);
+ DrawTextW(hdc, pszText, iCharCount, &rt, dwTextFlags);
+ OffsetRect(&rt, -ptShadowOffset.x, -ptShadowOffset.y);
+ SetTextColor(hdc, oldTextColor);
+ }
+ else if (iShadowType == TST_CONTINUOUS)
+ {
+ HANDLE hcomctl32 = GetModuleHandleW(L"comctl32.dll");
+ DRAWSHADOWTEXT pDrawShadowText;
+ if (!hcomctl32)
+ {
+ hcomctl32 = LoadLibraryW(L"comctl32.dll");
+ if (!hcomctl32)
+ ERR("Failed to load comctl32\n");
+ }
+
+ pDrawShadowText = (DRAWSHADOWTEXT)GetProcAddress(hcomctl32, "DrawShadowText");
+ if (pDrawShadowText)
+ {
+ pDrawShadowText(hdc, pszText, iCharCount, &rt, dwTextFlags, textColor, shadowColor, ptShadowOffset.x, ptShadowOffset.y);
+ goto cleanup;
+ }
+ }
+ }
+
oldTextColor = SetTextColor(hdc, textColor);
- oldBkMode = SetBkMode(hdc, TRANSPARENT);
DrawTextW(hdc, pszText, iCharCount, &rt, dwTextFlags);
- SetBkMode(hdc, oldBkMode);
SetTextColor(hdc, oldTextColor);
+cleanup:
+ SetBkMode(hdc, oldBkMode);
if(hFont) {
SelectObject(hdc, oldFont);
/* If nothing was found, leave unchanged */
}
- TRACE("left:%d,top:%d,right:%d,bottom:%d\n", pContentRect->left, pContentRect->top, pContentRect->right, pContentRect->bottom);
+ TRACE("%s\n", wine_dbgstr_rect(pContentRect));
return S_OK;
}
/* If nothing was found, leave unchanged */
}
- TRACE("left:%d,top:%d,right:%d,bottom:%d\n", pExtentRect->left, pExtentRect->top, pExtentRect->right, pExtentRect->bottom);
+ TRACE("%s\n", wine_dbgstr_rect(pExtentRect));
return S_OK;
}
return E_HANDLE;
if(pBoundingRect)
- CopyRect(&rt, pBoundingRect);
-
+ rt = *pBoundingRect;
+
hr = GetThemeFont(hTheme, hdc, iPartId, iStateId, TMT_FONT, &logfont);
if(SUCCEEDED(hr)) {
hFont = CreateFontIndirectW(&logfont);
oldFont = SelectObject(hdc, hFont);
DrawTextW(hdc, pszText, iCharCount, &rt, dwTextFlags|DT_CALCRECT);
- CopyRect(pExtentRect, &rt);
+ *pExtentRect = rt;
if(hFont) {
SelectObject(hdc, oldFont);
GetThemeEnumValue(hTheme, iPartId, iStateId, TMT_BGTYPE, &bgtype);
+#ifdef __REACTOS__
+ if (bgtype == BT_NONE) return TRUE;
+#endif
if (bgtype != BT_IMAGEFILE) return FALSE;
if(FAILED (UXTHEME_LoadImage (hTheme, 0, iPartId, iStateId, &rect, FALSE,