Chromium Code Reviews| 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 22 matching lines...) Expand all Loading... | |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 enum ButtonType { | 35 enum ButtonType { |
| 36 BUTTON_PRIMARY = 1 << 0, | 36 BUTTON_PRIMARY = 1 << 0, |
| 37 BUTTON_SECONDARY = 1 << 1, | 37 BUTTON_SECONDARY = 1 << 1, |
| 38 BUTTON_TERTIARY = 1 << 2, | 38 BUTTON_TERTIARY = 1 << 2, |
| 39 BUTTON_BACK = 1 << 3, | 39 BUTTON_BACK = 1 << 3, |
| 40 BUTTON_FORWARD = 1 << 4, | 40 BUTTON_FORWARD = 1 << 4, |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 enum Modifiers { | |
|
tdresser
2014/09/11 20:51:18
Where are these used?
jdduke (slow)
2014/09/11 20:51:57
Oops, they're not, I'll remove.
jdduke (slow)
2014/09/11 20:57:17
Done.
| |
| 44 MODIFIER_SHIFT = 1 << 0, | |
| 45 MODIFIER_CONTROL = 1 << 1, | |
| 46 MODIFIER_ALT = 1 << 2, | |
| 47 MODIFIER_META = 1 << 3, | |
| 48 MODIFIER_CAPS_LOCK_ON = 1 << 4, | |
| 49 MODIFIER_NUM_LOCK_ON = 1 << 5 | |
| 50 }; | |
| 51 | |
| 43 // The implementer promises that |GetPointerId()| will never exceed | 52 // The implementer promises that |GetPointerId()| will never exceed |
| 44 // MAX_POINTER_ID. | 53 // MAX_POINTER_ID. |
| 45 enum { MAX_POINTER_ID = 31, MAX_TOUCH_POINT_COUNT = 12 }; | 54 enum { MAX_POINTER_ID = 31, MAX_TOUCH_POINT_COUNT = 12 }; |
| 46 | 55 |
| 47 virtual ~MotionEvent() {} | 56 virtual ~MotionEvent() {} |
| 48 | 57 |
| 49 virtual int GetId() const = 0; | 58 virtual int GetId() const = 0; |
| 50 virtual Action GetAction() const = 0; | 59 virtual Action GetAction() const = 0; |
| 51 // Only valid if |GetAction()| returns ACTION_POINTER_UP or | 60 // Only valid if |GetAction()| returns ACTION_POINTER_UP or |
| 52 // ACTION_POINTER_DOWN. | 61 // ACTION_POINTER_DOWN. |
| 53 virtual int GetActionIndex() const = 0; | 62 virtual int GetActionIndex() const = 0; |
| 54 virtual size_t GetPointerCount() const = 0; | 63 virtual size_t GetPointerCount() const = 0; |
| 55 virtual int GetPointerId(size_t pointer_index) const = 0; | 64 virtual int GetPointerId(size_t pointer_index) const = 0; |
| 56 virtual float GetX(size_t pointer_index) const = 0; | 65 virtual float GetX(size_t pointer_index) const = 0; |
| 57 virtual float GetY(size_t pointer_index) const = 0; | 66 virtual float GetY(size_t pointer_index) const = 0; |
| 58 virtual float GetRawX(size_t pointer_index) const = 0; | 67 virtual float GetRawX(size_t pointer_index) const = 0; |
| 59 virtual float GetRawY(size_t pointer_index) const = 0; | 68 virtual float GetRawY(size_t pointer_index) const = 0; |
| 60 virtual float GetTouchMajor(size_t pointer_index) const = 0; | 69 virtual float GetTouchMajor(size_t pointer_index) const = 0; |
| 61 virtual float GetTouchMinor(size_t pointer_index) const = 0; | 70 virtual float GetTouchMinor(size_t pointer_index) const = 0; |
| 62 virtual float GetOrientation(size_t pointer_index) const = 0; | 71 virtual float GetOrientation(size_t pointer_index) const = 0; |
| 63 virtual float GetPressure(size_t pointer_index) const = 0; | 72 virtual float GetPressure(size_t pointer_index) const = 0; |
| 64 virtual ToolType GetToolType(size_t pointer_index) const = 0; | 73 virtual ToolType GetToolType(size_t pointer_index) const = 0; |
| 65 virtual int GetButtonState() const = 0; | 74 virtual int GetButtonState() const = 0; |
| 75 virtual int GetFlags() const = 0; | |
| 66 virtual base::TimeTicks GetEventTime() const = 0; | 76 virtual base::TimeTicks GetEventTime() const = 0; |
| 67 | 77 |
| 68 // Optional historical data, default implementation provides an empty history. | 78 // Optional historical data, default implementation provides an empty history. |
| 69 virtual size_t GetHistorySize() const; | 79 virtual size_t GetHistorySize() const; |
| 70 virtual base::TimeTicks GetHistoricalEventTime(size_t historical_index) const; | 80 virtual base::TimeTicks GetHistoricalEventTime(size_t historical_index) const; |
| 71 virtual float GetHistoricalTouchMajor(size_t pointer_index, | 81 virtual float GetHistoricalTouchMajor(size_t pointer_index, |
| 72 size_t historical_index) const; | 82 size_t historical_index) const; |
| 73 virtual float GetHistoricalX(size_t pointer_index, | 83 virtual float GetHistoricalX(size_t pointer_index, |
| 74 size_t historical_index) const; | 84 size_t historical_index) const; |
| 75 virtual float GetHistoricalY(size_t pointer_index, | 85 virtual float GetHistoricalY(size_t pointer_index, |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 100 }; | 110 }; |
| 101 | 111 |
| 102 GESTURE_DETECTION_EXPORT bool operator==(const MotionEvent& lhs, | 112 GESTURE_DETECTION_EXPORT bool operator==(const MotionEvent& lhs, |
| 103 const MotionEvent& rhs); | 113 const MotionEvent& rhs); |
| 104 GESTURE_DETECTION_EXPORT bool operator!=(const MotionEvent& lhs, | 114 GESTURE_DETECTION_EXPORT bool operator!=(const MotionEvent& lhs, |
| 105 const MotionEvent& rhs); | 115 const MotionEvent& rhs); |
| 106 | 116 |
| 107 } // namespace ui | 117 } // namespace ui |
| 108 | 118 |
| 109 #endif // UI_EVENTS_GESTURE_DETECTION_MOTION_EVENT_H_ | 119 #endif // UI_EVENTS_GESTURE_DETECTION_MOTION_EVENT_H_ |
| OLD | NEW |