diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-11 16:51:25 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-11 16:51:25 +0000 |
commit | 6545f1cdbbe569d404f916bef157f201028b63a0 (patch) | |
tree | 4d849f4aad386cc4cad08f94f314d78cfb7f55a5 /views/events/event.cc | |
parent | 5d451ad21fc1836a024cabecc1172c32fbe92b03 (diff) | |
download | chromium_src-6545f1cdbbe569d404f916bef157f201028b63a0.zip chromium_src-6545f1cdbbe569d404f916bef157f201028b63a0.tar.gz chromium_src-6545f1cdbbe569d404f916bef157f201028b63a0.tar.bz2 |
Adds the ability to construct a KeyEvent from a NativeEvent[2], and converts some code to use it.
Removes some of the Windows-specific stuff from KeyEvent.
BUG=72040
TEST=none
Review URL: http://codereview.chromium.org/6487002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@74614 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/events/event.cc')
-rw-r--r-- | views/events/event.cc | 40 |
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), |