blob: 058985a13f26bb7d5c693b4af2452921ad9bde0a [file] [log] [blame]
reed@android.com8a1c16f2008-12-17 15:59:43 +00001#ifndef SampleCode_DEFINED
2#define SampleCode_DEFINED
3
4#include "SkEvent.h"
reed@android.comf2b98d62010-12-20 18:26:13 +00005#include "SkKey.h"
reed@android.com8a1c16f2008-12-17 15:59:43 +00006
7class SampleCode {
8public:
reed@android.comf2b98d62010-12-20 18:26:13 +00009 static bool KeyQ(const SkEvent&, SkKey* outKey);
10 static bool CharQ(const SkEvent&, SkUnichar* outUni);
11
reed@android.com8a1c16f2008-12-17 15:59:43 +000012 static bool TitleQ(const SkEvent&);
13 static void TitleR(SkEvent*, const char title[]);
14
15 static bool PrefSizeQ(const SkEvent&);
16 static void PrefSizeR(SkEvent*, SkScalar width, SkScalar height);
reed@android.comf2b98d62010-12-20 18:26:13 +000017
18 static bool FastTextQ(const SkEvent&);
19
reed@android.com44177402009-11-23 21:07:51 +000020 static SkMSec GetAnimTime();
reed@android.comf2b98d62010-12-20 18:26:13 +000021 static SkMSec GetAnimTimeDelta();
22 static SkScalar GetAnimSecondsDelta();
reed@android.com44177402009-11-23 21:07:51 +000023 static SkScalar GetAnimScalar(SkScalar speedPerSec, SkScalar period = 0);
reed@android.com8a1c16f2008-12-17 15:59:43 +000024};
25
26//////////////////////////////////////////////////////////////////////////////
27
28class SkView;
29
30typedef SkView* (*SkViewFactory)();
31
32class SkViewRegister : SkNoncopyable {
33public:
deanm@chromium.org1220e1c2009-06-11 12:26:47 +000034 explicit SkViewRegister(SkViewFactory);
reed@android.com8a1c16f2008-12-17 15:59:43 +000035
36 static const SkViewRegister* Head() { return gHead; }
37
38 SkViewRegister* next() const { return fChain; }
39 SkViewFactory factory() const { return fFact; }
40
41private:
42 SkViewFactory fFact;
43 SkViewRegister* fChain;
44
45 static SkViewRegister* gHead;
46};
47
48#endif
49