Skip to content
Repos

DevPlaceApp

C++ 751 B22 lines Opens in site

Directory Raw Download

#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 <functional>

#include "ui/Modifiers.hpp"

namespace dp {

class OnAppearView : public ui::WrapperView {
 public:
  static constexpr double kAppearGapSeconds = 0.2;
  OnAppearView(ui::ViewPtr child, std::function<void()> onAppear) : WrapperView(std::move(child)), onAppear_(std::move(onAppear)) {}
  void draw(ui::Canvas& c) override;

 private:
  std::function<void()> onAppear_;
};

ui::ViewPtr OnAppear(ui::ViewPtr content, const std::string& key, std::function<void()> onAppear);

}  // namespace dp
56.6ms