| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "views/events/event.h" | 5 #include "views/events/event.h" |
| 6 | 6 |
| 7 #include "views/view.h" | 7 #include "views/view.h" |
| 8 | 8 |
| 9 namespace views { | 9 namespace views { |
| 10 | 10 |
| 11 Event::Event(ui::EventType type, int flags) | 11 Event::Event(ui::EventType type, int flags) |
| 12 : type_(type), | 12 : type_(type), |
| 13 time_stamp_(base::Time::NowFromSystemTime()), | 13 time_stamp_(base::Time::NowFromSystemTime()), |
| 14 flags_(flags) { | 14 flags_(flags) { |
| 15 Init(); |
| 16 } |
| 17 |
| 18 Event::Event(NativeEvent native_event, ui::EventType type, int flags) |
| 19 : type_(type), |
| 20 time_stamp_(base::Time::NowFromSystemTime()), |
| 21 flags_(flags) { |
| 22 InitWithNativeEvent(native_event); |
| 23 } |
| 24 |
| 25 Event::Event(NativeEvent2 native_event_2, ui::EventType type, int flags) |
| 26 : native_event_2_(native_event_2), |
| 27 type_(type), |
| 28 time_stamp_(base::Time::NowFromSystemTime()), |
| 29 flags_(flags) { |
| 30 InitWithNativeEvent2(native_event_2); |
| 15 } | 31 } |
| 16 | 32 |
| 17 LocatedEvent::LocatedEvent(const LocatedEvent& model, View* from, View* to) | 33 LocatedEvent::LocatedEvent(const LocatedEvent& model, View* from, View* to) |
| 18 : Event(model), | 34 : Event(model), |
| 19 location_(model.location_) { | 35 location_(model.location_) { |
| 20 if (to) | 36 if (to) |
| 21 View::ConvertPointToView(from, to, &location_); | 37 View::ConvertPointToView(from, to, &location_); |
| 22 } | 38 } |
| 23 | 39 |
| 24 KeyEvent::KeyEvent(ui::EventType type, ui::KeyboardCode key_code, | 40 KeyEvent::KeyEvent(ui::EventType type, ui::KeyboardCode key_code, |
| 25 int event_flags, int repeat_count, int message_flags) | 41 int event_flags) |
| 26 : Event(type, event_flags), | 42 : Event(type, event_flags), |
| 27 key_code_(key_code), | 43 key_code_(key_code) { |
| 28 repeat_count_(repeat_count), | |
| 29 message_flags_(message_flags) { | |
| 30 } | 44 } |
| 31 | 45 |
| 32 MouseEvent::MouseEvent(ui::EventType type, | 46 MouseEvent::MouseEvent(ui::EventType type, |
| 33 View* from, | 47 View* from, |
| 34 View* to, | 48 View* to, |
| 35 const gfx::Point &l, | 49 const gfx::Point &l, |
| 36 int flags) | 50 int flags) |
| 37 : LocatedEvent(LocatedEvent(type, gfx::Point(l.x(), l.y()), flags), | 51 : LocatedEvent(LocatedEvent(type, gfx::Point(l.x(), l.y()), flags), |
| 38 from, | 52 from, |
| 39 to) { | 53 to) { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 62 touch_id_(touch_id) { | 76 touch_id_(touch_id) { |
| 63 } | 77 } |
| 64 | 78 |
| 65 TouchEvent::TouchEvent(const TouchEvent& model, View* from, View* to) | 79 TouchEvent::TouchEvent(const TouchEvent& model, View* from, View* to) |
| 66 : LocatedEvent(model, from, to), | 80 : LocatedEvent(model, from, to), |
| 67 touch_id_(model.touch_id_) { | 81 touch_id_(model.touch_id_) { |
| 68 } | 82 } |
| 69 #endif | 83 #endif |
| 70 | 84 |
| 71 } // namespace views | 85 } // namespace views |
| OLD | NEW |