#pragma once // Spec: INV-posts 1.2 (ProgressView.onAppear). The host culls views outside the viewport, so a view that is drawn // has appeared. The callback fires when the view is drawn after not having been drawn for kAppearGapSeconds. #include #include "ui/Modifiers.hpp" namespace dp { class OnAppearView : public ui::WrapperView { public: static constexpr double kAppearGapSeconds = 0.2; OnAppearView(ui::ViewPtr child, std::function onAppear) : WrapperView(std::move(child)), onAppear_(std::move(onAppear)) {} void draw(ui::Canvas& c) override; private: std::function onAppear_; }; ui::ViewPtr OnAppear(ui::ViewPtr content, const std::string& key, std::function onAppear); } // namespace dp