Chromium Code Reviews| Index: tools/viewer/sk_app/Window.h |
| diff --git a/tools/viewer/sk_app/Window.h b/tools/viewer/sk_app/Window.h |
| index 65e1542e2cafe310c43e828193053da42804c17e..5d5ba5da8b75b3dd38408be5e6e7ccf7a76fcc24 100644 |
| --- a/tools/viewer/sk_app/Window.h |
| +++ b/tools/viewer/sk_app/Window.h |
| @@ -27,6 +27,7 @@ public: |
| virtual void setTitle(const char*) = 0; |
| virtual void show() = 0; |
| + virtual void onStateUpdated(const char* stateJsonStr) {} // do nothing in default |
|
djsollen
2016/05/24 17:32:40
the public API should be consistent with the one i
liyuqian
2016/05/24 20:18:05
Done.
djsollen
2016/05/26 18:08:40
should this be called setState()?
|
| // Shedules an invalidation event for window if one is not currently pending. |
| // Make sure that either onPaint or markInvalReceived is called when the client window consumes |
| @@ -110,6 +111,7 @@ public: |
| typedef bool(*OnKeyFunc)(Key key, InputState state, uint32_t modifiers, void* userData); |
| typedef bool(*OnMouseFunc)(int x, int y, InputState state, uint32_t modifiers, void* userData); |
| typedef bool(*OnTouchFunc)(int owner, InputState state, float x, float y, void* userData); |
| + typedef void(*OnSetFunc)(const SkString& stateName, const SkString& stateValue, void* userData); |
|
djsollen
2016/05/24 17:32:40
I find this naming very confusing as both the user
liyuqian
2016/05/24 20:18:05
Let's discuss.
|
| typedef void(*OnPaintFunc)(SkCanvas*, void* userData); |
| void registerCharFunc(OnCharFunc func, void* userData) { |
| @@ -137,10 +139,16 @@ public: |
| fTouchUserData = userData; |
| } |
| + void registerSetFunc(OnSetFunc func, void* userData) { |
| + fSetFunc = func; |
| + fSetUserData = userData; |
| + } |
| + |
| bool onChar(SkUnichar c, uint32_t modifiers); |
| bool onKey(Key key, InputState state, uint32_t modifiers); |
| bool onMouse(int x, int y, InputState state, uint32_t modifiers); |
| bool onTouch(int owner, InputState state, float x, float y); // multi-owner = multi-touch |
| + void onSet(const SkString& stateName, const SkString& stateValue); |
|
djsollen
2016/05/26 18:08:40
onStateChange()
|
| void onPaint(); |
| void onResize(uint32_t width, uint32_t height); |
| @@ -164,6 +172,8 @@ protected: |
| void* fMouseUserData; |
| OnTouchFunc fTouchFunc; |
| void* fTouchUserData; |
| + OnSetFunc fSetFunc; |
| + void* fSetUserData; |
| OnPaintFunc fPaintFunc; |
| void* fPaintUserData; |