33 using namespace Drawing;
46 ::SetWindowPos(h_wnd,
nullptr, 0, 0, w, h,
47 SWP_ASYNCWINDOWPOS | SWP_NOACTIVATE
48 | SWP_NOMOVE | SWP_NOOWNERZORDER | SWP_NOSENDCHANGING | SWP_NOZORDER);
58 YAssert(::IsWindow(h),
"Invalid window handle found.");
59 YAssert(::GetWindowThreadProcessId(h,
nullptr) == ::GetCurrentThreadId(),
60 "Window not created on current thread found.");
61 YAssert(::GetWindowLongPtrW(h, GWLP_USERDATA) == 0,
62 "Invalid user data of window found.");
67 if(std::wcscmp(buf, WindowClassName) != 0)
68 throw LoggedEvent(
"Wrong windows class name found.");
69 ::SetWindowLongPtrW(h_wnd, GWLP_USERDATA, ::LONG_PTR(
this));
70 ::SetWindowPos(h_wnd,
nullptr, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE
71 | SWP_NOOWNERZORDER | SWP_NOREDRAW | SWP_NOSENDCHANGING | SWP_NOSIZE
73 e.AddMappedItem(h_wnd,
this);
77 ::SetWindowLongPtrW(h_wnd, GWLP_USERDATA, ::LONG_PTR());
78 env.get().RemoveMappedItem(h_wnd);
81 ::DestroyWindow(h_wnd);
85 Window::GetInputBounds() const
ynothrow
89 ::GetClientRect(h_wnd, &rect);
91 YAssert(rect.right - rect.left >= 0 && rect.bottom - rect.top >= 0,
92 "Invalid boundary found.");
94 return {
Point(rect.left, rect.top),
Point(rect.right, rect.bottom)};
100 ::SendNotifyMessageW(h_wnd, WM_CLOSE, 0, 0);
106 ResizeWindow(GetNativeHandle(), s.Width, s.Height);
110 Window::ResizeClient(
const Size& s)
112 const auto h_wnd(GetNativeHandle());
113 ::RECT rect{0, 0, s.Width, s.Height};
115 ::AdjustWindowRect(&rect, ::GetWindowLongW(h_wnd, GWL_STYLE), FALSE);
116 ResizeWindow(h_wnd, rect.right - rect.left, rect.bottom - rect.top);
126 Window::OnLostFocus()
138 ::ShowWindowAsync(h_wnd, SW_SHOWNORMAL);