• 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_controller_capi.h
26  *
27  * @brief Provides the functions for using input method.
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_CONTROLLER_CAPI_H
36 #define OHOS_INPUTMETHOD_CONTROLLER_CAPI_H
37 #include <stdint.h>
38 #include <stdlib.h>
39 
40 #include "inputmethod_text_editor_proxy_capi.h"
41 #include "inputmethod_inputmethod_proxy_capi.h"
42 #include "inputmethod_attach_options_capi.h"
43 #ifdef __cplusplus
44 extern "C" {
45 #endif /* __cplusplus */
46 /**
47  * @brief Attach application to the input method service.
48  *
49  * @param textEditorProxy Represents a pointer to an {@link InputMethod_TextEditorProxy} instance.
50  *     The caller needs to manage the lifecycle of textEditorProxy.
51  *     If the call succeeds, caller cannot release textEditorProxy until the next attach or detach call.
52  * @param options Represents a pointer to an {@link InputMethod_AttachOptions} instance.
53  *     The options when attaching input method.
54  * @param inputMethodProxy Represents a pointer to an {@link InputMethod_InputMethodProxy} instance.
55  *     Lifecycle is mantianed until the next attach or detach call.
56  * @return Returns a specific error code.
57  *     {@link IME_ERR_OK} - success.
58  *     {@link IME_ERR_PARAMCHECK} - parameter check failed.
59  *     {@link IME_ERR_IMCLIENT} - input method client error.
60  *     {@link IME_ERR_IMMS} - input method manager service error.
61  *     {@link IME_ERR_NULL_POINTER} - unexpected null pointer.
62  * Specific error codes can be referenced {@link InputMethod_ErrorCode}.
63  * @since 12
64  */
65 InputMethod_ErrorCode OH_InputMethodController_Attach(InputMethod_TextEditorProxy *textEditorProxy,
66     InputMethod_AttachOptions *options, InputMethod_InputMethodProxy **inputMethodProxy);
67 
68 /**
69  * @brief Detach application from the input method service.
70  *
71  * @param inputMethodProxy Represents a pointer to an {@link InputMethod_InputMethodProxy} instance.
72  *     The inputMethodProxy is obtained from {@link OH_InputMethodController_Attach}.
73  * @return Returns a specific error code.
74  *     {@link IME_ERR_OK} - success.
75  *     {@link IME_ERR_IMCLIENT} - input method client error.
76  *     {@link IME_ERR_IMMS} - input method manager service error.
77  *     {@link IME_ERR_NULL_POINTER} - unexpected null pointer.
78  * Specific error codes can be referenced {@link InputMethod_ErrorCode}.
79  * @since 12
80  */
81 InputMethod_ErrorCode OH_InputMethodController_Detach(InputMethod_InputMethodProxy *inputMethodProxy);
82 #ifdef __cplusplus
83 }
84 #endif /* __cplusplus */
85 /** @} */
86 #endif // OHOS_INPUTMETHOD_CONTROLLER_CAPI_H