#ifndef DESKTOP_MULTI_WINDOW_WINDOWS_FLUTTER_WINDOW_WRAPPER_H_ #define DESKTOP_MULTI_WINDOW_WINDOWS_FLUTTER_WINDOW_WRAPPER_H_ #include #include #include #include #include #include class FlutterWindowWrapper { public: FlutterWindowWrapper(const std::string& window_id, HWND hwnd, const std::string& window_argument = "") : window_id_(window_id), hwnd_(hwnd), window_argument_(window_argument) {} ~FlutterWindowWrapper() = default; std::string GetWindowId() const { return window_id_; } std::string GetWindowArgument() const { return window_argument_; } HWND GetWindowHandle() { return hwnd_; } void SetChannel( std::shared_ptr> channel) { channel_ = channel; } void NotifyWindowEvent(const std::string& event, const flutter::EncodableMap& data) { if (channel_) { channel_->InvokeMethod(event, std::make_unique(data)); } } void HandleWindowMethod( const std::string& method, const flutter::EncodableMap* arguments, std::unique_ptr> result) { if (method == "window_show") { if (hwnd_) { ::ShowWindow(hwnd_, SW_SHOW); } result->Success(); } else if (method == "window_hide") { if (hwnd_) { ::ShowWindow(hwnd_, SW_HIDE); } result->Success(); } else { result->Error("-1", "unknown method: " + method); } } protected: void SetWindowHandle(HWND hwnd) { hwnd_ = hwnd; } private: std::string window_id_; HWND hwnd_; std::string window_argument_; std::shared_ptr> channel_; }; #endif // DESKTOP_MULTI_WINDOW_WINDOWS_FLUTTER_WINDOW_WRAPPER_H_