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_OZONE_EVDEV_EVENT_DISPATCH_CALLBACK_H_ | 5 #ifndef UI_EVENTS_OZONE_EVDEV_EVENT_DISPATCH_CALLBACK_H_ |
6 #define UI_EVENTS_OZONE_EVDEV_EVENT_DISPATCH_CALLBACK_H_ | 6 #define UI_EVENTS_OZONE_EVDEV_EVENT_DISPATCH_CALLBACK_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/time/time.h" | |
10 #include "ui/events/event_constants.h" | |
11 #include "ui/gfx/geometry/point_f.h" | |
12 #include "ui/gfx/geometry/vector2d_f.h" | |
13 | |
14 namespace base { | |
15 class TimeDelta; | |
16 } | |
17 | |
18 namespace gfx { | |
19 class PointF; | |
20 class Vector2d; | |
21 class Vector2dF; | |
22 } | |
23 | 9 |
24 namespace ui { | 10 namespace ui { |
25 | 11 |
26 class Event; | 12 class Event; |
27 | 13 |
28 typedef base::Callback<void(scoped_ptr<Event>)> EventDispatchCallback; | 14 typedef base::Callback<void(scoped_ptr<Event>)> EventDispatchCallback; |
29 | 15 |
30 typedef base::Callback<void(int device_id, unsigned int code, bool down)> | |
31 KeyEventDispatchCallback; | |
32 | |
33 typedef base::Callback<void(int device_id, const gfx::PointF& location)> | |
34 MouseMoveEventDispatchCallback; | |
35 | |
36 typedef base::Callback<void(int device_id, | |
37 const gfx::PointF& location, | |
38 unsigned int button, | |
39 bool down, | |
40 bool allow_remap)> MouseButtonEventDispatchCallback; | |
41 | |
42 typedef base::Callback<void(int device_id, | |
43 const gfx::PointF& location, | |
44 const gfx::Vector2d& delta)> | |
45 MouseWheelEventDispatchCallback; | |
46 | |
47 struct ScrollEventParams { | |
48 ScrollEventParams(int device_id, | |
49 EventType type, | |
50 const gfx::PointF location, | |
51 const gfx::Vector2dF delta, | |
52 const gfx::Vector2dF ordinal_delta, | |
53 int finger_count, | |
54 const base::TimeDelta timestamp); | |
55 ScrollEventParams(const ScrollEventParams& other); | |
56 ~ScrollEventParams(); | |
57 | |
58 int device_id; | |
59 EventType type; | |
60 const gfx::PointF location; | |
61 const gfx::Vector2dF delta; | |
62 const gfx::Vector2dF ordinal_delta; | |
63 int finger_count; | |
64 const base::TimeDelta timestamp; | |
65 }; | |
66 | |
67 typedef base::Callback<void(const ScrollEventParams& params)> | |
68 ScrollEventDispatchCallback; | |
69 | |
70 struct TouchEventParams { | |
71 TouchEventParams(int device_id, | |
72 int touch_id, | |
73 EventType type, | |
74 const gfx::PointF& location, | |
75 const gfx::Vector2dF& radii, | |
76 float pressure, | |
77 const base::TimeDelta& timestamp); | |
78 TouchEventParams(const TouchEventParams& other); | |
79 ~TouchEventParams(); | |
80 | |
81 int device_id; | |
82 int touch_id; | |
83 EventType type; | |
84 gfx::PointF location; | |
85 gfx::Vector2dF radii; | |
86 float pressure; | |
87 base::TimeDelta timestamp; | |
88 }; | |
89 | |
90 typedef base::Callback<void(const TouchEventParams& params)> | |
91 TouchEventDispatchCallback; | |
92 | |
93 } // namspace ui | 16 } // namspace ui |
94 | 17 |
95 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_DISPATCH_CALLBACK_H_ | 18 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_DISPATCH_CALLBACK_H_ |
OLD | NEW |