| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #ifndef SampleCode_DEFINED | 10 #ifndef SampleCode_DEFINED |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 | 110 |
| 111 class SampleView : public SkView { | 111 class SampleView : public SkView { |
| 112 public: | 112 public: |
| 113 SampleView() | 113 SampleView() |
| 114 : fPipeState(SkOSMenu::kOffState) | 114 : fPipeState(SkOSMenu::kOffState) |
| 115 , fBGColor(SK_ColorWHITE) | 115 , fBGColor(SK_ColorWHITE) |
| 116 , fRepeatCount(1) | 116 , fRepeatCount(1) |
| 117 {} | 117 {} |
| 118 | 118 |
| 119 void setBGColor(SkColor color) { fBGColor = color; } | 119 void setBGColor(SkColor color) { fBGColor = color; } |
| 120 bool animatePulse(SkMSec time) { return this->onAnimatePulse(time); } |
| 120 | 121 |
| 121 static bool IsSampleView(SkView*); | 122 static bool IsSampleView(SkView*); |
| 122 static bool SetRepeatDraw(SkView*, int count); | 123 static bool SetRepeatDraw(SkView*, int count); |
| 123 static bool SetUsePipe(SkView*, SkOSMenu::TriState); | 124 static bool SetUsePipe(SkView*, SkOSMenu::TriState); |
| 124 | 125 |
| 125 /** | 126 /** |
| 126 * Call this to request menu items from a SampleView. | 127 * Call this to request menu items from a SampleView. |
| 127 * Subclassing notes: A subclass of SampleView can overwrite this method | 128 * Subclassing notes: A subclass of SampleView can overwrite this method |
| 128 * to add new items of various types to the menu and change its title. | 129 * to add new items of various types to the menu and change its title. |
| 129 * The events attached to any new menu items must be handled in its onEvent | 130 * The events attached to any new menu items must be handled in its onEvent |
| 130 * method. See SkOSMenu.h for helper functions. | 131 * method. See SkOSMenu.h for helper functions. |
| 131 */ | 132 */ |
| 132 virtual void requestMenu(SkOSMenu* menu) {} | 133 virtual void requestMenu(SkOSMenu* menu) {} |
| 133 | 134 |
| 134 virtual void onTileSizeChanged(const SkSize& tileSize) {} | 135 virtual void onTileSizeChanged(const SkSize& tileSize) {} |
| 135 | 136 |
| 136 protected: | 137 protected: |
| 137 virtual void onDrawBackground(SkCanvas*); | 138 virtual void onDrawBackground(SkCanvas*); |
| 138 virtual void onDrawContent(SkCanvas*) = 0; | 139 virtual void onDrawContent(SkCanvas*) = 0; |
| 140 virtual bool onAnimatePulse(SkMSec) { return false; } |
| 139 | 141 |
| 140 // overrides | 142 // overrides |
| 141 virtual bool onEvent(const SkEvent& evt); | 143 virtual bool onEvent(const SkEvent& evt); |
| 142 virtual bool onQuery(SkEvent* evt); | 144 virtual bool onQuery(SkEvent* evt); |
| 143 virtual void draw(SkCanvas*); | 145 virtual void draw(SkCanvas*); |
| 144 virtual void onDraw(SkCanvas*); | 146 virtual void onDraw(SkCanvas*); |
| 145 | 147 |
| 146 SkOSMenu::TriState fPipeState; | 148 SkOSMenu::TriState fPipeState; |
| 147 SkColor fBGColor; | 149 SkColor fBGColor; |
| 148 | 150 |
| 149 private: | 151 private: |
| 150 int fRepeatCount; | 152 int fRepeatCount; |
| 151 | 153 |
| 152 typedef SkView INHERITED; | 154 typedef SkView INHERITED; |
| 153 }; | 155 }; |
| 154 | 156 |
| 155 #endif | 157 #endif |
| OLD | NEW |