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" |
11 | 11 |
12 namespace ui { | 12 namespace ui { |
13 | 13 |
14 // Abstract class for a generic motion-related event, patterned after that | 14 // Abstract class for a generic motion-related event, patterned after that |
15 // subset of Android's MotionEvent API used in gesture detection. | 15 // subset of Android's MotionEvent API used in gesture detection. |
16 class GESTURE_DETECTION_EXPORT MotionEvent { | 16 class GESTURE_DETECTION_EXPORT MotionEvent { |
17 public: | 17 public: |
18 enum Action { | 18 enum Action { |
19 ACTION_DOWN, | |
jdduke (slow)
2014/02/26 20:57:02
This was intentional, but it's purely a cosmetic c
| |
20 ACTION_UP, | |
21 ACTION_MOVE, | |
22 ACTION_CANCEL, | |
19 ACTION_POINTER_DOWN, | 23 ACTION_POINTER_DOWN, |
20 ACTION_POINTER_UP, | 24 ACTION_POINTER_UP, |
21 ACTION_DOWN, | |
22 ACTION_UP, | |
23 ACTION_CANCEL, | |
24 ACTION_MOVE | |
25 }; | 25 }; |
26 | 26 |
27 // The implementer promises that |GetPointerId()| will never exceed this. | 27 // The implementer promises that |GetPointerId()| will never exceed this. |
28 enum { MAX_POINTER_ID = 31 }; | 28 enum { MAX_POINTER_ID = 31 }; |
29 | 29 |
30 virtual ~MotionEvent() {} | 30 virtual ~MotionEvent() {} |
31 | 31 |
32 virtual Action GetAction() const = 0; | 32 virtual Action GetAction() const = 0; |
33 virtual int GetActionIndex() const = 0; | 33 virtual int GetActionIndex() const = 0; |
34 virtual size_t GetPointerCount() const = 0; | 34 virtual size_t GetPointerCount() const = 0; |
(...skipping 20 matching lines...) Expand all Loading... | |
55 float GetX() const { return GetX(0); } | 55 float GetX() const { return GetX(0); } |
56 float GetY() const { return GetY(0); } | 56 float GetY() const { return GetY(0); } |
57 float GetRawX() const { return GetX(); } | 57 float GetRawX() const { return GetX(); } |
58 float GetRawY() const { return GetY(); } | 58 float GetRawY() const { return GetY(); } |
59 float GetTouchMajor() const { return GetTouchMajor(0); } | 59 float GetTouchMajor() const { return GetTouchMajor(0); } |
60 }; | 60 }; |
61 | 61 |
62 } // namespace ui | 62 } // namespace ui |
63 | 63 |
64 #endif // UI_EVENTS_GESTURE_DETECTION_MOTION_EVENT_H_ | 64 #endif // UI_EVENTS_GESTURE_DETECTION_MOTION_EVENT_H_ |
OLD | NEW |