2018-02-15 23:40:48 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2018 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SlideDir_DEFINED
|
|
|
|
#define SlideDir_DEFINED
|
|
|
|
|
|
|
|
#include "Slide.h"
|
|
|
|
|
|
|
|
#include "SkTArray.h"
|
|
|
|
|
|
|
|
class SkString;
|
|
|
|
|
2018-02-19 18:25:18 +00:00
|
|
|
namespace sksg {
|
|
|
|
|
|
|
|
class Group;
|
|
|
|
class Scene;
|
|
|
|
|
|
|
|
}
|
2018-02-15 23:40:48 +00:00
|
|
|
|
|
|
|
class SlideDir final : public Slide {
|
|
|
|
public:
|
2018-09-05 19:41:23 +00:00
|
|
|
SlideDir(const SkString& name, SkTArray<sk_sp<Slide>>&&,
|
2018-02-15 23:40:48 +00:00
|
|
|
int columns = kDefaultColumnCount);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void load(SkScalar winWidth, SkScalar winHeight) override;
|
|
|
|
void unload() override;
|
|
|
|
|
|
|
|
SkISize getDimensions() const override;
|
|
|
|
|
|
|
|
void draw(SkCanvas*) override;
|
|
|
|
bool animate(const SkAnimTimer&) override;
|
|
|
|
|
|
|
|
bool onChar(SkUnichar) override;
|
|
|
|
bool onMouse(SkScalar x, SkScalar y, sk_app::Window::InputState, uint32_t modifiers) override;
|
|
|
|
|
|
|
|
private:
|
2018-02-19 18:25:18 +00:00
|
|
|
struct Rec;
|
|
|
|
class FocusController;
|
|
|
|
|
2018-02-15 23:40:48 +00:00
|
|
|
static constexpr int kDefaultColumnCount = 4;
|
|
|
|
|
2018-02-19 18:25:18 +00:00
|
|
|
const Rec* findCell(float x, float y) const;
|
2018-02-15 23:40:48 +00:00
|
|
|
|
2018-09-05 19:41:23 +00:00
|
|
|
const SkTArray<sk_sp<Slide>> fSlides;
|
2018-02-19 18:25:18 +00:00
|
|
|
std::unique_ptr<FocusController> fFocusController;
|
2018-02-15 23:40:48 +00:00
|
|
|
const int fColumns;
|
|
|
|
|
2018-02-19 18:25:18 +00:00
|
|
|
SkTArray<Rec, true> fRecs;
|
|
|
|
std::unique_ptr<sksg::Scene> fScene;
|
|
|
|
sk_sp<sksg::Group> fRoot;
|
|
|
|
|
|
|
|
SkSize fWinSize = SkSize::MakeEmpty();
|
|
|
|
SkSize fCellSize = SkSize::MakeEmpty();
|
|
|
|
SkMSec fTimeBase = 0;
|
2018-02-15 23:40:48 +00:00
|
|
|
|
2018-02-19 18:25:18 +00:00
|
|
|
const Rec* fTrackingCell = nullptr;
|
|
|
|
SkPoint fTrackingPos = SkPoint::Make(0, 0);
|
2018-02-15 23:40:48 +00:00
|
|
|
|
|
|
|
using INHERITED = Slide;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // SlideDir_DEFINED
|