| 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 <map>
11 #include <optional>
12
13 #include "flutter/fml/macros.h"
14 #include "flutter/shell/platform/windows/public/flutter_windows.h"
15
16 namespace flutter {
17
18 // Handles registration, unregistration, and dispatching for WindowProc
19 // delegation.
20 class WindowProcDelegateManager {
21 public:
22 explicit WindowProcDelegateManager();
23 ~WindowProcDelegateManager();
24
25 // Adds |delegate| as a delegate to be called for |OnTopLevelWindowProc|.
26 //
27 // Multiple calls with the same |delegate| will replace the previous
28 // registration, even if |user_data| is different.
29 void RegisterTopLevelWindowProcDelegate(
30 FlutterDesktopWindowProcCallback delegate,
31 void* user_data);
32
33 // Unregisters |delegate| as a delate for |OnTopLevelWindowProc|.
34 void UnregisterTopLevelWindowProcDelegate(
35 FlutterDesktopWindowProcCallback delegate);
36
37 // Calls any registered WindowProc delegates.
38 //
39 // If a result is returned, then the message was handled in such a way that
40 // further handling should not be done.
41 std::optional<LRESULT> OnTopLevelWindowProc(HWND hwnd,
42 UINT message,
43 WPARAM wparam,
44 LPARAM lparam);
45
46 private:
47 std::map<FlutterDesktopWindowProcCallback, void*>
48 top_level_window_proc_handlers_;
49
50 FML_DISALLOW_COPY_AND_ASSIGN(WindowProcDelegateManager);
51 };
52
53 } // namespace flutter
54
55 #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:49
flutter::WindowProcDelegateManager::OnTopLevelWindowProc
std::optional< LRESULT > OnTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
Definition: window_proc_delegate_manager.cc:25
flutter::WindowProcDelegateManager::RegisterTopLevelWindowProcDelegate
void RegisterTopLevelWindowProcDelegate(FlutterDesktopWindowProcCallback delegate, void *user_data)
Definition: window_proc_delegate_manager.cc:14
flutter::WindowProcDelegateManager::~WindowProcDelegateManager
~WindowProcDelegateManager()
flutter::WindowProcDelegateManager::UnregisterTopLevelWindowProcDelegate
void UnregisterTopLevelWindowProcDelegate(FlutterDesktopWindowProcCallback delegate)
Definition: window_proc_delegate_manager.cc:20
flutter::WindowProcDelegateManager
Definition: window_proc_delegate_manager.h:20
flutter
Definition: accessibility_bridge_windows.cc:11
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:238