scroggo | b66365f | 2011-03-18 21:43:03 +0000 | [diff] [blame] | 1 | #include "SampleCode.h" |
scroggo | b7e9aee | 2011-03-15 15:15:15 +0000 | [diff] [blame] | 2 | #include "SkCanvas.h" |
| 3 | #include "SkColor.h" |
scroggo | b66365f | 2011-03-18 21:43:03 +0000 | [diff] [blame] | 4 | #include "SkEvent.h" |
scroggo | b7e9aee | 2011-03-15 15:15:15 +0000 | [diff] [blame] | 5 | #include "SkView.h" |
| 6 | |
| 7 | class DrawBlue : public SkView { |
| 8 | |
| 9 | public: |
| 10 | DrawBlue() {} |
| 11 | protected: |
| 12 | virtual void onDraw(SkCanvas* canvas) { |
| 13 | canvas->drawColor(SK_ColorBLUE); |
| 14 | } |
scroggo | b66365f | 2011-03-18 21:43:03 +0000 | [diff] [blame] | 15 | virtual bool onQuery(SkEvent* evt) { |
| 16 | if (SampleCode::TitleQ(*evt)) { |
| 17 | SampleCode::TitleR(evt, "DrawBlue"); |
| 18 | return true; |
| 19 | } |
| 20 | return this->INHERITED::onQuery(evt); |
| 21 | } |
| 22 | private: |
| 23 | typedef SkView INHERITED; |
scroggo | b7e9aee | 2011-03-15 15:15:15 +0000 | [diff] [blame] | 24 | }; |
| 25 | |
| 26 | static SkView* MyFactory() { return new DrawBlue; } |
| 27 | static SkViewRegister reg(MyFactory); |