• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2 * Copyright (c) 2024 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  * @addtogroup InputMethod
17  * @{
18  *
19  * @brief InputMethod provides functions to use input methods and develop input methods.
20  *
21  * @since 12
22  */
23 
24 /**
25  * @file inputmethod_inputmethod_proxy_capi.h
26  *
27  * @brief Provides functions to use input methods.
28  *
29  * @library libohinputmethod.so
30  * @kit IMEKit
31  * @syscap SystemCapability.MiscServices.InputMethodFramework
32  * @since 12
33  * @version 1.0
34  */
35 #ifndef OHOS_INPUTMETHOD_INPUTMETHOD_PROXY_CAPI_H
36 #define OHOS_INPUTMETHOD_INPUTMETHOD_PROXY_CAPI_H
37 #include <stddef.h>
38 
39 #include "inputmethod_types_capi.h"
40 #include "inputmethod_attach_options_capi.h"
41 #include "inputmethod_cursor_info_capi.h"
42 #include "inputmethod_private_command_capi.h"
43 #ifdef __cplusplus
44 extern "C"{
45 #endif /* __cplusplus */
46 /**
47  * @brief Define the InputMethod_InputMethodProxy structure type.
48  *
49  * Provides methods for controlling input method.
50  *
51  * @since 12
52  */
53 typedef struct InputMethod_InputMethodProxy InputMethod_InputMethodProxy;
54 
55 /**
56  * @brief Show keyboard.
57  *
58  * @param inputMethodProxy Represents a pointer to an {@link InputMethod_InputMethodProxy} instance.
59  *     The inputMethodProxy is obtained from {@link OH_InputMethodController_Attach}.
60  * @return Returns a specific error code.
61  *     {@link IME_ERR_OK} - success.
62  *     {@link IME_ERR_IMCLIENT} - input method client error.
63  *     {@link IME_ERR_IMMS} - input method manager service error.
64  *     {@link IME_ERR_DETACHED} - input method client detached.
65  *     {@link IME_ERR_NULL_POINTER} - unexpected null pointer.
66  * Specific error codes can be referenced {@link InputMethod_ErrorCode}.
67  * @since 12
68  */
69 InputMethod_ErrorCode OH_InputMethodProxy_ShowKeyboard(InputMethod_InputMethodProxy *inputMethodProxy);
70 /**
71  * @brief ShowTextInput.
72  *
73  * @param inputMethodProxy Represents a pointer to an {@link InputMethod_InputMethodProxy} instance.
74  *     The inputMethodProxy is obtained from {@link OH_InputMethodController_Attach}.
75  * @param options Represents a pointer to an {@link InputMethod_AttachOptions} instance which will be get value from.
76  *     {@link ShowKeyboard} - property is always true,can not be changed,so no need to focus on
77  *     {@link InputMethod_RequestKeyboardReason} - property is the requestKeyboardReason for show keyboard
78  * @return Returns a specific error code.
79  *     {@link IME_ERR_OK} - success.
80  *     {@link IME_ERR_IMCLIENT} - input method client error.
81  *     {@link IME_ERR_IMMS} - input method manager service error.
82  *     {@link IME_ERR_DETACHED} - input method client detached.
83  *     {@link IME_ERR_NULL_POINTER} - unexpected null pointer. If inputMethodProxy is NULL, or options is NULL.
84  * Specific error codes can be referenced {@link InputMethod_ErrorCode}.
85  * @since 15
86  */
87 InputMethod_ErrorCode OH_InputMethodProxy_ShowTextInput(
88     InputMethod_InputMethodProxy *inputMethodProxy, InputMethod_AttachOptions *options);
89 /**
90  * @brief Hide keyboard.
91  *
92  * @param inputMethodProxy Represents a pointer to an {@link InputMethod_InputMethodProxy} instance.
93  *     The inputMethodProxy is obtained from {@link OH_InputMethodController_Attach}.
94  * @return Returns a specific error code.
95  *     {@link IME_ERR_OK} - success.
96  *     {@link IME_ERR_IMCLIENT} - input method client error.
97  *     {@link IME_ERR_IMMS} - input method manager service error.
98  *     {@link IME_ERR_DETACHED} - input method client detached.
99  *     {@link IME_ERR_NULL_POINTER} - unexpected null pointer.
100  * Specific error codes can be referenced {@link InputMethod_ErrorCode}.
101  * @since 12
102  */
103 InputMethod_ErrorCode OH_InputMethodProxy_HideKeyboard(InputMethod_InputMethodProxy *inputMethodProxy);
104 
105 /**
106  * @brief Notify selection change.
107  *
108  * Notify selection change when text or cursor position or selected text changed.
109  *
110  * @param inputMethodProxy Represents a pointer to an {@link InputMethod_InputMethodProxy} instance.
111  *     The inputMethodProxy is obtained from {@link OH_InputMethodController_Attach}.
112  * @param text The whole input text.
113  * @param length The length of text. Max length is 8K.
114  * @param start The start position of selected text.
115  * @param end The end position of selected text.
116  * @return Returns a specific error code.
117  *     {@link IME_ERR_OK} - success.
118  *     {@link IME_ERR_PARAMCHECK} - parameter check failed.
119  *     {@link IME_ERR_IMCLIENT} - input method client error.
120  *     {@link IME_ERR_IMMS} - input method manager service error.
121  *     {@link IME_ERR_DETACHED} - input method client detached.
122  *     {@link IME_ERR_NULL_POINTER} - unexpected null pointer.
123  * Specific error codes can be referenced {@link InputMethod_ErrorCode}.
124  * @since 12
125  */
126 InputMethod_ErrorCode OH_InputMethodProxy_NotifySelectionChange(
127     InputMethod_InputMethodProxy *inputMethodProxy, char16_t text[], size_t length, int start, int end);
128 
129 /**
130  * @brief Notify text editor configuration change.
131  *
132  * @param inputMethodProxy Represents a pointer to an {@link InputMethod_InputMethodProxy} instance.
133  *     The inputMethodProxy is obtained from {@link OH_InputMethodController_Attach}.
134  * @param enterKey The enter key type.
135  * @param textType The text input type.
136  * @return Returns a specific error code.
137  *     {@link IME_ERR_OK} - success.
138  *     {@link IME_ERR_PARAMCHECK} - parameter check failed.
139  *     {@link IME_ERR_IMCLIENT} - input method client error.
140  *     {@link IME_ERR_IMMS} - input method manager service error.
141  *     {@link IME_ERR_DETACHED} - input method client detached.
142  *     {@link IME_ERR_NULL_POINTER} - unexpected null pointer.
143  * Specific error codes can be referenced {@link InputMethod_ErrorCode}.
144  * @since 12
145  */
146 InputMethod_ErrorCode OH_InputMethodProxy_NotifyConfigurationChange(InputMethod_InputMethodProxy *inputMethodProxy,
147     InputMethod_EnterKeyType enterKey, InputMethod_TextInputType textType);
148 
149 /**
150  * @brief Notify cursor update.
151  *
152  * @param inputMethodProxy Represents a pointer to an {@link InputMethod_InputMethodProxy} instance.
153  *     The inputMethodProxy is obtained from {@link OH_InputMethodController_Attach}.
154  * @param cursorInfo Represents a pointer to an {@link InputMethod_CursorInfo} instance.
155  *     The cursor information.
156  * @return Returns a specific error code.
157  *     {@link IME_ERR_OK} - success.
158  *     {@link IME_ERR_PARAMCHECK} - parameter check failed.
159  *     {@link IME_ERR_IMCLIENT} - input method client error.
160  *     {@link IME_ERR_IMMS} - input method manager service error.
161  *     {@link IME_ERR_DETACHED} - input method client detached.
162  *     {@link IME_ERR_NULL_POINTER} - unexpected null pointer.
163  * Specific error codes can be referenced {@link InputMethod_ErrorCode}.
164  * @since 12
165  */
166 InputMethod_ErrorCode OH_InputMethodProxy_NotifyCursorUpdate(
167     InputMethod_InputMethodProxy *inputMethodProxy, InputMethod_CursorInfo *cursorInfo);
168 
169 /**
170  * @brief Send private command.
171  *
172  * @param inputMethodProxy Represents a pointer to an {@link InputMethod_InputMethodProxy} instance.
173  *     The inputMethodProxy is obtained from {@link OH_InputMethodController_Attach}.
174  * @param privateCommand The private commands, which is defined in {@link InputMethod_PrivateCommand}. Max size 32KB.
175  * @param size The size of privateCommand. Max is 5.
176  * @return Returns a specific error code.
177  *     {@link IME_ERR_OK} - success.
178  *     {@link IME_ERR_PARAMCHECK} - parameter check failed.
179  *     {@link IME_ERR_IMCLIENT} - input method client error.
180  *     {@link IME_ERR_IMMS} - input method manager service error.
181  *     {@link IME_ERR_DETACHED} - input method client detached.
182  *     {@link IME_ERR_NULL_POINTER} - unexpected null pointer.
183  * Specific error codes can be referenced {@link InputMethod_ErrorCode}.
184  * @since 12
185  */
186 InputMethod_ErrorCode OH_InputMethodProxy_SendPrivateCommand(
187     InputMethod_InputMethodProxy *inputMethodProxy, InputMethod_PrivateCommand *privateCommand[], size_t size);
188 #ifdef __cplusplus
189 }
190 #endif /* __cplusplus */
191 /** @} */
192 #endif // INPUTMETHOD_INPUTMETHOD_PROXY_CAP_H