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_UI_MOTION_EVENT_H_ | 5 #ifndef UI_EVENTS_GESTURE_DETECTION_UI_MOTION_EVENT_H_ |
6 #define UI_EVENTS_GESTURE_DETECTION_UI_MOTION_EVENT_H_ | 6 #define UI_EVENTS_GESTURE_DETECTION_UI_MOTION_EVENT_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
12 #include "ui/events/event.h" | 12 #include "ui/events/event.h" |
13 #include "ui/events/events_export.h" | 13 #include "ui/events/events_export.h" |
14 #include "ui/events/gesture_detection/motion_event.h" | 14 #include "ui/events/gesture_detection/motion_event.h" |
15 | 15 |
16 namespace ui { | 16 namespace ui { |
17 | 17 |
18 // Implementation of MotionEvent which takes a stream of ui::TouchEvents. | 18 // Implementation of MotionEvent which takes a stream of ui::TouchEvents. |
19 class EVENTS_EXPORT MotionEventImpl : public MotionEvent { | 19 class EVENTS_EXPORT MotionEventImpl : public MotionEvent { |
20 public: | 20 public: |
21 MotionEventImpl(); | 21 MotionEventImpl(); |
22 virtual ~MotionEventImpl(); | 22 ~MotionEventImpl() override; |
23 | 23 |
24 void OnTouch(const TouchEvent& touch); | 24 void OnTouch(const TouchEvent& touch); |
25 | 25 |
26 // MotionEvent implementation. | 26 // MotionEvent implementation. |
27 virtual int GetId() const override; | 27 int GetId() const override; |
28 virtual Action GetAction() const override; | 28 Action GetAction() const override; |
29 virtual int GetActionIndex() const override; | 29 int GetActionIndex() const override; |
30 virtual size_t GetPointerCount() const override; | 30 size_t GetPointerCount() const override; |
31 virtual int GetPointerId(size_t pointer_index) const override; | 31 int GetPointerId(size_t pointer_index) const override; |
32 virtual float GetX(size_t pointer_index) const override; | 32 float GetX(size_t pointer_index) const override; |
33 virtual float GetY(size_t pointer_index) const override; | 33 float GetY(size_t pointer_index) const override; |
34 virtual float GetRawX(size_t pointer_index) const override; | 34 float GetRawX(size_t pointer_index) const override; |
35 virtual float GetRawY(size_t pointer_index) const override; | 35 float GetRawY(size_t pointer_index) const override; |
36 virtual float GetTouchMajor(size_t pointer_index) const override; | 36 float GetTouchMajor(size_t pointer_index) const override; |
37 virtual float GetTouchMinor(size_t pointer_index) const override; | 37 float GetTouchMinor(size_t pointer_index) const override; |
38 virtual float GetOrientation(size_t pointer_index) const override; | 38 float GetOrientation(size_t pointer_index) const override; |
39 virtual float GetPressure(size_t pointer_index) const override; | 39 float GetPressure(size_t pointer_index) const override; |
40 virtual ToolType GetToolType(size_t pointer_index) const override; | 40 ToolType GetToolType(size_t pointer_index) const override; |
41 virtual int GetButtonState() const override; | 41 int GetButtonState() const override; |
42 virtual int GetFlags() const override; | 42 int GetFlags() const override; |
43 virtual base::TimeTicks GetEventTime() const override; | 43 base::TimeTicks GetEventTime() const override; |
44 | 44 |
45 virtual scoped_ptr<MotionEvent> Clone() const override; | 45 scoped_ptr<MotionEvent> Clone() const override; |
46 virtual scoped_ptr<MotionEvent> Cancel() const override; | 46 scoped_ptr<MotionEvent> Cancel() const override; |
47 | 47 |
48 int GetSourceDeviceId(size_t pointer_index) const; | 48 int GetSourceDeviceId(size_t pointer_index) const; |
49 | 49 |
50 // We can't cleanup removed touch points immediately upon receipt of a | 50 // We can't cleanup removed touch points immediately upon receipt of a |
51 // TouchCancel or TouchRelease, as the MotionEvent needs to be able to report | 51 // TouchCancel or TouchRelease, as the MotionEvent needs to be able to report |
52 // information about those touch events. Once the MotionEvent has been | 52 // information about those touch events. Once the MotionEvent has been |
53 // processed, we call CleanupRemovedTouchPoints to do the required | 53 // processed, we call CleanupRemovedTouchPoints to do the required |
54 // book-keeping. | 54 // book-keeping. |
55 void CleanupRemovedTouchPoints(const TouchEvent& event); | 55 void CleanupRemovedTouchPoints(const TouchEvent& event); |
56 | 56 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 | 93 |
94 // We want constant time indexing by pointer_index, and fast indexing by id. | 94 // We want constant time indexing by pointer_index, and fast indexing by id. |
95 PointData active_touches_[MotionEvent::MAX_TOUCH_POINT_COUNT]; | 95 PointData active_touches_[MotionEvent::MAX_TOUCH_POINT_COUNT]; |
96 | 96 |
97 DISALLOW_COPY_AND_ASSIGN(MotionEventImpl); | 97 DISALLOW_COPY_AND_ASSIGN(MotionEventImpl); |
98 }; | 98 }; |
99 | 99 |
100 } // namespace ui | 100 } // namespace ui |
101 | 101 |
102 #endif // UI_EVENTS_GESTURE_DETECTION_UI_MOTION_EVENT_H_ | 102 #endif // UI_EVENTS_GESTURE_DETECTION_UI_MOTION_EVENT_H_ |
OLD | NEW |