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_
24 LRESULT>(HWND hwnd, UINT
message, WPARAM wparam, LPARAM lparam)>;
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,
128 LPARAM lparam)
const {
129 std::optional<LRESULT> result;
130 for (
const auto& pair : window_proc_delegates_) {
131 result = pair.second(hwnd,
message, wparam, lparam);
141 std::unique_ptr<FlutterView> implicit_view_;
144 int next_window_proc_delegate_id_ = 1;
146 std::map<int, WindowProcDelegate> window_proc_delegates_;
FlutterDesktopPluginRegistrarRef registrar() const
int RegisterTopLevelWindowProcDelegate(WindowProcDelegate delegate)
std::shared_ptr< FlutterView > GetViewById(FlutterViewId view_id) const
void UnregisterTopLevelWindowProcDelegate(int proc_id)
PluginRegistrarWindows(FlutterDesktopPluginRegistrarRef core_registrar)
PluginRegistrarWindows & operator=(PluginRegistrarWindows const &)=delete
PluginRegistrarWindows(PluginRegistrarWindows const &)=delete
virtual ~PluginRegistrarWindows()
FlutterDesktopViewRef FlutterDesktopPluginRegistrarGetViewById(FlutterDesktopPluginRegistrarRef registrar, FlutterDesktopViewId view_id)
void FlutterDesktopPluginRegistrarUnregisterTopLevelWindowProcDelegate(FlutterDesktopPluginRegistrarRef registrar, FlutterDesktopWindowProcCallback delegate)
void FlutterDesktopPluginRegistrarRegisterTopLevelWindowProcDelegate(FlutterDesktopPluginRegistrarRef registrar, FlutterDesktopWindowProcCallback delegate, void *user_data)
FlutterDesktopViewRef FlutterDesktopPluginRegistrarGetView(FlutterDesktopPluginRegistrarRef registrar)
struct FlutterDesktopView * FlutterDesktopViewRef
std::function< std::optional< LRESULT >(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)> WindowProcDelegate