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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 // ACTION_POINTER_DOWN. | 50 // ACTION_POINTER_DOWN. |
51 virtual int GetActionIndex() const = 0; | 51 virtual int GetActionIndex() const = 0; |
52 virtual size_t GetPointerCount() const = 0; | 52 virtual size_t GetPointerCount() const = 0; |
53 virtual int GetPointerId(size_t pointer_index) const = 0; | 53 virtual int GetPointerId(size_t pointer_index) const = 0; |
54 virtual float GetX(size_t pointer_index) const = 0; | 54 virtual float GetX(size_t pointer_index) const = 0; |
55 virtual float GetY(size_t pointer_index) const = 0; | 55 virtual float GetY(size_t pointer_index) const = 0; |
56 virtual float GetRawX(size_t pointer_index) const = 0; | 56 virtual float GetRawX(size_t pointer_index) const = 0; |
57 virtual float GetRawY(size_t pointer_index) const = 0; | 57 virtual float GetRawY(size_t pointer_index) const = 0; |
58 virtual float GetTouchMajor(size_t pointer_index) const = 0; | 58 virtual float GetTouchMajor(size_t pointer_index) const = 0; |
59 virtual float GetPressure(size_t pointer_index) const = 0; | 59 virtual float GetPressure(size_t pointer_index) const = 0; |
| 60 virtual ToolType GetToolType(size_t pointer_index) const = 0; |
| 61 virtual int GetButtonState() const = 0; |
60 virtual base::TimeTicks GetEventTime() const = 0; | 62 virtual base::TimeTicks GetEventTime() const = 0; |
61 | 63 |
62 virtual size_t GetHistorySize() const = 0; | 64 // Optional historical data, default implementation provides an empty history. |
63 virtual base::TimeTicks GetHistoricalEventTime( | 65 virtual size_t GetHistorySize() const; |
64 size_t historical_index) const = 0; | 66 virtual base::TimeTicks GetHistoricalEventTime(size_t historical_index) const; |
65 virtual float GetHistoricalTouchMajor(size_t pointer_index, | 67 virtual float GetHistoricalTouchMajor(size_t pointer_index, |
66 size_t historical_index) const = 0; | 68 size_t historical_index) const; |
67 virtual float GetHistoricalX(size_t pointer_index, | 69 virtual float GetHistoricalX(size_t pointer_index, |
68 size_t historical_index) const = 0; | 70 size_t historical_index) const; |
69 virtual float GetHistoricalY(size_t pointer_index, | 71 virtual float GetHistoricalY(size_t pointer_index, |
70 size_t historical_index) const = 0; | 72 size_t historical_index) const; |
71 virtual ToolType GetToolType(size_t pointer_index) const = 0; | |
72 virtual int GetButtonState() const = 0; | |
73 | 73 |
74 virtual scoped_ptr<MotionEvent> Clone() const = 0; | 74 virtual scoped_ptr<MotionEvent> Clone() const = 0; |
75 virtual scoped_ptr<MotionEvent> Cancel() const = 0; | 75 virtual scoped_ptr<MotionEvent> Cancel() const = 0; |
76 | 76 |
77 // Utility accessor methods for convenience. | 77 // Utility accessor methods for convenience. |
78 float GetX() const { return GetX(0); } | 78 float GetX() const { return GetX(0); } |
79 float GetY() const { return GetY(0); } | 79 float GetY() const { return GetY(0); } |
80 float GetRawX() const { return GetRawX(0); } | 80 float GetRawX() const { return GetRawX(0); } |
81 float GetRawY() const { return GetRawY(0); } | 81 float GetRawY() const { return GetRawY(0); } |
82 float GetRawOffsetX() const { return GetRawX() - GetX(); } | 82 float GetRawOffsetX() const { return GetRawX() - GetX(); } |
83 float GetRawOffsetY() const { return GetRawY() - GetY(); } | 83 float GetRawOffsetY() const { return GetRawY() - GetY(); } |
84 float GetTouchMajor() const { return GetTouchMajor(0); } | 84 float GetTouchMajor() const { return GetTouchMajor(0); } |
85 float GetPressure() const { return GetPressure(0); } | 85 float GetPressure() const { return GetPressure(0); } |
86 }; | 86 }; |
87 | 87 |
| 88 GESTURE_DETECTION_EXPORT bool operator==(const MotionEvent& lhs, |
| 89 const MotionEvent& rhs); |
| 90 GESTURE_DETECTION_EXPORT bool operator!=(const MotionEvent& lhs, |
| 91 const MotionEvent& rhs); |
| 92 |
88 } // namespace ui | 93 } // namespace ui |
89 | 94 |
90 #endif // UI_EVENTS_GESTURE_DETECTION_MOTION_EVENT_H_ | 95 #endif // UI_EVENTS_GESTURE_DETECTION_MOTION_EVENT_H_ |
OLD | NEW |