| 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 #ifndef UI_VIEWS_EVENTS_EVENT_H_ | 5 #ifndef UI_VIEWS_EVENTS_EVENT_H_ |
| 6 #define UI_VIEWS_EVENTS_EVENT_H_ | 6 #define UI_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/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 // | 284 // |
| 285 //////////////////////////////////////////////////////////////////////////////// | 285 //////////////////////////////////////////////////////////////////////////////// |
| 286 class VIEWS_EXPORT KeyEvent : public Event { | 286 class VIEWS_EXPORT KeyEvent : public Event { |
| 287 public: | 287 public: |
| 288 explicit KeyEvent(const NativeEvent& native_event); | 288 explicit KeyEvent(const NativeEvent& native_event); |
| 289 | 289 |
| 290 // Creates a new KeyEvent synthetically (i.e. not in response to an input | 290 // Creates a new KeyEvent synthetically (i.e. not in response to an input |
| 291 // event from the host environment). This is typically only used in testing as | 291 // event from the host environment). This is typically only used in testing as |
| 292 // some metadata obtainable from the underlying native event is not present. | 292 // some metadata obtainable from the underlying native event is not present. |
| 293 // It's also used by input methods to fabricate keyboard events. | 293 // It's also used by input methods to fabricate keyboard events. |
| 294 KeyEvent(ui::EventType type, | 294 KeyEvent(ui::EventType type, ui::KeyboardCode key_code, int event_flags); |
| 295 ui::KeyboardCode key_code, | |
| 296 int event_flags); | |
| 297 | 295 |
| 298 ui::KeyboardCode key_code() const { return key_code_; } | 296 ui::KeyboardCode key_code() const { return key_code_; } |
| 299 | 297 |
| 300 // These setters allow an I18N virtual keyboard to fabricate a keyboard event | 298 // These setters allow an I18N virtual keyboard to fabricate a keyboard event |
| 301 // which does not have a corresponding ui::KeyboardCode (example: U+00E1 Latin | 299 // which does not have a corresponding ui::KeyboardCode (example: U+00E1 Latin |
| 302 // small letter A with acute, U+0410 Cyrillic capital letter A.) | 300 // small letter A with acute, U+0410 Cyrillic capital letter A.) |
| 303 // GetCharacter() and GetUnmodifiedCharacter() return the character. | 301 // GetCharacter() and GetUnmodifiedCharacter() return the character. |
| 304 void set_character(uint16 character) { character_ = character; } | 302 void set_character(uint16 character) { character_ = character; } |
| 305 void set_unmodified_character(uint16 unmodified_character) { | 303 void set_unmodified_character(uint16 unmodified_character) { |
| 306 unmodified_character_ = unmodified_character; | 304 unmodified_character_ = unmodified_character; |
| 307 } | 305 } |
| 308 | 306 |
| 309 // Gets the character generated by this key event. It only supports Unicode | 307 // Gets the character generated by this key event. It only supports Unicode |
| 310 // BMP characters. | 308 // BMP characters. |
| 311 uint16 GetCharacter() const; | 309 uint16 GetCharacter() const; |
| 312 | 310 |
| 313 // Gets the character generated by this key event ignoring concurrently-held | 311 // Gets the character generated by this key event ignoring concurrently-held |
| 314 // modifiers (except shift). | 312 // modifiers (except shift). |
| 315 uint16 GetUnmodifiedCharacter() const; | 313 uint16 GetUnmodifiedCharacter() const; |
| 316 | 314 |
| 315 // Returns if the key is a numeric pad digit, regardless of NumLock state. |
| 316 bool IsNumPadDigit() const; |
| 317 |
| 317 private: | 318 private: |
| 318 ui::KeyboardCode key_code_; | 319 ui::KeyboardCode key_code_; |
| 319 | 320 |
| 320 uint16 character_; | 321 uint16 character_; |
| 321 uint16 unmodified_character_; | 322 uint16 unmodified_character_; |
| 322 | 323 |
| 323 DISALLOW_COPY_AND_ASSIGN(KeyEvent); | 324 DISALLOW_COPY_AND_ASSIGN(KeyEvent); |
| 324 }; | 325 }; |
| 325 | 326 |
| 326 class ScrollEvent; | 327 class ScrollEvent; |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 DISALLOW_COPY_AND_ASSIGN(GestureEventForTest); | 448 DISALLOW_COPY_AND_ASSIGN(GestureEventForTest); |
| 448 }; | 449 }; |
| 449 | 450 |
| 450 #if defined(OS_WIN) | 451 #if defined(OS_WIN) |
| 451 int GetModifiersFromKeyState(); | 452 int GetModifiersFromKeyState(); |
| 452 #endif | 453 #endif |
| 453 | 454 |
| 454 } // namespace views | 455 } // namespace views |
| 455 | 456 |
| 456 #endif // UI_VIEWS_EVENTS_EVENT_H_ | 457 #endif // UI_VIEWS_EVENTS_EVENT_H_ |
| OLD | NEW |