5#ifndef FLUTTER_SHELL_PLATFORM_WINDOWS_CLIENT_WRAPPER_INCLUDE_FLUTTER_PLUGIN_REGISTRAR_WINDOWS_H_
6#define FLUTTER_SHELL_PLATFORM_WINDOWS_CLIENT_WRAPPER_INCLUDE_FLUTTER_PLUGIN_REGISTRAR_WINDOWS_H_
38 implicit_view_ = std::make_unique<FlutterView>(implicit_view);
46 implicit_view_.reset();
72 return std::make_shared<FlutterView>(view);
89 if (window_proc_delegates_.empty()) {
91 registrar(), PluginRegistrarWindows::OnTopLevelWindowProc,
this);
94 window_proc_delegates_.emplace(
delegate_id, std::move(delegate));
100 window_proc_delegates_.erase(proc_id);
101 if (window_proc_delegates_.empty()) {
103 registrar(), PluginRegistrarWindows::OnTopLevelWindowProc);
110 static bool OnTopLevelWindowProc(HWND hwnd,
117 std::optional optional_result =
registrar->CallTopLevelWindowProcDelegates(
118 hwnd,
message, wparam, lparam);
119 if (optional_result) {
120 *
result = *optional_result;
122 return optional_result.has_value();
125 std::optional<LRESULT> CallTopLevelWindowProcDelegates(HWND hwnd,
129 std::optional<LRESULT>
result;
130 for (
const auto& pair : window_proc_delegates_) {
141 std::unique_ptr<FlutterView> implicit_view_;
144 int next_window_proc_delegate_id_ = 1;
146 std::map<int, WindowProcDelegate> window_proc_delegates_;
int RegisterTopLevelWindowProcDelegate(WindowProcDelegate delegate)
std::shared_ptr< FlutterView > GetViewById(FlutterViewId view_id) const
PluginRegistrarWindows & operator=(PluginRegistrarWindows const &)=delete
void UnregisterTopLevelWindowProcDelegate(int proc_id)
PluginRegistrarWindows(FlutterDesktopPluginRegistrarRef core_registrar)
PluginRegistrarWindows(PluginRegistrarWindows const &)=delete
virtual ~PluginRegistrarWindows()
FlutterDesktopPluginRegistrarRef registrar() const
struct FlutterDesktopView * FlutterDesktopViewRef
Dart_NativeFunction function
std::function< std::optional< LRESULT >(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)> WindowProcDelegate
void FlutterDesktopPluginRegistrarUnregisterTopLevelWindowProcDelegate(FlutterDesktopPluginRegistrarRef registrar, FlutterDesktopWindowProcCallback delegate)
void FlutterDesktopPluginRegistrarRegisterTopLevelWindowProcDelegate(FlutterDesktopPluginRegistrarRef registrar, FlutterDesktopWindowProcCallback delegate, void *user_data)
FlutterDesktopViewRef FlutterDesktopPluginRegistrarGetView(FlutterDesktopPluginRegistrarRef controller)
FlutterDesktopViewRef FlutterDesktopPluginRegistrarGetViewById(FlutterDesktopPluginRegistrarRef controller, FlutterDesktopViewId view_id)