From fe078af239f3b73651c32bb1cdb158dcab39ad5c Mon Sep 17 00:00:00 2001 From: Jonas Kümmerlin Date: Sun, 30 Jun 2019 12:48:57 +0200 Subject: label reimplement --- alf/alfcompat.cpp | 41 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) (limited to 'alf/alfcompat.cpp') diff --git a/alf/alfcompat.cpp b/alf/alfcompat.cpp index 3895545..8672bb8 100644 --- a/alf/alfcompat.cpp +++ b/alf/alfcompat.cpp @@ -260,11 +260,44 @@ ALF_Compat_fallbackIsThemeBackgroundPartiallyTransparent(HTHEME hTheme, int iPar static HRESULT WINAPI ALF_Compat_fallbackDrawThemeParentBackground(HWND hwnd, HDC hdc, RECT *prc) { - (void)hwnd; - (void)hdc; - (void)prc; + HWND parent = GetParent(hwnd); + if (!parent) + return E_NOTIMPL; + + RECT rc; + if (prc) { + rc = *prc; + } else { + GetClientRect(hwnd, &rc); + } + MapWindowRect(hwnd, parent, &rc); - return E_NOTIMPL; + RECT childr; + GetClientRect(hwnd, &childr); + MapWindowRect(hwnd, parent, &childr); + + POINT o; + OffsetViewportOrgEx(hdc, -childr.left, -childr.top, &o); + + HRGN oldClipRgn = CreateRectRgn(0, 0, 0, 0); + if (!GetClipRgn(hdc, oldClipRgn)) { + DeleteObject(oldClipRgn); + oldClipRgn = NULL; + } + + IntersectClipRect(hdc, rc.left, rc.top, rc.right, rc.bottom); + + SendMessage(parent, WM_ERASEBKGND, (WPARAM)hdc, 0); + SendMessage(parent, WM_PRINTCLIENT, (WPARAM)hdc, (LPARAM)PRF_CLIENT); + + SelectClipRgn(hdc, oldClipRgn); + if (oldClipRgn) { + DeleteObject(oldClipRgn); + } + + SetViewportOrgEx(hdc, o.x, o.y, NULL); + + return S_OK; } static HRESULT WINAPI -- cgit v1.2.3