Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(239)

Unified Diff: tools/viewer/sk_app/Window.h

Issue 2004633002: Add drawer with state information (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Format_old Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;

Powered by Google App Engine
This is Rietveld 408576698