Flutter Engine
The Flutter Engine
Classes | Public Member Functions | List of all members
flutter::WindowProcDelegateManager Class Reference

#include <window_proc_delegate_manager.h>

Public Member Functions

 WindowProcDelegateManager ()
 
 ~WindowProcDelegateManager ()
 
void RegisterTopLevelWindowProcDelegate (FlutterDesktopWindowProcCallback callback, void *user_data)
 
void UnregisterTopLevelWindowProcDelegate (FlutterDesktopWindowProcCallback callback)
 
std::optional< LRESULTOnTopLevelWindowProc (HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) const
 

Detailed Description

Definition at line 20 of file window_proc_delegate_manager.h.

Constructor & Destructor Documentation

◆ WindowProcDelegateManager()

flutter::WindowProcDelegateManager::WindowProcDelegateManager ( )
explicitdefault

◆ ~WindowProcDelegateManager()

flutter::WindowProcDelegateManager::~WindowProcDelegateManager ( )
default

Member Function Documentation

◆ OnTopLevelWindowProc()

std::optional< LRESULT > flutter::WindowProcDelegateManager::OnTopLevelWindowProc ( HWND  hwnd,
UINT  message,
WPARAM  wparam,
LPARAM  lparam 
) const

Definition at line 37 of file window_proc_delegate_manager.cc.

41 {
42 std::optional<LRESULT> result;
43 for (const auto& delegate : delegates_) {
44 LPARAM handler_result;
45 // Stop as soon as any delegate indicates that it has handled the message.
46 if (delegate.callback(hwnd, message, wparam, lparam, delegate.user_data,
47 &handler_result)) {
48 result = handler_result;
49 break;
50 }
51 }
52 return result;
53}
GAsyncResult * result
Win32Message message
LONG_PTR LPARAM
Definition: windows_types.h:60

◆ RegisterTopLevelWindowProcDelegate()

void flutter::WindowProcDelegateManager::RegisterTopLevelWindowProcDelegate ( FlutterDesktopWindowProcCallback  callback,
void *  user_data 
)

Definition at line 16 of file window_proc_delegate_manager.cc.

18 {
20
21 delegates_.push_back(WindowProcDelegate{
22 .callback = callback,
23 .user_data = user_data,
24 });
25}
void UnregisterTopLevelWindowProcDelegate(FlutterDesktopWindowProcCallback callback)
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
std::function< std::optional< LRESULT >(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)> WindowProcDelegate
void * user_data

◆ UnregisterTopLevelWindowProcDelegate()

void flutter::WindowProcDelegateManager::UnregisterTopLevelWindowProcDelegate ( FlutterDesktopWindowProcCallback  callback)

Definition at line 27 of file window_proc_delegate_manager.cc.

28 {
29 delegates_.erase(
30 std::remove_if(delegates_.begin(), delegates_.end(),
31 [&callback](const WindowProcDelegate& delegate) {
32 return delegate.callback == callback;
33 }),
34 delegates_.end());
35}

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