2008-12-17 15:59:43 +00:00
|
|
|
#ifndef SampleCode_DEFINED
|
|
|
|
#define SampleCode_DEFINED
|
|
|
|
|
|
|
|
#include "SkEvent.h"
|
2010-12-20 18:26:13 +00:00
|
|
|
#include "SkKey.h"
|
2008-12-17 15:59:43 +00:00
|
|
|
|
|
|
|
class SampleCode {
|
|
|
|
public:
|
2010-12-20 18:26:13 +00:00
|
|
|
static bool KeyQ(const SkEvent&, SkKey* outKey);
|
|
|
|
static bool CharQ(const SkEvent&, SkUnichar* outUni);
|
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
static bool TitleQ(const SkEvent&);
|
|
|
|
static void TitleR(SkEvent*, const char title[]);
|
|
|
|
|
|
|
|
static bool PrefSizeQ(const SkEvent&);
|
|
|
|
static void PrefSizeR(SkEvent*, SkScalar width, SkScalar height);
|
2010-12-20 18:26:13 +00:00
|
|
|
|
|
|
|
static bool FastTextQ(const SkEvent&);
|
|
|
|
|
2009-11-23 21:07:51 +00:00
|
|
|
static SkMSec GetAnimTime();
|
2010-12-20 18:26:13 +00:00
|
|
|
static SkMSec GetAnimTimeDelta();
|
|
|
|
static SkScalar GetAnimSecondsDelta();
|
2009-11-23 21:07:51 +00:00
|
|
|
static SkScalar GetAnimScalar(SkScalar speedPerSec, SkScalar period = 0);
|
2008-12-17 15:59:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
class SkView;
|
|
|
|
|
|
|
|
typedef SkView* (*SkViewFactory)();
|
|
|
|
|
|
|
|
class SkViewRegister : SkNoncopyable {
|
|
|
|
public:
|
2009-06-11 12:26:47 +00:00
|
|
|
explicit SkViewRegister(SkViewFactory);
|
2008-12-17 15:59:43 +00:00
|
|
|
|
|
|
|
static const SkViewRegister* Head() { return gHead; }
|
|
|
|
|
|
|
|
SkViewRegister* next() const { return fChain; }
|
|
|
|
SkViewFactory factory() const { return fFact; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
SkViewFactory fFact;
|
|
|
|
SkViewRegister* fChain;
|
|
|
|
|
|
|
|
static SkViewRegister* gHead;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|