| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef COMPONENTS_EXO_TOUCH_STYLUS_DELEGATE_H_ |
| 6 #define COMPONENTS_EXO_TOUCH_STYLUS_DELEGATE_H_ |
| 7 |
| 8 #include "base/time/time.h" |
| 9 #include "ui/events/event_constants.h" |
| 10 |
| 11 namespace gfx { |
| 12 class Vector2dF; |
| 13 } |
| 14 |
| 15 namespace exo { |
| 16 class Touch; |
| 17 |
| 18 // Handles stylus specific events as an extension to TouchDelegate. |
| 19 class TouchStylusDelegate { |
| 20 public: |
| 21 // Called at the top of the touch's destructor, to give observers a |
| 22 // chance to remove themselves. |
| 23 virtual void OnTouchDestroying(Touch* pointer) = 0; |
| 24 |
| 25 // Called to set the tool type of a touch. Only called once with the down |
| 26 // event. A tool type cannot change afterwards. |
| 27 virtual void OnTouchTool(int touch_id, ui::EventPointerType type) = 0; |
| 28 |
| 29 // Called when the force (pressure) of the touch changes. |
| 30 // Normalized to be [0, 1]. |
| 31 virtual void OnTouchForce(base::TimeTicks time_stamp, |
| 32 int touch_id, |
| 33 float force) = 0; |
| 34 |
| 35 // Called when the tilt of a pen/stylus changes. Measured from surface normal |
| 36 // as plane angle in degrees, values lie in [-90,90]. A positive x is to the |
| 37 // right and a positive y is towards the user. |
| 38 virtual void OnTouchTilt(base::TimeTicks time_stamp, |
| 39 int touch_id, |
| 40 const gfx::Vector2dF& tilt) = 0; |
| 41 |
| 42 protected: |
| 43 virtual ~TouchStylusDelegate() {} |
| 44 }; |
| 45 |
| 46 } // namespace exo |
| 47 |
| 48 #endif // COMPONENTS_EXO_TOUCH_STYLUS_DELEGATE_H_ |
| OLD | NEW |