#pragma once #include #include #include #include #include #include #include #include #include // Keeps the system resize frame and window commands around a Flutter header. class WindowChrome { public: WindowChrome(HWND window, HWND view, flutter::BinaryMessenger* messenger); ~WindowChrome(); std::optional HandleMessage(UINT message, WPARAM wparam, LPARAM lparam); private: struct Region { double x, y, width, height; bool maximize; }; void Configure(bool enabled, double height, bool intercept_close, bool interactive); LRESULT HitTest(LPARAM position) const; void NotifyState(); void SetMaximizeHovered(bool hovered); static LRESULT CALLBACK ViewProc(HWND window, UINT message, WPARAM wparam, LPARAM lparam, UINT_PTR id, DWORD_PTR data); HWND window_; HWND view_; bool enabled_ = false; bool intercept_close_ = false; bool interactive_ = true; bool maximize_hovered_ = false; bool maximize_pressed_ = false; double header_height_ = 46; std::map controls_; std::unique_ptr> chrome_; std::unique_ptr> controls_channel_; };