Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
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
 
WindowArchetype GetArchetype () 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, GetWindowPositionCallback get_position_callback, HWND parent)
 
static std::unique_ptr< HostWindowCreatePopupWindow (WindowManager *window_manager, FlutterWindowsEngine *engine, const WindowConstraints &preferred_constraints, 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< SizeGetWindowSizeForClientSize (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 36 of file host_window_dialog.cc.

42 : HostWindow(window_manager, engine) {
43 InitializeFlutterView(HostWindowInitializationParams{
44 .archetype = WindowArchetype::kDialog,
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),
50 .title = title,
51 .owner_window = owner_window,
52 });
53 auto hwnd = window_handle_;
54 if (owner_window == nullptr) {
55 if (HMENU hMenu = GetSystemMenu(hwnd, FALSE)) {
56 EnableMenuItem(hMenu, SC_CLOSE, MF_BYCOMMAND | MF_GRAYED);
57 }
58 }
59
60 if (owner_window != nullptr) {
61 UpdateModalState();
62 }
63}
void InitializeFlutterView(HostWindowInitializationParams const &params)
HostWindow(WindowManager *window_manager, FlutterWindowsEngine *engine)
FlutterEngine engine
Definition main.cc:84

References flutter::HostWindow::HostWindowInitializationParams::archetype, engine, 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 149 of file host_window_dialog.cc.

149 {
150 return false;
151}

◆ HandleMessage()

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

Reimplemented from flutter::HostWindow.

Definition at line 93 of file host_window_dialog.cc.

96 {
97 switch (message) {
98 case WM_DESTROY:
100 if (HostWindow* const owner_window = GetOwnerWindow()) {
101 UpdateModalState();
102 FocusRootViewOf(owner_window);
103 }
104 break;
105
106 case WM_ACTIVATE:
107 // Forward the message to Dart before handling it on the C++ side.
108 // This ensures that Dart-side handlers (e.g. popup dismiss logic)
109 // can observe activation changes caused by dialog windows.
110 if (auto const result =
112 window_handle_, message, wparam, lparam)) {
113 return *result;
114 }
115
116 if (LOWORD(wparam) != WA_INACTIVE) {
117 // Prevent disabled window from being activated using the task
118 // switcher.
119 if (!IsWindowEnabled(hwnd)) {
120 // Redirect focus and activation to the first enabled descendant.
121 if (HostWindow* enabled_descendant = FindFirstEnabledDescendant()) {
122 SetActiveWindow(enabled_descendant->GetWindowHandle());
123 FocusRootViewOf(this);
124 }
125 return 0;
126 }
127 FocusRootViewOf(this);
128 }
129 return 0;
130 }
131
132 return HostWindow::HandleMessage(hwnd, message, wparam, lparam);
133}
WindowProcDelegateManager * window_proc_delegate_manager()
HostWindow * GetOwnerWindow() const
static void FocusRootViewOf(HostWindow *window)
FlutterWindowsEngine * engine_
virtual LRESULT HandleMessage(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
HostWindow * FindFirstEnabledDescendant() const
std::optional< LRESULT > OnTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) const
const char * message

References flutter::HostWindow::engine_, flutter::HostWindow::FindFirstEnabledDescendant(), flutter::HostWindow::FocusRootViewOf(), flutter::HostWindow::GetOwnerWindow(), flutter::HostWindow::HandleMessage(), flutter::HostWindow::is_being_destroyed_, message, flutter::WindowProcDelegateManager::OnTopLevelWindowProc(), flutter::HostWindow::window_handle_, and flutter::FlutterWindowsEngine::window_proc_delegate_manager().

◆ SetFullscreen()

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

Reimplemented from flutter::HostWindow.

Definition at line 145 of file host_window_dialog.cc.

147 {}

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