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 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 | 531 |
532 // This allows an I18N virtual keyboard to fabricate a keyboard event that | 532 // This allows an I18N virtual keyboard to fabricate a keyboard event that |
533 // does not have a corresponding KeyboardCode (example: U+00E1 Latin small | 533 // does not have a corresponding KeyboardCode (example: U+00E1 Latin small |
534 // letter A with acute, U+0410 Cyrillic capital letter A). | 534 // letter A with acute, U+0410 Cyrillic capital letter A). |
535 void set_character(uint16 character) { character_ = character; } | 535 void set_character(uint16 character) { character_ = character; } |
536 | 536 |
537 // Gets the character generated by this key event. It only supports Unicode | 537 // Gets the character generated by this key event. It only supports Unicode |
538 // BMP characters. | 538 // BMP characters. |
539 uint16 GetCharacter() const; | 539 uint16 GetCharacter() const; |
540 | 540 |
| 541 // Gets the platform key code. For XKB, this is the xksym value. |
| 542 uint32 platform_keycode() const { return platform_keycode_; } |
541 KeyboardCode key_code() const { return key_code_; } | 543 KeyboardCode key_code() const { return key_code_; } |
542 bool is_char() const { return is_char_; } | 544 bool is_char() const { return is_char_; } |
543 | 545 |
544 // This is only intended to be used externally by classes that are modifying | 546 // This is only intended to be used externally by classes that are modifying |
545 // events in EventFilter::PreHandleKeyEvent(). set_character() should also be | 547 // events in EventFilter::PreHandleKeyEvent(). set_character() should also be |
546 // called. | 548 // called. |
547 void set_key_code(KeyboardCode key_code) { key_code_ = key_code; } | 549 void set_key_code(KeyboardCode key_code) { key_code_ = key_code; } |
548 | 550 |
549 // Returns true for [Alt]+<num-pad digit> Unicode alt key codes used by Win. | 551 // Returns true for [Alt]+<num-pad digit> Unicode alt key codes used by Win. |
550 // TODO(msw): Additional work may be needed for analogues on other platforms. | 552 // TODO(msw): Additional work may be needed for analogues on other platforms. |
(...skipping 23 matching lines...) Expand all Loading... |
574 // http://www.w3.org/TR/uievents/#keyboard-key-codes. | 576 // http://www.w3.org/TR/uievents/#keyboard-key-codes. |
575 // | 577 // |
576 // This value represents the physical position in the keyboard and can be | 578 // This value represents the physical position in the keyboard and can be |
577 // converted from / to keyboard scan code like XKB. | 579 // converted from / to keyboard scan code like XKB. |
578 std::string code_; | 580 std::string code_; |
579 | 581 |
580 // True if this is a translated character event (vs. a raw key down). Both | 582 // True if this is a translated character event (vs. a raw key down). Both |
581 // share the same type: ET_KEY_PRESSED. | 583 // share the same type: ET_KEY_PRESSED. |
582 bool is_char_; | 584 bool is_char_; |
583 | 585 |
| 586 // The platform related keycode value. For XKB, it's keysym value. |
| 587 // For now, this is used for CharacterComposer in ChromeOS. |
| 588 // Note: for XKB, the keysym vlaue is modifiered value. But for other |
| 589 // platforms, it may be unmodifiered value. |
| 590 uint32 platform_keycode_; |
| 591 |
| 592 // String of 'key' defined in DOM KeyboardEvent (e.g. 'a', 'รข') |
| 593 // http://www.w3.org/TR/uievents/#keyboard-key-codes. |
| 594 // |
| 595 // This value represents the text that the key event will insert to input |
| 596 // field. For key with modifier key, it may have specifial text. |
| 597 // e.g. CTRL+A has '\x01'. |
584 uint16 character_; | 598 uint16 character_; |
585 | 599 |
586 static bool IsRepeated(const KeyEvent& event); | 600 static bool IsRepeated(const KeyEvent& event); |
587 | 601 |
588 static KeyEvent* last_key_event_; | 602 static KeyEvent* last_key_event_; |
589 }; | 603 }; |
590 | 604 |
591 class EVENTS_EXPORT ScrollEvent : public MouseEvent { | 605 class EVENTS_EXPORT ScrollEvent : public MouseEvent { |
592 public: | 606 public: |
593 explicit ScrollEvent(const base::NativeEvent& native_event); | 607 explicit ScrollEvent(const base::NativeEvent& native_event); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 // The set of indices of ones in the binary representation of | 684 // The set of indices of ones in the binary representation of |
671 // touch_ids_bitfield_ is the set of touch_ids associate with this gesture. | 685 // touch_ids_bitfield_ is the set of touch_ids associate with this gesture. |
672 // This value is stored as a bitfield because the number of touch ids varies, | 686 // This value is stored as a bitfield because the number of touch ids varies, |
673 // but we currently don't need more than 32 touches at a time. | 687 // but we currently don't need more than 32 touches at a time. |
674 const unsigned int touch_ids_bitfield_; | 688 const unsigned int touch_ids_bitfield_; |
675 }; | 689 }; |
676 | 690 |
677 } // namespace ui | 691 } // namespace ui |
678 | 692 |
679 #endif // UI_EVENTS_EVENT_H_ | 693 #endif // UI_EVENTS_EVENT_H_ |
OLD | NEW |