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 <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "ui/base/keycodes/keyboard_code_conversion_win.h" | 10 #include "ui/base/keycodes/keyboard_code_conversion_win.h" |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 key_code_(ui::KeyboardCodeForWindowsKeyCode(native_event.wParam)) { | 210 key_code_(ui::KeyboardCodeForWindowsKeyCode(native_event.wParam)) { |
211 } | 211 } |
212 | 212 |
213 KeyEvent::KeyEvent(NativeEvent2 native_event_2, FromNativeEvent2 from_native) | 213 KeyEvent::KeyEvent(NativeEvent2 native_event_2, FromNativeEvent2 from_native) |
214 : Event(native_event_2, ui::ET_UNKNOWN, 0, from_native) { | 214 : Event(native_event_2, ui::ET_UNKNOWN, 0, from_native) { |
215 // No one should ever call this on Windows. | 215 // No one should ever call this on Windows. |
216 // TODO(beng): remove once we rid views of Gtk/Gdk. | 216 // TODO(beng): remove once we rid views of Gtk/Gdk. |
217 NOTREACHED(); | 217 NOTREACHED(); |
218 } | 218 } |
219 | 219 |
| 220 uint16 KeyEvent::GetCharacter() const { |
| 221 return (native_event().message == WM_CHAR) ? key_code_ : |
| 222 GetCharacterFromKeyCode(key_code_, flags()); |
| 223 } |
| 224 |
| 225 uint16 KeyEvent::GetUnmodifiedCharacter() const { |
| 226 // Looks like there is no way to get unmodified character on Windows. |
| 227 return (native_event().message == WM_CHAR) ? key_code_ : |
| 228 GetCharacterFromKeyCode(key_code_, flags() & ui::EF_SHIFT_DOWN); |
| 229 } |
| 230 |
220 //////////////////////////////////////////////////////////////////////////////// | 231 //////////////////////////////////////////////////////////////////////////////// |
221 // MouseEvent, public: | 232 // MouseEvent, public: |
222 | 233 |
223 MouseEvent::MouseEvent(NativeEvent native_event) | 234 MouseEvent::MouseEvent(NativeEvent native_event) |
224 : LocatedEvent(native_event) { | 235 : LocatedEvent(native_event) { |
225 if (IsNonClientMouseEvent(native_event)) { | 236 if (IsNonClientMouseEvent(native_event)) { |
226 // Non-client message. The position is contained in a POINTS structure in | 237 // Non-client message. The position is contained in a POINTS structure in |
227 // LPARAM, and is in screen coordinates so we have to convert to client. | 238 // LPARAM, and is in screen coordinates so we have to convert to client. |
228 POINT native_point = location_.ToPOINT(); | 239 POINT native_point = location_.ToPOINT(); |
229 ScreenToClient(native_event.hwnd, &native_point); | 240 ScreenToClient(native_event.hwnd, &native_point); |
(...skipping 19 matching lines...) Expand all Loading... |
249 | 260 |
250 MouseWheelEvent::MouseWheelEvent(NativeEvent2 native_event_2, | 261 MouseWheelEvent::MouseWheelEvent(NativeEvent2 native_event_2, |
251 FromNativeEvent2 from_native) | 262 FromNativeEvent2 from_native) |
252 : MouseEvent(native_event_2, from_native) { | 263 : MouseEvent(native_event_2, from_native) { |
253 // No one should ever call this on Windows. | 264 // No one should ever call this on Windows. |
254 // TODO(msw): remove once we rid views of Gtk/Gdk. | 265 // TODO(msw): remove once we rid views of Gtk/Gdk. |
255 NOTREACHED(); | 266 NOTREACHED(); |
256 } | 267 } |
257 | 268 |
258 } // namespace views | 269 } // namespace views |
OLD | NEW |