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 // The interface must support platforms that only provide a single opaque | |
25 // system layout, so there is no standalone 'KeyboardLayout' object. | |
26 class EVENTS_OZONE_LAYOUT_EXPORT KeyboardLayoutEngine { | |
27 public: | |
28 KeyboardLayoutEngine() {} | |
29 virtual ~KeyboardLayoutEngine() {} | |
30 | |
31 // Returns true if it is possible to change the current layout. | |
32 virtual bool CanSetCurrentLayout() const = 0; | |
33 | |
34 // Sets the current layout; returns true on success. | |
35 virtual bool SetCurrentLayoutByName(const std::string& layout_name) = 0; | |
Wez
2014/12/09 07:00:33
What's the format of the layout name? Or is that p
kpschoedel
2014/12/09 19:58:44
This is currently a drop-in replacement for ImeKey
Wez
2014/12/12 20:04:17
OK, SGTM; consider referencing the corresponding b
kpschoedel
2014/12/12 21:20:39
Done.
| |
36 | |
37 // Returns true if the current layout makes use of the ISO Level 5 Shift key. | |
38 virtual bool UsesISOLevel5Shift() const = 0; | |
Wez
2014/12/09 07:00:33
Do you mean Level 5 shift, or Level 3?
kpschoedel
2014/12/09 19:58:44
Level 5. This again is a drop-in for ImeKeyboard::
| |
39 | |
40 // Returns true if the current layout makes use of the AltGr | |
41 // (ISO Level 3 Shift) key. | |
42 virtual bool UsesAltGr() const = 0; | |
43 | |
44 // Provides the meaning of a physical key. | |
45 // | |
46 // The caller must supply valid addresses for all the output parameters; | |
47 // the function must not use their initial values. | |
48 // | |
49 // Returns true if it can determine the meaning of the (dom_code, flags) | |
50 // values, OR if it can determine that they have no meaning in the current | |
51 // layout (e.g. the key is unbound). In the latter case, the function sets | |
52 // *dom_key to UNIDENTIFIED, *character to 0, and *key_code to VKEY_UNKNOWN. | |
Wez
2014/12/09 07:00:33
Do all implementations have to set all of the fiel
kpschoedel
2014/12/09 19:58:44
This was up in the air for a while, but I've settl
Wez
2014/12/12 20:04:17
OK, sounds reasonable.
| |
53 // | |
54 // Returns false if it cannot determine the meaning (and cannot determine | |
55 // that there is none); in this case it does not set any of the output | |
56 // parameters. | |
57 virtual bool Lookup(DomCode dom_code, | |
58 int flags, | |
Wez
2014/12/09 07:00:33
What are the contents of |flags|?
kpschoedel
2014/12/09 19:58:44
ui::EventFlags, which is an unscoped enum. Most ex
Wez
2014/12/12 20:04:17
Suggest clarifying that it's ui::EventFlags in the
kpschoedel
2014/12/12 21:20:39
Done.
| |
59 DomKey* dom_key, | |
60 base::char16* character, | |
Wez
2014/12/09 07:00:33
There isn't a 1:1 correspondence between keys and
kpschoedel
2014/12/09 19:58:44
Not in the short term; it's currently wrapped up w
| |
61 KeyboardCode* key_code) const = 0; | |
62 }; | |
63 | |
64 } // namespace ui | |
65 | |
66 #endif // UI_OZONE_PUBLIC_KEYBOARD_LAYOUT_ENGINE_H_ | |
OLD | NEW |