1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Direct2D: Add initial support

This commit is contained in:
reuk 2024-04-15 19:15:28 +01:00
parent 0e6a358c45
commit 19061e6d17
No known key found for this signature in database
GPG key ID: FCB43929F012EE5C
83 changed files with 8182 additions and 1558 deletions

View file

@ -67,6 +67,8 @@ public:
ScopedThreadDPIAwarenessSetter threadDpiAwarenessSetter { hwnd };
SetWindowPos (hwnd, nullptr, area.getX(), area.getY(), area.getWidth(), area.getHeight(), flagsToSend);
invalidateHWNDAndChildren();
}
}
@ -89,7 +91,7 @@ public:
ShowWindow (hwnd, isShowing ? SW_SHOWNA : SW_HIDE);
if (isShowing)
InvalidateRect (hwnd, nullptr, 0);
InvalidateRect (hwnd, nullptr, TRUE);
}
void componentVisibilityChanged() override
@ -120,6 +122,17 @@ public:
return {};
}
void invalidateHWNDAndChildren()
{
EnumChildWindows (hwnd, invalidateHwndCallback, 0);
}
static BOOL WINAPI invalidateHwndCallback (HWND hwnd, LPARAM)
{
InvalidateRect (hwnd, nullptr, TRUE);
return TRUE;
}
HWND hwnd;
private:
@ -127,14 +140,14 @@ private:
{
if (currentPeer != nullptr)
{
auto windowFlags = GetWindowLongPtr (hwnd, -16);
auto windowFlags = GetWindowLongPtr (hwnd, GWL_STYLE);
using FlagType = decltype (windowFlags);
windowFlags &= ~(FlagType) WS_POPUP;
windowFlags |= (FlagType) WS_CHILD;
SetWindowLongPtr (hwnd, -16, windowFlags);
SetWindowLongPtr (hwnd, GWL_STYLE, windowFlags);
SetParent (hwnd, (HWND) currentPeer->getNativeHandle());
componentMovedOrResized (true, true);