Flutter Windows Embedder
window_proc_delegate_manager.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_WINDOW_PROC_DELEGATE_MANAGER_H_
6 #define FLUTTER_SHELL_PLATFORM_WINDOWS_WINDOW_PROC_DELEGATE_MANAGER_H_
7 
8 #include <Windows.h>
9 
10 #include <optional>
11 #include <vector>
12 
13 #include "flutter/fml/macros.h"
15 
16 namespace flutter {
17 
18 // Handles registration, unregistration, and dispatching for WindowProc
19 // delegation.
21  public:
22  explicit WindowProcDelegateManager();
24 
25  // Adds |callback| as a delegate to be called for |OnTopLevelWindowProc|.
26  //
27  // Multiple calls with the same |callback| will replace the previous
28  // registration, even if |user_data| is different.
31  void* user_data);
32 
33  // Unregisters |callback| as a delegate for |OnTopLevelWindowProc|.
36 
37  // Calls any registered WindowProc delegates in the order they were
38  // registered.
39  //
40  // If a result is returned, then the message was handled in such a way that
41  // further handling should not be done.
42  std::optional<LRESULT> OnTopLevelWindowProc(HWND hwnd,
43  UINT message,
44  WPARAM wparam,
45  LPARAM lparam) const;
46 
47  private:
48  struct WindowProcDelegate {
50  void* user_data = nullptr;
51  };
52 
53  std::vector<WindowProcDelegate> delegates_;
54 
55  FML_DISALLOW_COPY_AND_ASSIGN(WindowProcDelegateManager);
56 };
57 
58 } // namespace flutter
59 
60 #endif // FLUTTER_SHELL_PLATFORM_WINDOWS_WINDOW_PROC_DELEGATE_MANAGER_H_
flutter::WindowProcDelegateManager::WindowProcDelegateManager
WindowProcDelegateManager()
user_data
void * user_data
Definition: flutter_windows_view_unittests.cc:52
flutter::WindowProcDelegateManager::OnTopLevelWindowProc
std::optional< LRESULT > OnTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) const
Definition: window_proc_delegate_manager.cc:37
flutter::WindowProcDelegateManager::~WindowProcDelegateManager
~WindowProcDelegateManager()
flutter::WindowProcDelegateManager
Definition: window_proc_delegate_manager.h:20
flutter
Definition: accessibility_bridge_windows.cc:11
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
flutter_windows.h
message
Win32Message message
Definition: keyboard_unittests.cc:137
FlutterDesktopWindowProcCallback
bool(* FlutterDesktopWindowProcCallback)(HWND, UINT, WPARAM, LPARAM, void *, LRESULT *result)
Definition: flutter_windows.h:245
flutter::WindowProcDelegateManager::RegisterTopLevelWindowProcDelegate
void RegisterTopLevelWindowProcDelegate(FlutterDesktopWindowProcCallback callback, void *user_data)
Definition: window_proc_delegate_manager.cc:16
callback
FlutterDesktopBinaryReply callback
Definition: flutter_windows_view_unittests.cc:51