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 // XXX TODO(kpschoedel): document me |
| 20 class EVENTS_OZONE_LAYOUT_EXPORT KeyboardLayoutEngine { |
| 21 public: |
| 22 KeyboardLayoutEngine() {} |
| 23 virtual ~KeyboardLayoutEngine() {} |
| 24 |
| 25 // Returns true if it is possible to change the current layout. |
| 26 virtual bool CanSetCurrentLayout() const = 0; |
| 27 |
| 28 // Sets the current layout; returns true on success. |
| 29 virtual bool SetCurrentLayoutByName(const std::string& layout_name) = 0; |
| 30 |
| 31 // Returns true if the current layout makes use of the ISO Level 5 Shift key. |
| 32 virtual bool UsesISOLevel5Shift() const = 0; |
| 33 |
| 34 // Returns true if the current layout makes use of the AltGr |
| 35 // (ISO Level 3 Shift) key. |
| 36 virtual bool UsesAltGr() const = 0; |
| 37 |
| 38 // Provides the interpretation of a physical key. |
| 39 // |
| 40 // The caller must supply valid addresses for all the output parameters; |
| 41 // the function must not use their initial values. |
| 42 // |
| 43 // If the function can determine an interpretation of the (dom_code, flags) |
| 44 // values, it must set *dom_key and must set *character, may optionally |
| 45 // set *key_code, and returns true. A layout function that does not directly |
| 46 // know the correct KeyboardCode should not touch *key_code. |
| 47 // |
| 48 // If the function can determine that the (dom_code, flags) values have NO |
| 49 // interpretation in the current layout (e.g. the key is unbound), it must |
| 50 // set *dom_key to UNIDENTIFIED and *character to 0, should set *key_code |
| 51 // to VKEY_UNKNOWN if and only if it would normally set *key_code, and |
| 52 // returns true. |
| 53 // |
| 54 // Otherwise -- if it cannot determine the interpretation, and cannot |
| 55 // determine that there is none -- it must not set any of the output |
| 56 // parameters, and returns false. |
| 57 virtual bool Lookup(DomCode dom_code, |
| 58 int flags, |
| 59 DomKey* dom_key, |
| 60 base::char16* character, |
| 61 KeyboardCode* key_code) const = 0; |
| 62 }; |
| 63 |
| 64 } // namespace ui |
| 65 |
| 66 #endif // UI_OZONE_PUBLIC_KEYBOARD_LAYOUT_ENGINE_H_ |
OLD | NEW |