Flutter Windows Embedder
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< LRESULT > OnTopLevelWindowProc (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 }

References message.

Referenced by flutter::testing::TEST().

◆ 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 }

References callback, UnregisterTopLevelWindowProcDelegate(), and user_data.

Referenced by FlutterDesktopPluginRegistrarRegisterTopLevelWindowProcDelegate(), and flutter::testing::TEST().

◆ 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 }

References callback.

Referenced by FlutterDesktopPluginRegistrarUnregisterTopLevelWindowProcDelegate(), RegisterTopLevelWindowProcDelegate(), and flutter::testing::TEST().


The documentation for this class was generated from the following files:
user_data
void * user_data
Definition: flutter_windows_view_unittests.cc:53
flutter::WindowProcDelegateManager::UnregisterTopLevelWindowProcDelegate
void UnregisterTopLevelWindowProcDelegate(FlutterDesktopWindowProcCallback callback)
Definition: window_proc_delegate_manager.cc:27
flutter::WindowProcDelegate
std::function< std::optional< LRESULT >(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)> WindowProcDelegate
Definition: plugin_registrar_windows.h:24
message
Win32Message message
Definition: keyboard_unittests.cc:137
callback
FlutterDesktopBinaryReply callback
Definition: flutter_windows_view_unittests.cc:52