OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef Window_DEFINED | 8 #ifndef Window_DEFINED |
9 #define Window_DEFINED | 9 #define Window_DEFINED |
10 | 10 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 enum InputState { | 104 enum InputState { |
105 kDown_InputState, | 105 kDown_InputState, |
106 kUp_InputState, | 106 kUp_InputState, |
107 kMove_InputState // only valid for mouse | 107 kMove_InputState // only valid for mouse |
108 }; | 108 }; |
109 | 109 |
110 // return value of 'true' means 'I have handled this event' | 110 // return value of 'true' means 'I have handled this event' |
111 typedef bool(*OnCharFunc)(SkUnichar c, uint32_t modifiers, void* userData); | 111 typedef bool(*OnCharFunc)(SkUnichar c, uint32_t modifiers, void* userData); |
112 typedef bool(*OnKeyFunc)(Key key, InputState state, uint32_t modifiers, void
* userData); | 112 typedef bool(*OnKeyFunc)(Key key, InputState state, uint32_t modifiers, void
* userData); |
113 typedef bool(*OnMouseFunc)(int x, int y, InputState state, uint32_t modifier
s, void* userData); | 113 typedef bool(*OnMouseFunc)(int x, int y, InputState state, uint32_t modifier
s, void* userData); |
114 typedef bool(*OnTouchFunc)(int owner, InputState state, float x, float y, vo
id* userData); | 114 typedef bool(*OnTouchFunc)(intptr_t owner, InputState state, float x, float
y, void* userData); |
115 typedef void(*OnUIStateChangedFunc)( | 115 typedef void(*OnUIStateChangedFunc)( |
116 const SkString& stateName, const SkString& stateValue, void* userDat
a); | 116 const SkString& stateName, const SkString& stateValue, void* userDat
a); |
117 typedef void(*OnPaintFunc)(SkCanvas*, void* userData); | 117 typedef void(*OnPaintFunc)(SkCanvas*, void* userData); |
118 | 118 |
119 void registerCharFunc(OnCharFunc func, void* userData) { | 119 void registerCharFunc(OnCharFunc func, void* userData) { |
120 fCharFunc = func; | 120 fCharFunc = func; |
121 fCharUserData = userData; | 121 fCharUserData = userData; |
122 } | 122 } |
123 | 123 |
124 void registerKeyFunc(OnKeyFunc func, void* userData) { | 124 void registerKeyFunc(OnKeyFunc func, void* userData) { |
(...skipping 17 matching lines...) Expand all Loading... |
142 } | 142 } |
143 | 143 |
144 void registerUIStateChangedFunc(OnUIStateChangedFunc func, void* userData) { | 144 void registerUIStateChangedFunc(OnUIStateChangedFunc func, void* userData) { |
145 fUIStateChangedFunc = func; | 145 fUIStateChangedFunc = func; |
146 fUIStateChangedUserData = userData; | 146 fUIStateChangedUserData = userData; |
147 } | 147 } |
148 | 148 |
149 bool onChar(SkUnichar c, uint32_t modifiers); | 149 bool onChar(SkUnichar c, uint32_t modifiers); |
150 bool onKey(Key key, InputState state, uint32_t modifiers); | 150 bool onKey(Key key, InputState state, uint32_t modifiers); |
151 bool onMouse(int x, int y, InputState state, uint32_t modifiers); | 151 bool onMouse(int x, int y, InputState state, uint32_t modifiers); |
152 bool onTouch(int owner, InputState state, float x, float y); // multi-owner
= multi-touch | 152 bool onTouch(intptr_t owner, InputState state, float x, float y); // multi-
owner = multi-touch |
153 void onUIStateChanged(const SkString& stateName, const SkString& stateValue)
; | 153 void onUIStateChanged(const SkString& stateName, const SkString& stateValue)
; |
154 void onPaint(); | 154 void onPaint(); |
155 void onResize(uint32_t width, uint32_t height); | 155 void onResize(uint32_t width, uint32_t height); |
156 | 156 |
157 uint32_t width() { return fWidth; } | 157 uint32_t width() { return fWidth; } |
158 uint32_t height() { return fHeight; } | 158 uint32_t height() { return fHeight; } |
159 | 159 |
160 virtual const DisplayParams& getDisplayParams(); | 160 virtual const DisplayParams& getDisplayParams(); |
161 void setDisplayParams(const DisplayParams& params); | 161 void setDisplayParams(const DisplayParams& params); |
162 | 162 |
(...skipping 22 matching lines...) Expand all Loading... |
185 virtual void onInval() = 0; | 185 virtual void onInval() = 0; |
186 | 186 |
187 // Uncheck fIsContentInvalided to allow future inval/onInval. | 187 // Uncheck fIsContentInvalided to allow future inval/onInval. |
188 void markInvalProcessed(); | 188 void markInvalProcessed(); |
189 | 189 |
190 bool fIsContentInvalidated = false; // use this to avoid duplicate invalida
te events | 190 bool fIsContentInvalidated = false; // use this to avoid duplicate invalida
te events |
191 }; | 191 }; |
192 | 192 |
193 } // namespace sk_app | 193 } // namespace sk_app |
194 #endif | 194 #endif |
OLD | NEW |