Chromium Code Reviews| 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_EVENTS_EVENT_H_ | 5 #ifndef UI_EVENTS_EVENT_H_ |
| 6 #define UI_EVENTS_EVENT_H_ | 6 #define UI_EVENTS_EVENT_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/event_types.h" | 10 #include "base/event_types.h" |
| (...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 543 // letter A with acute, U+0410 Cyrillic capital letter A). | 543 // letter A with acute, U+0410 Cyrillic capital letter A). |
| 544 void set_character(uint16 character) { character_ = character; } | 544 void set_character(uint16 character) { character_ = character; } |
| 545 | 545 |
| 546 // Gets the character generated by this key event. It only supports Unicode | 546 // Gets the character generated by this key event. It only supports Unicode |
| 547 // BMP characters. | 547 // BMP characters. |
| 548 uint16 GetCharacter() const; | 548 uint16 GetCharacter() const; |
| 549 | 549 |
| 550 KeyboardCode key_code() const { return key_code_; } | 550 KeyboardCode key_code() const { return key_code_; } |
| 551 bool is_char() const { return is_char_; } | 551 bool is_char() const { return is_char_; } |
| 552 | 552 |
| 553 bool is_fabricated_by_ime() const { return is_fabricated_by_ime_; } | |
| 554 | |
| 553 // This is only intended to be used externally by classes that are modifying | 555 // This is only intended to be used externally by classes that are modifying |
| 554 // events in EventFilter::PreHandleKeyEvent(). set_character() should also be | 556 // events in EventFilter::PreHandleKeyEvent(). set_character() should also be |
| 555 // called. | 557 // called. |
| 556 void set_key_code(KeyboardCode key_code) { key_code_ = key_code; } | 558 void set_key_code(KeyboardCode key_code) { key_code_ = key_code; } |
| 557 | 559 |
| 558 // Returns true for [Alt]+<num-pad digit> Unicode alt key codes used by Win. | 560 // Returns true for [Alt]+<num-pad digit> Unicode alt key codes used by Win. |
| 559 // TODO(msw): Additional work may be needed for analogues on other platforms. | 561 // TODO(msw): Additional work may be needed for analogues on other platforms. |
| 560 bool IsUnicodeKeyCode() const; | 562 bool IsUnicodeKeyCode() const; |
| 561 | 563 |
| 562 std::string code() const { return code_; } | 564 std::string code() const { return code_; } |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 577 // http://www.w3.org/TR/uievents/#keyboard-key-codes. | 579 // http://www.w3.org/TR/uievents/#keyboard-key-codes. |
| 578 // | 580 // |
| 579 // This value represents the physical position in the keyboard and can be | 581 // This value represents the physical position in the keyboard and can be |
| 580 // converted from / to keyboard scan code like XKB. | 582 // converted from / to keyboard scan code like XKB. |
| 581 std::string code_; | 583 std::string code_; |
| 582 | 584 |
| 583 // True if this is a translated character event (vs. a raw key down). Both | 585 // True if this is a translated character event (vs. a raw key down). Both |
| 584 // share the same type: ET_KEY_PRESSED. | 586 // share the same type: ET_KEY_PRESSED. |
| 585 bool is_char_; | 587 bool is_char_; |
| 586 | 588 |
| 589 // True if the key event is fabricated by the underlying IME and not resulting | |
| 590 // from an user action. | |
| 591 bool is_fabricated_by_ime_; | |
|
sadrul
2014/04/18 19:01:48
How is this different from TranslatedKeyEvent? Wha
Yuki
2014/04/21 02:38:30
TranslatedKeyEvent represents that:
1. The key eve
sadrul
2014/04/22 15:34:29
I think it will be cleaner to have this as a KeyEv
Yuki
2014/04/23 08:08:24
Done.
| |
| 592 | |
| 587 uint16 character_; | 593 uint16 character_; |
| 588 }; | 594 }; |
| 589 | 595 |
| 590 // A key event which is translated by an input method (IME). | 596 // A key event which is translated by an input method (IME). |
| 591 // For example, if an IME receives a KeyEvent(VKEY_SPACE), and it does not | 597 // For example, if an IME receives a KeyEvent(VKEY_SPACE), and it does not |
| 592 // consume the key, the IME usually generates and dispatches a | 598 // consume the key, the IME usually generates and dispatches a |
| 593 // TranslatedKeyEvent(VKEY_SPACE) event. If the IME receives a KeyEvent and | 599 // TranslatedKeyEvent(VKEY_SPACE) event. If the IME receives a KeyEvent and |
| 594 // it does consume the event, it might dispatch a | 600 // it does consume the event, it might dispatch a |
| 595 // TranslatedKeyEvent(VKEY_PROCESSKEY) event as defined in the DOM spec. | 601 // TranslatedKeyEvent(VKEY_PROCESSKEY) event as defined in the DOM spec. |
| 596 class EVENTS_EXPORT TranslatedKeyEvent : public KeyEvent { | 602 class EVENTS_EXPORT TranslatedKeyEvent : public KeyEvent { |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 692 // The set of indices of ones in the binary representation of | 698 // The set of indices of ones in the binary representation of |
| 693 // touch_ids_bitfield_ is the set of touch_ids associate with this gesture. | 699 // touch_ids_bitfield_ is the set of touch_ids associate with this gesture. |
| 694 // This value is stored as a bitfield because the number of touch ids varies, | 700 // This value is stored as a bitfield because the number of touch ids varies, |
| 695 // but we currently don't need more than 32 touches at a time. | 701 // but we currently don't need more than 32 touches at a time. |
| 696 const unsigned int touch_ids_bitfield_; | 702 const unsigned int touch_ids_bitfield_; |
| 697 }; | 703 }; |
| 698 | 704 |
| 699 } // namespace ui | 705 } // namespace ui |
| 700 | 706 |
| 701 #endif // UI_EVENTS_EVENT_H_ | 707 #endif // UI_EVENTS_EVENT_H_ |
| OLD | NEW |