reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 1 | #ifndef SampleCode_DEFINED |
| 2 | #define SampleCode_DEFINED |
| 3 | |
| 4 | #include "SkEvent.h" |
reed@android.com | f2b98d6 | 2010-12-20 18:26:13 +0000 | [diff] [blame] | 5 | #include "SkKey.h" |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 6 | |
| 7 | class SampleCode { |
| 8 | public: |
reed@android.com | f2b98d6 | 2010-12-20 18:26:13 +0000 | [diff] [blame] | 9 | static bool KeyQ(const SkEvent&, SkKey* outKey); |
| 10 | static bool CharQ(const SkEvent&, SkUnichar* outUni); |
| 11 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 12 | 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.com | f2b98d6 | 2010-12-20 18:26:13 +0000 | [diff] [blame] | 17 | |
| 18 | static bool FastTextQ(const SkEvent&); |
| 19 | |
reed@android.com | 4417740 | 2009-11-23 21:07:51 +0000 | [diff] [blame] | 20 | static SkMSec GetAnimTime(); |
reed@android.com | f2b98d6 | 2010-12-20 18:26:13 +0000 | [diff] [blame] | 21 | static SkMSec GetAnimTimeDelta(); |
| 22 | static SkScalar GetAnimSecondsDelta(); |
reed@android.com | 4417740 | 2009-11-23 21:07:51 +0000 | [diff] [blame] | 23 | static SkScalar GetAnimScalar(SkScalar speedPerSec, SkScalar period = 0); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 24 | }; |
| 25 | |
| 26 | ////////////////////////////////////////////////////////////////////////////// |
| 27 | |
| 28 | class SkView; |
| 29 | |
| 30 | typedef SkView* (*SkViewFactory)(); |
| 31 | |
| 32 | class SkViewRegister : SkNoncopyable { |
| 33 | public: |
deanm@chromium.org | 1220e1c | 2009-06-11 12:26:47 +0000 | [diff] [blame] | 34 | explicit SkViewRegister(SkViewFactory); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 35 | |
| 36 | static const SkViewRegister* Head() { return gHead; } |
| 37 | |
| 38 | SkViewRegister* next() const { return fChain; } |
| 39 | SkViewFactory factory() const { return fFact; } |
| 40 | |
| 41 | private: |
| 42 | SkViewFactory fFact; |
| 43 | SkViewRegister* fChain; |
| 44 | |
| 45 | static SkViewRegister* gHead; |
| 46 | }; |
| 47 | |
| 48 | #endif |
| 49 | |