Flutter Windows Embedder
flutter::HostWindowDialog Class Reference

#include <host_window_dialog.h>

Inheritance diagram for flutter::HostWindowDialog:
flutter::HostWindow

Public Member Functions

 HostWindowDialog (WindowManager *window_manager, FlutterWindowsEngine *engine, const WindowSizeRequest &preferred_size, const BoxConstraints &constraints, LPCWSTR title, std::optional< HWND > const &owner_window)
 
void SetFullscreen (bool fullscreen, std::optional< FlutterEngineDisplayId > display_id) override
 
bool GetFullscreen () const override
 
- Public Member Functions inherited from flutter::HostWindow
virtual ~HostWindow ()
 
HWND GetWindowHandle () const
 
HWND GetFlutterViewWindowHandle () const
 
void SetContentSize (const WindowSizeRequest &size)
 
void SetConstraints (const WindowConstraints &constraints)
 
HostWindowGetOwnerWindow () const
 
void UpdateModalStateLayer ()
 

Protected Member Functions

LRESULT HandleMessage (HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) override
 
- Protected Member Functions inherited from flutter::HostWindow
void InitializeFlutterView (HostWindowInitializationParams const &params)
 
 HostWindow (WindowManager *window_manager, FlutterWindowsEngine *engine)
 
void EnableRecursively (bool enable)
 
HostWindowFindFirstEnabledDescendant () const
 
std::vector< HostWindow * > GetOwnedWindows () const
 
void DisableRecursively ()
 
 FML_DISALLOW_COPY_AND_ASSIGN (HostWindow)
 

Additional Inherited Members

- Static Public Member Functions inherited from flutter::HostWindow
static std::unique_ptr< HostWindowCreateRegularWindow (WindowManager *window_manager, FlutterWindowsEngine *engine, const WindowSizeRequest &preferred_size, const WindowConstraints &preferred_constraints, LPCWSTR title)
 
static std::unique_ptr< HostWindowCreateDialogWindow (WindowManager *window_manager, FlutterWindowsEngine *engine, const WindowSizeRequest &preferred_size, const WindowConstraints &preferred_constraints, LPCWSTR title, HWND parent)
 
static std::unique_ptr< HostWindowCreateTooltipWindow (WindowManager *window_manager, FlutterWindowsEngine *engine, const WindowConstraints &preferred_constraints, bool is_sized_to_content, GetWindowPositionCallback get_position_callback, HWND parent)
 
static HostWindowGetThisFromHandle (HWND hwnd)
 
static ActualWindowSize GetWindowContentSize (HWND hwnd)
 
- Static Protected Member Functions inherited from flutter::HostWindow
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)
 
static void FocusRootViewOf (HostWindow *window)
 
static LRESULT WndProc (HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
 
- Protected Attributes inherited from flutter::HostWindow
friend WindowManager
 
WindowManager *const window_manager_ = nullptr
 
FlutterWindowsEngineengine_
 
std::unique_ptr< FlutterWindowsViewControllerview_controller_
 
WindowArchetype archetype_ = WindowArchetype::kRegular
 
HWND window_handle_
 
BoxConstraints box_constraints_
 
bool is_being_destroyed_ = false
 
bool is_fullscreen_ = false
 
SavedWindowInfo saved_window_info_
 
Microsoft::WRL::ComPtr< ITaskbarList2 > task_bar_list_
 

Detailed Description

Definition at line 11 of file host_window_dialog.h.

Constructor & Destructor Documentation

◆ HostWindowDialog()

flutter::HostWindowDialog::HostWindowDialog ( WindowManager window_manager,
FlutterWindowsEngine engine,
const WindowSizeRequest preferred_size,
const BoxConstraints &  constraints,
LPCWSTR  title,
std::optional< HWND > const &  owner_window 
)

Definition at line 35 of file host_window_dialog.cc.

41  : HostWindow(window_manager, engine) {
42  InitializeFlutterView(HostWindowInitializationParams{
43  .archetype = WindowArchetype::kDialog,
44  .window_style = GetWindowStyleForDialog(owner_window),
45  .extended_window_style = GetExtendedWindowStyleForDialog(owner_window),
46  .box_constraints = constraints,
47  .initial_window_rect =
48  GetInitialRect(engine, preferred_size, constraints, owner_window),
49  .title = title,
50  .owner_window = owner_window,
51  });
52  auto hwnd = window_handle_;
53  if (owner_window == nullptr) {
54  if (HMENU hMenu = GetSystemMenu(hwnd, FALSE)) {
55  EnableMenuItem(hMenu, SC_CLOSE, MF_BYCOMMAND | MF_GRAYED);
56  }
57  }
58 
59  if (owner_window != nullptr) {
60  UpdateModalState();
61  }
62 }
void InitializeFlutterView(HostWindowInitializationParams const &params)
Definition: host_window.cc:245
HostWindow(WindowManager *window_manager, FlutterWindowsEngine *engine)
Definition: host_window.cc:241

References flutter::HostWindow::HostWindowInitializationParams::archetype, flutter::HostWindow::InitializeFlutterView(), flutter::kDialog, and flutter::HostWindow::window_handle_.

Member Function Documentation

◆ GetFullscreen()

bool flutter::HostWindowDialog::GetFullscreen ( ) const
overridevirtual

Reimplemented from flutter::HostWindow.

Definition at line 139 of file host_window_dialog.cc.

139  {
140  return false;
141 }

◆ HandleMessage()

LRESULT flutter::HostWindowDialog::HandleMessage ( HWND  hwnd,
UINT  message,
WPARAM  wparam,
LPARAM  lparam 
)
overrideprotectedvirtual

Reimplemented from flutter::HostWindow.

Definition at line 92 of file host_window_dialog.cc.

95  {
96  switch (message) {
97  case WM_DESTROY:
98  is_being_destroyed_ = true;
99  if (HostWindow* const owner_window = GetOwnerWindow()) {
100  UpdateModalState();
101  FocusRootViewOf(owner_window);
102  }
103  break;
104 
105  case WM_ACTIVATE:
106  if (LOWORD(wparam) != WA_INACTIVE) {
107  // Prevent disabled window from being activated using the task
108  // switcher.
109  if (!IsWindowEnabled(hwnd)) {
110  // Redirect focus and activation to the first enabled descendant.
111  if (HostWindow* enabled_descendant = FindFirstEnabledDescendant()) {
112  SetActiveWindow(enabled_descendant->GetWindowHandle());
113  FocusRootViewOf(this);
114  }
115  return 0;
116  }
117  FocusRootViewOf(this);
118  }
119  return 0;
120  }
121 
122  return HostWindow::HandleMessage(hwnd, message, wparam, lparam);
123 }
HostWindow * GetOwnerWindow() const
Definition: host_window.cc:829
static void FocusRootViewOf(HostWindow *window)
Definition: host_window.cc:358
virtual LRESULT HandleMessage(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
Definition: host_window.cc:382
HostWindow * FindFirstEnabledDescendant() const
Definition: host_window.cc:792
Win32Message message

References flutter::HostWindow::FindFirstEnabledDescendant(), flutter::HostWindow::FocusRootViewOf(), flutter::HostWindow::GetOwnerWindow(), flutter::HostWindow::HandleMessage(), flutter::HostWindow::is_being_destroyed_, and message.

◆ SetFullscreen()

void flutter::HostWindowDialog::SetFullscreen ( bool  fullscreen,
std::optional< FlutterEngineDisplayId >  display_id 
)
overridevirtual

Reimplemented from flutter::HostWindow.

Definition at line 135 of file host_window_dialog.cc.

137  {}

The documentation for this class was generated from the following files: