summaryrefslogtreecommitdiffstats
path: root/views/events/event.cc
diff options
context:
space:
mode:
Diffstat (limited to 'views/events/event.cc')
-rw-r--r--views/events/event.cc40
1 files changed, 35 insertions, 5 deletions
diff --git a/views/events/event.cc b/views/events/event.cc
index 565165b..2a814bd 100644
--- a/views/events/event.cc
+++ b/views/events/event.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -8,12 +8,35 @@
namespace views {
+////////////////////////////////////////////////////////////////////////////////
+// Event, protected:
+
Event::Event(ui::EventType type, int flags)
: type_(type),
time_stamp_(base::Time::NowFromSystemTime()),
flags_(flags) {
+ Init();
+}
+
+Event::Event(NativeEvent native_event, ui::EventType type, int flags)
+ : type_(type),
+ time_stamp_(base::Time::NowFromSystemTime()),
+ flags_(flags) {
+ InitWithNativeEvent(native_event);
+}
+
+Event::Event(NativeEvent2 native_event_2, ui::EventType type, int flags,
+ FromNativeEvent2 from_native)
+ : native_event_2_(native_event_2),
+ type_(type),
+ time_stamp_(base::Time::NowFromSystemTime()),
+ flags_(flags) {
+ InitWithNativeEvent2(native_event_2, from_native);
}
+////////////////////////////////////////////////////////////////////////////////
+// LocatedEvent, public:
+
LocatedEvent::LocatedEvent(const LocatedEvent& model, View* from, View* to)
: Event(model),
location_(model.location_) {
@@ -21,14 +44,18 @@ LocatedEvent::LocatedEvent(const LocatedEvent& model, View* from, View* to)
View::ConvertPointToView(from, to, &location_);
}
+////////////////////////////////////////////////////////////////////////////////
+// KeyEvent, public:
+
KeyEvent::KeyEvent(ui::EventType type, ui::KeyboardCode key_code,
- int event_flags, int repeat_count, int message_flags)
+ int event_flags)
: Event(type, event_flags),
- key_code_(key_code),
- repeat_count_(repeat_count),
- message_flags_(message_flags) {
+ key_code_(key_code) {
}
+////////////////////////////////////////////////////////////////////////////////
+// MouseEvent, public:
+
MouseEvent::MouseEvent(ui::EventType type,
View* from,
View* to,
@@ -43,6 +70,9 @@ MouseEvent::MouseEvent(const MouseEvent& model, View* from, View* to)
: LocatedEvent(model, from, to) {
}
+////////////////////////////////////////////////////////////////////////////////
+// TouchEvent, public:
+
#if defined(TOUCH_UI)
TouchEvent::TouchEvent(ui::EventType type, int x, int y, int flags, int touch_id)
: LocatedEvent(type, gfx::Point(x, y), flags),