| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "views/events/event.h" | |
| 6 | |
| 7 #include "base/logging.h" | |
| 8 #include "ui/aura/event.h" | |
| 9 #include "ui/base/keycodes/keyboard_code_conversion.h" | |
| 10 | |
| 11 namespace views { | |
| 12 | |
| 13 //////////////////////////////////////////////////////////////////////////////// | |
| 14 // LocatedEvent, protected: | |
| 15 | |
| 16 LocatedEvent::LocatedEvent(const NativeEvent& native_event) | |
| 17 : Event(native_event, native_event->type(), native_event->flags()), | |
| 18 location_(static_cast<aura::LocatedEvent*>(native_event)->location()) { | |
| 19 } | |
| 20 | |
| 21 //////////////////////////////////////////////////////////////////////////////// | |
| 22 // TouchEvent, public: | |
| 23 | |
| 24 TouchEvent::TouchEvent(const NativeEvent& event) | |
| 25 : LocatedEvent(event), | |
| 26 touch_id_(static_cast<aura::TouchEvent*>(event)->touch_id()), | |
| 27 radius_x_(static_cast<aura::TouchEvent*>(event)->radius_x()), | |
| 28 radius_y_(static_cast<aura::TouchEvent*>(event)->radius_y()), | |
| 29 rotation_angle_(static_cast<aura::TouchEvent*>(event)->rotation_angle()), | |
| 30 force_(static_cast<aura::TouchEvent*>(event)->force()) { | |
| 31 } | |
| 32 | |
| 33 //////////////////////////////////////////////////////////////////////////////// | |
| 34 // KeyEvent, public: | |
| 35 | |
| 36 KeyEvent::KeyEvent(const NativeEvent& native_event) | |
| 37 : Event(native_event, native_event->type(), native_event->flags()), | |
| 38 key_code_(static_cast<aura::KeyEvent*>(native_event)->key_code()), | |
| 39 character_(ui::GetCharacterFromKeyCode(key_code_, flags())), | |
| 40 unmodified_character_(0) { | |
| 41 } | |
| 42 | |
| 43 uint16 KeyEvent::GetCharacter() const { | |
| 44 return character_; | |
| 45 } | |
| 46 | |
| 47 uint16 KeyEvent::GetUnmodifiedCharacter() const { | |
| 48 if (unmodified_character_) | |
| 49 return unmodified_character_; | |
| 50 | |
| 51 return ui::GetCharacterFromKeyCode(key_code_, flags() & ui::EF_SHIFT_DOWN); | |
| 52 } | |
| 53 | |
| 54 //////////////////////////////////////////////////////////////////////////////// | |
| 55 // MouseWheelEvent, public: | |
| 56 | |
| 57 MouseWheelEvent::MouseWheelEvent(const NativeEvent& native_event) | |
| 58 : MouseEvent(native_event), | |
| 59 offset_(ui::GetMouseWheelOffset(native_event->native_event())) { | |
| 60 } | |
| 61 | |
| 62 } // namespace views | |
| OLD | NEW |