OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "ui/views/events/event.h" | |
6 | |
7 #include "base/logging.h" | |
8 #include "ui/base/keycodes/keyboard_code_conversion.h" | |
9 #include "ui/views/view.h" | |
10 #include "ui/views/widget/root_view.h" | |
11 | |
12 namespace views { | |
13 | |
14 //////////////////////////////////////////////////////////////////////////////// | |
15 // MouseWheelEvent, public: | |
16 | |
17 #if !defined(USE_AURA) | |
18 MouseWheelEvent::MouseWheelEvent(const ui::NativeEvent& native_event) | |
19 : MouseEvent(native_event), | |
20 offset_(ui::GetMouseWheelOffset(native_event)) { | |
21 } | |
22 #endif | |
23 | |
24 MouseWheelEvent::MouseWheelEvent(const ScrollEvent& scroll_event) | |
25 : MouseEvent(scroll_event), | |
26 offset_(scroll_event.y_offset()) { | |
27 set_type(ui::ET_MOUSEWHEEL); | |
28 } | |
29 | |
30 //////////////////////////////////////////////////////////////////////////////// | |
31 // TouchEvent, public: | |
32 | |
33 TouchEvent::TouchEvent(ui::EventType type, | |
34 int x, | |
35 int y, | |
36 int flags, | |
37 int touch_id, | |
38 float radius_x, | |
39 float radius_y, | |
40 float angle, | |
41 float force) | |
42 : LocatedEvent(type, gfx::Point(x, y), gfx::Point(x, y), flags), | |
43 touch_id_(touch_id), | |
44 radius_x_(radius_x), | |
45 radius_y_(radius_y), | |
46 rotation_angle_(angle), | |
47 force_(force) { | |
48 } | |
49 | |
50 TouchEvent::TouchEvent(const TouchEvent& model, View* source, View* target) | |
51 : LocatedEvent(model, source, target), | |
52 touch_id_(model.touch_id_), | |
53 radius_x_(model.radius_x_), | |
54 radius_y_(model.radius_y_), | |
55 rotation_angle_(model.rotation_angle_), | |
56 force_(model.force_) { | |
57 } | |
58 | |
59 TouchEvent::~TouchEvent() { | |
60 } | |
61 | |
62 //////////////////////////////////////////////////////////////////////////////// | |
63 // MouseWheelEvent, public: | |
64 | |
65 #if defined(OS_WIN) | |
66 // This value matches windows WHEEL_DELTA. | |
67 // static | |
68 const int MouseWheelEvent::kWheelDelta = 120; | |
69 #else | |
70 // This value matches GTK+ wheel scroll amount. | |
71 const int MouseWheelEvent::kWheelDelta = 53; | |
72 #endif | |
73 | |
74 //////////////////////////////////////////////////////////////////////////////// | |
75 // GestureEvent, public: | |
76 | |
77 GestureEvent::GestureEvent(const GestureEvent& model, View* source, | |
78 View* target) | |
79 : LocatedEvent(model, source, target), | |
80 details_(model.details_) { | |
81 } | |
82 | |
83 //////////////////////////////////////////////////////////////////////////////// | |
84 // GestureEvent, private: | |
85 | |
86 GestureEvent::GestureEvent(ui::EventType type, int x, int y, int flags) | |
87 : LocatedEvent(type, gfx::Point(x, y), gfx::Point(x, y), flags), | |
88 details_(type, 0.f, 0.f) { | |
89 } | |
90 | |
91 GestureEvent::~GestureEvent() { | |
92 } | |
93 | |
94 GestureEventForTest::GestureEventForTest(ui::EventType type, | |
95 int x, | |
96 int y, | |
97 int flags) | |
98 : GestureEvent(type, x, y, flags) { | |
99 } | |
100 | |
101 } // namespace views | |
OLD | NEW |