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 UI_AURA_EVENT_H_ | 5 #ifndef UI_AURA_EVENT_H_ |
6 #define UI_AURA_EVENT_H_ | 6 #define UI_AURA_EVENT_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/event_types.h" | 10 #include "base/event_types.h" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 | 143 |
144 class AURA_EXPORT KeyEvent : public Event { | 144 class AURA_EXPORT KeyEvent : public Event { |
145 public: | 145 public: |
146 KeyEvent(const base::NativeEvent& native_event, bool is_char); | 146 KeyEvent(const base::NativeEvent& native_event, bool is_char); |
147 | 147 |
148 // Used for synthetic events in testing. | 148 // Used for synthetic events in testing. |
149 KeyEvent(ui::EventType type, | 149 KeyEvent(ui::EventType type, |
150 ui::KeyboardCode key_code, | 150 ui::KeyboardCode key_code, |
151 int flags); | 151 int flags); |
152 | 152 |
| 153 // These setters allow an I18N virtual keyboard to fabricate a keyboard event |
| 154 // which does not have a corresponding ui::KeyboardCode (example: U+00E1 Latin |
| 155 // small letter A with acute, U+0410 Cyrillic capital letter A.) |
| 156 // GetCharacter() and GetUnmodifiedCharacter() return the character. |
| 157 void set_character(uint16 character) { character_ = character; } |
| 158 void set_unmodified_character(uint16 unmodified_character) { |
| 159 unmodified_character_ = unmodified_character; |
| 160 } |
| 161 |
| 162 // Gets the character generated by this key event. It only supports Unicode |
| 163 // BMP characters. |
| 164 uint16 GetCharacter() const; |
| 165 |
| 166 // Gets the character generated by this key event ignoring concurrently-held |
| 167 // modifiers (except shift). |
| 168 uint16 GetUnmodifiedCharacter() const; |
| 169 |
153 ui::KeyboardCode key_code() const { return key_code_; } | 170 ui::KeyboardCode key_code() const { return key_code_; } |
154 bool is_char() const { return is_char_; } | 171 bool is_char() const { return is_char_; } |
155 | 172 |
156 private: | 173 private: |
157 ui::KeyboardCode key_code_; | 174 ui::KeyboardCode key_code_; |
158 // True if this is a translated character event (vs. a raw key down). Both | 175 // True if this is a translated character event (vs. a raw key down). Both |
159 // share the same type: ui::ET_KEY_PRESSED. | 176 // share the same type: ui::ET_KEY_PRESSED. |
160 bool is_char_; | 177 bool is_char_; |
| 178 |
| 179 uint16 character_; |
| 180 uint16 unmodified_character_; |
161 }; | 181 }; |
162 | 182 |
163 } // namespace aura | 183 } // namespace aura |
164 | 184 |
165 #endif // UI_AURA_EVENT_H_ | 185 #endif // UI_AURA_EVENT_H_ |
OLD | NEW |