• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef FRAMEWORKS_INPUTMETHOD_CONTROLLER_INCLUDE_INPUT_METHOD_UTILS_H
17 #define FRAMEWORKS_INPUTMETHOD_CONTROLLER_INCLUDE_INPUT_METHOD_UTILS_H
18 
19 #include <stdint.h>
20 
21 namespace OHOS {
22 namespace MiscServices {
23     enum class EnterKeyType {
24         UNSPECIFIED = 0,
25         NONE,
26         GO,
27         SEARCH,
28         SEND,
29         NEXT,
30         DONE,
31         PREVIOUS
32     };
33 
34     enum class TextInputType {
35         NONE = -1,
36         TEXT = 0,
37         MULTILINE,
38         NUMBER,
39         PHONE,
40         DATETIME,
41         EMAIL_ADDRESS,
42         URL,
43         VISIBLE_PASSWORD,
44     };
45 
46     enum class Direction {
47         NONE = 0,
48         UP = 1,
49         DOWN,
50         LEFT,
51         RIGHT,
52     };
53 
54     class Configuration {
55     public:
GetEnterKeyType()56         EnterKeyType GetEnterKeyType() const
57         {
58             return enterKeyType;
59         }
60 
SetEnterKeyType(EnterKeyType keyType)61         void SetEnterKeyType(EnterKeyType keyType)
62         {
63             enterKeyType = keyType;
64         }
65 
GetTextInputType()66         TextInputType GetTextInputType() const
67         {
68             return textInputType;
69         }
70 
SetTextInputType(TextInputType textType)71         void SetTextInputType(TextInputType textType)
72         {
73             textInputType = textType;
74         }
75 
76     private:
77         EnterKeyType enterKeyType = EnterKeyType::UNSPECIFIED;
78         TextInputType textInputType = TextInputType::TEXT;
79     };
80 
81     struct CursorInfo {
82         double left = 0.0;
83         double top = 0.0;
84         double width = 0.0;
85         double height = 0.0;
86     };
87 
88     class KeyEvent {
89     };
90 
91     enum class KeyboardStatus {
92         NONE = 0,
93         HIDE,
94         SHOW
95     };
96 
97     enum class FunctionKey {
98         NONE = 0,
99         CONFIRM
100     };
101 
102     class KeyboardInfo {
103     public:
GetKeyboardStatus()104         KeyboardStatus GetKeyboardStatus() const
105         {
106             return keyboardStatus;
107         }
108 
SetKeyboardStatus(int32_t status)109         void SetKeyboardStatus(int32_t status)
110         {
111             keyboardStatus = static_cast<KeyboardStatus>(status);
112         }
113 
GetFunctionKey()114         FunctionKey GetFunctionKey() const
115         {
116             return functionKey;
117         }
118 
SetFunctionKey(int32_t key)119         void SetFunctionKey(int32_t key)
120         {
121             functionKey = static_cast<FunctionKey>(key);
122         }
123 
124     private:
125         KeyboardStatus keyboardStatus = KeyboardStatus::NONE;
126         FunctionKey functionKey = FunctionKey::NONE;
127     };
128 } // namespace MiscServices
129 } // namespace OHOS
130 #endif // FRAMEWORKS_INPUTMETHOD_CONTROLLER_INCLUDE_INPUT_METHOD_UTILS_H
131