122736c2fSopenharmony_ci/* 222736c2fSopenharmony_ci* Copyright (c) 2024 Huawei Device Co., Ltd. 322736c2fSopenharmony_ci* Licensed under the Apache License, Version 2.0 (the "License"); 422736c2fSopenharmony_ci* you may not use this file except in compliance with the License. 522736c2fSopenharmony_ci* You may obtain a copy of the License at 622736c2fSopenharmony_ci* 722736c2fSopenharmony_ci* http://www.apache.org/licenses/LICENSE-2.0 822736c2fSopenharmony_ci* 922736c2fSopenharmony_ci* Unless required by applicable law or agreed to in writing, software 1022736c2fSopenharmony_ci* distributed under the License is distributed on an "AS IS" BASIS, 1122736c2fSopenharmony_ci* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1222736c2fSopenharmony_ci* See the License for the specific language governing permissions and 1322736c2fSopenharmony_ci* limitations under the License. 1422736c2fSopenharmony_ci*/ 1522736c2fSopenharmony_ci#ifndef OHOS_INPUTMETHOD_INPUTMETHOD_PROXY_CAPI_H 1622736c2fSopenharmony_ci#define OHOS_INPUTMETHOD_INPUTMETHOD_PROXY_CAPI_H 1722736c2fSopenharmony_ci/** 1822736c2fSopenharmony_ci * @addtogroup InputMethod 1922736c2fSopenharmony_ci * @{ 2022736c2fSopenharmony_ci * 2122736c2fSopenharmony_ci * @brief InputMethod provides functions to use input methods and develop input methods. 2222736c2fSopenharmony_ci * 2322736c2fSopenharmony_ci * @since 12 2422736c2fSopenharmony_ci */ 2522736c2fSopenharmony_ci 2622736c2fSopenharmony_ci/** 2722736c2fSopenharmony_ci * @file inputmethod_inputmethod_proxy_capi.h 2822736c2fSopenharmony_ci * 2922736c2fSopenharmony_ci * @brief Provides functions to use input methods. 3022736c2fSopenharmony_ci * 3122736c2fSopenharmony_ci * @library libohinputmethod.so 3222736c2fSopenharmony_ci * @kit IMEKit 3322736c2fSopenharmony_ci * @syscap SystemCapability.MiscServices.InputMethodFramework 3422736c2fSopenharmony_ci * @since 12 3522736c2fSopenharmony_ci * @version 1.0 3622736c2fSopenharmony_ci */ 3722736c2fSopenharmony_ci#include <stddef.h> 3822736c2fSopenharmony_ci 3922736c2fSopenharmony_ci#include "inputmethod_types_capi.h" 4022736c2fSopenharmony_ci#include "inputmethod_cursor_info_capi.h" 4122736c2fSopenharmony_ci#include "inputmethod_private_command_capi.h" 4222736c2fSopenharmony_ci#ifdef __cplusplus 4322736c2fSopenharmony_ciextern "C"{ 4422736c2fSopenharmony_ci#endif /* __cplusplus */ 4522736c2fSopenharmony_ci/** 4622736c2fSopenharmony_ci * @brief Define the InputMethod_InputMethodProxy structure type. 4722736c2fSopenharmony_ci * 4822736c2fSopenharmony_ci * Provides methods for controlling input method. 4922736c2fSopenharmony_ci * 5022736c2fSopenharmony_ci * @since 12 5122736c2fSopenharmony_ci */ 5222736c2fSopenharmony_citypedef struct InputMethod_InputMethodProxy InputMethod_InputMethodProxy; 5322736c2fSopenharmony_ci 5422736c2fSopenharmony_ci/** 5522736c2fSopenharmony_ci * @brief Show keyboard. 5622736c2fSopenharmony_ci * 5722736c2fSopenharmony_ci * @param inputMethodProxy Represents a pointer to an {@link InputMethod_InputMethodProxy} instance. 5822736c2fSopenharmony_ci * The inputMethodProxy is obtained from {@link OH_InputMethodController_Attach}. 5922736c2fSopenharmony_ci * @return Returns a specific error code. 6022736c2fSopenharmony_ci * {@link IME_ERR_OK} - success. 6122736c2fSopenharmony_ci * {@link IME_ERR_IMCLIENT} - input method client error. 6222736c2fSopenharmony_ci * {@link IME_ERR_IMMS} - input method manager service error. 6322736c2fSopenharmony_ci * {@link IME_ERR_DETACHED} - input method client is detached. 6422736c2fSopenharmony_ci * {@link IME_ERR_NULL_POINTER} - unexpected null pointer. 6522736c2fSopenharmony_ci * Specific error codes can be referenced {@link InputMethod_ErrorCode}. 6622736c2fSopenharmony_ci * @since 12 6722736c2fSopenharmony_ci */ 6822736c2fSopenharmony_ciInputMethod_ErrorCode OH_InputMethodProxy_ShowKeyboard(InputMethod_InputMethodProxy *inputMethodProxy); 6922736c2fSopenharmony_ci 7022736c2fSopenharmony_ci/** 7122736c2fSopenharmony_ci * @brief Hide keyboard. 7222736c2fSopenharmony_ci * 7322736c2fSopenharmony_ci * @param inputMethodProxy Represents a pointer to an {@link InputMethod_InputMethodProxy} instance. 7422736c2fSopenharmony_ci * The inputMethodProxy is obtained from {@link OH_InputMethodController_Attach}. 7522736c2fSopenharmony_ci * @return Returns a specific error code. 7622736c2fSopenharmony_ci * {@link IME_ERR_OK} - success. 7722736c2fSopenharmony_ci * {@link IME_ERR_IMCLIENT} - input method client error. 7822736c2fSopenharmony_ci * {@link IME_ERR_IMMS} - input method manager service error. 7922736c2fSopenharmony_ci * {@link IME_ERR_DETACHED} - input method client is detached. 8022736c2fSopenharmony_ci * {@link IME_ERR_NULL_POINTER} - unexpected null pointer. 8122736c2fSopenharmony_ci * Specific error codes can be referenced {@link InputMethod_ErrorCode}. 8222736c2fSopenharmony_ci * @since 12 8322736c2fSopenharmony_ci */ 8422736c2fSopenharmony_ciInputMethod_ErrorCode OH_InputMethodProxy_HideKeyboard(InputMethod_InputMethodProxy *inputMethodProxy); 8522736c2fSopenharmony_ci 8622736c2fSopenharmony_ci/** 8722736c2fSopenharmony_ci * @brief Notify selection change. 8822736c2fSopenharmony_ci * 8922736c2fSopenharmony_ci * Notify selection change when text or cursor position or selected text changed. 9022736c2fSopenharmony_ci * 9122736c2fSopenharmony_ci * @param inputMethodProxy Represents a pointer to an {@link InputMethod_InputMethodProxy} instance. 9222736c2fSopenharmony_ci * The inputMethodProxy is obtained from {@link OH_InputMethodController_Attach}. 9322736c2fSopenharmony_ci * @param text The whole input text. 9422736c2fSopenharmony_ci * @param length The length of text. Max length is 8K. 9522736c2fSopenharmony_ci * @param start The start position of selected text. 9622736c2fSopenharmony_ci * @param end The end position of selected text. 9722736c2fSopenharmony_ci * @return Returns a specific error code. 9822736c2fSopenharmony_ci * {@link IME_ERR_OK} - success. 9922736c2fSopenharmony_ci * {@link IME_ERR_PARAMCHECK} - parameter check failed. 10022736c2fSopenharmony_ci * {@link IME_ERR_IMCLIENT} - input method client error. 10122736c2fSopenharmony_ci * {@link IME_ERR_IMMS} - input method manager service error. 10222736c2fSopenharmony_ci * {@link IME_ERR_DETACHED} - input method client is detached. 10322736c2fSopenharmony_ci * {@link IME_ERR_NULL_POINTER} - unexpected null pointer. 10422736c2fSopenharmony_ci * Specific error codes can be referenced {@link InputMethod_ErrorCode}. 10522736c2fSopenharmony_ci * @since 12 10622736c2fSopenharmony_ci */ 10722736c2fSopenharmony_ciInputMethod_ErrorCode OH_InputMethodProxy_NotifySelectionChange( 10822736c2fSopenharmony_ci InputMethod_InputMethodProxy *inputMethodProxy, char16_t text[], size_t length, int start, int end); 10922736c2fSopenharmony_ci 11022736c2fSopenharmony_ci/** 11122736c2fSopenharmony_ci * @brief Notify text editor configuration change. 11222736c2fSopenharmony_ci * 11322736c2fSopenharmony_ci * @param inputMethodProxy Represents a pointer to an {@link InputMethod_InputMethodProxy} instance. 11422736c2fSopenharmony_ci * The inputMethodProxy is obtained from {@link OH_InputMethodController_Attach}. 11522736c2fSopenharmony_ci * @param enterKey The enter key type. 11622736c2fSopenharmony_ci * @param textType The text input type. 11722736c2fSopenharmony_ci * @return Returns a specific error code. 11822736c2fSopenharmony_ci * {@link IME_ERR_OK} - success. 11922736c2fSopenharmony_ci * {@link IME_ERR_PARAMCHECK} - parameter check failed. 12022736c2fSopenharmony_ci * {@link IME_ERR_IMCLIENT} - input method client error. 12122736c2fSopenharmony_ci * {@link IME_ERR_IMMS} - input method manager service error. 12222736c2fSopenharmony_ci * {@link IME_ERR_DETACHED} - input method client is detached. 12322736c2fSopenharmony_ci * {@link IME_ERR_NULL_POINTER} - unexpected null pointer. 12422736c2fSopenharmony_ci * Specific error codes can be referenced {@link InputMethod_ErrorCode}. 12522736c2fSopenharmony_ci * @since 12 12622736c2fSopenharmony_ci */ 12722736c2fSopenharmony_ciInputMethod_ErrorCode OH_InputMethodProxy_NotifyConfigurationChange(InputMethod_InputMethodProxy *inputMethodProxy, 12822736c2fSopenharmony_ci InputMethod_EnterKeyType enterKey, InputMethod_TextInputType textType); 12922736c2fSopenharmony_ci 13022736c2fSopenharmony_ci/** 13122736c2fSopenharmony_ci * @brief Notify cursor update. 13222736c2fSopenharmony_ci * 13322736c2fSopenharmony_ci * @param inputMethodProxy Represents a pointer to an {@link InputMethod_InputMethodProxy} instance. 13422736c2fSopenharmony_ci * The inputMethodProxy is obtained from {@link OH_InputMethodController_Attach}. 13522736c2fSopenharmony_ci * @param cursorInfo Represents a pointer to an {@link InputMethod_CursorInfo} instance. 13622736c2fSopenharmony_ci * The cursor information. 13722736c2fSopenharmony_ci * @return Returns a specific error code. 13822736c2fSopenharmony_ci * {@link IME_ERR_OK} - success. 13922736c2fSopenharmony_ci * {@link IME_ERR_PARAMCHECK} - parameter check failed. 14022736c2fSopenharmony_ci * {@link IME_ERR_IMCLIENT} - input method client error. 14122736c2fSopenharmony_ci * {@link IME_ERR_IMMS} - input method manager service error. 14222736c2fSopenharmony_ci * {@link IME_ERR_DETACHED} - input method client is detached. 14322736c2fSopenharmony_ci * {@link IME_ERR_NULL_POINTER} - unexpected null pointer. 14422736c2fSopenharmony_ci * Specific error codes can be referenced {@link InputMethod_ErrorCode}. 14522736c2fSopenharmony_ci * @since 12 14622736c2fSopenharmony_ci */ 14722736c2fSopenharmony_ciInputMethod_ErrorCode OH_InputMethodProxy_NotifyCursorUpdate( 14822736c2fSopenharmony_ci InputMethod_InputMethodProxy *inputMethodProxy, InputMethod_CursorInfo *cursorInfo); 14922736c2fSopenharmony_ci 15022736c2fSopenharmony_ci/** 15122736c2fSopenharmony_ci * @brief Send private command. 15222736c2fSopenharmony_ci * 15322736c2fSopenharmony_ci * @param inputMethodProxy Represents a pointer to an {@link OH_InputMethod_InputMethodProxy} instance. 15422736c2fSopenharmony_ci * The inputMethodProxy is obtained from {@link OH_InputMethodController_Attach}. 15522736c2fSopenharmony_ci * @param privateCommand The private commands, which is defined in {@link InputMethod_PrivateCommand}. Max size 32KB. 15622736c2fSopenharmony_ci * @param size The size of privateCommand. Max is 5. 15722736c2fSopenharmony_ci * @return Returns a specific error code. 15822736c2fSopenharmony_ci * {@link IME_ERR_OK} - success. 15922736c2fSopenharmony_ci * {@link IME_ERR_PARAMCHECK} - parameter check failed. 16022736c2fSopenharmony_ci * {@link IME_ERR_IMCLIENT} - input method client error. 16122736c2fSopenharmony_ci * {@link IME_ERR_IMMS} - input method manager service error. 16222736c2fSopenharmony_ci * {@link IME_ERR_DETACHED} - input method client is detached. 16322736c2fSopenharmony_ci * {@link IME_ERR_NULL_POINTER} - unexpected null pointer. 16422736c2fSopenharmony_ci * Specific error codes can be referenced {@link InputMethod_ErrorCode}. 16522736c2fSopenharmony_ci * @since 12 16622736c2fSopenharmony_ci */ 16722736c2fSopenharmony_ciInputMethod_ErrorCode OH_InputMethodProxy_SendPrivateCommand( 16822736c2fSopenharmony_ci InputMethod_InputMethodProxy *inputMethodProxy, InputMethod_PrivateCommand *privateCommand[], size_t size); 16922736c2fSopenharmony_ci#ifdef __cplusplus 17022736c2fSopenharmony_ci} 17122736c2fSopenharmony_ci#endif /* __cplusplus */ 17222736c2fSopenharmony_ci/** @} */ 17322736c2fSopenharmony_ci#endif // INPUTMETHOD_INPUTMETHOD_PROXY_CAP_H