mirror of
https://github.com/narzoul/DDrawCompat
synced 2024-12-30 08:55:36 +01:00
Added manual rendering of default push button highlight
This commit is contained in:
parent
3588072155
commit
0244c8c022
@ -57,6 +57,10 @@ namespace
|
|||||||
updateScrolledWindow(reinterpret_cast<HWND>(ret->lParam));
|
updateScrolledWindow(reinterpret_cast<HWND>(ret->lParam));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (BM_SETSTYLE == ret->message)
|
||||||
|
{
|
||||||
|
RedrawWindow(ret->hwnd, nullptr, nullptr, RDW_ERASE | RDW_FRAME | RDW_INVALIDATE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return CallNextHookEx(nullptr, nCode, wParam, lParam);
|
return CallNextHookEx(nullptr, nCode, wParam, lParam);
|
||||||
@ -73,6 +77,19 @@ namespace
|
|||||||
&disableTransitions, sizeof(disableTransitions));
|
&disableTransitions, sizeof(disableTransitions));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool drawButtonHighlight(HWND hwnd, const RECT& windowRect, HDC compatDc)
|
||||||
|
{
|
||||||
|
if (SendMessage(hwnd, WM_GETDLGCODE, 0, 0) & DLGC_DEFPUSHBUTTON)
|
||||||
|
{
|
||||||
|
RECT rect = {};
|
||||||
|
SetRect(&rect, 0, 0, windowRect.right - windowRect.left, windowRect.bottom - windowRect.top);
|
||||||
|
FrameRect(compatDc, &rect, GetSysColorBrush(COLOR_WINDOWFRAME));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void eraseBackground(HWND hwnd, HDC dc)
|
void eraseBackground(HWND hwnd, HDC dc)
|
||||||
{
|
{
|
||||||
if (CompatGdi::beginGdiRendering())
|
if (CompatGdi::beginGdiRendering())
|
||||||
@ -115,23 +132,27 @@ namespace
|
|||||||
{
|
{
|
||||||
RECT windowRect = {};
|
RECT windowRect = {};
|
||||||
GetWindowRect(hwnd, &windowRect);
|
GetWindowRect(hwnd, &windowRect);
|
||||||
RECT clientRect = {};
|
|
||||||
GetClientRect(hwnd, &clientRect);
|
|
||||||
POINT clientOrigin = {};
|
|
||||||
ClientToScreen(hwnd, &clientOrigin);
|
|
||||||
|
|
||||||
CompatGdi::TitleBar titleBar(hwnd, compatDc);
|
if (!drawButtonHighlight(hwnd, windowRect, compatDc))
|
||||||
titleBar.drawAll();
|
{
|
||||||
titleBar.excludeFromClipRegion();
|
CompatGdi::TitleBar titleBar(hwnd, compatDc);
|
||||||
|
titleBar.drawAll();
|
||||||
|
titleBar.excludeFromClipRegion();
|
||||||
|
|
||||||
CompatGdi::ScrollBar scrollBar(hwnd, compatDc);
|
CompatGdi::ScrollBar scrollBar(hwnd, compatDc);
|
||||||
scrollBar.drawAll();
|
scrollBar.drawAll();
|
||||||
scrollBar.excludeFromClipRegion();
|
scrollBar.excludeFromClipRegion();
|
||||||
|
|
||||||
OffsetRect(&clientRect, clientOrigin.x - windowRect.left, clientOrigin.y - windowRect.top);
|
RECT clientRect = {};
|
||||||
ExcludeClipRect(compatDc, clientRect.left, clientRect.top, clientRect.right, clientRect.bottom);
|
GetClientRect(hwnd, &clientRect);
|
||||||
CALL_ORIG_GDI(BitBlt)(compatDc, 0, 0,
|
POINT clientOrigin = {};
|
||||||
windowRect.right - windowRect.left, windowRect.bottom - windowRect.top, windowDc, 0, 0, SRCCOPY);
|
ClientToScreen(hwnd, &clientOrigin);
|
||||||
|
|
||||||
|
OffsetRect(&clientRect, clientOrigin.x - windowRect.left, clientOrigin.y - windowRect.top);
|
||||||
|
ExcludeClipRect(compatDc, clientRect.left, clientRect.top, clientRect.right, clientRect.bottom);
|
||||||
|
CALL_ORIG_GDI(BitBlt)(compatDc, 0, 0,
|
||||||
|
windowRect.right - windowRect.left, windowRect.bottom - windowRect.top, windowDc, 0, 0, SRCCOPY);
|
||||||
|
}
|
||||||
|
|
||||||
CompatGdiDc::releaseDc(windowDc);
|
CompatGdiDc::releaseDc(windowDc);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user