2 * Copyright 2018 Google Inc.
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
8 #ifndef SlideDir_DEFINED
9 #define SlideDir_DEFINED
11 #include "tools/viewer/Slide.h"
13 #include "include/private/SkTArray.h"
27 class SlideDir final : public Slide {
29 SlideDir(const SkString& name, SkTArray<sk_sp<Slide>>&&,
30 int columns = kDefaultColumnCount);
35 void load(SkScalar winWidth, SkScalar winHeight) override;
36 void unload() override;
38 SkISize getDimensions() const override;
40 void draw(SkCanvas*) override;
41 bool animate(double) override;
43 bool onChar(SkUnichar) override;
44 bool onMouse(SkScalar x, SkScalar y, skui::InputState, skui::ModifierKey modifiers) override;
48 class FocusController;
50 static constexpr int kDefaultColumnCount = 4;
52 const Rec* findCell(float x, float y) const;
54 const SkTArray<sk_sp<Slide>> fSlides;
55 std::unique_ptr<FocusController> fFocusController;
58 SkTArray<Rec, true> fRecs;
59 std::unique_ptr<sksg::Scene> fScene;
60 std::vector<sk_sp<Animator>> fSceneAnimators;
61 sk_sp<sksg::Group> fRoot;
63 SkSize fWinSize = SkSize::MakeEmpty();
64 SkSize fCellSize = SkSize::MakeEmpty();
67 const Rec* fTrackingCell = nullptr;
68 SkPoint fTrackingPos = SkPoint::Make(0, 0);
70 using INHERITED = Slide;
73 #endif // SlideDir_DEFINED