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_GENERIC_H_ | 5 #ifndef UI_EVENTS_GESTURE_DETECTION_UI_MOTION_EVENT_GENERIC_H_ |
6 #define UI_EVENTS_GESTURE_DETECTION_UI_MOTION_EVENT_GENERIC_H_ | 6 #define UI_EVENTS_GESTURE_DETECTION_UI_MOTION_EVENT_GENERIC_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/containers/stack_container.h" | 9 #include "base/containers/stack_container.h" |
10 #include "ui/events/gesture_detection/gesture_detection_export.h" | 10 #include "ui/events/gesture_detection/gesture_detection_export.h" |
11 #include "ui/events/gesture_detection/motion_event.h" | 11 #include "ui/events/gesture_detection/motion_event.h" |
12 | 12 |
13 namespace ui { | 13 namespace ui { |
14 | 14 |
15 struct GESTURE_DETECTION_EXPORT PointerProperties { | 15 struct GESTURE_DETECTION_EXPORT PointerProperties { |
16 PointerProperties(); | 16 PointerProperties(); |
17 PointerProperties(float x, float y); | 17 PointerProperties(float x, float y); |
18 | 18 |
19 int id; | 19 int id; |
20 MotionEvent::ToolType tool_type; | 20 MotionEvent::ToolType tool_type; |
21 float x; | 21 float x; |
22 float y; | 22 float y; |
23 float raw_x; | 23 float raw_x; |
24 float raw_y; | 24 float raw_y; |
25 float pressure; | 25 float pressure; |
26 float touch_major; | 26 float touch_major; |
27 float touch_minor; | |
28 float orientation; | |
29 }; | 27 }; |
30 | 28 |
31 // A generic MotionEvent implementation. | 29 // A generic MotionEvent implementation. |
32 class GESTURE_DETECTION_EXPORT MotionEventGeneric : public MotionEvent { | 30 class GESTURE_DETECTION_EXPORT MotionEventGeneric : public MotionEvent { |
33 public: | 31 public: |
34 MotionEventGeneric(Action action, | 32 MotionEventGeneric(Action action, |
35 base::TimeTicks event_time, | 33 base::TimeTicks event_time, |
36 const PointerProperties& pointer); | 34 const PointerProperties& pointer); |
37 MotionEventGeneric(const MotionEventGeneric& other); | 35 MotionEventGeneric(const MotionEventGeneric& other); |
38 | 36 |
39 virtual ~MotionEventGeneric(); | 37 virtual ~MotionEventGeneric(); |
40 | 38 |
41 // MotionEvent implementation. | 39 // MotionEvent implementation. |
42 virtual int GetId() const OVERRIDE; | 40 virtual int GetId() const OVERRIDE; |
43 virtual Action GetAction() const OVERRIDE; | 41 virtual Action GetAction() const OVERRIDE; |
44 virtual int GetActionIndex() const OVERRIDE; | 42 virtual int GetActionIndex() const OVERRIDE; |
45 virtual size_t GetPointerCount() const OVERRIDE; | 43 virtual size_t GetPointerCount() const OVERRIDE; |
46 virtual int GetPointerId(size_t pointer_index) const OVERRIDE; | 44 virtual int GetPointerId(size_t pointer_index) const OVERRIDE; |
47 virtual float GetX(size_t pointer_index) const OVERRIDE; | 45 virtual float GetX(size_t pointer_index) const OVERRIDE; |
48 virtual float GetY(size_t pointer_index) const OVERRIDE; | 46 virtual float GetY(size_t pointer_index) const OVERRIDE; |
49 virtual float GetRawX(size_t pointer_index) const OVERRIDE; | 47 virtual float GetRawX(size_t pointer_index) const OVERRIDE; |
50 virtual float GetRawY(size_t pointer_index) const OVERRIDE; | 48 virtual float GetRawY(size_t pointer_index) const OVERRIDE; |
51 virtual float GetTouchMajor(size_t pointer_index) const OVERRIDE; | 49 virtual float GetTouchMajor(size_t pointer_index) const OVERRIDE; |
52 virtual float GetTouchMinor(size_t pointer_index) const OVERRIDE; | |
53 virtual float GetOrientation(size_t pointer_index) const OVERRIDE; | |
54 virtual float GetPressure(size_t pointer_index) const OVERRIDE; | 50 virtual float GetPressure(size_t pointer_index) const OVERRIDE; |
55 virtual ToolType GetToolType(size_t pointer_index) const OVERRIDE; | 51 virtual ToolType GetToolType(size_t pointer_index) const OVERRIDE; |
56 virtual int GetButtonState() const OVERRIDE; | 52 virtual int GetButtonState() const OVERRIDE; |
57 virtual base::TimeTicks GetEventTime() const OVERRIDE; | 53 virtual base::TimeTicks GetEventTime() const OVERRIDE; |
58 virtual scoped_ptr<MotionEvent> Clone() const OVERRIDE; | 54 virtual scoped_ptr<MotionEvent> Clone() const OVERRIDE; |
59 virtual scoped_ptr<MotionEvent> Cancel() const OVERRIDE; | 55 virtual scoped_ptr<MotionEvent> Cancel() const OVERRIDE; |
60 | 56 |
61 void PushPointer(const PointerProperties& pointer); | 57 void PushPointer(const PointerProperties& pointer); |
62 | 58 |
63 void set_action(Action action) { action_ = action; } | 59 void set_action(Action action) { action_ = action; } |
(...skipping 19 matching lines...) Expand all Loading... |
83 base::TimeTicks event_time_; | 79 base::TimeTicks event_time_; |
84 int id_; | 80 int id_; |
85 int action_index_; | 81 int action_index_; |
86 int button_state_; | 82 int button_state_; |
87 base::StackVector<PointerProperties, kTypicalMaxPointerCount> pointers_; | 83 base::StackVector<PointerProperties, kTypicalMaxPointerCount> pointers_; |
88 }; | 84 }; |
89 | 85 |
90 } // namespace ui | 86 } // namespace ui |
91 | 87 |
92 #endif // UI_EVENTS_GESTURE_DETECTION_UI_MOTION_EVENT_GENERIC_H_ | 88 #endif // UI_EVENTS_GESTURE_DETECTION_UI_MOTION_EVENT_GENERIC_H_ |
OLD | NEW |