Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(226)

Side by Side Diff: views/events/event.cc

Issue 6487002: Add a new constructor to KeyEvent. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
OLDNEW
« no previous file with comments | « views/events/event.h ('k') | views/events/event_gtk.cc » ('j') | views/events/event_gtk.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698