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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 // ACTION_POINTER_DOWN. | 53 // ACTION_POINTER_DOWN. |
54 virtual int GetActionIndex() const = 0; | 54 virtual int GetActionIndex() const = 0; |
55 virtual size_t GetPointerCount() const = 0; | 55 virtual size_t GetPointerCount() const = 0; |
56 virtual int GetPointerId(size_t pointer_index) const = 0; | 56 virtual int GetPointerId(size_t pointer_index) const = 0; |
57 virtual float GetX(size_t pointer_index) const = 0; | 57 virtual float GetX(size_t pointer_index) const = 0; |
58 virtual float GetY(size_t pointer_index) const = 0; | 58 virtual float GetY(size_t pointer_index) const = 0; |
59 virtual float GetRawX(size_t pointer_index) const = 0; | 59 virtual float GetRawX(size_t pointer_index) const = 0; |
60 virtual float GetRawY(size_t pointer_index) const = 0; | 60 virtual float GetRawY(size_t pointer_index) const = 0; |
61 virtual float GetTouchMajor(size_t pointer_index) const = 0; | 61 virtual float GetTouchMajor(size_t pointer_index) const = 0; |
62 virtual float GetTouchMinor(size_t pointer_index) const = 0; | 62 virtual float GetTouchMinor(size_t pointer_index) const = 0; |
63 virtual float GetOrientation(size_t pointer_index) const = 0; | 63 virtual float GetTouchOrientation(size_t pointer_index) const = 0; |
64 virtual float GetPressure(size_t pointer_index) const = 0; | 64 virtual float GetPressure(size_t pointer_index) const = 0; |
65 virtual ToolType GetToolType(size_t pointer_index) const = 0; | 65 virtual ToolType GetToolType(size_t pointer_index) const = 0; |
66 virtual int GetButtonState() const = 0; | 66 virtual int GetButtonState() const = 0; |
67 virtual int GetFlags() const = 0; | 67 virtual int GetFlags() const = 0; |
68 virtual base::TimeTicks GetEventTime() const = 0; | 68 virtual base::TimeTicks GetEventTime() const = 0; |
69 | 69 |
70 // Optional historical data, default implementation provides an empty history. | 70 // Optional historical data, default implementation provides an empty history. |
71 virtual size_t GetHistorySize() const; | 71 virtual size_t GetHistorySize() const; |
72 virtual base::TimeTicks GetHistoricalEventTime(size_t historical_index) const; | 72 virtual base::TimeTicks GetHistoricalEventTime(size_t historical_index) const; |
73 virtual float GetHistoricalTouchMajor(size_t pointer_index, | 73 virtual float GetHistoricalTouchMajor(size_t pointer_index, |
(...skipping 11 matching lines...) Expand all Loading... |
85 float GetX() const { return GetX(0); } | 85 float GetX() const { return GetX(0); } |
86 float GetY() const { return GetY(0); } | 86 float GetY() const { return GetY(0); } |
87 float GetRawX() const { return GetRawX(0); } | 87 float GetRawX() const { return GetRawX(0); } |
88 float GetRawY() const { return GetRawY(0); } | 88 float GetRawY() const { return GetRawY(0); } |
89 float GetRawOffsetX() const { return GetRawX() - GetX(); } | 89 float GetRawOffsetX() const { return GetRawX() - GetX(); } |
90 float GetRawOffsetY() const { return GetRawY() - GetY(); } | 90 float GetRawOffsetY() const { return GetRawY() - GetY(); } |
91 | 91 |
92 float GetTouchMajor() const { return GetTouchMajor(0); } | 92 float GetTouchMajor() const { return GetTouchMajor(0); } |
93 float GetTouchMinor() const { return GetTouchMinor(0); } | 93 float GetTouchMinor() const { return GetTouchMinor(0); } |
94 | 94 |
95 // Returns the orientation of the major axis clockwise from vertical, in | 95 // Returns the orientation of the touch major axis clockwise from vertical, |
96 // radians. The return value lies in [-PI/2, PI/2]. | 96 // in radians. The return value lies in [-PI/2, PI/2]. |
97 float GetOrientation() const { return GetOrientation(0); } | 97 float GetTouchOrientation() const { return GetTouchOrientation(0); } |
98 | 98 |
99 float GetPressure() const { return GetPressure(0); } | 99 float GetPressure() const { return GetPressure(0); } |
100 ToolType GetToolType() const { return GetToolType(0); } | 100 ToolType GetToolType() const { return GetToolType(0); } |
101 | 101 |
102 // O(N) search of pointers (use sparingly!). Returns -1 if |id| nonexistent. | 102 // O(N) search of pointers (use sparingly!). Returns -1 if |id| nonexistent. |
103 int FindPointerIndexOfId(int id) const; | 103 int FindPointerIndexOfId(int id) const; |
104 | 104 |
105 // Note that these methods perform shallow copies of the originating events. | 105 // Note that these methods perform shallow copies of the originating events. |
106 // They guarantee only that the returned type will reflect the same | 106 // They guarantee only that the returned type will reflect the same |
107 // data exposed by the MotionEvent interface; no guarantees are made that the | 107 // data exposed by the MotionEvent interface; no guarantees are made that the |
108 // underlying implementation is identical to the source implementation. | 108 // underlying implementation is identical to the source implementation. |
109 scoped_ptr<MotionEvent> Clone() const; | 109 scoped_ptr<MotionEvent> Clone() const; |
110 scoped_ptr<MotionEvent> Cancel() const; | 110 scoped_ptr<MotionEvent> Cancel() const; |
111 }; | 111 }; |
112 | 112 |
113 } // namespace ui | 113 } // namespace ui |
114 | 114 |
115 #endif // UI_EVENTS_GESTURE_DETECTION_MOTION_EVENT_H_ | 115 #endif // UI_EVENTS_GESTURE_DETECTION_MOTION_EVENT_H_ |
OLD | NEW |