| OLD | NEW |
| 1 // Copyright (c) 2011 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 "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "views/view.h" | 8 #include "views/view.h" |
| 9 #include "views/widget/root_view.h" | 9 #include "views/widget/root_view.h" |
| 10 | 10 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 character_(0), | 81 character_(0), |
| 82 unmodified_character_(0) { | 82 unmodified_character_(0) { |
| 83 } | 83 } |
| 84 #endif | 84 #endif |
| 85 | 85 |
| 86 KeyEvent::KeyEvent(ui::EventType type, | 86 KeyEvent::KeyEvent(ui::EventType type, |
| 87 ui::KeyboardCode key_code, | 87 ui::KeyboardCode key_code, |
| 88 int event_flags) | 88 int event_flags) |
| 89 : Event(type, event_flags), | 89 : Event(type, event_flags), |
| 90 key_code_(key_code), | 90 key_code_(key_code), |
| 91 character_(0), | 91 character_(GetCharacterFromKeyCode(key_code, event_flags)), |
| 92 unmodified_character_(0) { | 92 unmodified_character_(0) { |
| 93 } | 93 } |
| 94 | 94 |
| 95 // KeyEvent, private: --------------------------------------------------------- | 95 // KeyEvent, private: --------------------------------------------------------- |
| 96 | 96 |
| 97 // static | 97 // static |
| 98 uint16 KeyEvent::GetCharacterFromKeyCode(ui::KeyboardCode key_code, int flags) { | 98 uint16 KeyEvent::GetCharacterFromKeyCode(ui::KeyboardCode key_code, int flags) { |
| 99 const bool ctrl = (flags & ui::EF_CONTROL_DOWN) != 0; | 99 const bool ctrl = (flags & ui::EF_CONTROL_DOWN) != 0; |
| 100 const bool shift = (flags & ui::EF_SHIFT_DOWN) != 0; | 100 const bool shift = (flags & ui::EF_SHIFT_DOWN) != 0; |
| 101 const bool upper = shift ^ ((flags & ui::EF_CAPS_LOCK_DOWN) != 0); | 101 const bool upper = shift ^ ((flags & ui::EF_CAPS_LOCK_DOWN) != 0); |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 } | 291 } |
| 292 | 292 |
| 293 //////////////////////////////////////////////////////////////////////////////// | 293 //////////////////////////////////////////////////////////////////////////////// |
| 294 // MouseWheelEvent, public: | 294 // MouseWheelEvent, public: |
| 295 | 295 |
| 296 // This value matches windows WHEEL_DELTA. | 296 // This value matches windows WHEEL_DELTA. |
| 297 // static | 297 // static |
| 298 const int MouseWheelEvent::kWheelDelta = 120; | 298 const int MouseWheelEvent::kWheelDelta = 120; |
| 299 | 299 |
| 300 } // namespace views | 300 } // namespace views |
| OLD | NEW |