Flutter Engine
The Flutter Engine
Slide.h
Go to the documentation of this file.
1/*
2* Copyright 2016 Google Inc.
3*
4* Use of this source code is governed by a BSD-style license that can be
5* found in the LICENSE file.
6*/
7
8#ifndef Slide_DEFINED
9#define Slide_DEFINED
10
12#include "include/core/SkSize.h"
14#include "tools/Registry.h"
17
18class SkCanvas;
19class SkMetaData;
20class Slide;
21
22using SlideFactory = Slide* (*)();
24
25#define DEF_SLIDE(code) \
26 static Slide* SK_MACRO_APPEND_LINE(F_)() { code } \
27 static SlideRegistry SK_MACRO_APPEND_LINE(R_)(SK_MACRO_APPEND_LINE(F_));
28
29class Slide : public SkRefCnt {
30public:
31 /**
32 * A slide may have a content dimensions that is independent of the current window size. An
33 * empty size indicates that the Slide's dimensions are equal to the window's dimensions.
34 */
35 virtual SkISize getDimensions() const { return SkISize::MakeEmpty(); }
36
37 virtual void gpuTeardown() { }
38 virtual void draw(SkCanvas* canvas) = 0;
39 virtual bool animate(double nanos) { return false; }
40 virtual void load(SkScalar winWidth, SkScalar winHeight) {}
41 virtual void resize(SkScalar winWidth, SkScalar winHeight) {}
42 virtual void unload() {}
43
44 virtual bool onChar(SkUnichar c) { return false; }
46 skui::ModifierKey modifiers) { return false; }
47
48 virtual bool onGetControls(SkMetaData*) { return false; }
49 virtual void onSetControls(const SkMetaData&) {}
50
51 const SkString& getName() { return fName; }
52
53protected:
55};
56
57#endif
int32_t SkUnichar
Definition: SkTypes.h:175
Slide *(*)() SlideFactory
Definition: Slide.h:22
Definition: Slide.h:29
virtual bool onMouse(SkScalar x, SkScalar y, skui::InputState state, skui::ModifierKey modifiers)
Definition: Slide.h:45
virtual void unload()
Definition: Slide.h:42
virtual bool onChar(SkUnichar c)
Definition: Slide.h:44
virtual void resize(SkScalar winWidth, SkScalar winHeight)
Definition: Slide.h:41
SkString fName
Definition: Slide.h:54
virtual SkISize getDimensions() const
Definition: Slide.h:35
virtual bool onGetControls(SkMetaData *)
Definition: Slide.h:48
const SkString & getName()
Definition: Slide.h:51
virtual void load(SkScalar winWidth, SkScalar winHeight)
Definition: Slide.h:40
virtual void onSetControls(const SkMetaData &)
Definition: Slide.h:49
virtual bool animate(double nanos)
Definition: Slide.h:39
virtual void draw(SkCanvas *canvas)=0
virtual void gpuTeardown()
Definition: Slide.h:37
float SkScalar
Definition: extension.cpp:12
AtkStateType state
double y
double x
InputState
Definition: InputState.h:6
ModifierKey
Definition: ModifierKey.h:9
Definition: SkSize.h:16
static constexpr SkISize MakeEmpty()
Definition: SkSize.h:22