Flutter Engine
The Flutter Engine
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"
14#include "flutter/shell/platform/windows/public/flutter_windows.h"
15
16namespace flutter {
17
18// Handles registration, unregistration, and dispatching for WindowProc
19// delegation.
21 public:
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,
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_
std::optional< LRESULT > OnTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) const
void UnregisterTopLevelWindowProcDelegate(FlutterDesktopWindowProcCallback callback)
void RegisterTopLevelWindowProcDelegate(FlutterDesktopWindowProcCallback callback, void *user_data)
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
bool(* FlutterDesktopWindowProcCallback)(HWND, UINT, WPARAM, LPARAM, void *, LRESULT *result)
Win32Message message
std::function< std::optional< LRESULT >(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)> WindowProcDelegate
void * user_data
unsigned int UINT
Definition: windows_types.h:32
LONG_PTR LPARAM
Definition: windows_types.h:60
UINT_PTR WPARAM
Definition: windows_types.h:59