harmony 鸿蒙InputMethod

2025-06-16 浏览 (1)

InputMethod

概述

InputMethod模块提供方法来使用输入法和开发输入法。

起始版本: 12

汇总

文件

名称描述
inputmethod_attach_options_capi.h提供输入法绑定选项对象的创建、销毁与读写方法。
inputmethod_controller_capi.h提供绑定、解绑输入法的方法。
inputmethod_cursor_info_capi.h提供光标信息对象的创建、销毁与读写方法。
inputmethod_inputmethod_proxy_capi.h提供使用输入法的方法,可以向输入法应用发送请求和通知。
inputmethod_private_command_capi.h提供私有数据对象的创建、销毁与读写方法。
inputmethod_text_avoid_info_capi.h提供输入框避让信息对象的创建、销毁与读写方法。
inputmethod_text_config_capi.h提供输入框配置信息对象的创建、销毁与读写方法。
inputmethod_text_editor_proxy_capi.h提供一套方法支持应用开发的自绘输入框获取来自输入法应用的通知和请求。
inputmethod_types_capi.h提供了输入法相关的类型定义。

类型定义

名称描述
InputMethod_AttachOptions输入法绑定选项。
InputMethod_CursorInfo光标信息。
InputMethod_InputMethodProxy输入法代理对象。
InputMethod_PrivateCommand私有数据。
InputMethod_TextAvoidInfo输入框避让信息。
InputMethod_TextConfig输入框配置。
InputMethod_TextEditorProxy输入框代理。
typedef void(* OH_TextEditorProxy_GetTextConfigFunc) (InputMethod_TextEditorProxy *textEditorProxy, InputMethod_TextConfig *config)输入法获取输入框配置时触发的函数。
typedef void(* OH_TextEditorProxy_InsertTextFunc) (InputMethod_TextEditorProxy *textEditorProxy, const char16_t *text, size_t length)输入法应用插入文本时触发的函数。
typedef void(* OH_TextEditorProxy_DeleteForwardFunc) (InputMethod_TextEditorProxy *textEditorProxy, int32_t length)输入法删除光标右侧文本时触发的函数。
typedef void(* OH_TextEditorProxy_DeleteBackwardFunc) (InputMethod_TextEditorProxy *textEditorProxy, int32_t length)输入法删除光标左侧文本时触发的函数。
typedef void(* OH_TextEditorProxy_SendKeyboardStatusFunc) (InputMethod_TextEditorProxy *textEditorProxy, InputMethod_KeyboardStatus keyboardStatus)输入法通知键盘状态时触发的函数。
typedef void(* OH_TextEditorProxy_SendEnterKeyFunc) (InputMethod_TextEditorProxy *textEditorProxy, InputMethod_EnterKeyType enterKeyType)输入法发送回车键时触发的函数。
typedef void(* OH_TextEditorProxy_MoveCursorFunc) (InputMethod_TextEditorProxy *textEditorProxy, InputMethod_Direction direction)输入法移动光标时触发的函数。
typedef void(* OH_TextEditorProxy_HandleSetSelectionFunc) (InputMethod_TextEditorProxy *textEditorProxy, int32_t start, int32_t end)输入法请求选中文本时触发的函数。
typedef void(* OH_TextEditorProxy_HandleExtendActionFunc) (InputMethod_TextEditorProxy *textEditorProxy, InputMethod_ExtendAction action)输入法发送扩展编辑操作时触发的函数。
typedef void(* OH_TextEditorProxy_GetLeftTextOfCursorFunc) (InputMethod_TextEditorProxy *textEditorProxy, int32_t number, char16_t text[], size_t *length)输入法获取光标左侧文本时触发的函数。
typedef void(* OH_TextEditorProxy_GetRightTextOfCursorFunc) (InputMethod_TextEditorProxy *textEditorProxy, int32_t number, char16_t text[], size_t *length)输入法获取光标右侧文本时触发的函数。
typedef int32_t(* OH_TextEditorProxy_GetTextIndexAtCursorFunc) (InputMethod_TextEditorProxy *textEditorProxy)输入法获取光标所在输入框文本索引时触发的函数。
typedef int32_t(* OH_TextEditorProxy_ReceivePrivateCommandFunc) (InputMethod_TextEditorProxy *textEditorProxy, InputMethod_PrivateCommand *privateCommand[], size_t size)输入法应用发送私有数据命令时触发的函数。
typedef int32_t(* OH_TextEditorProxy_SetPreviewTextFunc) (InputMethod_TextEditorProxy *textEditorProxy, const char16_t text[], size_t length, int32_t start, int32_t end)输入法设置预上屏文本时触发的函数。
typedef void(* OH_TextEditorProxy_FinishTextPreviewFunc) (InputMethod_TextEditorProxy *textEditorProxy)输入法结束预上屏时触发的函数。
InputMethod_KeyboardStatus键盘状态。
InputMethod_EnterKeyType回车键功能类型。
InputMethod_Direction移动方向。
InputMethod_ExtendAction编辑框中文本的扩展编辑操作类型。
InputMethod_TextInputType文本输入类型。
InputMethod_CommandValueType私有数据类型。
InputMethod_ErrorCode输入法错误码。
InputMethod_RequestKeyboardReason请求键盘输入原因。

枚举

名称描述
InputMethod_KeyboardStatus {
IME_KEYBOARD_STATUS_NONE = 0,
IME_KEYBOARD_STATUS_HIDE = 1,
IME_KEYBOARD_STATUS_SHOW = 2
}
键盘状态。
InputMethod_EnterKeyType {
IME_ENTER_KEY_UNSPECIFIED = 0,
IME_ENTER_KEY_NONE = 1,
IME_ENTER_KEY_GO = 2,
IME_ENTER_KEY_SEARCH = 3,
IME_ENTER_KEY_SEND = 4,
IME_ENTER_KEY_NEXT = 5,
IME_ENTER_KEY_DONE = 6,
IME_ENTER_KEY_PREVIOUS = 7,
IME_ENTER_KEY_NEWLINE = 8
}
回车键功能类型。
InputMethod_Direction {
IME_DIRECTION_NONE = 0,
IME_DIRECTION_UP = 1,
IME_DIRECTION_DOWN = 2,
IME_DIRECTION_LEFT = 3,
IME_DIRECTION_RIGHT = 4
}
移动方向。
InputMethod_ExtendAction {
IME_EXTEND_ACTION_SELECT_ALL = 0,
IME_EXTEND_ACTION_CUT = 3,
IME_EXTEND_ACTION_COPY = 4,
IME_EXTEND_ACTION_PASTE = 5
}
编辑框中文本的扩展编辑操作类型。
InputMethod_TextInputType {
IME_TEXT_INPUT_TYPE_NONE = -1,
IME_TEXT_INPUT_TYPE_TEXT = 0,
IME_TEXT_INPUT_TYPE_MULTILINE = 1,
IME_TEXT_INPUT_TYPE_NUMBER = 2,
IME_TEXT_INPUT_TYPE_PHONE = 3,
IME_TEXT_INPUT_TYPE_DATETIME = 4,
IME_TEXT_INPUT_TYPE_EMAIL_ADDRESS = 5,
IME_TEXT_INPUT_TYPE_URL = 6,
IME_TEXT_INPUT_TYPE_VISIBLE_PASSWORD = 7,
IME_TEXT_INPUT_TYPE_NUMBER_PASSWORD = 8,
IME_TEXT_INPUT_TYPE_SCREEN_LOCK_PASSWORD = 9,
IME_TEXT_INPUT_TYPE_USER_NAME = 10,
IME_TEXT_INPUT_TYPE_NEW_PASSWORD = 11,
IME_TEXT_INPUT_TYPE_NUMBER_DECIMAL = 12,
IME_TEXT_INPUT_TYPE_ONE_TIME_CODE = 13
}
文本输入类型。
InputMethod_CommandValueType {
IME_COMMAND_VALUE_TYPE_NONE = 0,
IME_COMMAND_VALUE_TYPE_STRING = 1,
IME_COMMAND_VALUE_TYPE_BOOL = 2,
IME_COMMAND_VALUE_TYPE_INT32 = 3
}
私有数据类型。
InputMethod_ErrorCode {
IME_ERR_OK = 0, IME_ERR_UNDEFINED = 1,
IME_ERR_PARAMCHECK = 401,
IME_ERR_PACKAGEMANAGER = 12800001,
IME_ERR_IMENGINE = 12800002,
IME_ERR_IMCLIENT = 12800003,
IME_ERR_CONFIG_PERSIST = 12800005,
IME_ERR_CONTROLLER = 12800006,
IME_ERR_SETTINGS = 12800007,
IME_ERR_IMMS = 12800008,
IME_ERR_DETACHED = 12800009,
IME_ERR_NULL_POINTER = 12802000,
IME_ERR_QUERY_FAILED = 12802001
}
输入法错误码。
InputMethod_RequestKeyboardReason {
IME_REQUEST_REASON_NONE = 0,
IME_REQUEST_REASON_MOUSE = 1,
IME_REQUEST_REASON_TOUCH = 2,
IME_REQUEST_REASON_OTHER = 20
}
请求键盘输入原因。

函数

名称描述
InputMethod_AttachOptions * OH_AttachOptions_Create (bool showKeyboard)创建一个新的InputMethod_AttachOptions实例。
InputMethod_AttachOptions * OH_AttachOptions_CreateWithRequestKeyboardReason (bool showKeyboard, InputMethod_RequestKeyboardReason requestKeyboardReason)创建一个新的InputMethod_AttachOptions实例。
void OH_AttachOptions_Destroy (InputMethod_AttachOptions *options)销毁一个InputMethod_AttachOptions实例。
InputMethod_ErrorCode OH_AttachOptions_IsShowKeyboard (InputMethod_AttachOptions *options, bool *showKeyboard)InputMethod_AttachOptions中获取是否显示键盘的值。
InputMethod_ErrorCode OH_AttachOptions_GetRequestKeyboardReason (InputMethod_AttachOptions *options, int *requestKeyboardReason)InputMethod_AttachOptions中获取是否显示键盘的值。
InputMethod_ErrorCode OH_InputMethodController_Attach (InputMethod_TextEditorProxy *textEditorProxy, InputMethod_AttachOptions *options, InputMethod_InputMethodProxy **inputMethodProxy)将应用绑定到输入法服务。
InputMethod_ErrorCode OH_InputMethodController_Detach (InputMethod_InputMethodProxy *inputMethodProxy)将应用从输入法服务解绑。
InputMethod_CursorInfo * OH_CursorInfo_Create (double left, double top, double width, double height)创建一个新的InputMethod_CursorInfo实例。
void OH_CursorInfo_Destroy (InputMethod_CursorInfo *cursorInfo)销毁一个InputMethod_CursorInfo实例。
InputMethod_ErrorCode OH_CursorInfo_SetRect (InputMethod_CursorInfo *cursorInfo, double left, double top, double width, double height)设置光标信息内容。
InputMethod_ErrorCode OH_CursorInfo_GetRect (InputMethod_CursorInfo *cursorInfo, double *left, double *top, double *width, double *height)获取光标信息内容。
InputMethod_ErrorCode OH_InputMethodProxy_ShowKeyboard (InputMethod_InputMethodProxy *inputMethodProxy)显示键盘。
InputMethod_ErrorCode OH_InputMethodProxy_ShowTextInput (InputMethod_InputMethodProxy *inputMethodProxy, InputMethod_AttachOptions *options)显示文本输入。
InputMethod_ErrorCode OH_InputMethodProxy_HideKeyboard (InputMethod_InputMethodProxy *inputMethodProxy)隐藏键盘。
InputMethod_ErrorCode OH_InputMethodProxy_NotifySelectionChange (InputMethod_InputMethodProxy *inputMethodProxy, char16_t text[], size_t length, int start, int end)通知文本框选区变化。
InputMethod_ErrorCode OH_InputMethodProxy_NotifyConfigurationChange (InputMethod_InputMethodProxy *inputMethodProxy, InputMethod_EnterKeyType enterKey, InputMethod_TextInputType textType)通知输入框配置变化。
InputMethod_ErrorCode OH_InputMethodProxy_NotifyCursorUpdate (InputMethod_InputMethodProxy *inputMethodProxy, InputMethod_CursorInfo *cursorInfo)通知光标位置变化。
InputMethod_ErrorCode OH_InputMethodProxy_SendPrivateCommand (InputMethod_InputMethodProxy *inputMethodProxy, InputMethod_PrivateCommand *privateCommand[], size_t size)发送私有数据命令。
InputMethod_PrivateCommand * OH_PrivateCommand_Create (char key[], size_t keyLength)创建一个新的InputMethod_PrivateCommand实例。
void OH_PrivateCommand_Destroy (InputMethod_PrivateCommand *command)销毁一个InputMethod_PrivateCommand实例。
InputMethod_ErrorCode OH_PrivateCommand_SetKey (InputMethod_PrivateCommand *command, char key[], size_t keyLength)设置InputMethod_PrivateCommand的key值。
InputMethod_ErrorCode OH_PrivateCommand_SetBoolValue (InputMethod_PrivateCommand *command, bool value)设置InputMethod_PrivateCommand的布尔类型value值。
InputMethod_ErrorCode OH_PrivateCommand_SetIntValue (InputMethod_PrivateCommand *command, int32_t value)设置InputMethod_PrivateCommand的整数类型value值。
InputMethod_ErrorCode OH_PrivateCommand_SetStrValue (InputMethod_PrivateCommand *command, char value[], size_t valueLength)设置InputMethod_PrivateCommand的字符串类型value值。
InputMethod_ErrorCode OH_PrivateCommand_GetKey (InputMethod_PrivateCommand *command, const char **key, size_t *keyLength)InputMethod_PrivateCommand获取key值。
InputMethod_ErrorCode OH_PrivateCommand_GetValueType (InputMethod_PrivateCommand *command, InputMethod_CommandValueType *type)InputMethod_PrivateCommand获取value的数据类型。
InputMethod_ErrorCode OH_PrivateCommand_GetBoolValue (InputMethod_PrivateCommand *command, bool *value)InputMethod_PrivateCommand获取布尔类型的value的值。
InputMethod_ErrorCode OH_PrivateCommand_GetIntValue (InputMethod_PrivateCommand *command, int32_t *value)InputMethod_PrivateCommand获取整数类型的value的值。
InputMethod_ErrorCode OH_PrivateCommand_GetStrValue (InputMethod_PrivateCommand *command, const char **value, size_t *valueLength)InputMethod_PrivateCommand获取字符串类型的value的值。
InputMethod_TextAvoidInfo * OH_TextAvoidInfo_Create (double positionY, double height)创建一个新的InputMethod_TextAvoidInfo实例。
void OH_TextAvoidInfo_Destroy (InputMethod_TextAvoidInfo *info)销毁一个InputMethod_TextAvoidInfo实例。
InputMethod_ErrorCode OH_TextAvoidInfo_SetPositionY (InputMethod_TextAvoidInfo *info, double positionY)设置InputMethod_TextAvoidInfo中的Y坐标值。
InputMethod_ErrorCode OH_TextAvoidInfo_SetHeight (InputMethod_TextAvoidInfo *info, double height)设置InputMethod_TextAvoidInfo中的高度值。
InputMethod_ErrorCode OH_TextAvoidInfo_GetPositionY (InputMethod_TextAvoidInfo *info, double *positionY)InputMethod_TextAvoidInfo获取Y坐标值。
InputMethod_ErrorCode OH_TextAvoidInfo_GetHeight (InputMethod_TextAvoidInfo *info, double *height)InputMethod_TextAvoidInfo获取高度值。
InputMethod_TextConfig * OH_TextConfig_Create ()创建一个新的InputMethod_TextConfig实例。
void OH_TextConfig_Destroy (InputMethod_TextConfig *config)销毁一个InputMethod_TextConfig实例。
InputMethod_ErrorCode OH_TextConfig_SetInputType (InputMethod_TextConfig *config, InputMethod_TextInputType inputType)设置InputMethod_TextConfig实例的输入框类型。
InputMethod_ErrorCode OH_TextConfig_SetEnterKeyType (InputMethod_TextConfig *config, InputMethod_EnterKeyType enterKeyType)设置InputMethod_TextConfig实例的回车键功能类型。
InputMethod_ErrorCode OH_TextConfig_SetPreviewTextSupport (InputMethod_TextConfig *config, bool supported)将预上屏支持情况设置到InputMethod_TextConfig实例。
InputMethod_ErrorCode OH_TextConfig_SetSelection (InputMethod_TextConfig *config, int32_t start, int32_t end)设置InputMethod_TextConfig实例的选中文本范围。
InputMethod_ErrorCode OH_TextConfig_SetWindowId (InputMethod_TextConfig *config, int32_t windowId)设置InputMethod_TextConfig实例的所属窗口的窗口id。
InputMethod_ErrorCode OH_TextConfig_GetInputType (InputMethod_TextConfig *config, InputMethod_TextInputType *inputType)获取InputMethod_TextConfig实例的输入框类型。
InputMethod_ErrorCode OH_TextConfig_GetEnterKeyType (InputMethod_TextConfig *config, InputMethod_EnterKeyType *enterKeyType)获取InputMethod_TextConfig实例的回车键功能类型。
InputMethod_ErrorCode OH_TextConfig_IsPreviewTextSupported (InputMethod_TextConfig *config, bool *supported)获取InputMethod_TextConfig实例的是否支持预上屏。
InputMethod_ErrorCode OH_TextConfig_GetCursorInfo (InputMethod_TextConfig *config, InputMethod_CursorInfo **cursorInfo)获取InputMethod_TextConfig实例的光标信息。
InputMethod_ErrorCode OH_TextConfig_GetTextAvoidInfo (InputMethod_TextConfig *config, InputMethod_TextAvoidInfo **avoidInfo)获取InputMethod_TextConfig实例的避让信息。
InputMethod_ErrorCode OH_TextConfig_GetSelection (InputMethod_TextConfig *config, int32_t *start, int32_t *end)获取InputMethod_TextConfig实例的选区范围信息。
InputMethod_ErrorCode OH_TextConfig_GetWindowId (InputMethod_TextConfig *config, int32_t *windowId)获取InputMethod_TextConfig实例所属窗口的窗口id。
InputMethod_ErrorCode OH_TextConfig_SetPlaceholder (InputMethod_TextConfig *config, const char16_t *placeholder, size_t length)设置InputMethod_TextConfig实例的占位符文本信息。
InputMethod_ErrorCode OH_TextConfig_SetAbilityName (InputMethod_TextConfig *config, const char16_t *abilityName, size_t length)设置InputMethod_TextConfig实例的ability名称信息。
InputMethod_ErrorCode OH_TextConfig_GetPlaceholder (InputMethod_TextConfig *config, char16_t *placeholder,size_t *length)获取InputMethod_TextConfig实例占位文本信息。
InputMethod_ErrorCode OH_TextConfig_GetAbilityName (InputMethod_TextConfig *config, char16_t *abilityName,size_t *length)获取InputMethod_TextConfig实例ability名称信息。
InputMethod_TextEditorProxy * OH_TextEditorProxy_Create ()创建一个新的InputMethod_TextEditorProxy实例。
void OH_TextEditorProxy_Destroy (InputMethod_TextEditorProxy *proxy)销毁一个InputMethod_TextEditorProxy实例。
InputMethod_ErrorCode OH_TextEditorProxy_SetGetTextConfigFunc (InputMethod_TextEditorProxy *proxy, OH_TextEditorProxy_GetTextConfigFunc getTextConfigFunc)将函数OH_TextEditorProxy_GetTextConfigFunc设置到InputMethod_TextEditorProxy中。
InputMethod_ErrorCode OH_TextEditorProxy_SetInsertTextFunc (InputMethod_TextEditorProxy *proxy, OH_TextEditorProxy_InsertTextFunc insertTextFunc)将函数OH_TextEditorProxy_InsertTextFunc设置到InputMethod_TextEditorProxy中。
InputMethod_ErrorCode OH_TextEditorProxy_SetDeleteForwardFunc (InputMethod_TextEditorProxy *proxy, OH_TextEditorProxy_DeleteForwardFunc deleteForwardFunc)将函数OH_TextEditorProxy_DeleteForwardFunc设置到InputMethod_TextEditorProxy中。
InputMethod_ErrorCode OH_TextEditorProxy_SetDeleteBackwardFunc (InputMethod_TextEditorProxy *proxy, OH_TextEditorProxy_DeleteBackwardFunc deleteBackwardFunc)将函数OH_TextEditorProxy_DeleteBackwardFunc设置到InputMethod_TextEditorProxy中。
InputMethod_ErrorCode OH_TextEditorProxy_SetSendKeyboardStatusFunc (InputMethod_TextEditorProxy *proxy, OH_TextEditorProxy_SendKeyboardStatusFunc sendKeyboardStatusFunc)将函数OH_TextEditorProxy_SendKeyboardStatusFunc设置到InputMethod_TextEditorProxy中。
InputMethod_ErrorCode OH_TextEditorProxy_SetSendEnterKeyFunc (InputMethod_TextEditorProxy *proxy, OH_TextEditorProxy_SendEnterKeyFunc sendEnterKeyFunc)将函数OH_TextEditorProxy_SetSendEnterKeyFunc设置到InputMethod_TextEditorProxy中。
InputMethod_ErrorCode OH_TextEditorProxy_SetMoveCursorFunc (InputMethod_TextEditorProxy *proxy, OH_TextEditorProxy_MoveCursorFunc moveCursorFunc)将函数OH_TextEditorProxy_SetMoveCursorFunc设置到InputMethod_TextEditorProxy中。
InputMethod_ErrorCode OH_TextEditorProxy_SetHandleSetSelectionFunc (InputMethod_TextEditorProxy *proxy, OH_TextEditorProxy_HandleSetSelectionFunc handleSetSelectionFunc)将函数OH_TextEditorProxy_HandleSetSelectionFunc设置到InputMethod_TextEditorProxy中。
InputMethod_ErrorCode OH_TextEditorProxy_SetHandleExtendActionFunc (InputMethod_TextEditorProxy *proxy, OH_TextEditorProxy_HandleExtendActionFunc handleExtendActionFunc)将函数OH_TextEditorProxy_HandleExtendActionFunc设置到InputMethod_TextEditorProxy中。
InputMethod_ErrorCode OH_TextEditorProxy_SetGetLeftTextOfCursorFunc (InputMethod_TextEditorProxy *proxy, OH_TextEditorProxy_GetLeftTextOfCursorFunc getLeftTextOfCursorFunc)将函数OH_TextEditorProxy_GetLeftTextOfCursorFunc设置到InputMethod_TextEditorProxy中。
InputMethod_ErrorCode OH_TextEditorProxy_SetGetRightTextOfCursorFunc (InputMethod_TextEditorProxy *proxy, OH_TextEditorProxy_GetRightTextOfCursorFunc getRightTextOfCursorFunc)将函数OH_TextEditorProxy_GetRightTextOfCursorFunc设置到InputMethod_TextEditorProxy中。
InputMethod_ErrorCode OH_TextEditorProxy_SetGetTextIndexAtCursorFunc (InputMethod_TextEditorProxy *proxy, OH_TextEditorProxy_GetTextIndexAtCursorFunc getTextIndexAtCursorFunc)将函数OH_TextEditorProxy_GetTextIndexAtCursorFunc设置到InputMethod_TextEditorProxy中。
InputMethod_ErrorCode OH_TextEditorProxy_SetReceivePrivateCommandFunc (InputMethod_TextEditorProxy *proxy, OH_TextEditorProxy_ReceivePrivateCommandFunc receivePrivateCommandFunc)将函数OH_TextEditorProxy_ReceivePrivateCommandFunc设置到InputMethod_TextEditorProxy中。
InputMethod_ErrorCode OH_TextEditorProxy_SetSetPreviewTextFunc (InputMethod_TextEditorProxy *proxy, OH_TextEditorProxy_SetPreviewTextFunc setPreviewTextFunc)将函数OH_TextEditorProxy_SetPreviewTextFunc设置到InputMethod_TextEditorProxy中。
InputMethod_ErrorCode OH_TextEditorProxy_SetFinishTextPreviewFunc (InputMethod_TextEditorProxy *proxy, OH_TextEditorProxy_FinishTextPreviewFunc finishTextPreviewFunc)将函数OH_TextEditorProxy_FinishTextPreviewFunc设置到InputMethod_TextEditorProxy中。
InputMethod_ErrorCode OH_TextEditorProxy_GetGetTextConfigFunc (InputMethod_TextEditorProxy *proxy, OH_TextEditorProxy_GetTextConfigFunc *getTextConfigFunc)InputMethod_TextEditorProxy中获取OH_TextEditorProxy_GetTextConfigFunc函数。
InputMethod_ErrorCode OH_TextEditorProxy_GetInsertTextFunc (InputMethod_TextEditorProxy *proxy, OH_TextEditorProxy_InsertTextFunc *insertTextFunc)InputMethod_TextEditorProxy中获取OH_TextEditorProxy_InsertTextFunc函数。
InputMethod_ErrorCode OH_TextEditorProxy_GetDeleteForwardFunc (InputMethod_TextEditorProxy *proxy, OH_TextEditorProxy_DeleteForwardFunc *deleteForwardFunc)InputMethod_TextEditorProxy中获取OH_TextEditorProxy_DeleteForwardFunc函数。
InputMethod_ErrorCode OH_TextEditorProxy_GetDeleteBackwardFunc (InputMethod_TextEditorProxy *proxy, OH_TextEditorProxy_DeleteBackwardFunc *deleteBackwardFunc)InputMethod_TextEditorProxy中获取OH_TextEditorProxy_DeleteBackwardFunc函数。
InputMethod_ErrorCode OH_TextEditorProxy_GetSendKeyboardStatusFunc (InputMethod_TextEditorProxy *proxy, OH_TextEditorProxy_SendKeyboardStatusFunc *sendKeyboardStatusFunc)InputMethod_TextEditorProxy中获取OH_TextEditorProxy_SendKeyboardStatusFunc函数。
InputMethod_ErrorCode OH_TextEditorProxy_GetSendEnterKeyFunc (InputMethod_TextEditorProxy *proxy, OH_TextEditorProxy_SendEnterKeyFunc *sendEnterKeyFunc)InputMethod_TextEditorProxy中获取OH_TextEditorProxy_SendEnterKeyFunc函数。
InputMethod_ErrorCode OH_TextEditorProxy_GetMoveCursorFunc (InputMethod_TextEditorProxy *proxy, OH_TextEditorProxy_MoveCursorFunc *moveCursorFunc)InputMethod_TextEditorProxy中获取OH_TextEditorProxy_MoveCursorFunc函数。
InputMethod_ErrorCode OH_TextEditorProxy_GetHandleSetSelectionFunc (InputMethod_TextEditorProxy *proxy, OH_TextEditorProxy_HandleSetSelectionFunc *handleSetSelectionFunc)InputMethod_TextEditorProxy中获取OH_TextEditorProxy_HandleSetSelectionFunc函数。
InputMethod_ErrorCode OH_TextEditorProxy_GetHandleExtendActionFunc (InputMethod_TextEditorProxy *proxy, OH_TextEditorProxy_HandleExtendActionFunc *handleExtendActionFunc)InputMethod_TextEditorProxy中获取OH_TextEditorProxy_HandleExtendActionFunc函数。
InputMethod_ErrorCode OH_TextEditorProxy_GetGetLeftTextOfCursorFunc (InputMethod_TextEditorProxy *proxy, OH_TextEditorProxy_GetLeftTextOfCursorFunc *getLeftTextOfCursorFunc)InputMethod_TextEditorProxy中获取OH_TextEditorProxy_GetLeftTextOfCursorFunc函数。
InputMethod_ErrorCode OH_TextEditorProxy_GetGetRightTextOfCursorFunc (InputMethod_TextEditorProxy *proxy, OH_TextEditorProxy_GetRightTextOfCursorFunc *getRightTextOfCursorFunc)InputMethod_TextEditorProxy中获取OH_TextEditorProxy_GetRightTextOfCursorFunc函数。
InputMethod_ErrorCode OH_TextEditorProxy_GetGetTextIndexAtCursorFunc (InputMethod_TextEditorProxy *proxy, OH_TextEditorProxy_GetTextIndexAtCursorFunc *getTextIndexAtCursorFunc)InputMethod_TextEditorProxy中获取OH_TextEditorProxy_GetTextIndexAtCursorFunc函数。
InputMethod_ErrorCode OH_TextEditorProxy_GetReceivePrivateCommandFunc (InputMethod_TextEditorProxy *proxy, OH_TextEditorProxy_ReceivePrivateCommandFunc *receivePrivateCommandFunc)InputMethod_TextEditorProxy中获取OH_TextEditorProxy_ReceivePrivateCommandFunc函数。
InputMethod_ErrorCode OH_TextEditorProxy_GetSetPreviewTextFunc (InputMethod_TextEditorProxy *proxy, OH_TextEditorProxy_SetPreviewTextFunc *setPreviewTextFunc)InputMethod_TextEditorProxy中获取OH_TextEditorProxy_SetPreviewTextFunc函数。
InputMethod_ErrorCode OH_TextEditorProxy_GetFinishTextPreviewFunc (InputMethod_TextEditorProxy *proxy, OH_TextEditorProxy_FinishTextPreviewFunc *finishTextPreviewFunc)InputMethod_TextEditorProxy中获取OH_TextEditorProxy_FinishTextPreviewFunc函数。

类型定义说明

InputMethod_AttachOptions

typedef struct InputMethod_AttachOptions InputMethod_AttachOptions

描述

绑定输入法时携带的选项。

起始版本: 12

InputMethod_CommandValueType

typedef enum InputMethod_CommandValueType InputMethod_CommandValueType

描述

私有数据类型。

起始版本: 12

InputMethod_CursorInfo

typedef struct InputMethod_CursorInfo InputMethod_CursorInfo

描述

光标的坐标位置、宽度和高度。

起始版本: 12

InputMethod_Direction

typedef enum InputMethod_Direction InputMethod_Direction

描述

移动方向。

起始版本: 12

InputMethod_EnterKeyType

typedef enum InputMethod_EnterKeyType InputMethod_EnterKeyType

描述

回车键功能类型。

起始版本: 12

InputMethod_ErrorCode

typedef enum InputMethod_ErrorCode InputMethod_ErrorCode

描述

输入法错误码。

起始版本: 12

InputMethod_RequestKeyboardReason

typedef enum InputMethod_RequestKeyboardReason InputMethod_RequestKeyboardReason

描述

请求键盘输入原因。

起始版本: 15

InputMethod_ExtendAction

typedef enum InputMethod_ExtendAction InputMethod_ExtendAction

描述

编辑框中文本的扩展编辑操作类型。

起始版本: 12

InputMethod_InputMethodProxy

typedef struct InputMethod_InputMethodProxy InputMethod_InputMethodProxy

描述

输入法代理对象。

使用此对象可以用于调用使用输入法的方法。

起始版本: 12

InputMethod_KeyboardStatus

typedef enum InputMethod_KeyboardStatus InputMethod_KeyboardStatus

描述

键盘状态。

起始版本: 12

InputMethod_PrivateCommand

typedef struct InputMethod_PrivateCommand InputMethod_PrivateCommand

描述

私有数据。

输入框和输入法应用之间交互的私有数据。

起始版本: 12

InputMethod_TextAvoidInfo

typedef struct InputMethod_TextAvoidInfo InputMethod_TextAvoidInfo

描述

输入框用于避让键盘的信息。

起始版本: 12

InputMethod_TextConfig

typedef struct InputMethod_TextConfig InputMethod_TextConfig

描述

输入框的配置信息。

起始版本: 12

InputMethod_TextEditorProxy

typedef struct InputMethod_TextEditorProxy InputMethod_TextEditorProxy

描述

输入框代理。

提供了获取来自输入法应用的通知和请求的方法。

起始版本: 12

InputMethod_TextInputType

typedef enum InputMethod_TextInputType InputMethod_TextInputType

描述

文本输入类型。

起始版本: 12

OH_TextEditorProxy_DeleteBackwardFunc

typedef void(* OH_TextEditorProxy_DeleteBackwardFunc) (InputMethod_TextEditorProxy *textEditorProxy, int32_t length)

描述

输入法删除光标左侧文本时触发的函数。

您需要实现此函数,将它设置到InputMethod_TextEditorProxy中,并通过OH_InputMethodController_Attach完成注册。

起始版本: 12

参数:

名称描述
textEditorProxy指向即将被设置的InputMethod_TextEditorProxy实例的指针。
length要删除字符的长度。

OH_TextEditorProxy_DeleteForwardFunc

typedef void(* OH_TextEditorProxy_DeleteForwardFunc) (InputMethod_TextEditorProxy *textEditorProxy, int32_t length)

描述

输入法删除光标右侧文本时触发的函数。

您需要实现此函数,将它设置到InputMethod_TextEditorProxy中,并通过OH_InputMethodController_Attach完成注册。

起始版本: 12

参数:

名称描述
textEditorProxy指向即将被设置的InputMethod_TextEditorProxy实例的指针。
length要删除字符的长度。

OH_TextEditorProxy_FinishTextPreviewFunc

typedef void(* OH_TextEditorProxy_FinishTextPreviewFunc) (InputMethod_TextEditorProxy *textEditorProxy)

描述

输入法结束预上屏时触发的函数。

您需要实现此函数,将它设置到InputMethod_TextEditorProxy中,并通过OH_InputMethodController_Attach完成注册。

起始版本: 12

参数:

名称描述
textEditorProxy指向即将被设置的InputMethod_TextEditorProxy实例的指针。

OH_TextEditorProxy_GetLeftTextOfCursorFunc

typedef void(* OH_TextEditorProxy_GetLeftTextOfCursorFunc) (InputMethod_TextEditorProxy *textEditorProxy, int32_t number, char16_t text[], size_t *length)

描述

输入法获取光标左侧文本时触发的函数。

您需要实现此函数,将它设置到InputMethod_TextEditorProxy中,并通过OH_InputMethodController_Attach完成注册。

起始版本: 12

参数:

名称描述
textEditorProxy指向即将被设置的InputMethod_TextEditorProxy实例的指针。
number目标获取文本的长度。
text光标左侧指定长度的文本内容,需要在函数实现中对它赋值。

OH_TextEditorProxy_GetRightTextOfCursorFunc

typedef void(* OH_TextEditorProxy_GetRightTextOfCursorFunc) (InputMethod_TextEditorProxy *textEditorProxy, int32_t number, char16_t text[], size_t *length)

描述

输入法获取光标右侧文本时触发的函数。

您需要实现此函数,将它设置到InputMethod_TextEditorProxy中,并通过OH_InputMethodController_Attach完成注册。

起始版本: 12

参数:

名称描述
textEditorProxy指向即将被设置的InputMethod_TextEditorProxy实例的指针。
number目标获取文本的长度。
text光标右侧指定长度的文本内容,需要在函数实现中对它赋值。

OH_TextEditorProxy_GetTextConfigFunc

typedef void(* OH_TextEditorProxy_GetTextConfigFunc) (InputMethod_TextEditorProxy *textEditorProxy, InputMethod_TextConfig *config)

描述

输入法获取输入框配置时触发的函数。

您需要实现此函数,将它设置到InputMethod_TextEditorProxy中,并通过OH_InputMethodController_Attach完成注册。

起始版本: 12

参数:

名称描述
textEditorProxy指向即将被设置的InputMethod_TextEditorProxy实例的指针。
config输入框配置。

OH_TextEditorProxy_GetTextIndexAtCursorFunc

typedef int32_t(* OH_TextEditorProxy_GetTextIndexAtCursorFunc) (InputMethod_TextEditorProxy *textEditorProxy)

描述

输入法获取光标所在输入框文本索引时触发的函数。

您需要实现此函数,将它设置到InputMethod_TextEditorProxy中,并通过OH_InputMethodController_Attach完成注册。

起始版本: 12

参数:

名称描述
textEditorProxy指向即将被设置的InputMethod_TextEditorProxy实例的指针。

返回:

返回光标所在输入框文本索引。

OH_TextEditorProxy_HandleExtendActionFunc

typedef void(* OH_TextEditorProxy_HandleExtendActionFunc) (InputMethod_TextEditorProxy *textEditorProxy, InputMethod_ExtendAction action)

描述

输入法发送扩展编辑操作时触发的函数。

您需要实现此函数,将它设置到InputMethod_TextEditorProxy中,并通过OH_InputMethodController_Attach完成注册。

起始版本: 12

参数:

名称描述
textEditorProxy指向即将被设置的InputMethod_TextEditorProxy实例的指针。
action扩展编辑操作,具体定义详见InputMethod_ExtendAction

OH_TextEditorProxy_HandleSetSelectionFunc

typedef void(* OH_TextEditorProxy_HandleSetSelectionFunc) (InputMethod_TextEditorProxy *textEditorProxy, int32_t start, int32_t end)

描述

输入法请求选中文本时触发的函数。

您需要实现此函数,将它设置到InputMethod_TextEditorProxy中,并通过OH_InputMethodController_Attach完成注册。

起始版本: 12

参数:

名称描述
textEditorProxy指向即将被设置的InputMethod_TextEditorProxy实例的指针。
start表示选中文本的起始位置。
end表示选中文本的结束位置。

OH_TextEditorProxy_InsertTextFunc

typedef void(* OH_TextEditorProxy_InsertTextFunc) (InputMethod_TextEditorProxy *textEditorProxy, const char16_t *text, size_t length)

描述

输入法应用插入文本时触发的函数。

您需要实现此函数,将它设置到InputMethod_TextEditorProxy中,并通过OH_InputMethodController_Attach完成注册。

起始版本: 12

参数:

名称描述
textEditorProxy指向即将被设置的InputMethod_TextEditorProxy实例的指针。
text插入的字符。
length插入字符的长度。

OH_TextEditorProxy_MoveCursorFunc

typedef void(* OH_TextEditorProxy_MoveCursorFunc) (InputMethod_TextEditorProxy *textEditorProxy, InputMethod_Direction direction)

描述

输入法移动光标时触发的函数。

您需要实现此函数,将它设置到InputMethod_TextEditorProxy中,并通过OH_InputMethodController_Attach完成注册。

起始版本: 12

参数:

名称描述
textEditorProxy指向即将被设置的InputMethod_TextEditorProxy实例的指针。
direction光标移动方向,具体定义详见InputMethod_Direction

OH_TextEditorProxy_ReceivePrivateCommandFunc

typedef int32_t(* OH_TextEditorProxy_ReceivePrivateCommandFunc) (InputMethod_TextEditorProxy *textEditorProxy, InputMethod_PrivateCommand *privateCommand[], size_t size)

描述

输入法应用发送私有数据命令时触发的函数。

您需要实现此函数,将它设置到InputMethod_TextEditorProxy中,并通过OH_InputMethodController_Attach完成注册。

起始版本: 12

参数:

名称描述
textEditorProxy指向即将被设置的InputMethod_TextEditorProxy实例的指针。
privateCommand私有数据命令。
size私有数据的大小。

返回:

返回对私有数据命令处理的处理结果。

OH_TextEditorProxy_SendEnterKeyFunc

typedef void(* OH_TextEditorProxy_SendEnterKeyFunc) (InputMethod_TextEditorProxy *textEditorProxy, InputMethod_EnterKeyType enterKeyType)

描述

输入法发送回车键时触发的函数。

您需要实现此函数,将它设置到InputMethod_TextEditorProxy中,并通过OH_InputMethodController_Attach完成注册。

起始版本: 12

参数:

名称描述
textEditorProxy指向即将被设置的InputMethod_TextEditorProxy实例的指针。
enterKeyType回车键类型,具体定义详见InputMethod_EnterKeyType

OH_TextEditorProxy_SendKeyboardStatusFunc

typedef void(* OH_TextEditorProxy_SendKeyboardStatusFunc) (InputMethod_TextEditorProxy *textEditorProxy, InputMethod_KeyboardStatus keyboardStatus)

描述

输入法通知键盘状态时触发的函数。

您需要实现此函数,将它设置到InputMethod_TextEditorProxy中,并通过OH_InputMethodController_Attach完成注册。

起始版本: 12

参数:

名称描述
textEditorProxy指向即将被设置的InputMethod_TextEditorProxy实例的指针。
keyboardStatus键盘状态,具体定义详见InputMethod_KeyboardStatus

OH_TextEditorProxy_SetPreviewTextFunc

typedef int32_t(* OH_TextEditorProxy_SetPreviewTextFunc) (InputMethod_TextEditorProxy *textEditorProxy, const char16_t text[], size_t length, int32_t start, int32_t end)

描述

输入法设置预上屏文本时触发的函数。

您需要实现此函数,将它设置到InputMethod_TextEditorProxy中,并通过OH_InputMethodController_Attach完成注册。

起始版本: 12

参数:

名称描述
textEditorProxy指向即将被设置的InputMethod_TextEditorProxy实例的指针。
text请求设置为预上屏样式的文本内容。
length预上屏文本长度。
start预上屏文本起始光标位置。
end预上屏文本结束光标位置。

返回:

返回设置预上屏文本的处理结果。

枚举类型说明

InputMethod_CommandValueType

enum InputMethod_CommandValueType

描述

私有数据类型。

起始版本: 12

枚举值描述
IME_COMMAND_VALUE_TYPE_NONENONE。
IME_COMMAND_VALUE_TYPE_STRING字符串类型。
IME_COMMAND_VALUE_TYPE_BOOL布尔类型。
IME_COMMAND_VALUE_TYPE_INT3232位带符号整数类型。

InputMethod_Direction

enum InputMethod_Direction

描述

移动方向。

起始版本: 12

枚举值描述
IME_DIRECTION_NONENONE。
IME_DIRECTION_UP向上。
IME_DIRECTION_DOWN向下。
IME_DIRECTION_LEFT向左。
IME_DIRECTION_RIGHT向右。

InputMethod_EnterKeyType

enum InputMethod_EnterKeyType

描述

回车键功能类型。

起始版本: 12

枚举值描述
IME_ENTER_KEY_UNSPECIFIED未指定。
IME_ENTER_KEY_NONENONE。
IME_ENTER_KEY_GO前往。
IME_ENTER_KEY_SEARCH搜索。
IME_ENTER_KEY_SEND发送。
IME_ENTER_KEY_NEXT下一步。
IME_ENTER_KEY_DONE完成。
IME_ENTER_KEY_PREVIOUS上一步。
IME_ENTER_KEY_NEWLINE换行。

InputMethod_ErrorCode

enum InputMethod_ErrorCode

描述

输入法错误码。

起始版本: 12

枚举值描述
IME_ERR_OK成功。
IME_ERR_UNDEFINED查询失败。
IME_ERR_PARAMCHECK参数检查失败。
IME_ERR_PACKAGEMANAGER包管理异常。
IME_ERR_IMENGINE输入法应用异常。
IME_ERR_IMCLIENT输入框客户端异常。
IME_ERR_CONFIG_PERSIST配置固化失败。当保存配置失败时,会报此错误码。
IME_ERR_CONTROLLER输入法控制器异常。
IME_ERR_SETTINGS输入法设置器异常。
IME_ERR_IMMS输入法管理服务异常。
IME_ERR_DETACHED输入框未绑定。
IME_ERR_NULL_POINTER空指针异常。
IME_ERR_QUERY_FAILED查询失败。

InputMethod_ExtendAction

enum InputMethod_ExtendAction

描述

编辑框中文本的扩展编辑操作类型。

起始版本: 12

枚举值描述
IME_EXTEND_ACTION_SELECT_ALL全选。
IME_EXTEND_ACTION_CUT剪切。
IME_EXTEND_ACTION_COPY赋值。
IME_EXTEND_ACTION_PASTE粘贴。

InputMethod_KeyboardStatus

enum InputMethod_KeyboardStatus

描述

键盘状态。

起始版本: 12

枚举值描述
IME_KEYBOARD_STATUS_NONE键盘状态为NONE。
IME_KEYBOARD_STATUS_HIDE键盘状态为隐藏。
IME_KEYBOARD_STATUS_SHOW键盘状态为显示。

InputMethod_RequestKeyboardReason

enum InputMethod_RequestKeyboardReason

描述

请求键盘输入原因。

起始版本: 15

枚举值描述
IME_REQUEST_REASON_NONE表示没有特定原因触发键盘请求。
IME_REQUEST_REASON_MOUSE表示键盘请求是由鼠标操作触发。
IME_REQUEST_REASON_TOUCH表示键盘请求是由触摸操作触发。
IME_REQUEST_REASON_OTHER表示键盘请求是由其他原因触发。

InputMethod_TextInputType

enum InputMethod_TextInputType

描述

文本输入类型。

起始版本: 12

枚举值描述
IME_TEXT_INPUT_TYPE_NONENONE。
IME_TEXT_INPUT_TYPE_TEXT文本类型。
IME_TEXT_INPUT_TYPE_MULTILINE多行类型。
IME_TEXT_INPUT_TYPE_NUMBER数字类型。
IME_TEXT_INPUT_TYPE_PHONE电话号码类型。
IME_TEXT_INPUT_TYPE_DATETIME日期类型。
IME_TEXT_INPUT_TYPE_EMAIL_ADDRESS邮箱地址类型。
IME_TEXT_INPUT_TYPE_URL链接类型。
IME_TEXT_INPUT_TYPE_VISIBLE_PASSWORD密码类型。
IME_TEXT_INPUT_TYPE_NUMBER_PASSWORD数字密码类型。
IME_TEXT_INPUT_TYPE_SCREEN_LOCK_PASSWORD锁屏密码类型。
IME_TEXT_INPUT_TYPE_USER_NAME用户名类型。
IME_TEXT_INPUT_TYPE_NEW_PASSWORD新密码类型。
IME_TEXT_INPUT_TYPE_NUMBER_DECIMAL带小数点的数字类型。
IME_TEXT_INPUT_TYPE_ONE_TIME_CODE验证码类型。

函数说明

OH_AttachOptions_Create()

InputMethod_AttachOptions* OH_AttachOptions_Create (bool showKeyboard)

描述

创建一个新的InputMethod_AttachOptions实例。

起始版本: 12

参数:

名称描述
showKeyboard表示是否显示键盘。

返回:

如果创建成功,返回一个指向新创建的InputMethod_AttachOptions实例的指针。 如果创建失败,对象返回NULL,可能的失败原因有应用地址空间满。

OH_AttachOptions_CreateWithRequestKeyboardReason()

InputMethod_AttachOptions* OH_AttachOptions_CreateWithRequestKeyboardReason (bool showKeyboard, InputMethod_RequestKeyboardReason requestKeyboardReason)

描述

创建一个新的InputMethod_AttachOptions实例。

起始版本: 15

参数:

名称描述
showKeyboard表示是否显示键盘。
requestKeyboardReason表示请求键盘输入原因,具体定义详见InputMethod_RequestKeyboardReason

返回:

如果创建成功,返回一个指向新创建的InputMethod_AttachOptions实例的指针。 如果创建失败,对象返回NULL,失败原因可能是应用地址空间已满。

OH_AttachOptions_Destroy()

void OH_AttachOptions_Destroy (InputMethod_AttachOptions * options)

描述

销毁一个InputMethod_AttachOptions实例。

起始版本: 12

参数:

名称描述
options表示即将被销毁的InputMethod_AttachOptions实例。

OH_AttachOptions_IsShowKeyboard()

InputMethod_ErrorCode OH_AttachOptions_IsShowKeyboard (InputMethod_AttachOptions * options, bool * showKeyboard )

描述

InputMethod_AttachOptions中获取是否显示键盘的值。

起始版本: 12

参数:

名称描述
options表示被读取值的InputMethod_AttachOptions实例。
showKeyboard表示绑定时是否显示键盘。 true表示绑定完成时需要显示键盘; false表示绑定完成时不需要显示键盘。

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_AttachOptions_GetRequestKeyboardReason()

InputMethod_ErrorCode OH_AttachOptions_GetRequestKeyboardReason (InputMethod_AttachOptions * options, int * requestKeyboardReason )

描述

InputMethod_AttachOptions中获取输入法键盘拉起原因。

起始版本: 15

参数:

名称描述
options表示被读取值的InputMethod_AttachOptions实例。
requestKeyboardReason表示请求键盘输入原因,具体定义详见InputMethod_RequestKeyboardReason

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_CursorInfo_Create()

InputMethod_CursorInfo* OH_CursorInfo_Create (double left, double top, double width, double height )

描述

创建一个新的InputMethod_CursorInfo实例。

起始版本: 12

参数:

名称描述
left光标靠左点与物理屏幕左侧距离的绝对值。
top光标顶点与物理屏幕上侧距离的绝对值。
width宽度。
height高度。

返回:

如果创建成功,返回一个指向新创建的InputMethod_CursorInfo实例的指针。 如果创建失败,对象返回NULL,可能的失败原因有应用地址空间满。

OH_CursorInfo_Destroy()

void OH_CursorInfo_Destroy (InputMethod_CursorInfo * cursorInfo)

描述

销毁一个InputMethod_CursorInfo实例。

起始版本: 12

参数:

名称描述
cursorInfo表示指向即将被销毁的InputMethod_CursorInfo实例的指针。

OH_CursorInfo_GetRect()

InputMethod_ErrorCode OH_CursorInfo_GetRect (InputMethod_CursorInfo * cursorInfo, double * left, double * top, double * width, double * height )

描述

获取光标信息内容。

起始版本: 12

参数:

名称描述
cursorInfo表示指向InputMethod_CursorInfo实例的指针。
left靠左点与物理屏幕左侧距离的绝对值。
top顶点与物理屏幕上侧距离的绝对值。
width宽度。
height高度。

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考InputMethod_ErrorCode

OH_CursorInfo_SetRect()

InputMethod_ErrorCode OH_CursorInfo_SetRect (InputMethod_CursorInfo * cursorInfo, double left, double top, double width, double height )

描述

设置光标信息内容。

起始版本: 12

参数:

名称描述
cursorInfo表示指向InputMethod_CursorInfo实例的指针。
left光标靠左点与物理屏幕左侧距离的绝对值。
top光标顶点与物理屏幕上侧距离的绝对值。
width宽度。
height高度。

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_InputMethodController_Attach()

InputMethod_ErrorCode OH_InputMethodController_Attach (InputMethod_TextEditorProxy * textEditorProxy, InputMethod_AttachOptions * options, InputMethod_InputMethodProxy ** inputMethodProxy )

描述

将应用绑定到输入法服务。

起始版本: 12

参数:

名称描述
textEditorProxy表示指向InputMethod_TextEditorProxy实例的指针。 调用者需要自行管理textEditorProxy的生命周期。 并且如果调用成功,调用者在下次发起绑定或解绑之前,不能将textEditorProxy释放。
options表示指向InputMethod_AttachOptions实例的指针,是绑定时的选项。
inputMethodProxy表示指向InputMethod_InputMethodProxy实例的指针。生命周期维持到下一次绑定或解绑的调用。

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_PARAMCHECK - 表示参数错误。

IME_ERR_IMCLIENT - 输入法客户端错误。

IME_ERR_IMMS - 输入法服务错误。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考InputMethod_ErrorCode

OH_InputMethodController_Detach()

InputMethod_ErrorCode OH_InputMethodController_Detach (InputMethod_InputMethodProxy * inputMethodProxy)

描述

将应用从输入法服务解绑。

起始版本: 12

参数:

名称描述
inputMethodProxy表示指向InputMethod_InputMethodProxy实例的指针。 inputMethodProxy由调用OH_InputMethodController_Attach获取。

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_IMCLIENT - 表示输入法客户端错误。

IME_ERR_IMMS - 表示输入法服务错误。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考InputMethod_ErrorCode

OH_InputMethodProxy_HideKeyboard()

InputMethod_ErrorCode OH_InputMethodProxy_HideKeyboard (InputMethod_InputMethodProxy * inputMethodProxy)

描述

隐藏键盘。

起始版本: 12

参数:

名称描述
inputMethodProxy表示指向InputMethod_InputMethodProxy实例的指针。 inputMethodProxy由调用OH_InputMethodController_Attach获取。

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_IMCLIENT - 表示输入法客户端错误。

IME_ERR_IMMS - 表示输入法服务错误。

IME_ERR_DETACHED - 未绑定输入法。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考InputMethod_ErrorCode

OH_InputMethodProxy_NotifyConfigurationChange()

InputMethod_ErrorCode OH_InputMethodProxy_NotifyConfigurationChange (InputMethod_InputMethodProxy * inputMethodProxy, InputMethod_EnterKeyType enterKey, InputMethod_TextInputType textType )

描述

通知输入框配置变化。

起始版本: 12

参数:

名称描述
inputMethodProxy表示指向InputMethod_InputMethodProxy实例的指针。 inputMethodProxy由调用OH_InputMethodController_Attach获取。
enterKey回车键类型,具体定义详见InputMethod_EnterKeyType
textType输入框类型,具体定义详见InputMethod_TextInputType

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_PARAMCHECK - 表示参数错误。

IME_ERR_IMCLIENT - 输入法客户端错误。

IME_ERR_IMMS - 表示输入法服务错误。

IME_ERR_DETACHED - 未绑定输入法。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考InputMethod_ErrorCode

OH_InputMethodProxy_NotifyCursorUpdate()

InputMethod_ErrorCode OH_InputMethodProxy_NotifyCursorUpdate (InputMethod_InputMethodProxy * inputMethodProxy, InputMethod_CursorInfo * cursorInfo )

描述

通知光标位置变化。

起始版本: 12

参数:

名称描述
inputMethodProxy表示指向InputMethod_InputMethodProxy实例的指针。 inputMethodProxy由调用OH_InputMethodController_Attach获取。
cursorInfo指向InputMethod_CursorInfo实例的指针,表示光标信息。

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_PARAMCHECK - 表示参数错误。

IME_ERR_IMCLIENT - 输入法客户端错误。

IME_ERR_IMMS - 表示输入法服务错误。

IME_ERR_DETACHED - 未绑定输入法。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考InputMethod_ErrorCode

OH_InputMethodProxy_NotifySelectionChange()

InputMethod_ErrorCode OH_InputMethodProxy_NotifySelectionChange (InputMethod_InputMethodProxy * inputMethodProxy, char16_t text[], size_t length, int start, int end )

描述

通知文本框选区变化。

当输入框内文本内容、光标位置或选中文本发生变化时,通过此接口将信息通知给输入法应用。

起始版本: 12

参数:

名称描述
inputMethodProxy表示指向InputMethod_InputMethodProxy实例的指针。 inputMethodProxy由调用OH_InputMethodController_Attach获取。
text整个输入文本。
lengthtext参数的长度。最大长度为8K。
start所选文本的起始位置。
end所选文本的结束位置。

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_PARAMCHECK - 表示参数错误。

IME_ERR_IMCLIENT - 输入法客户端错误。

IME_ERR_IMMS - 表示输入法服务错误。

IME_ERR_DETACHED - 未绑定输入法。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考InputMethod_ErrorCode

OH_InputMethodProxy_SendPrivateCommand()

InputMethod_ErrorCode OH_InputMethodProxy_SendPrivateCommand (InputMethod_InputMethodProxy * inputMethodProxy, InputMethod_PrivateCommand * privateCommand[], size_t size )

描述

发送私有数据命令。

起始版本: 12

参数:

名称描述
inputMethodProxy表示指向InputMethod_InputMethodProxy实例的指针。 inputMethodProxy由调用OH_InputMethodController_Attach获取。
privateCommand私有命令, 定义在InputMethod_PrivateCommand,最大大小为32KB。
size私有命令的大小,最大大小为5。

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_PARAMCHECK - 表示参数错误。

IME_ERR_IMCLIENT - 输入法客户端错误。

IME_ERR_IMMS - 表示输入法服务错误。

IME_ERR_DETACHED - 未绑定输入法。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考InputMethod_ErrorCode

OH_InputMethodProxy_ShowKeyboard()

InputMethod_ErrorCode OH_InputMethodProxy_ShowKeyboard (InputMethod_InputMethodProxy * inputMethodProxy)

描述

显示键盘。

起始版本: 12

参数:

名称描述
inputMethodProxy表示指向InputMethod_InputMethodProxy实例的指针。 inputMethodProxy由调用OH_InputMethodController_Attach获取。

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_PARAMCHECK - 表示参数错误。

IME_ERR_IMCLIENT - 输入法客户端错误。

IME_ERR_IMMS - 表示输入法服务错误。

IME_ERR_DETACHED - 未绑定输入法。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考InputMethod_ErrorCode

OH_InputMethodProxy_ShowTextInput()

InputMethod_ErrorCode OH_InputMethodProxy_ShowTextInput (InputMethod_InputMethodProxy * inputMethodProxy, InputMethod_AttachOptions *options)

描述

显示文本输入。

起始版本: 15

参数:

名称描述
inputMethodProxy表示指向InputMethod_InputMethodProxy实例的指针。 inputMethodProxy由调用OH_InputMethodController_Attach获取。
options表示指向InputMethod_AttachOptions实例的指针,是绑定时的选项。

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_PARAMCHECK - 表示参数错误。

IME_ERR_IMCLIENT - 输入法客户端错误。

IME_ERR_IMMS - 表示输入法服务错误。

IME_ERR_DETACHED - 未绑定输入法。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考InputMethod_ErrorCode

OH_PrivateCommand_Create()

InputMethod_PrivateCommand* OH_PrivateCommand_Create (char key[], size_t keyLength )

描述

创建一个新的InputMethod_PrivateCommand实例。

起始版本: 12

参数:

名称描述
key私有数据的key值。
keyLengthkey长度。

返回:

如果创建成功,返回一个指向新创建的InputMethod_PrivateCommand实例的指针。 如果创建失败,对象返回NULL,可能的失败原因有应用地址空间满。

OH_PrivateCommand_Destroy()

void OH_PrivateCommand_Destroy (InputMethod_PrivateCommand * command)

描述

销毁一个InputMethod_PrivateCommand实例。

起始版本: 12

参数:

名称描述
command指向即将被销毁的InputMethod_PrivateCommand实例的指针。

OH_PrivateCommand_GetBoolValue()

InputMethod_ErrorCode OH_PrivateCommand_GetBoolValue (InputMethod_PrivateCommand * command, bool * value )

描述

InputMethod_PrivateCommand获取布尔类型的value的值。

起始版本: 12

参数:

名称描述
command指向即将被获取value值的InputMethod_PrivateCommand实例的指针。
value布尔类型的value的值。

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_PrivateCommand_GetIntValue()

InputMethod_ErrorCode OH_PrivateCommand_GetIntValue (InputMethod_PrivateCommand * command, int32_t * value )

描述

InputMethod_PrivateCommand获取整数类型的value的值。

起始版本: 12

参数:

名称描述
command指向即将被获取value值的InputMethod_PrivateCommand实例的指针。
value整数类型的value的值。

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_PrivateCommand_GetKey()

InputMethod_ErrorCode OH_PrivateCommand_GetKey (InputMethod_PrivateCommand * command, const char ** key, size_t * keyLength )

描述

InputMethod_PrivateCommand获取key值。

起始版本: 12

参数:

名称描述
command指向即将被获取key值的InputMethod_PrivateCommand实例的指针。
keykey的生命周期和command一致。不要直接保存key地址,或者直接写key。建议拷贝后使用。
keyLengthkey长度。

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_PrivateCommand_GetStrValue()

InputMethod_ErrorCode OH_PrivateCommand_GetStrValue (InputMethod_PrivateCommand * command, const char ** value, size_t * valueLength )

描述

InputMethod_PrivateCommand获取字符串类型的value的值。

起始版本: 12

参数:

名称描述
command指向即将被获取value值的InputMethod_PrivateCommand实例的指针。
value字符串类型的value的值。
valueLengthvalue的生命周期和command一致。不要直接保存value地址,或者直接写value。建议拷贝后使用。

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_PrivateCommand_GetValueType()

InputMethod_ErrorCode OH_PrivateCommand_GetValueType (InputMethod_PrivateCommand * command, InputMethod_CommandValueType * type )

描述

InputMethod_PrivateCommand获取value的数据类型。

起始版本: 12

参数:

名称描述
command指向即将被获取value值的InputMethod_PrivateCommand实例的指针。
typevalue值的数据类型。

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_PrivateCommand_SetBoolValue()

InputMethod_ErrorCode OH_PrivateCommand_SetBoolValue (InputMethod_PrivateCommand * command, bool value )

描述

设置InputMethod_PrivateCommand的布尔类型value值。

起始版本: 12

参数:

名称描述
command指向即将被设置的InputMethod_PrivateCommand实例的指针。
value布尔类型value值。

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_PrivateCommand_SetIntValue()

InputMethod_ErrorCode OH_PrivateCommand_SetIntValue (InputMethod_PrivateCommand * command, int32_t value )

描述

设置InputMethod_PrivateCommand的整数类型value值。

起始版本: 12

参数:

名称描述
command指向即将被设置的InputMethod_PrivateCommand实例的指针。
value整型value值。

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_PrivateCommand_SetKey()

InputMethod_ErrorCode OH_PrivateCommand_SetKey (InputMethod_PrivateCommand * command, char key[], size_t keyLength )

描述

设置InputMethod_PrivateCommand的key值。

起始版本: 12

参数:

名称描述
command指向即将被设置的InputMethod_PrivateCommand实例的指针。
keykey值。
keyLengthkey长度。

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_PrivateCommand_SetStrValue()

InputMethod_ErrorCode OH_PrivateCommand_SetStrValue (InputMethod_PrivateCommand * command, char value[], size_t valueLength )

描述

设置InputMethod_PrivateCommand的字符串类型value值。

起始版本: 12

参数:

名称描述
command指向即将被设置的InputMethod_PrivateCommand实例的指针。
value字符串类型value值。

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_TextAvoidInfo_Create()

InputMethod_TextAvoidInfo* OH_TextAvoidInfo_Create (double positionY, double height )

描述

创建一个新的InputMethod_TextAvoidInfo实例。

起始版本: 12

参数:

名称描述
positionY表示输入框位置的Y坐标值。
height表示输入框高度。

返回:

如果创建成功,返回一个指向新创建的InputMethod_TextAvoidInfo实例的指针。 如果创建失败,对象返回NULL,可能的失败原因有应用地址空间满。

OH_TextAvoidInfo_Destroy()

void OH_TextAvoidInfo_Destroy (InputMethod_TextAvoidInfo * info)

描述

销毁一个InputMethod_TextAvoidInfo实例。

起始版本: 12

参数:

名称描述
options表示指向即将被销毁的InputMethod_TextAvoidInfo实例的指针。

OH_TextAvoidInfo_GetHeight()

InputMethod_ErrorCode OH_TextAvoidInfo_GetHeight (InputMethod_TextAvoidInfo * info, double * height )

描述

InputMethod_TextAvoidInfo获取高度值。

起始版本: 12

参数:

名称描述
info指向即将被获取值的InputMethod_TextAvoidInfo实例的指针。
height输入框高度。

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_TextAvoidInfo_GetPositionY()

InputMethod_ErrorCode OH_TextAvoidInfo_GetPositionY (InputMethod_TextAvoidInfo * info, double * positionY )

描述

InputMethod_TextAvoidInfo获取Y坐标值。

起始版本: 12

参数:

名称描述
info指向即将被获取值的InputMethod_TextAvoidInfo实例的指针。
positionYpositionY值,即输入框顶点与物理屏幕上侧距离的绝对值。

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_TextAvoidInfo_SetHeight()

InputMethod_ErrorCode OH_TextAvoidInfo_SetHeight (InputMethod_TextAvoidInfo * info, double height )

描述

设置InputMethod_TextAvoidInfo中的高度值。

起始版本: 12

参数:

名称描述
info指向即将被设置值的InputMethod_TextAvoidInfo实例的指针。
height高度值。

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_TextAvoidInfo_SetPositionY()

InputMethod_ErrorCode OH_TextAvoidInfo_SetPositionY (InputMethod_TextAvoidInfo * info, double positionY )

描述

设置InputMethod_TextAvoidInfo中的Y坐标值。

起始版本: 12

参数:

名称描述
info指向即将被设置值的InputMethod_TextAvoidInfo实例的指针。
positionYpositionY值,即输入框顶点与物理屏幕上侧距离的绝对值。

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_TextConfig_Create()

InputMethod_TextConfig* OH_TextConfig_Create ()

描述

创建一个新的InputMethod_TextConfig实例。

起始版本: 12

返回:

如果创建成功,返回一个指向新创建的InputMethod_TextConfig实例的指针。 如果创建失败,对象返回NULL,可能的失败原因有应用地址空间满。

OH_TextConfig_Destroy()

void OH_TextConfig_Destroy (InputMethod_TextConfig * config)

描述

销毁一个InputMethod_TextConfig实例。

起始版本: 12

参数:

名称描述
config表示指向即将被销毁的InputMethod_TextConfig实例的指针。

OH_TextConfig_GetCursorInfo()

InputMethod_ErrorCode OH_TextConfig_GetCursorInfo (InputMethod_TextConfig * config, InputMethod_CursorInfo ** cursorInfo )

描述

获取InputMethod_TextConfig实例的光标信息。

起始版本: 12

参数:

名称描述
config指向即将被获取值的InputMethod_TextConfig实例的指针。
cursorInfo光标信息。

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_TextConfig_GetEnterKeyType()

InputMethod_ErrorCode OH_TextConfig_GetEnterKeyType (InputMethod_TextConfig * config, InputMethod_EnterKeyType * enterKeyType )

描述

获取InputMethod_TextConfig实例的回车键功能类型。

起始版本: 12

参数:

名称描述
config指向即将被获取值的InputMethod_TextConfig实例的指针。
enterKeyType输入框的回车键功能类型,具体定义详见InputMethod_EnterKeyType

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_TextConfig_GetInputType()

InputMethod_ErrorCode OH_TextConfig_GetInputType (InputMethod_TextConfig * config, InputMethod_TextInputType * inputType )

描述

获取InputMethod_TextConfig实例的输入框类型。

起始版本: 12

参数:

名称描述
config指向即将被获取值的InputMethod_TextConfig实例的指针。
inputType输入框的输入类型,具体定义详见InputMethod_TextInputType

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_TextConfig_GetSelection()

InputMethod_ErrorCode OH_TextConfig_GetSelection (InputMethod_TextConfig * config, int32_t * start, int32_t * end )

描述

获取InputMethod_TextConfig实例的选区范围信息。

起始版本: 12

参数:

名称描述
config指向即将被获取值的InputMethod_TextConfig实例的指针。
start所选文本的起始位置。
end所选文本的结束位置。

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_TextConfig_GetTextAvoidInfo()

InputMethod_ErrorCode OH_TextConfig_GetTextAvoidInfo (InputMethod_TextConfig * config, InputMethod_TextAvoidInfo ** avoidInfo )

描述

获取InputMethod_TextConfig实例的避让信息。

起始版本: 12

参数:

名称描述
config指向即将被获取值的InputMethod_TextConfig实例的指针。
avoidInfo输入框避让信息。

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_TextConfig_GetWindowId()

InputMethod_ErrorCode OH_TextConfig_GetWindowId (InputMethod_TextConfig * config, int32_t * windowId )

描述

获取InputMethod_TextConfig实例所属窗口的窗口id。

起始版本: 12

参数:

名称描述
config指向即将被获取值的InputMethod_TextConfig实例的指针。
windowId绑定输入法的应用所属窗口的窗口id。

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_TextConfig_IsPreviewTextSupported()

InputMethod_ErrorCode OH_TextConfig_IsPreviewTextSupported (InputMethod_TextConfig * config, bool * supported )

描述

获取InputMethod_TextConfig实例的是否支持预上屏。

起始版本: 12

参数:

名称描述
config指向即将被获取值的InputMethod_TextConfig实例的指针。
supported表示输入框是否支持预上屏。

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_TextConfig_SetEnterKeyType()

InputMethod_ErrorCode OH_TextConfig_SetEnterKeyType (InputMethod_TextConfig * config, InputMethod_EnterKeyType enterKeyType )

描述

设置InputMethod_TextConfig实例的回车键功能类型。

起始版本: 12

参数:

名称描述
config指向即将被设置值的InputMethod_TextConfig实例的指针。
enterKeyType回车键功能类型,具体定义详见InputMethod_EnterKeyType

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_TextConfig_SetInputType()

InputMethod_ErrorCode OH_TextConfig_SetInputType (InputMethod_TextConfig * config, InputMethod_TextInputType inputType )

描述

设置InputMethod_TextConfig实例的输入框类型。

起始版本: 12

参数:

名称描述
config指向即将被设置值的InputMethod_TextConfig实例的指针。
inputType输入框的输入类型,具体定义详见InputMethod_TextInputType

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_TextConfig_SetPreviewTextSupport()

InputMethod_ErrorCode OH_TextConfig_SetPreviewTextSupport (InputMethod_TextConfig * config, bool supported )

描述

将预上屏支持情况设置到InputMethod_TextConfig实例。

起始版本: 12

参数:

名称描述
config指向即将被设置值的InputMethod_TextConfig实例的指针。
supported表示输入框是否支持预上屏。

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_TextConfig_SetSelection()

InputMethod_ErrorCode OH_TextConfig_SetSelection (InputMethod_TextConfig * config, int32_t start, int32_t end )

描述

设置InputMethod_TextConfig实例的选中文本范围。

起始版本: 12

参数:

名称描述
config指向即将被设置值的InputMethod_TextConfig实例的指针。
start所选文本的起始位置。
end所选文本的结束位置。

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_TextConfig_SetWindowId()

InputMethod_ErrorCode OH_TextConfig_SetWindowId (InputMethod_TextConfig * config, int32_t windowId )

描述

设置InputMethod_TextConfig实例的所属窗口的窗口id。

起始版本: 12

参数:

名称描述
config指向即将被设置值的InputMethod_TextConfig实例的指针。
windowId绑定输入法的应用所属窗口的窗口id。

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_TextEditorProxy_Create()

InputMethod_TextEditorProxy* OH_TextEditorProxy_Create ()

描述

创建一个新的InputMethod_TextEditorProxy实例。

起始版本: 12

返回:

如果创建成功,返回一个指向新创建的InputMethod_TextEditorProxy实例的指针。 如果创建失败,对象返回NULL,可能的失败原因有应用地址空间满。

OH_TextEditorProxy_Destroy()

void OH_TextEditorProxy_Destroy (InputMethod_TextEditorProxy * proxy)

描述

销毁一个InputMethod_TextEditorProxy实例。

起始版本: 12

参数:

名称描述
proxy表示指向即将被销毁的InputMethod_TextEditorProxy实例的指针。

OH_TextEditorProxy_GetDeleteBackwardFunc()

InputMethod_ErrorCode OH_TextEditorProxy_GetDeleteBackwardFunc (InputMethod_TextEditorProxy * proxy, OH_TextEditorProxy_DeleteBackwardFunc * deleteBackwardFunc )

描述

InputMethod_TextEditorProxy中获取OH_TextEditorProxy_DeleteBackwardFunc函数。

起始版本: 12

参数:

名称描述
proxy指向被读取的InputMethod_TextEditorProxy实例的指针。
deleteBackwardFunc表示从proxy获取到的函数OH_TextEditorProxy_DeleteBackwardFunc

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_TextEditorProxy_GetDeleteForwardFunc()

InputMethod_ErrorCode OH_TextEditorProxy_GetDeleteForwardFunc (InputMethod_TextEditorProxy * proxy, OH_TextEditorProxy_DeleteForwardFunc * deleteForwardFunc )

描述

InputMethod_TextEditorProxy中获取OH_TextEditorProxy_DeleteForwardFunc函数。

起始版本: 12

参数:

名称描述
proxy指向被读取的InputMethod_TextEditorProxy实例的指针。
deleteForwardFunc表示从proxy获取到的函数OH_TextEditorProxy_DeleteForwardFunc

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_TextEditorProxy_GetFinishTextPreviewFunc()

InputMethod_ErrorCode OH_TextEditorProxy_GetFinishTextPreviewFunc (InputMethod_TextEditorProxy * proxy, OH_TextEditorProxy_FinishTextPreviewFunc * finishTextPreviewFunc )

描述

InputMethod_TextEditorProxy中获取OH_TextEditorProxy_FinishTextPreviewFunc函数。

起始版本: 12

参数:

名称描述
proxy指向被读取的InputMethod_TextEditorProxy实例的指针。
finishTextPreviewFunc表示从proxy获取到的函数OH_TextEditorProxy_FinishTextPreviewFunc

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_TextEditorProxy_GetGetLeftTextOfCursorFunc()

InputMethod_ErrorCode OH_TextEditorProxy_GetGetLeftTextOfCursorFunc (InputMethod_TextEditorProxy * proxy, OH_TextEditorProxy_GetLeftTextOfCursorFunc * getLeftTextOfCursorFunc )

描述

InputMethod_TextEditorProxy中获取OH_TextEditorProxy_GetLeftTextOfCursorFunc函数。

起始版本: 12

参数:

名称描述
proxy指向被读取的InputMethod_TextEditorProxy实例的指针。
getLeftTextOfCursorFunc表示从proxy获取到的函数OH_TextEditorProxy_GetLeftTextOfCursorFunc

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_TextEditorProxy_GetGetRightTextOfCursorFunc()

InputMethod_ErrorCode OH_TextEditorProxy_GetGetRightTextOfCursorFunc (InputMethod_TextEditorProxy * proxy, OH_TextEditorProxy_GetRightTextOfCursorFunc * getRightTextOfCursorFunc )

描述

InputMethod_TextEditorProxy中获取OH_TextEditorProxy_GetRightTextOfCursorFunc函数。

起始版本: 12

参数:

名称描述
proxy指向被读取的InputMethod_TextEditorProxy实例的指针。
getRightTextOfCursorFunc表示从proxy获取到的函数OH_TextEditorProxy_GetRightTextOfCursorFunc

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_TextEditorProxy_GetGetTextConfigFunc()

InputMethod_ErrorCode OH_TextEditorProxy_GetGetTextConfigFunc (InputMethod_TextEditorProxy * proxy, OH_TextEditorProxy_GetTextConfigFunc * getTextConfigFunc )

描述

InputMethod_TextEditorProxy中获取OH_TextEditorProxy_GetTextConfigFunc函数。

起始版本: 12

参数:

名称描述
proxy指向被读取的InputMethod_TextEditorProxy实例的指针。
getTextConfigFunc表示从proxy获取到的函数OH_TextEditorProxy_GetTextConfigFunc

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_TextEditorProxy_GetGetTextIndexAtCursorFunc()

InputMethod_ErrorCode OH_TextEditorProxy_GetGetTextIndexAtCursorFunc (InputMethod_TextEditorProxy * proxy, OH_TextEditorProxy_GetTextIndexAtCursorFunc * getTextIndexAtCursorFunc )

描述

InputMethod_TextEditorProxy中获取OH_TextEditorProxy_GetTextIndexAtCursorFunc函数。

起始版本: 12

参数:

名称描述
proxy指向被读取的InputMethod_TextEditorProxy实例的指针。
getTextIndexAtCursorFunc表示从proxy获取到的函数OH_TextEditorProxy_GetTextIndexAtCursorFunc

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_TextEditorProxy_GetHandleExtendActionFunc()

InputMethod_ErrorCode OH_TextEditorProxy_GetHandleExtendActionFunc (InputMethod_TextEditorProxy * proxy, OH_TextEditorProxy_HandleExtendActionFunc * handleExtendActionFunc )

描述

InputMethod_TextEditorProxy中获取OH_TextEditorProxy_HandleExtendActionFunc函数。

起始版本: 12

参数:

名称描述
proxy指向被读取的InputMethod_TextEditorProxy实例的指针。
handleExtendActionFunc表示从proxy获取到的函数OH_TextEditorProxy_HandleExtendActionFunc

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_TextEditorProxy_GetHandleSetSelectionFunc()

InputMethod_ErrorCode OH_TextEditorProxy_GetHandleSetSelectionFunc (InputMethod_TextEditorProxy * proxy, OH_TextEditorProxy_HandleSetSelectionFunc * handleSetSelectionFunc )

描述

InputMethod_TextEditorProxy中获取OH_TextEditorProxy_HandleSetSelectionFunc函数。

起始版本: 12

参数:

名称描述
proxy指向被读取的InputMethod_TextEditorProxy实例的指针。
handleSetSelectionFunc表示从proxy获取到的函数OH_TextEditorProxy_HandleSetSelectionFunc

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_TextEditorProxy_GetInsertTextFunc()

InputMethod_ErrorCode OH_TextEditorProxy_GetInsertTextFunc (InputMethod_TextEditorProxy * proxy, OH_TextEditorProxy_InsertTextFunc * insertTextFunc )

描述

InputMethod_TextEditorProxy中获取OH_TextEditorProxy_InsertTextFunc函数。

起始版本: 12

参数:

名称描述
proxy指向被读取的InputMethod_TextEditorProxy实例的指针。
insertTextFunc表示从proxy获取到的函数OH_TextEditorProxy_InsertTextFunc

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_TextEditorProxy_GetMoveCursorFunc()

InputMethod_ErrorCode OH_TextEditorProxy_GetMoveCursorFunc (InputMethod_TextEditorProxy * proxy, OH_TextEditorProxy_MoveCursorFunc * moveCursorFunc )

描述

InputMethod_TextEditorProxy中获取OH_TextEditorProxy_MoveCursorFunc函数。

起始版本: 12

参数:

名称描述
proxy指向被读取的InputMethod_TextEditorProxy实例的指针。
moveCursorFunc表示从proxy获取到的函数OH_TextEditorProxy_MoveCursorFunc

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_TextEditorProxy_GetReceivePrivateCommandFunc()

InputMethod_ErrorCode OH_TextEditorProxy_GetReceivePrivateCommandFunc (InputMethod_TextEditorProxy * proxy, OH_TextEditorProxy_ReceivePrivateCommandFunc * receivePrivateCommandFunc )

描述

InputMethod_TextEditorProxy中获取OH_TextEditorProxy_ReceivePrivateCommandFunc函数。

起始版本: 12

参数:

名称描述
proxy指向被读取的InputMethod_TextEditorProxy实例的指针。
receivePrivateCommandFunc表示从proxy获取到的函数OH_TextEditorProxy_ReceivePrivateCommandFunc

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_TextEditorProxy_GetSendEnterKeyFunc()

InputMethod_ErrorCode OH_TextEditorProxy_GetSendEnterKeyFunc (InputMethod_TextEditorProxy * proxy, OH_TextEditorProxy_SendEnterKeyFunc * sendEnterKeyFunc )

描述

InputMethod_TextEditorProxy中获取OH_TextEditorProxy_SendEnterKeyFunc函数。

起始版本: 12

参数:

名称描述
proxy指向被读取的InputMethod_TextEditorProxy实例的指针。
sendEnterKeyFunc表示从proxy获取到的函数OH_TextEditorProxy_SendEnterKeyFunc

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_TextEditorProxy_GetSendKeyboardStatusFunc()

InputMethod_ErrorCode OH_TextEditorProxy_GetSendKeyboardStatusFunc (InputMethod_TextEditorProxy * proxy, OH_TextEditorProxy_SendKeyboardStatusFunc * sendKeyboardStatusFunc )

描述

InputMethod_TextEditorProxy中获取OH_TextEditorProxy_SendKeyboardStatusFunc函数。

起始版本: 12

参数:

名称描述
proxy指向被读取的InputMethod_TextEditorProxy实例的指针。
sendKeyboardStatusFunc表示从proxy获取到的函数OH_TextEditorProxy_SendKeyboardStatusFunc

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_TextEditorProxy_GetSetPreviewTextFunc()

InputMethod_ErrorCode OH_TextEditorProxy_GetSetPreviewTextFunc (InputMethod_TextEditorProxy * proxy, OH_TextEditorProxy_SetPreviewTextFunc * setPreviewTextFunc )

描述

InputMethod_TextEditorProxy中获取OH_TextEditorProxy_SetPreviewTextFunc函数。

起始版本: 12

参数:

名称描述
proxy指向被读取的InputMethod_TextEditorProxy实例的指针。
setPreviewTextFunc表示从proxy获取到的函数OH_TextEditorProxy_SetPreviewTextFunc

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_TextEditorProxy_SetDeleteBackwardFunc()

InputMethod_ErrorCode OH_TextEditorProxy_SetDeleteBackwardFunc (InputMethod_TextEditorProxy * proxy, OH_TextEditorProxy_DeleteBackwardFunc deleteBackwardFunc )

描述

将函数OH_TextEditorProxy_DeleteBackwardFunc设置到InputMethod_TextEditorProxy中。

起始版本: 12

参数:

名称描述
proxy指向即将被设置的InputMethod_TextEditorProxy实例的指针。
deleteBackwardFunc表示被设置到proxy的函数OH_TextEditorProxy_DeleteBackwardFunc

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_TextEditorProxy_SetDeleteForwardFunc()

InputMethod_ErrorCode OH_TextEditorProxy_SetDeleteForwardFunc (InputMethod_TextEditorProxy * proxy, OH_TextEditorProxy_DeleteForwardFunc deleteForwardFunc )

描述

将函数OH_TextEditorProxy_DeleteForwardFunc设置到InputMethod_TextEditorProxy中。

起始版本: 12

参数:

名称描述
proxy指向即将被设置的InputMethod_TextEditorProxy实例的指针。
deleteForwardFunc表示被设置到proxy的函数OH_TextEditorProxy_DeleteForwardFunc

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_TextEditorProxy_SetFinishTextPreviewFunc()

InputMethod_ErrorCode OH_TextEditorProxy_SetFinishTextPreviewFunc (InputMethod_TextEditorProxy * proxy, OH_TextEditorProxy_FinishTextPreviewFunc finishTextPreviewFunc )

描述

将函数OH_TextEditorProxy_FinishTextPreviewFunc设置到InputMethod_TextEditorProxy中。

起始版本: 12

参数:

名称描述
proxy指向即将被设置的InputMethod_TextEditorProxy实例的指针。
finishTextPreviewFunc表示被设置到proxy的函数OH_TextEditorProxy_FinishTextPreviewFunc

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_TextEditorProxy_SetGetLeftTextOfCursorFunc()

InputMethod_ErrorCode OH_TextEditorProxy_SetGetLeftTextOfCursorFunc (InputMethod_TextEditorProxy * proxy, OH_TextEditorProxy_GetLeftTextOfCursorFunc getLeftTextOfCursorFunc )

描述

将函数OH_TextEditorProxy_GetLeftTextOfCursorFunc设置到InputMethod_TextEditorProxy中。

起始版本: 12

参数:

名称描述
proxy指向即将被设置的InputMethod_TextEditorProxy实例的指针。
getLeftTextOfCursorFunc表示被设置到proxy的函数OH_TextEditorProxy_GetLeftTextOfCursorFunc

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_TextEditorProxy_SetGetRightTextOfCursorFunc()

InputMethod_ErrorCode OH_TextEditorProxy_SetGetRightTextOfCursorFunc (InputMethod_TextEditorProxy * proxy, OH_TextEditorProxy_GetRightTextOfCursorFunc getRightTextOfCursorFunc )

描述

将函数OH_TextEditorProxy_GetRightTextOfCursorFunc设置到InputMethod_TextEditorProxy中。

起始版本: 12

参数:

名称描述
proxy指向即将被设置的InputMethod_TextEditorProxy实例的指针。
getRightTextOfCursorFunc表示被设置到proxy的函数OH_TextEditorProxy_GetRightTextOfCursorFunc

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_TextEditorProxy_SetGetTextConfigFunc()

InputMethod_ErrorCode OH_TextEditorProxy_SetGetTextConfigFunc (InputMethod_TextEditorProxy * proxy, OH_TextEditorProxy_GetTextConfigFunc getTextConfigFunc )

描述

将函数OH_TextEditorProxy_GetTextConfigFunc设置到InputMethod_TextEditorProxy中。

起始版本: 12

参数:

名称描述
proxy指向即将被设置的InputMethod_TextEditorProxy实例的指针。
getTextConfigFunc表示被设置到proxy的函数OH_TextEditorProxy_GetTextConfigFunc

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_TextEditorProxy_SetGetTextIndexAtCursorFunc()

InputMethod_ErrorCode OH_TextEditorProxy_SetGetTextIndexAtCursorFunc (InputMethod_TextEditorProxy * proxy, OH_TextEditorProxy_GetTextIndexAtCursorFunc getTextIndexAtCursorFunc )

描述

将函数OH_TextEditorProxy_GetTextIndexAtCursorFunc设置到InputMethod_TextEditorProxy中。

起始版本: 12

参数:

名称描述
proxy指向即将被设置的InputMethod_TextEditorProxy实例的指针。
getTextIndexAtCursorFunc表示被设置到proxy的函数OH_TextEditorProxy_GetTextIndexAtCursorFunc

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_TextEditorProxy_SetHandleExtendActionFunc()

InputMethod_ErrorCode OH_TextEditorProxy_SetHandleExtendActionFunc (InputMethod_TextEditorProxy * proxy, OH_TextEditorProxy_HandleExtendActionFunc handleExtendActionFunc )

描述

将函数OH_TextEditorProxy_HandleExtendActionFunc设置到InputMethod_TextEditorProxy中。

起始版本: 12

参数:

名称描述
proxy指向即将被设置的InputMethod_TextEditorProxy实例的指针。
handleExtendActionFunc表示被设置到proxy的函数OH_TextEditorProxy_HandleExtendActionFunc

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_TextEditorProxy_SetHandleSetSelectionFunc()

InputMethod_ErrorCode OH_TextEditorProxy_SetHandleSetSelectionFunc (InputMethod_TextEditorProxy * proxy, OH_TextEditorProxy_HandleSetSelectionFunc handleSetSelectionFunc )

描述

将函数OH_TextEditorProxy_HandleSetSelectionFunc设置到InputMethod_TextEditorProxy中。

起始版本: 12

参数:

名称描述
proxy指向即将被设置的InputMethod_TextEditorProxy实例的指针。
handleSetSelectionFunc表示被设置到proxy的函数OH_TextEditorProxy_HandleSetSelectionFunc

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_TextEditorProxy_SetInsertTextFunc()

InputMethod_ErrorCode OH_TextEditorProxy_SetInsertTextFunc (InputMethod_TextEditorProxy * proxy, OH_TextEditorProxy_InsertTextFunc insertTextFunc )

描述

将函数OH_TextEditorProxy_InsertTextFunc设置到InputMethod_TextEditorProxy中。

起始版本: 12

参数:

名称描述
proxy指向即将被设置的InputMethod_TextEditorProxy实例的指针。
insertTextFunc表示被设置到proxy的函数OH_TextEditorProxy_InsertTextFunc

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_TextEditorProxy_SetMoveCursorFunc()

InputMethod_ErrorCode OH_TextEditorProxy_SetMoveCursorFunc (InputMethod_TextEditorProxy * proxy, OH_TextEditorProxy_MoveCursorFunc moveCursorFunc )

描述

将函数OH_TextEditorProxy_SetMoveCursorFunc设置到InputMethod_TextEditorProxy中。

起始版本: 12

参数:

名称描述
proxy指向即将被设置的InputMethod_TextEditorProxy实例的指针。
moveCursorFunc表示被设置到proxy的函数OH_TextEditorProxy_MoveCursorFunc

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_TextEditorProxy_SetReceivePrivateCommandFunc()

InputMethod_ErrorCode OH_TextEditorProxy_SetReceivePrivateCommandFunc (InputMethod_TextEditorProxy * proxy, OH_TextEditorProxy_ReceivePrivateCommandFunc receivePrivateCommandFunc )

描述

将函数OH_TextEditorProxy_ReceivePrivateCommandFunc设置到InputMethod_TextEditorProxy中。

起始版本: 12

参数:

名称描述
proxy指向即将被设置的InputMethod_TextEditorProxy实例的指针。
receivePrivateCommandFunc表示被设置到proxy的函数OH_TextEditorProxy_ReceivePrivateCommandFunc

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_TextEditorProxy_SetSendEnterKeyFunc()

InputMethod_ErrorCode OH_TextEditorProxy_SetSendEnterKeyFunc (InputMethod_TextEditorProxy * proxy, OH_TextEditorProxy_SendEnterKeyFunc sendEnterKeyFunc )

描述

将函数OH_TextEditorProxy_SetSendEnterKeyFunc设置到InputMethod_TextEditorProxy中。

起始版本: 12

参数:

名称描述
proxy指向即将被设置的InputMethod_TextEditorProxy实例的指针。
sendEnterKeyFunc表示被设置到proxy的函数OH_TextEditorProxy_SendEnterKeyFunc

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_TextEditorProxy_SetSendKeyboardStatusFunc()

InputMethod_ErrorCode OH_TextEditorProxy_SetSendKeyboardStatusFunc (InputMethod_TextEditorProxy * proxy, OH_TextEditorProxy_SendKeyboardStatusFunc sendKeyboardStatusFunc )

描述

将函数OH_TextEditorProxy_SendKeyboardStatusFunc设置到InputMethod_TextEditorProxy中。

起始版本: 12

参数:

名称描述
proxy指向即将被设置的InputMethod_TextEditorProxy实例的指针。
sendKeyboardStatusFunc表示被设置到proxy的函数OH_TextEditorProxy_SendKeyboardStatusFunc

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_TextEditorProxy_SetSetPreviewTextFunc()

InputMethod_ErrorCode OH_TextEditorProxy_SetSetPreviewTextFunc (InputMethod_TextEditorProxy * proxy, OH_TextEditorProxy_SetPreviewTextFunc setPreviewTextFunc )

描述

将函数OH_TextEditorProxy_SetPreviewTextFunc设置到InputMethod_TextEditorProxy中。

起始版本: 12

参数:

名称描述
proxy指向即将被设置的InputMethod_TextEditorProxy实例的指针。
setPreviewTextFunc表示被设置到proxy的函数OH_TextEditorProxy_SetPreviewTextFunc

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_TextConfig_SetPlaceholder()

InputMethod_ErrorCode OH_TextConfig_SetPlaceholder (InputMethod_TextConfig * config, const char16_t *placeholder,
    size_t length )

描述

设置InputMethod_TextConfig实例的占位符文本信息。

起始版本: 20

参数:

名称描述
config指向即将被设置值的InputMethod_TextConfig实例的指针。
placeholder指向UTF-16编码的双字节指针;若传空指针,则会将占位文本信息设置为空字符串。
lengthplaceholder指针指向内存所包含的元素个数,包含最后的字符串结尾符,计数单位为双字节。
1. 如果长度为0,占位文本信息会被设置为空字符串。
2. UTF-16编码的最大长度为255个字符(如果最后一位是字符串结尾符,不包含在计数中),超过255个字符数将会被截断。

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_TextConfig_SetAbilityName()

InputMethod_ErrorCode OH_TextConfig_SetAbilityName (InputMethod_TextConfig * config, const char16_t *abilityName, size_t length )

描述

设置InputMethod_TextConfig实例的ability名称。

起始版本: 20

参数:

名称描述
config指向即将被设置值的InputMethod_TextConfig实例的指针。
abilityName指向UTF-16编码的双字节指针;若传空指针,则会将ability名称设置为空字符串。
lengthabilityName指针指向内存所包含的元素个数,包含最后的字符串结尾符,计数单位为双字节。
1. 如果长度为0,ability名称会被设置为空字符串。
2. UTF-16编码的最大长度为127个字符(如果最后一位是字符串结尾符,不包含在计数中),超过127个字符数将会被截断。

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_TextConfig_GetPlaceholder()

InputMethod_ErrorCode OH_TextConfig_GetPlaceholder (InputMethod_TextConfig * config, char16_t *placeholder, size_t *length )

描述

获取InputMethod_TextConfig实例占位文本信息。

起始版本: 20

参数:

名称描述
config指向即将被获取值的InputMethod_TextConfig实例的指针。
placeholder用于存放占位文本信息,该指针内存由调用者维护。
length占位文本信息长度,计数单位为双字节,长度包含字符串结尾符。
1. 作为入参,代表placeholder指向的内存可用长度。作为出参,代表实际的占位文本长度。
2. 如果placeholder为空指针,且length指向有效内存,则length会被填充实际的占位文本长度。接口会返错。
3. 如果placeholder和length都指向有效内存,但length传入的长度小于实际的占位文本长度,则length会被填充实际的占位文本长度。接口会返错。

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_PARAMCHECK - 参数检查失败。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

OH_TextConfig_GetAbilityName()

InputMethod_ErrorCode OH_TextConfig_GetAbilityName (InputMethod_TextConfig * config, char16_t *abilityName, size_t *length )

描述

获取InputMethod_TextConfig实例ability名称。

起始版本: 20

参数:

名称描述
config指向即将被获取值的InputMethod_TextConfig实例的指针。
abilityName用于存放ability名称信息,该指针内存由调用者维护。
lengthability名称长度,计数单位为双字节,长度包含字符串结尾符。
1. 作为入参,代表abilityName指向的内存可用长度。作为出参,代表实际的ability名称长度。
2. 如果abilityName为空指针,且length指向有效内存,则length会被填充实际的ability名称长度。接口会返错。
3. 如果abilityName和length都指向有效内存,但length传入的长度小于实际的ability名称长度,则length会被填充实际的占位文本长度。接口会返错。

返回:

返回一个特定的错误码。

IME_ERR_OK - 表示成功。

IME_ERR_PARAMCHECK - 参数检查失败。

IME_ERR_NULL_POINTER - 非预期的空指针。

具体错误码可以参考 InputMethod_ErrorCode

你可能感兴趣的鸿蒙文章

harmony 鸿蒙IME Kit(输入法开发服务)

harmony 鸿蒙输入法框架错误码

harmony 鸿蒙inputmethod_attach_options_capi.h

harmony 鸿蒙inputmethod_controller_capi.h

harmony 鸿蒙inputmethod_cursor_info_capi.h

harmony 鸿蒙inputmethod_inputmethod_proxy_capi.h

harmony 鸿蒙inputmethod_private_command_capi.h

harmony 鸿蒙inputmethod_text_avoid_info_capi.h

harmony 鸿蒙inputmethod_text_config_capi.h

harmony 鸿蒙inputmethod_text_editor_proxy_capi.h

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/pwf5X1