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 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 | 743 |
744 // If this is a keystroke event with key_code_ VKEY_RETURN, returns '\r'; | 744 // If this is a keystroke event with key_code_ VKEY_RETURN, returns '\r'; |
745 // otherwise returns the same as GetCharacter(). | 745 // otherwise returns the same as GetCharacter(). |
746 base::char16 GetUnmodifiedText() const; | 746 base::char16 GetUnmodifiedText() const; |
747 | 747 |
748 // If the Control key is down in the event, returns a layout-independent | 748 // If the Control key is down in the event, returns a layout-independent |
749 // character (corresponding to US layout); otherwise returns the same | 749 // character (corresponding to US layout); otherwise returns the same |
750 // as GetUnmodifiedText(). | 750 // as GetUnmodifiedText(). |
751 base::char16 GetText() const; | 751 base::char16 GetText() const; |
752 | 752 |
753 // Gets the platform key code. For XKB, this is the xksym value. | |
754 // This should not be used in new code. | |
755 void set_platform_keycode(uint32 keycode) { platform_keycode_ = keycode; } | |
756 uint32 platform_keycode() const { return platform_keycode_; } | |
757 | |
758 // Gets the associated (Windows-based) KeyboardCode for this key event. | 753 // Gets the associated (Windows-based) KeyboardCode for this key event. |
759 // Historically, this has also been used to obtain the character associated | 754 // Historically, this has also been used to obtain the character associated |
760 // with a character event, because both use the Window message 'wParam' field. | 755 // with a character event, because both use the Window message 'wParam' field. |
761 // This should be avoided; if necessary for backwards compatibility, use | 756 // This should be avoided; if necessary for backwards compatibility, use |
762 // GetConflatedWindowsKeyCode(). | 757 // GetConflatedWindowsKeyCode(). |
763 KeyboardCode key_code() const { return key_code_; } | 758 KeyboardCode key_code() const { return key_code_; } |
764 | 759 |
765 // True if this is a character event, false if this is a keystroke event. | 760 // True if this is a character event, false if this is a keystroke event. |
766 bool is_char() const { return is_char_; } | 761 bool is_char() const { return is_char_; } |
767 | 762 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 // DOM KeyboardEvent |code| (e.g. DomCode::KEY_A, DomCode::SPACE). | 805 // DOM KeyboardEvent |code| (e.g. DomCode::KEY_A, DomCode::SPACE). |
811 // http://www.w3.org/TR/DOM-Level-3-Events-code/ | 806 // http://www.w3.org/TR/DOM-Level-3-Events-code/ |
812 // | 807 // |
813 // This value represents the physical position in the keyboard and can be | 808 // This value represents the physical position in the keyboard and can be |
814 // converted from / to keyboard scan code like XKB. | 809 // converted from / to keyboard scan code like XKB. |
815 DomCode code_; | 810 DomCode code_; |
816 | 811 |
817 // True if this is a character event, false if this is a keystroke event. | 812 // True if this is a character event, false if this is a keystroke event. |
818 bool is_char_ = false; | 813 bool is_char_ = false; |
819 | 814 |
820 // The platform related keycode value. For XKB, it's keysym value. | |
821 // For now, this is used for CharacterComposer in ChromeOS. | |
822 mutable uint32 platform_keycode_ = 0; | |
823 | |
824 // TODO(kpschoedel): refactor so that key_ is not mutable. | 815 // TODO(kpschoedel): refactor so that key_ is not mutable. |
825 // This requires defining the KeyEvent completely at construction rather | 816 // This requires defining the KeyEvent completely at construction rather |
826 // than lazily under GetCharacter(), which likely also means removing | 817 // than lazily under GetCharacter(), which likely also means removing |
827 // the two 'incomplete' constructors. crbug.com/444045 | 818 // the two 'incomplete' constructors. crbug.com/444045 |
828 // | 819 // |
829 // DOM KeyboardEvent |key| | 820 // DOM KeyboardEvent |key| |
830 // http://www.w3.org/TR/DOM-Level-3-Events-key/ | 821 // http://www.w3.org/TR/DOM-Level-3-Events-key/ |
831 // | 822 // |
832 // This value represents the meaning of a key, which is either a Unicode | 823 // This value represents the meaning of a key, which is either a Unicode |
833 // character, or a named DomKey:: value. | 824 // character, or a named DomKey:: value. |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
915 | 906 |
916 const GestureEventDetails& details() const { return details_; } | 907 const GestureEventDetails& details() const { return details_; } |
917 | 908 |
918 private: | 909 private: |
919 GestureEventDetails details_; | 910 GestureEventDetails details_; |
920 }; | 911 }; |
921 | 912 |
922 } // namespace ui | 913 } // namespace ui |
923 | 914 |
924 #endif // UI_EVENTS_EVENT_H_ | 915 #endif // UI_EVENTS_EVENT_H_ |
OLD | NEW |