Chromium Code Reviews| 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 #ifndef VIEWS_EVENTS_EVENT_H_ | 5 #ifndef VIEWS_EVENTS_EVENT_H_ |
| 6 #define VIEWS_EVENTS_EVENT_H_ | 6 #define VIEWS_EVENTS_EVENT_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/time.h" | 10 #include "base/time.h" |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 282 // | 282 // |
| 283 //////////////////////////////////////////////////////////////////////////////// | 283 //////////////////////////////////////////////////////////////////////////////// |
| 284 class KeyEvent : public Event { | 284 class KeyEvent : public Event { |
| 285 public: | 285 public: |
| 286 explicit KeyEvent(NativeEvent native_event); | 286 explicit KeyEvent(NativeEvent native_event); |
| 287 KeyEvent(NativeEvent2 native_event_2, FromNativeEvent2 from_native); | 287 KeyEvent(NativeEvent2 native_event_2, FromNativeEvent2 from_native); |
| 288 | 288 |
| 289 // Creates a new KeyEvent synthetically (i.e. not in response to an input | 289 // Creates a new KeyEvent synthetically (i.e. not in response to an input |
| 290 // event from the host environment). This is typically only used in testing as | 290 // event from the host environment). This is typically only used in testing as |
| 291 // some metadata obtainable from the underlying native event is not present. | 291 // some metadata obtainable from the underlying native event is not present. |
| 292 // TODO(beng): see if we can kill this. | 292 // It's also used by input methods to fabricate keyboard events. |
| 293 KeyEvent(ui::EventType type, | 293 KeyEvent(ui::EventType type, |
| 294 ui::KeyboardCode key_code, | 294 ui::KeyboardCode key_code, |
| 295 int event_flags); | 295 int event_flags); |
| 296 | 296 |
| 297 ui::KeyboardCode key_code() const { return key_code_; } | 297 ui::KeyboardCode key_code() const { return key_code_; } |
| 298 | 298 |
| 299 // Gets the character generated by this key event. It only supports Unicode | |
| 300 // BMP characters. | |
|
oshima
2011/03/21 18:35:42
What do we do for non-BMP?
James Su
2011/03/21 18:59:22
non-BMP characters could be input via TextInputCli
| |
| 301 uint16 GetCharacter() const; | |
| 302 | |
| 303 // Gets the character generated by this key event ignoring concurrently-held | |
| 304 // modifiers (except shift). | |
| 305 uint16 GetUnmodifiedCharacter() const; | |
| 306 | |
| 299 private: | 307 private: |
| 308 // A helper function to get the character generated by a key event in a | |
| 309 // platform independent way. It supports control characters as well. | |
| 310 // It assumes a US keyboard layout is used, so it may only be used when there | |
| 311 // is no native event or no better way to get the character. | |
|
oshima
2011/03/21 18:35:42
I indeed assume us keyboard, but it's still not cl
James Su
2011/03/21 18:59:22
Key events generated by virtual keyboard or input
| |
| 312 static uint16 GetCharacterFromKeyCode(ui::KeyboardCode key_code, int flags); | |
| 313 | |
| 300 ui::KeyboardCode key_code_; | 314 ui::KeyboardCode key_code_; |
| 301 | 315 |
| 302 DISALLOW_COPY_AND_ASSIGN(KeyEvent); | 316 DISALLOW_COPY_AND_ASSIGN(KeyEvent); |
| 303 }; | 317 }; |
| 304 | 318 |
| 305 //////////////////////////////////////////////////////////////////////////////// | 319 //////////////////////////////////////////////////////////////////////////////// |
| 306 // | 320 // |
| 307 // MouseWheelEvent class | 321 // MouseWheelEvent class |
| 308 // | 322 // |
| 309 // A MouseWheelEvent is used to propagate mouse wheel user events. | 323 // A MouseWheelEvent is used to propagate mouse wheel user events. |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 362 | 376 |
| 363 // Bitmask of supported ui::DragDropTypes::DragOperation by the source. | 377 // Bitmask of supported ui::DragDropTypes::DragOperation by the source. |
| 364 int source_operations_; | 378 int source_operations_; |
| 365 | 379 |
| 366 DISALLOW_COPY_AND_ASSIGN(DropTargetEvent); | 380 DISALLOW_COPY_AND_ASSIGN(DropTargetEvent); |
| 367 }; | 381 }; |
| 368 | 382 |
| 369 } // namespace views | 383 } // namespace views |
| 370 | 384 |
| 371 #endif // VIEWS_EVENTS_EVENT_H_ | 385 #endif // VIEWS_EVENTS_EVENT_H_ |
| OLD | NEW |