OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef UI_EVENTS_GESTURE_DETECTION_MOTION_EVENT_H_ | 5 #ifndef UI_EVENTS_GESTURE_DETECTION_MOTION_EVENT_H_ |
6 #define UI_EVENTS_GESTURE_DETECTION_MOTION_EVENT_H_ | 6 #define UI_EVENTS_GESTURE_DETECTION_MOTION_EVENT_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "ui/events/gesture_detection/gesture_detection_export.h" | 10 #include "ui/events/gesture_detection/gesture_detection_export.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 virtual size_t GetPointerCount() const = 0; | 58 virtual size_t GetPointerCount() const = 0; |
59 virtual int GetPointerId(size_t pointer_index) const = 0; | 59 virtual int GetPointerId(size_t pointer_index) const = 0; |
60 virtual float GetX(size_t pointer_index) const = 0; | 60 virtual float GetX(size_t pointer_index) const = 0; |
61 virtual float GetY(size_t pointer_index) const = 0; | 61 virtual float GetY(size_t pointer_index) const = 0; |
62 virtual float GetRawX(size_t pointer_index) const = 0; | 62 virtual float GetRawX(size_t pointer_index) const = 0; |
63 virtual float GetRawY(size_t pointer_index) const = 0; | 63 virtual float GetRawY(size_t pointer_index) const = 0; |
64 virtual float GetTouchMajor(size_t pointer_index) const = 0; | 64 virtual float GetTouchMajor(size_t pointer_index) const = 0; |
65 virtual float GetTouchMinor(size_t pointer_index) const = 0; | 65 virtual float GetTouchMinor(size_t pointer_index) const = 0; |
66 virtual float GetOrientation(size_t pointer_index) const = 0; | 66 virtual float GetOrientation(size_t pointer_index) const = 0; |
67 virtual float GetPressure(size_t pointer_index) const = 0; | 67 virtual float GetPressure(size_t pointer_index) const = 0; |
| 68 virtual float GetTilt(size_t pointer_index) const = 0; |
68 virtual ToolType GetToolType(size_t pointer_index) const = 0; | 69 virtual ToolType GetToolType(size_t pointer_index) const = 0; |
69 virtual int GetButtonState() const = 0; | 70 virtual int GetButtonState() const = 0; |
70 virtual int GetFlags() const = 0; | 71 virtual int GetFlags() const = 0; |
71 virtual base::TimeTicks GetEventTime() const = 0; | 72 virtual base::TimeTicks GetEventTime() const = 0; |
72 | 73 |
73 // Optional historical data, default implementation provides an empty history. | 74 // Optional historical data, default implementation provides an empty history. |
74 virtual size_t GetHistorySize() const; | 75 virtual size_t GetHistorySize() const; |
75 virtual base::TimeTicks GetHistoricalEventTime(size_t historical_index) const; | 76 virtual base::TimeTicks GetHistoricalEventTime(size_t historical_index) const; |
76 virtual float GetHistoricalTouchMajor(size_t pointer_index, | 77 virtual float GetHistoricalTouchMajor(size_t pointer_index, |
77 size_t historical_index) const; | 78 size_t historical_index) const; |
(...skipping 18 matching lines...) Expand all Loading... |
96 float GetTouchMinor() const { return GetTouchMinor(0); } | 97 float GetTouchMinor() const { return GetTouchMinor(0); } |
97 | 98 |
98 // Returns the orientation in radians. The meaning is overloaded: | 99 // Returns the orientation in radians. The meaning is overloaded: |
99 // * For a touch screen or pad, it's the orientation of the major axis | 100 // * For a touch screen or pad, it's the orientation of the major axis |
100 // clockwise from vertical. The return value lies in [-PI/2, PI/2]. | 101 // clockwise from vertical. The return value lies in [-PI/2, PI/2]. |
101 // * For a stylus, it indicates the direction in which the stylus is pointing. | 102 // * For a stylus, it indicates the direction in which the stylus is pointing. |
102 // The return value lies in [-PI, PI]. | 103 // The return value lies in [-PI, PI]. |
103 float GetOrientation() const { return GetOrientation(0); } | 104 float GetOrientation() const { return GetOrientation(0); } |
104 | 105 |
105 float GetPressure() const { return GetPressure(0); } | 106 float GetPressure() const { return GetPressure(0); } |
| 107 float GetTilt() const { return GetTilt(0); } |
106 ToolType GetToolType() const { return GetToolType(0); } | 108 ToolType GetToolType() const { return GetToolType(0); } |
107 | 109 |
108 // O(N) search of pointers (use sparingly!). Returns -1 if |id| nonexistent. | 110 // O(N) search of pointers (use sparingly!). Returns -1 if |id| nonexistent. |
109 int FindPointerIndexOfId(int id) const; | 111 int FindPointerIndexOfId(int id) const; |
110 | 112 |
111 // Note that these methods perform shallow copies of the originating events. | 113 // Note that these methods perform shallow copies of the originating events. |
112 // They guarantee only that the returned type will reflect the same | 114 // They guarantee only that the returned type will reflect the same |
113 // data exposed by the MotionEvent interface; no guarantees are made that the | 115 // data exposed by the MotionEvent interface; no guarantees are made that the |
114 // underlying implementation is identical to the source implementation. | 116 // underlying implementation is identical to the source implementation. |
115 scoped_ptr<MotionEvent> Clone() const; | 117 scoped_ptr<MotionEvent> Clone() const; |
116 scoped_ptr<MotionEvent> Cancel() const; | 118 scoped_ptr<MotionEvent> Cancel() const; |
117 }; | 119 }; |
118 | 120 |
119 } // namespace ui | 121 } // namespace ui |
120 | 122 |
121 #endif // UI_EVENTS_GESTURE_DETECTION_MOTION_EVENT_H_ | 123 #endif // UI_EVENTS_GESTURE_DETECTION_MOTION_EVENT_H_ |
OLD | NEW |