OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/views/events/event.h" | 5 #include "ui/views/events/event.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "ui/base/event.h" | 8 #include "ui/base/event.h" |
9 #include "ui/base/keycodes/keyboard_code_conversion.h" | 9 #include "ui/base/keycodes/keyboard_code_conversion.h" |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 : LocatedEvent(event), | 25 : LocatedEvent(event), |
26 touch_id_(static_cast<ui::TouchEventImpl*>(event)->touch_id()), | 26 touch_id_(static_cast<ui::TouchEventImpl*>(event)->touch_id()), |
27 radius_x_(static_cast<ui::TouchEventImpl*>(event)->radius_x()), | 27 radius_x_(static_cast<ui::TouchEventImpl*>(event)->radius_x()), |
28 radius_y_(static_cast<ui::TouchEventImpl*>(event)->radius_y()), | 28 radius_y_(static_cast<ui::TouchEventImpl*>(event)->radius_y()), |
29 rotation_angle_( | 29 rotation_angle_( |
30 static_cast<ui::TouchEventImpl*>(event)->rotation_angle()), | 30 static_cast<ui::TouchEventImpl*>(event)->rotation_angle()), |
31 force_(static_cast<ui::TouchEventImpl*>(event)->force()) { | 31 force_(static_cast<ui::TouchEventImpl*>(event)->force()) { |
32 } | 32 } |
33 | 33 |
34 //////////////////////////////////////////////////////////////////////////////// | 34 //////////////////////////////////////////////////////////////////////////////// |
35 // KeyEvent, public: | |
36 | |
37 KeyEvent::KeyEvent(const NativeEvent& native_event) | |
38 : Event(native_event, native_event->type(), native_event->flags()), | |
39 key_code_(static_cast<ui::KeyEvent*>(native_event)->key_code()), | |
40 character_(ui::GetCharacterFromKeyCode(key_code_, flags())), | |
41 unmodified_character_(0) { | |
42 } | |
43 | |
44 uint16 KeyEvent::GetCharacter() const { | |
45 return character_; | |
46 } | |
47 | |
48 uint16 KeyEvent::GetUnmodifiedCharacter() const { | |
49 if (unmodified_character_) | |
50 return unmodified_character_; | |
51 | |
52 return ui::GetCharacterFromKeyCode(key_code_, flags() & ui::EF_SHIFT_DOWN); | |
53 } | |
54 | |
55 //////////////////////////////////////////////////////////////////////////////// | |
56 // MouseWheelEvent, public: | 35 // MouseWheelEvent, public: |
57 | 36 |
58 MouseWheelEvent::MouseWheelEvent(const NativeEvent& native_event) | 37 MouseWheelEvent::MouseWheelEvent(const NativeEvent& native_event) |
59 : MouseEvent(native_event), | 38 : MouseEvent(native_event), |
60 offset_(ui::GetMouseWheelOffset(native_event->native_event())) { | 39 offset_(ui::GetMouseWheelOffset(native_event->native_event())) { |
61 } | 40 } |
62 | 41 |
63 //////////////////////////////////////////////////////////////////////////////// | 42 //////////////////////////////////////////////////////////////////////////////// |
64 // ScrollEvent, public: | 43 // ScrollEvent, public: |
65 | 44 |
(...skipping 10 matching lines...) Expand all Loading... |
76 : LocatedEvent(event), | 55 : LocatedEvent(event), |
77 details_(static_cast<ui::GestureEventImpl*>(event)->details()) { | 56 details_(static_cast<ui::GestureEventImpl*>(event)->details()) { |
78 } | 57 } |
79 | 58 |
80 int GestureEvent::GetLowestTouchId() const { | 59 int GestureEvent::GetLowestTouchId() const { |
81 return native_event() ? static_cast<ui::GestureEventImpl*>( | 60 return native_event() ? static_cast<ui::GestureEventImpl*>( |
82 native_event())->GetLowestTouchId() : 0; | 61 native_event())->GetLowestTouchId() : 0; |
83 } | 62 } |
84 | 63 |
85 } // namespace views | 64 } // namespace views |
OLD | NEW |