11DWORD GetWindowStyleForDialog(std::optional<HWND>
const& owner_window) {
12 DWORD window_style = WS_OVERLAPPED | WS_CAPTION | WS_THICKFRAME;
15 window_style |= WS_MINIMIZEBOX | WS_SYSMENU;
21DWORD GetExtendedWindowStyleForDialog(std::optional<HWND>
const& owner_window) {
22 DWORD extended_window_style = WS_EX_DLGMODALFRAME;
26 if (GetWindowLongPtr(*owner_window, GWL_EXSTYLE) & WS_EX_TOOLWINDOW) {
27 extended_window_style |= WS_EX_TOOLWINDOW;
30 return extended_window_style;
41 std::optional<HWND>
const& owner_window)
45 .window_style = GetWindowStyleForDialog(owner_window),
46 .extended_window_style = GetExtendedWindowStyleForDialog(owner_window),
47 .box_constraints = constraints,
48 .initial_window_rect =
49 GetInitialRect(
engine, preferred_size, constraints, owner_window),
51 .owner_window = owner_window,
54 if (owner_window ==
nullptr) {
55 if (HMENU hMenu = GetSystemMenu(hwnd, FALSE)) {
56 EnableMenuItem(hMenu, SC_CLOSE, MF_BYCOMMAND | MF_GRAYED);
60 if (owner_window !=
nullptr) {
68 std::optional<HWND>
const& owner_window) {
69 auto const window_style = GetWindowStyleForDialog(owner_window);
70 auto const extended_window_style =
71 GetExtendedWindowStyleForDialog(owner_window);
72 std::optional<Size>
const window_size =
74 *
engine->windows_proc_table(),
78 extended_window_style, owner_window);
79 Point window_origin = {CW_USEDEFAULT, CW_USEDEFAULT};
80 if (owner_window && window_size.has_value()) {
83 DwmGetWindowAttribute(*owner_window, DWMWA_EXTENDED_FRAME_BOUNDS, &frame,
85 window_origin = {(frame.left + frame.right - window_size->width()) * 0.5,
86 (frame.top + frame.bottom - window_size->height()) * 0.5};
89 return {window_origin,
90 window_size ? *window_size :
Size{CW_USEDEFAULT, CW_USEDEFAULT}};
110 if (
auto const result =
116 if (LOWORD(wparam) != WA_INACTIVE) {
119 if (!IsWindowEnabled(hwnd)) {
122 SetActiveWindow(enabled_descendant->GetWindowHandle());
135void HostWindowDialog::UpdateModalState() {
147 std::optional<FlutterEngineDisplayId> display_id) {}
WindowProcDelegateManager * window_proc_delegate_manager()
HostWindowDialog(WindowManager *window_manager, FlutterWindowsEngine *engine, const WindowSizeRequest &preferred_size, const BoxConstraints &constraints, LPCWSTR title, std::optional< HWND > const &owner_window)
bool GetFullscreen() const override
void SetFullscreen(bool fullscreen, std::optional< FlutterEngineDisplayId > display_id) override
LRESULT HandleMessage(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) override
void InitializeFlutterView(HostWindowInitializationParams const ¶ms)
HostWindow * GetOwnerWindow() const
void UpdateModalStateLayer()
static void FocusRootViewOf(HostWindow *window)
FlutterWindowsEngine * engine_
virtual LRESULT HandleMessage(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
static std::optional< Size > GetWindowSizeForClientSize(WindowsProcTable const &win32, Size const &client_size, std::optional< Size > smallest, std::optional< Size > biggest, DWORD window_style, DWORD extended_window_style, std::optional< HWND > const &owner_hwnd)
HostWindow * FindFirstEnabledDescendant() const
std::optional< LRESULT > OnTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) const
WindowArchetype archetype
double preferred_view_height
double preferred_view_width