目录

InputMethod_TextEditorProxy

typedef struct InputMethod_TextEditorProxy InputMethod_TextEditorProxy

概述

输入法文本编辑器代理类。用于处理输入法应用与文本编辑器之间的交互,提供接收输入法请求和通知的方法,适用于需要实现输入法与编辑器双向通信的场景。该结构体为不透明类型(opaque type),调用者不可直接访问其内部成员,仅可通过本模块提供的函数接口进行操作。

起始版本: 12

相关模块: InputMethod

所在头文件: inputmethod_text_editor_proxy_capi.h

结构体用途

InputMethod_TextEditorProxy是文本编辑器端与输入法应用交互的代理对象,采用回调机制实现输入法应用向编辑器发送请求和通知的双向通信。当输入法应用向编辑器发送请求(如插入文本、删除文本、移动光标等)或通知(如键盘状态变化、回车键事件等)时,通过此代理对象中注册的回调函数进行处理。开发者需实现各回调函数并通过Set*Func接口将其注册到TextEditorProxy中,再通过Attach完成注册。

生命周期管理

回调机制说明

TextEditorProxy采用回调函数机制实现输入法应用与编辑器之间的双向通信:

使用注意事项

相关函数:

函数 描述
OH_TextEditorProxy_Create 创建一个新的InputMethod_TextEditorProxy实例。
OH_TextEditorProxy_Destroy 销毁一个InputMethod_TextEditorProxy实例。
函数 描述
OH_TextEditorProxy_SetGetTextConfigFunc 设置GetTextConfigFunc回调。
OH_TextEditorProxy_SetInsertTextFunc 设置InsertTextFunc回调。
OH_TextEditorProxy_SetDeleteForwardFunc 设置DeleteForwardFunc回调。
OH_TextEditorProxy_SetDeleteBackwardFunc 设置DeleteBackwardFunc回调。
OH_TextEditorProxy_SetSendKeyboardStatusFunc 设置SendKeyboardStatusFunc回调。
OH_TextEditorProxy_SetSendEnterKeyFunc 设置SendEnterKeyFunc回调。
OH_TextEditorProxy_SetMoveCursorFunc 设置MoveCursorFunc回调。
OH_TextEditorProxy_SetHandleSetSelectionFunc 设置HandleSetSelectionFunc回调。
OH_TextEditorProxy_SetHandleExtendActionFunc 设置HandleExtendActionFunc回调。
OH_TextEditorProxy_SetGetLeftTextOfCursorFunc 设置GetLeftTextOfCursorFunc回调。
OH_TextEditorProxy_SetGetRightTextOfCursorFunc 设置GetRightTextOfCursorFunc回调。
OH_TextEditorProxy_SetGetTextIndexAtCursorFunc 设置GetTextIndexAtCursorFunc回调。
OH_TextEditorProxy_SetReceivePrivateCommandFunc 设置ReceivePrivateCommandFunc回调。
OH_TextEditorProxy_SetSetPreviewTextFunc 设置SetPreviewTextFunc回调。
OH_TextEditorProxy_SetFinishTextPreviewFunc 设置FinishTextPreviewFunc回调。
函数 描述
OH_TextEditorProxy_GetGetTextConfigFunc 获取已注册的GetTextConfigFunc回调。
OH_TextEditorProxy_GetInsertTextFunc 获取已注册的InsertTextFunc回调。
OH_TextEditorProxy_GetDeleteForwardFunc 获取已注册的DeleteForwardFunc回调。
OH_TextEditorProxy_GetDeleteBackwardFunc 获取已注册的DeleteBackwardFunc回调。
OH_TextEditorProxy_GetSendKeyboardStatusFunc 获取已注册的SendKeyboardStatusFunc回调。
OH_TextEditorProxy_GetSendEnterKeyFunc 获取已注册的SendEnterKeyFunc回调。
OH_TextEditorProxy_GetMoveCursorFunc 获取已注册的MoveCursorFunc回调。
OH_TextEditorProxy_GetHandleSetSelectionFunc 获取已注册的HandleSetSelectionFunc回调。
OH_TextEditorProxy_GetHandleExtendActionFunc 获取已注册的HandleExtendActionFunc回调。
OH_TextEditorProxy_GetGetLeftTextOfCursorFunc 获取已注册的GetLeftTextOfCursorFunc回调。
OH_TextEditorProxy_GetGetRightTextOfCursorFunc 获取已注册的GetRightTextOfCursorFunc回调。
OH_TextEditorProxy_GetGetTextIndexAtCursorFunc 获取已注册的GetTextIndexAtCursorFunc回调。
OH_TextEditorProxy_GetReceivePrivateCommandFunc 获取已注册的ReceivePrivateCommandFunc回调。
OH_TextEditorProxy_GetSetPreviewTextFunc 获取已注册的SetPreviewTextFunc回调。
OH_TextEditorProxy_GetFinishTextPreviewFunc 获取已注册的FinishTextPreviewFunc回调。

线程配置函数:

函数 描述
OH_TextEditorProxy_SetCallbackInMainThread 配置回调函数的执行线程策略。

关联关系: