OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef UI_OZONE_PUBLIC_KEYBOARD_LAYOUT_ENGINE_H_ | |
6 #define UI_OZONE_PUBLIC_KEYBOARD_LAYOUT_ENGINE_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/strings/string16.h" | |
11 #include "ui/events/keycodes/keyboard_codes.h" | |
12 #include "ui/events/ozone/layout/events_ozone_layout_export.h" | |
13 | |
14 namespace ui { | |
15 | |
16 enum class DomCode; | |
17 enum class DomKey; | |
18 | |
19 // A KeyboardLayoutEngine provides a platform-independent interface to | |
20 // key mapping. Key mapping provides a meaning (DomKey and character, | |
21 // and optionally Windows key code) for a physical key press (DomCode | |
22 // and modifier flags). | |
23 // | |
24 // This interface does not expose individual layouts because it must support | |
25 // platforms that only provide for one active system layout, and/or platforms | |
26 // where layouts have no accessible representation. | |
27 class EVENTS_OZONE_LAYOUT_EXPORT KeyboardLayoutEngine { | |
28 public: | |
29 KeyboardLayoutEngine() {} | |
30 virtual ~KeyboardLayoutEngine() {} | |
31 | |
32 // Returns true if it is possible to change the current layout. | |
33 virtual bool CanSetCurrentLayout() const = 0; | |
34 | |
35 // Sets the current layout; returns true on success. | |
36 // Drop-in replacement for ImeKeyboard::SetCurrentKeyboardLayoutByName(). | |
37 virtual bool SetCurrentLayoutByName(const std::string& layout_name) = 0; | |
38 | |
39 // Returns true if the current layout makes use of the ISO Level 5 Shift key. | |
40 // Drop-in replacement for ImeKeyboard::IsISOLevel5ShiftAvailable(). | |
41 virtual bool UsesISOLevel5Shift() const = 0; | |
42 | |
43 // Returns true if the current layout makes use of the AltGr | |
44 // (ISO Level 3 Shift) key. | |
45 // Drop-in replacement for ImeKeyboard::IsAltGrAvailable(). | |
46 virtual bool UsesAltGr() const = 0; | |
47 | |
48 // Provides the meaning of a physical key. | |
49 // | |
50 // The caller must supply valid addresses for all the output parameters; | |
51 // the function must not use their initial values. | |
52 // | |
53 // Returns true if it can determine the meaning of the (dom_code, flags) | |
54 // values and the corresponding key_code, OR if it can determine that they | |
55 // have no meaning in the current layout (e.g. the key is unbound). In the | |
56 // latter case, the function sets *dom_key to UNIDENTIFIED, *character to 0, | |
57 // and *key_code to VKEY_UNKNOWN. | |
Wez
2014/12/12 20:04:18
What does it set key_code to?
Do you need the ret
kpschoedel
2014/12/12 21:20:39
The Windows-compatible code for the ‘equivalent’ l
| |
58 // | |
59 // Returns false if it cannot determine the meaning (and cannot determine | |
60 // that there is none); in this case it does not set any of the output | |
61 // parameters. | |
62 virtual bool Lookup(DomCode dom_code, | |
63 int event_flags, | |
64 DomKey* dom_key, | |
65 base::char16* character, | |
66 KeyboardCode* key_code) const = 0; | |
67 }; | |
68 | |
69 } // namespace ui | |
70 | |
71 #endif // UI_OZONE_PUBLIC_KEYBOARD_LAYOUT_ENGINE_H_ | |
OLD | NEW |