Flutter Engine
win32_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_WIN32_WINDOW_PROC_DELEGATE_MANAGER_H_
6 #define FLUTTER_SHELL_PLATFORM_WINDOWS_WIN32_WINDOW_PROC_DELEGATE_MANAGER_H_
7 
8 #include <Windows.h>
9 
10 #include <map>
11 #include <optional>
12 
13 #include "flutter/shell/platform/windows/public/flutter_windows.h"
14 
15 namespace flutter {
16 
17 // Handles registration, unregistration, and dispatching for WindowProc
18 // delegation.
20  public:
23 
24  // Prevent copying.
26  delete;
28  Win32WindowProcDelegateManager const&) = delete;
29 
30  // Adds |delegate| as a delegate to be called for |OnTopLevelWindowProc|.
31  //
32  // Multiple calls with the same |delegate| will replace the previous
33  // registration, even if |user_data| is different.
36  void* user_data);
37 
38  // Unregisters |delegate| as a delate for |OnTopLevelWindowProc|.
41 
42  // Calls any registered WindowProc delegates.
43  //
44  // If a result is returned, then the message was handled in such a way that
45  // further handling should not be done.
46  std::optional<LRESULT> OnTopLevelWindowProc(HWND hwnd,
47  UINT message,
48  WPARAM wparam,
49  LPARAM lparam);
50 
51  private:
52  std::map<FlutterDesktopWindowProcCallback, void*>
53  top_level_window_proc_handlers_;
54 };
55 
56 } // namespace flutter
57 
58 #endif // FLUTTER_SHELL_PLATFORM_WINDOWS_WIN32_WINDOW_PROC_DELEGATE_MANAGER_H_
Win32WindowProcDelegateManager & operator=(Win32WindowProcDelegateManager const &)=delete
std::optional< LRESULT > OnTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
G_BEGIN_DECLS FlValue gpointer user_data
bool(* FlutterDesktopWindowProcCallback)(HWND, UINT, WPARAM, LPARAM, void *, LRESULT *result)
void UnregisterTopLevelWindowProcDelegate(FlutterDesktopWindowProcCallback delegate)
void RegisterTopLevelWindowProcDelegate(FlutterDesktopWindowProcCallback delegate, void *user_data)