Flutter Windows Embedder
host_window_dialog.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef FLUTTER_SHELL_PLATFORM_WINDOWS_HOST_WINDOW_DIALOG_H_
6 #define FLUTTER_SHELL_PLATFORM_WINDOWS_HOST_WINDOW_DIALOG_H_
7 
8 #include <optional>
9 
10 #include "host_window_sized.h"
11 
12 namespace flutter {
14  public:
15  // Creates a dialog window.
16  //
17  // If |owner_window| is not null, the dialog will be modal to the owner.
18  // This also affects the dialog window's styling.
19  //
20  // If |sized_to_content| is true, the window is initially sized to the
21  // minimum of |constraints| and will automatically resize to its rendered
22  // content after each frame. If |resizable| is false, the window will
23  // continue to track content size and its resize border is removed.
24  // If |resizable| is true, the user may resize the window after the initial
25  // content-based sizing.
26  //
27  // If |sized_to_content| is false, the window is created with the size
28  // specified in |preferred_size|.
29  HostWindowDialog(WindowManager* window_manager,
30  FlutterWindowsEngine* engine,
31  const WindowSizeRequest& preferred_size,
32  const BoxConstraints& constraints,
33  LPCWSTR title,
34  std::optional<HWND> const& owner_window,
35  bool sized_to_content,
36  bool resizable);
37 
38  ~HostWindowDialog() override;
39 
40  void SetFullscreen(bool fullscreen,
41  std::optional<FlutterEngineDisplayId> display_id) override;
42  bool GetFullscreen() const override;
43 
44  protected:
45  LRESULT HandleMessage(HWND hwnd,
46  UINT message,
47  WPARAM wparam,
48  LPARAM lparam) override;
49 
50  private:
51  // Enforces modal behavior. This favors enabling most recently created
52  // modal window higest up in the window hierarchy.
53  void UpdateModalState();
54 
55  static DWORD GetWindowStyleForDialog(std::optional<HWND> const& owner_window,
56  bool resizable);
57  static DWORD GetExtendedWindowStyleForDialog(
58  std::optional<HWND> const& owner_window);
59  static Rect GetInitialRect(FlutterWindowsEngine* engine,
60  const WindowSizeRequest& preferred_size,
61  const BoxConstraints& constraints,
62  std::optional<HWND> const& owner_window,
63  bool sized_to_content,
64  bool resizable);
65 };
66 } // namespace flutter
67 
68 #endif // FLUTTER_SHELL_PLATFORM_WINDOWS_HOST_WINDOW_DIALOG_H_
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
HostWindowDialog(WindowManager *window_manager, FlutterWindowsEngine *engine, const WindowSizeRequest &preferred_size, const BoxConstraints &constraints, LPCWSTR title, std::optional< HWND > const &owner_window, bool sized_to_content, bool resizable)
Win32Message message