• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# native_interface_xcomponent.h
2
3## 概述
4
5声明用于访问Native XComponent的API。
6
7**引用文件:** <ace/xcomponent/native_interface_xcomponent.h>
8
9**库:** libace_ndk.z.so
10
11**系统能力:** SystemCapability.ArkUI.ArkUI.Full
12
13**起始版本:** 8
14
15**相关模块:** [OH_NativeXComponent Native XComponent](capi-oh-nativexcomponent-native-xcomponent.md)
16
17## 汇总
18
19### 结构体
20
21| 名称 | typedef关键字 | 描述 |
22| -- | -- | -- |
23| [OH_NativeXComponent_HistoricalPoint](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent-historicalpoint.md) | OH_NativeXComponent_HistoricalPoint | 历史接触点。 |
24| [OH_NativeXComponent_TouchPoint](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent-touchpoint.md) | OH_NativeXComponent_TouchPoint | 触摸事件中触摸点的信息。 |
25| [OH_NativeXComponent_TouchEvent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent-touchevent.md) | OH_NativeXComponent_TouchEvent | 触摸事件。 |
26| [OH_NativeXComponent_MouseEvent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent-mouseevent.md) | OH_NativeXComponent_MouseEvent | 鼠标事件。 |
27| [OH_NativeXComponent_Callback](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent-callback.md) | OH_NativeXComponent_Callback | 注册Surface生命周期和触摸事件回调。 |
28| [OH_NativeXComponent_MouseEvent_Callback](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent-mouseevent-callback.md) | OH_NativeXComponent_MouseEvent_Callback | 注册鼠标事件的回调。 |
29| [OH_NativeXComponent_ExpectedRateRange](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent-expectedraterange.md) | OH_NativeXComponent_ExpectedRateRange | 定义期望帧率范围。 |
30| [OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md) | OH_NativeXComponent | 提供封装的OH_NativeXComponent实例。 |
31| [OH_NativeXComponent_KeyEvent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent-keyevent.md) | OH_NativeXComponent_KeyEvent | 提供封装的OH_NativeXComponent_KeyEvent实例。 |
32| [OH_NativeXComponent_ExtraMouseEventInfo](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent-extramouseeventinfo.md) | OH_NativeXComponent_ExtraMouseEventInfo | 提供封装的扩展的鼠标事件信息实例。 |
33| [OH_ArkUI_SurfaceHolder](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfaceholder.md) | OH_ArkUI_SurfaceHolder | 提供封装的OH_ArkUI_SurfaceHolder实例。 |
34| [OH_ArkUI_SurfaceCallback](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfacecallback.md) | OH_ArkUI_SurfaceCallback | 定义Surface生命周期回调函数。 |
35| [OHNativeWindow](capi-oh-nativexcomponent-native-xcomponent-nativewindow.md) | OHNativeWindow | 提供封装的NativeWindow实例。 |
36
37### 枚举
38
39| 名称 | typedef关键字 | 描述 |
40| -- | -- | -- |
41| [anonymous](#anonymous) | - | 枚举API访问状态。 |
42| [ArkUI_XComponent_ImageAnalyzerState](#arkui_xcomponent_imageanalyzerstate) | ArkUI_XComponent_ImageAnalyzerState | XComponent图像AI分析状态码. |
43| [OH_NativeXComponent_TouchEventType](#oh_nativexcomponent_toucheventtype) | OH_NativeXComponent_TouchEventType | 触摸事件类型。 |
44| [OH_NativeXComponent_TouchPointToolType](#oh_nativexcomponent_touchpointtooltype) | OH_NativeXComponent_TouchPointToolType | 触摸点工具类型。 |
45| [OH_NativeXComponent_EventSourceType](#oh_nativexcomponent_eventsourcetype) | OH_NativeXComponent_EventSourceType | 触摸事件源类型。 |
46| [OH_NativeXComponent_MouseEventAction](#oh_nativexcomponent_mouseeventaction) | OH_NativeXComponent_MouseEventAction | 鼠标事件动作。 |
47| [OH_NativeXComponent_MouseEventButton](#oh_nativexcomponent_mouseeventbutton) | OH_NativeXComponent_MouseEventButton | 鼠标事件按键。 |
48| [OH_NativeXComponent_TouchEvent_SourceTool](#oh_nativexcomponent_touchevent_sourcetool) | OH_NativeXComponent_TouchEvent_SourceTool | 表示触摸事件的源工具类型 |
49
50### 函数
51
52| 名称 | 描述 |
53| -- | -- |
54| [int32_t OH_NativeXComponent_GetXComponentId(OH_NativeXComponent* component, char* id, uint64_t* size)](#oh_nativexcomponent_getxcomponentid) | 获取ArkUI XComponent的id。 |
55| [int32_t OH_NativeXComponent_GetXComponentSize(OH_NativeXComponent* component, const void* window, uint64_t* width, uint64_t* height)](#oh_nativexcomponent_getxcomponentsize) | 获取ArkUI XComponent持有的Surface的大小。 |
56| [int32_t OH_NativeXComponent_GetXComponentOffset(OH_NativeXComponent* component, const void* window, double* x, double* y)](#oh_nativexcomponent_getxcomponentoffset) | 获取ArkUI XComponent持有的Surface相对其父组件左顶点的偏移量。 |
57| [int32_t OH_NativeXComponent_GetTouchEvent(OH_NativeXComponent* component, const void* window, OH_NativeXComponent_TouchEvent* touchEvent)](#oh_nativexcomponent_gettouchevent) | 获取ArkUI XComponent调度的触摸事件。 |
58| [int32_t OH_NativeXComponent_GetTouchPointToolType(OH_NativeXComponent* component, uint32_t pointIndex, OH_NativeXComponent_TouchPointToolType* toolType)](#oh_nativexcomponent_gettouchpointtooltype) | 获取ArkUI XComponent触摸点工具类型。 |
59| [int32_t OH_NativeXComponent_GetTouchPointTiltX(OH_NativeXComponent* component, uint32_t pointIndex, float* tiltX)](#oh_nativexcomponent_gettouchpointtiltx) | 获取ArkUI XComponent触摸点倾斜与X轴角度。 |
60| [int32_t OH_NativeXComponent_GetTouchPointTiltY(OH_NativeXComponent* component, uint32_t pointIndex, float* tiltY)](#oh_nativexcomponent_gettouchpointtilty) | 获取ArkUI XComponent触摸点倾斜与Y轴角度。 |
61| [int32_t OH_NativeXComponent_GetTouchPointWindowX(OH_NativeXComponent* component, uint32_t pointIndex, float* windowX)](#oh_nativexcomponent_gettouchpointwindowx) | 获取ArkUI XComponent触摸点相对于应用窗口左上角的X坐标。 |
62| [int32_t OH_NativeXComponent_GetTouchPointWindowY(OH_NativeXComponent* component, uint32_t pointIndex, float* windowY)](#oh_nativexcomponent_gettouchpointwindowy) | 获取ArkUI XComponent触摸点相对于应用窗口左上角的Y坐标。 |
63| [int32_t OH_NativeXComponent_GetTouchPointDisplayX(OH_NativeXComponent* component, uint32_t pointIndex, float* displayX)](#oh_nativexcomponent_gettouchpointdisplayx) | 获取ArkUI XComponent触摸点相对于应用所在屏幕左上角的X坐标。 |
64| [int32_t OH_NativeXComponent_GetTouchPointDisplayY(OH_NativeXComponent* component, uint32_t pointIndex, float* displayY)](#oh_nativexcomponent_gettouchpointdisplayy) | 获取ArkUI XComponent触摸点相对于应用所在屏幕左上角的Y坐标。 |
65| [int32_t OH_NativeXComponent_GetHistoricalPoints(OH_NativeXComponent* component, const void* window, int32_t* size, OH_NativeXComponent_HistoricalPoint** historicalPoints)](#oh_nativexcomponent_gethistoricalpoints) | 获取当前XComponent触摸事件的历史点信息。由于部分输入设备上报触点的频率非常高(最高可达每1 ms上报一次),而对输入事件的响应通常是为了使UI界面发生变化以响应用户操作,如果将触摸事件按照上报触点的频率如此高频率上报给应用,大多会造成冗余,因此触摸事件在一帧内只会上报一次给应用。在当前帧内上报的触点均作为历史点保存,如果应用需要直接处理这些数据,可调用该接口获取历史点信息。 |
66| [int32_t OH_NativeXComponent_GetMouseEvent(OH_NativeXComponent* component, const void* window, OH_NativeXComponent_MouseEvent* mouseEvent)](#oh_nativexcomponent_getmouseevent) | 获取ArkUI XComponent调度的鼠标事件。 |
67| [int32_t OH_NativeXComponent_RegisterCallback(OH_NativeXComponent* component, OH_NativeXComponent_Callback* callback)](#oh_nativexcomponent_registercallback) | 为此[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例注册回调。 |
68| [int32_t OH_NativeXComponent_RegisterMouseEventCallback(OH_NativeXComponent* component, OH_NativeXComponent_MouseEvent_Callback* callback)](#oh_nativexcomponent_registermouseeventcallback) | 为此[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例注册鼠标事件回调。 |
69| [int32_t OH_NativeXComponent_GetExtraMouseEventInfo(OH_NativeXComponent* component, OH_NativeXComponent_ExtraMouseEventInfo** extraMouseEventInfo)](#oh_nativexcomponent_getextramouseeventinfo) | 从此[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例中获取扩展的鼠标事件信息。 |
70| [int32_t OH_NativeXComponent_GetMouseEventModifierKeyStates (OH_NativeXComponent_ExtraMouseEventInfo* extraMouseEventInfo, uint64_t* keys)](#oh_nativexcomponent_getmouseeventmodifierkeystates) | 从[OH_NativeXComponent_ExtraMouseEventInfo](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent-extramouseeventinfo.md)实例中获取功能键按压状态信息。 |
71| [int32_t OH_NativeXComponent_RegisterFocusEventCallback(OH_NativeXComponent* component, void (\*callback)(OH_NativeXComponent* component, void* window))](#oh_nativexcomponent_registerfocuseventcallback) | 为此[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例注册获焦事件回调。 |
72| [int32_t OH_NativeXComponent_RegisterKeyEventCallback(OH_NativeXComponent* component, void (\*callback)(OH_NativeXComponent* component, void* window))](#oh_nativexcomponent_registerkeyeventcallback) | 为此[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例注册按键事件回调。 |
73| [int32_t OH_NativeXComponent_RegisterBlurEventCallback(OH_NativeXComponent* component, void (\*callback)(OH_NativeXComponent* component, void* window))](#oh_nativexcomponent_registerblureventcallback) | 为此[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例注册失焦事件回调。 |
74| [int32_t OH_NativeXComponent_GetKeyEvent(OH_NativeXComponent* component, OH_NativeXComponent_KeyEvent** keyEvent)](#oh_nativexcomponent_getkeyevent) | 获取ArkUI XComponent调度的按键事件。 |
75| [int32_t OH_NativeXComponent_GetKeyEventAction(OH_NativeXComponent_KeyEvent* keyEvent, OH_NativeXComponent_KeyAction* action)](#oh_nativexcomponent_getkeyeventaction) | 获取传入按键事件的动作。 |
76| [int32_t OH_NativeXComponent_GetKeyEventCode(OH_NativeXComponent_KeyEvent* keyEvent, OH_NativeXComponent_KeyCode* code)](#oh_nativexcomponent_getkeyeventcode) | 获取传入按键事件的按键码。 |
77| [int32_t OH_NativeXComponent_GetKeyEventSourceType(OH_NativeXComponent_KeyEvent* keyEvent, OH_NativeXComponent_EventSourceType* sourceType)](#oh_nativexcomponent_getkeyeventsourcetype) | 获取传入按键事件的事件源类型。 |
78| [int32_t OH_NativeXComponent_GetKeyEventDeviceId(OH_NativeXComponent_KeyEvent* keyEvent, int64_t* deviceId)](#oh_nativexcomponent_getkeyeventdeviceid) | 获取传入按键事件的设备id。 |
79| [int32_t OH_NativeXComponent_GetKeyEventTimestamp(OH_NativeXComponent_KeyEvent* keyEvent, int64_t* timestamp)](#oh_nativexcomponent_getkeyeventtimestamp) | 获取传入按键事件的时间戳。 |
80| [int32_t OH_NativeXComponent_GetKeyEventModifierKeyStates(OH_NativeXComponent_KeyEvent* keyEvent, uint64_t* keys)](#oh_nativexcomponent_getkeyeventmodifierkeystates) | 从按键事件中获取功能键按压状态信息。 |
81| [int32_t OH_NativeXComponent_GetKeyEventNumLockState(OH_NativeXComponent_KeyEvent* keyEvent, bool* isNumLockOn)](#oh_nativexcomponent_getkeyeventnumlockstate) | 从按键事件中获取NumLock(小键盘锁定)键的状态信息。 |
82| [int32_t OH_NativeXComponent_GetKeyEventCapsLockState(OH_NativeXComponent_KeyEvent* keyEvent, bool* isCapsLockOn)](#oh_nativexcomponent_getkeyeventcapslockstate) | 从按键事件中获取CapsLock(大写锁定)键的状态信息。 |
83| [int32_t OH_NativeXComponent_GetKeyEventScrollLockState(OH_NativeXComponent_KeyEvent* keyEvent, bool* isScrollLockOn)](#oh_nativexcomponent_getkeyeventscrolllockstate) | 从按键事件中获取ScrollLock(滚动锁定)键的状态信息。 |
84| [int32_t OH_NativeXComponent_SetExpectedFrameRateRange(OH_NativeXComponent* component, OH_NativeXComponent_ExpectedRateRange* range)](#oh_nativexcomponent_setexpectedframeraterange) | 设置期望帧率范围。 |
85| [int32_t OH_NativeXComponent_RegisterOnFrameCallback(OH_NativeXComponent* component, void (\*callback)(OH_NativeXComponent* component, uint64_t timestamp, uint64_t targetTimestamp))](#oh_nativexcomponent_registeronframecallback) | 为此[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例注册显示更新回调,并使能每帧回调此函数。 |
86| [int32_t OH_NativeXComponent_UnregisterOnFrameCallback(OH_NativeXComponent* component)](#oh_nativexcomponent_unregisteronframecallback) | 为此[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例取消注册回调函数,并关闭每帧回调此函数。 |
87| [int32_t OH_NativeXComponent_AttachNativeRootNode(OH_NativeXComponent* component, ArkUI_NodeHandle root)](#oh_nativexcomponent_attachnativerootnode) | 将通过ArkUI的Native接口创建出来的UI组件挂载到当前XComponent上。 |
88| [int32_t OH_NativeXComponent_DetachNativeRootNode(OH_NativeXComponent* component, ArkUI_NodeHandle root)](#oh_nativexcomponent_detachnativerootnode) | 将ArkUI的Native组件从当前XComponent上卸载。 |
89| [int32_t OH_NativeXComponent_RegisterUIInputEventCallback(OH_NativeXComponent *component, void (\*callback)(OH_NativeXComponent *component, ArkUI_UIInputEvent *event,ArkUI_UIInputEvent_Type type),ArkUI_UIInputEvent_Type type)](#oh_nativexcomponent_registeruiinputeventcallback) | 为此[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例注册UI输入事件回调,并使能收到UI输入事件时回调此函数。当前仅支持轴事件。 |
90| [int32_t OH_NativeXComponent_RegisterOnTouchInterceptCallback(OH_NativeXComponent* component, HitTestMode (\*callback)(OH_NativeXComponent* component, ArkUI_UIInputEvent* event))](#oh_nativexcomponent_registerontouchinterceptcallback) | 为此[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例注册自定义事件拦截回调,并使能在做触摸测试时回调此函数。通过该回调获取到的事件对象不支持UIInput相关信息操作接口,建议切换为通过注册native node上的[NODE_ON_TOUCH_INTERCEPT](capi-native-node-h.md#arkui_nodeeventtype)通用事件来支持。 |
91| [int32_t OH_NativeXComponent_SetNeedSoftKeyboard(OH_NativeXComponent* component, bool needSoftKeyboard)](#oh_nativexcomponent_setneedsoftkeyboard) | 为此[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例设置是否需要软键盘。 |
92| [int32_t OH_NativeXComponent_RegisterSurfaceShowCallback(OH_NativeXComponent* component, void (\*callback)(OH_NativeXComponent* component, void* window))](#oh_nativexcomponent_registersurfaceshowcallback) | 为此[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例注册Surface显示回调,该回调在应用窗口已经从后台回到前台时触发。 |
93| [int32_t OH_NativeXComponent_RegisterSurfaceHideCallback(OH_NativeXComponent* component, void (\*callback)(OH_NativeXComponent* component, void* window))](#oh_nativexcomponent_registersurfacehidecallback) | 为此[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例注册Surface隐藏回调,该回调在应用窗口已经从前台进入后台时触发。 |
94| [int32_t OH_NativeXComponent_GetTouchEventSourceType(OH_NativeXComponent* component, int32_t pointId, OH_NativeXComponent_EventSourceType* sourceType)](#oh_nativexcomponent_gettoucheventsourcetype) | 获取ArkUI XComponent触摸事件的输入设备类型。 |
95| [OH_NativeXComponent* OH_NativeXComponent_GetNativeXComponent(ArkUI_NodeHandle node)](#oh_nativexcomponent_getnativexcomponent) | 基于Native接口创建的组件实例获取[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)类型的指针。 |
96| [int32_t OH_NativeXComponent_GetNativeAccessibilityProvider(OH_NativeXComponent* component, ArkUI_AccessibilityProvider** handle)](#oh_nativexcomponent_getnativeaccessibilityprovider) | 获取ArkUI XComponent无障碍接入句柄指针。 |
97| [int32_t OH_NativeXComponent_RegisterKeyEventCallbackWithResult(OH_NativeXComponent* component, bool (\*callback)(OH_NativeXComponent* component, void* window))](#oh_nativexcomponent_registerkeyeventcallbackwithresult) | 为此[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例注册带有返回值的按键事件回调。通过此接口注册的按键事件回调都必须返回一个结果,即true或false。当返回值为true时,该事件将不会继续分发;当返回值为false时,该事件将按照事件处理流程继续分发。 |
98| [int32_t OH_ArkUI_XComponent_StartImageAnalyzer(ArkUI_NodeHandle node, void* userData, void (\*callback)(ArkUI_NodeHandle node, ArkUI_XComponent_ImageAnalyzerState statusCode, void* userData))](#oh_arkui_xcomponent_startimageanalyzer) | 为此XComponent组件实例开始图像AI分析,使用前需先使能图像AI分析能力。 |
99| [int32_t OH_ArkUI_XComponent_StopImageAnalyzer(ArkUI_NodeHandle node)](#oh_arkui_xcomponent_stopimageanalyzer) | 为此XComponent组件实例停止图像AI分析。 |
100| [OH_ArkUI_SurfaceHolder* OH_ArkUI_SurfaceHolder_Create(ArkUI_NodeHandle node)](#oh_arkui_surfaceholder_create) | 创建XComponent组件的[OH_ArkUI_SurfaceHolder](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfaceholder.md)对象。 |
101| [void OH_ArkUI_SurfaceHolder_Dispose(OH_ArkUI_SurfaceHolder* surfaceHolder)](#oh_arkui_surfaceholder_dispose) | 销毁[OH_ArkUI_SurfaceHolder](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfaceholder.md)对象。 |
102| [int32_t OH_ArkUI_SurfaceHolder_SetUserData(OH_ArkUI_SurfaceHolder* surfaceHolder, void* userData)](#oh_arkui_surfaceholder_setuserdata) | 向[OH_ArkUI_SurfaceHolder](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfaceholder.md)实例存储自定义数据。 |
103| [void* OH_ArkUI_SurfaceHolder_GetUserData(OH_ArkUI_SurfaceHolder* surfaceHolder)](#oh_arkui_surfaceholder_getuserdata) | 获取[OH_ArkUI_SurfaceHolder](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfaceholder.md)实例存储的自定义数据。 |
104| [OH_ArkUI_SurfaceCallback* OH_ArkUI_SurfaceCallback_Create()](#oh_arkui_surfacecallback_create) | 创建[OH_ArkUI_SurfaceCallback](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfacecallback.md)对象。 |
105| [void OH_ArkUI_SurfaceCallback_Dispose(OH_ArkUI_SurfaceCallback* callback)](#oh_arkui_surfacecallback_dispose) | 销毁[OH_ArkUI_SurfaceCallback](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfacecallback.md)对象。 |
106| [void OH_ArkUI_SurfaceCallback_SetSurfaceCreatedEvent(OH_ArkUI_SurfaceCallback* callback,void (\*onSurfaceCreated)(OH_ArkUI_SurfaceHolder* surfaceHolder))](#oh_arkui_surfacecallback_setsurfacecreatedevent) | 设置Surface生命周期回调中的创建回调事件。 |
107| [void OH_ArkUI_SurfaceCallback_SetSurfaceChangedEvent(OH_ArkUI_SurfaceCallback* callback,void (\*onSurfaceChanged)(OH_ArkUI_SurfaceHolder* surfaceHolder, uint64_t width, uint64_t height))](#oh_arkui_surfacecallback_setsurfacechangedevent) | 设置Surface生命周期回调中的大小改变回调事件。 |
108| [void OH_ArkUI_SurfaceCallback_SetSurfaceDestroyedEvent(OH_ArkUI_SurfaceCallback* callback,void (\*onSurfaceDestroyed)(OH_ArkUI_SurfaceHolder* surfaceHolder))](#oh_arkui_surfacecallback_setsurfacedestroyedevent) | 设置Surface生命周期回调中的销毁回调事件。 |
109| [int32_t OH_ArkUI_SurfaceHolder_AddSurfaceCallback(OH_ArkUI_SurfaceHolder* surfaceHolder,OH_ArkUI_SurfaceCallback* callback)](#oh_arkui_surfaceholder_addsurfacecallback) | 添加Surface生命周期回调到[OH_ArkUI_SurfaceHolder](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfaceholder.md)实例。 |
110| [int32_t OH_ArkUI_SurfaceHolder_RemoveSurfaceCallback(OH_ArkUI_SurfaceHolder* surfaceHolder,OH_ArkUI_SurfaceCallback* callback)](#oh_arkui_surfaceholder_removesurfacecallback) | 删除[OH_ArkUI_SurfaceHolder](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfaceholder.md)实例的先前添加的Surface生命周期回调。 |
111| [OHNativeWindow* OH_ArkUI_XComponent_GetNativeWindow(OH_ArkUI_SurfaceHolder* surfaceHolder)](#oh_arkui_xcomponent_getnativewindow) | 获取[OH_ArkUI_SurfaceHolder](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfaceholder.md)实例关联的NativeWindow。 |
112| [int32_t OH_ArkUI_XComponent_SetAutoInitialize(ArkUI_NodeHandle node, bool autoInitialize)](#oh_arkui_xcomponent_setautoinitialize) | 设置XComponent组件是否需要自动初始化Surface的标志位。 |
113| [int32_t OH_ArkUI_XComponent_Initialize(ArkUI_NodeHandle node)](#oh_arkui_xcomponent_initialize) | 初始化XComponent组件持有的Surface。 |
114| [int32_t OH_ArkUI_XComponent_Finalize(ArkUI_NodeHandle node)](#oh_arkui_xcomponent_finalize) | 销毁XComponent组件持有的Surface。 |
115| [int32_t OH_ArkUI_XComponent_IsInitialized(ArkUI_NodeHandle node, bool* isInitialized)](#oh_arkui_xcomponent_isinitialized) | 获取XComponent组件是否已经初始化的标志位。 |
116| [int32_t OH_ArkUI_XComponent_SetExpectedFrameRateRange(ArkUI_NodeHandle node, OH_NativeXComponent_ExpectedRateRange range)](#oh_arkui_xcomponent_setexpectedframeraterange) | 为此XComponent组件实例设置期望帧率。 |
117| [int32_t OH_ArkUI_XComponent_RegisterOnFrameCallback(ArkUI_NodeHandle node,void (\*callback)(ArkUI_NodeHandle node, uint64_t timestamp, uint64_t targetTimestamp))](#oh_arkui_xcomponent_registeronframecallback) | 为此XComponent组件实例注册帧回调函数。 |
118| [int32_t OH_ArkUI_XComponent_UnregisterOnFrameCallback(ArkUI_NodeHandle node)](#oh_arkui_xcomponent_unregisteronframecallback) | 为此XComponent组件实例取消注册帧回调函数。 |
119| [int32_t OH_ArkUI_XComponent_SetNeedSoftKeyboard(ArkUI_NodeHandle node, bool needSoftKeyboard)](#oh_arkui_xcomponent_setneedsoftkeyboard) | 为此XComponent组件实例设置是否需要软键盘。 |
120| [ArkUI_AccessibilityProvider* OH_ArkUI_AccessibilityProvider_Create(ArkUI_NodeHandle node)](#oh_arkui_accessibilityprovider_create) | 基于此XComponent实例创建[ArkUI_AccessibilityProvider](capi-arkui-accessibility-arkui-accessibilityprovider.md)实例。 |
121| [void OH_ArkUI_AccessibilityProvider_Dispose(ArkUI_AccessibilityProvider* provider)](#oh_arkui_accessibilityprovider_dispose) | 销毁由Native接口[OH_ArkUI_AccessibilityProvider_Create](capi-native-interface-xcomponent-h.md#oh_arkui_accessibilityprovider_create)创建的[ArkUI_AccessibilityProvider](capi-arkui-accessibility-arkui-accessibilityprovider.md)实例。 |
122| [void OH_ArkUI_SurfaceCallback_SetSurfaceShowEvent(OH_ArkUI_SurfaceCallback* callback, void (\*onSurfaceShow)(OH_ArkUI_SurfaceHolder* surfaceHolder))](#oh_arkui_surfacecallback_setsurfaceshowevent) | 为此[OH_ArkUI_SurfaceCallback](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfacecallback.md)实例设置Surface显示回调,该回调在应用窗口已经从后台回到前台时触发。 |
123| [void OH_ArkUI_SurfaceCallback_SetSurfaceHideEvent(OH_ArkUI_SurfaceCallback* callback, void (\*onSurfaceHide)(OH_ArkUI_SurfaceHolder* surfaceHolder))](#oh_arkui_surfacecallback_setsurfacehideevent) | 为此[OH_ArkUI_SurfaceCallback](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfacecallback.md)实例设置Surface隐藏回调,该回调在应用窗口已经从前台进入后台时触发。 |
124
125### 变量
126
127| 名称 | 描述 |
128| -- | -- |
129| const uint32_t OH_XCOMPONENT_ID_LEN_MAX = 128 | ArkUI XComponent的id最大长度。<br>**起始版本:** 8 |
130| const uint32_t OH_MAX_TOUCH_POINTS_NUMBER = 10 | 触摸事件中的可识别的触摸点个数最大值。<br>**起始版本:** 8 |
131
132## 枚举类型说明
133
134### anonymous
135
136```
137enum anonymous
138```
139
140**描述:**
141
142
143枚举API访问状态。
144
145**起始版本:** 8
146
147| 枚举项 | 描述 |
148| -- | -- |
149| OH_NATIVEXCOMPONENT_RESULT_SUCCESS = 0 | 成功结果。 |
150| OH_NATIVEXCOMPONENT_RESULT_FAILED = -1 | 失败结果。 |
151| OH_NATIVEXCOMPONENT_RESULT_BAD_PARAMETER = -2 | 无效参数。 |
152
153### ArkUI_XComponent_ImageAnalyzerState
154
155```
156enum ArkUI_XComponent_ImageAnalyzerState
157```
158
159**描述:**
160
161
162XComponent图像AI分析状态码.
163
164**起始版本:** 18
165
166| 枚举项 | 描述 |
167| -- | -- |
168| ARKUI_XCOMPONENT_AI_ANALYSIS_FINISHED = 0 | 图像AI分析完成。 |
169| ARKUI_XCOMPONENT_AI_ANALYSIS_DISABLED = 110000 | 图像AI分析已禁用。 |
170| ARKUI_XCOMPONENT_AI_ANALYSIS_UNSUPPORTED = 110001 | 设备不支持图像AI分析。 |
171| ARKUI_XCOMPONENT_AI_ANALYSIS_ONGOING = 110002 | 图像AI分析进行中。 |
172| ARKUI_XCOMPONENT_AI_ANALYSIS_STOPPED = 110003 | 图像AI分析停止。 |
173
174### OH_NativeXComponent_TouchEventType
175
176```
177enum OH_NativeXComponent_TouchEventType
178```
179
180**描述:**
181
182
183触摸事件类型。
184
185**起始版本:** 8
186
187| 枚举项 | 描述 |
188| -- | -- |
189| OH_NATIVEXCOMPONENT_DOWN = 0 | 手指按下时触发触摸事件。 |
190| OH_NATIVEXCOMPONENT_UP | 手指抬起时触发触摸事件。 |
191| OH_NATIVEXCOMPONENT_MOVE | 手指按下状态下在屏幕上移动时触发触摸事件。 |
192| OH_NATIVEXCOMPONENT_CANCEL | 触摸事件取消时触发事件。 |
193| OH_NATIVEXCOMPONENT_UNKNOWN | 无效的触摸类型。 |
194
195### OH_NativeXComponent_TouchPointToolType
196
197```
198enum OH_NativeXComponent_TouchPointToolType
199```
200
201**描述:**
202
203
204触摸点工具类型。
205
206**起始版本:** 9
207
208| 枚举项 | 描述 |
209| -- | -- |
210| OH_NATIVEXCOMPONENT_TOOL_TYPE_UNKNOWN = 0 | 未识别工具类型。 |
211| OH_NATIVEXCOMPONENT_TOOL_TYPE_FINGER | 表示用手指。 |
212| OH_NATIVEXCOMPONENT_TOOL_TYPE_PEN | 表示用触笔。 |
213| OH_NATIVEXCOMPONENT_TOOL_TYPE_RUBBER | 表示用橡皮擦。 |
214| OH_NATIVEXCOMPONENT_TOOL_TYPE_BRUSH | 表示用画笔。 |
215| OH_NATIVEXCOMPONENT_TOOL_TYPE_PENCIL | 表示用铅笔。 |
216| OH_NATIVEXCOMPONENT_TOOL_TYPE_AIRBRUSH | 表示用气笔。 |
217| OH_NATIVEXCOMPONENT_TOOL_TYPE_MOUSE | 表示用鼠标。 |
218| OH_NATIVEXCOMPONENT_TOOL_TYPE_LENS | 表示用晶状体。 |
219
220### OH_NativeXComponent_EventSourceType
221
222```
223enum OH_NativeXComponent_EventSourceType
224```
225
226**描述:**
227
228
229触摸事件源类型。
230
231**起始版本:** 9
232
233| 枚举项 | 描述 |
234| -- | -- |
235| OH_NATIVEXCOMPONENT_SOURCE_TYPE_UNKNOWN = 0 | 未知的输入源类型。 |
236| OH_NATIVEXCOMPONENT_SOURCE_TYPE_MOUSE | 表示输入源生成鼠标多点触摸事件。 |
237| OH_NATIVEXCOMPONENT_SOURCE_TYPE_TOUCHSCREEN | 表示输入源生成一个触摸屏多点触摸事件。 |
238| OH_NATIVEXCOMPONENT_SOURCE_TYPE_TOUCHPAD | 表示输入源生成一个触摸板多点触摸事件。 |
239| OH_NATIVEXCOMPONENT_SOURCE_TYPE_JOYSTICK | 表示输入源生成一个操纵杆多点触摸事件。 |
240| OH_NATIVEXCOMPONENT_SOURCE_TYPE_KEYBOARD | 表示输入源生成一个键盘事件。<br>**起始版本:** 10 |
241
242### OH_NativeXComponent_MouseEventAction
243
244```
245enum OH_NativeXComponent_MouseEventAction
246```
247
248**描述:**
249
250
251鼠标事件动作。
252
253**起始版本:** 9
254
255| 枚举项 | 描述                              |
256| -- |---------------------------------|
257| OH_NATIVEXCOMPONENT_MOUSE_NONE = 0 | 无效鼠标事件。                         |
258| OH_NATIVEXCOMPONENT_MOUSE_PRESS | 鼠标按键按下时触发鼠标事件。                  |
259| OH_NATIVEXCOMPONENT_MOUSE_RELEASE | 鼠标按键松开时触发鼠标事件。                  |
260| OH_NATIVEXCOMPONENT_MOUSE_MOVE | 鼠标在屏幕上移动时触发鼠标事件。                |
261| OH_NATIVEXCOMPONENT_MOUSE_CANCEL | 鼠标按键被取消时触发鼠标事件。<br>**起始版本:** 18 |
262
263### OH_NativeXComponent_MouseEventButton
264
265```
266enum OH_NativeXComponent_MouseEventButton
267```
268
269**描述:**
270
271
272鼠标事件按键。
273
274**起始版本:** 9
275
276| 枚举项 | 描述 |
277| -- | -- |
278| OH_NATIVEXCOMPONENT_NONE_BUTTON = 0 | 鼠标无按键操作时触发鼠标事件。 |
279| OH_NATIVEXCOMPONENT_LEFT_BUTTON = 0x01 | 按下鼠标左键时触发鼠标事件。 |
280| OH_NATIVEXCOMPONENT_RIGHT_BUTTON = 0x02 | 按下鼠标右键时触发鼠标事件。 |
281| OH_NATIVEXCOMPONENT_MIDDLE_BUTTON = 0x04 | 按下鼠标中键时触发鼠标事件。 |
282| OH_NATIVEXCOMPONENT_BACK_BUTTON = 0x08 | 按下鼠标左侧后退键时触发鼠标事件。 |
283| OH_NATIVEXCOMPONENT_FORWARD_BUTTON = 0x10 | 按下鼠标左侧前进键时触发鼠标事件。 |
284
285### OH_NativeXComponent_TouchEvent_SourceTool
286
287```
288enum OH_NativeXComponent_TouchEvent_SourceTool
289```
290
291**描述:**
292
293
294表示触摸事件的源工具类型
295
296**起始版本:** 10
297
298| 枚举项 | 描述 |
299| -- | -- |
300| OH_NATIVEXCOMPONENT_SOURCETOOL_UNKNOWN = 0 | 未知的触摸事件的源工具。 |
301| OH_NATIVEXCOMPONENT_SOURCETOOL_FINGER = 1 | 表示触摸事件的源工具是手指。 |
302| OH_NATIVEXCOMPONENT_SOURCETOOL_PEN = 2 | 表示触摸事件的源工具是钢笔。 |
303| OH_NATIVEXCOMPONENT_SOURCETOOL_RUBBER = 3 | 表示触摸事件的源工具是橡皮。 |
304| OH_NATIVEXCOMPONENT_SOURCETOOL_BRUSH = 4 | 表示触摸事件的源工具是笔刷。 |
305| OH_NATIVEXCOMPONENT_SOURCETOOL_PENCIL = 5 | 表示触摸事件的源工具是铅笔。 |
306| OH_NATIVEXCOMPONENT_SOURCETOOL_AIRBRUSH = 6 | 表示触摸事件的源工具是喷枪。 |
307| OH_NATIVEXCOMPONENT_SOURCETOOL_MOUSE = 7 | 表示触摸事件的源工具是鼠标。 |
308| OH_NATIVEXCOMPONENT_SOURCETOOL_LENS = 8 | 表示触摸事件的源工具是透镜。 |
309| OH_NATIVEXCOMPONENT_SOURCETOOL_TOUCHPAD = 9 | 表示触摸事件的源工具是触摸板。 |
310
311
312## 函数说明
313
314### OH_NativeXComponent_GetXComponentId()
315
316```
317int32_t OH_NativeXComponent_GetXComponentId(OH_NativeXComponent* component, char* id, uint64_t* size)
318```
319
320**描述:**
321
322
323获取ArkUI XComponent的id。
324
325**起始版本:** 8
326
327
328**参数:**
329
330| 参数项 | 描述 |
331| -- | -- |
332| [OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)* component | 表示指向[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例的指针。 |
333| char* id | 表示用于保存此[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例的ID的字符缓冲区。请注意,空终止符将附加到字符缓冲区,因此字符缓冲区的大小应至少比真实id长度大一个单位。建议字符缓冲区的大小为\[[OH_XCOMPONENT_ID_LEN_MAX](#变量) + 1]。 |
334| uint64_t* size | 表示指向id长度的指针,用于接收id的长度信息。 |
335
336**返回:**
337
338| 类型 | 说明 |
339| -- | -- |
340| int32_t | 返回执行的状态代码。 |
341
342### OH_NativeXComponent_GetXComponentSize()
343
344```
345int32_t OH_NativeXComponent_GetXComponentSize(OH_NativeXComponent* component, const void* window, uint64_t* width, uint64_t* height)
346```
347
348**描述:**
349
350
351获取ArkUI XComponent持有的Surface的大小。
352
353**起始版本:** 8
354
355
356**参数:**
357
358| 参数项 | 描述 |
359| -- | -- |
360| [OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)* component | 表示指向[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例的指针。 |
361| const void* window | 表示NativeWindow句柄。 |
362| uint64_t* width | 表示指向当前Surface宽度的指针。 |
363| uint64_t* height | 表示指向当前Surface高度的指针。 |
364
365**返回:**
366
367| 类型 | 说明 |
368| -- | -- |
369| int32_t | 返回执行的状态代码。 |
370
371### OH_NativeXComponent_GetXComponentOffset()
372
373```
374int32_t OH_NativeXComponent_GetXComponentOffset(OH_NativeXComponent* component, const void* window, double* x, double* y)
375```
376
377**描述:**
378
379
380获取ArkUI XComponent持有的Surface相对其父组件左顶点的偏移量。
381
382**起始版本:** 8
383
384
385**参数:**
386
387| 参数项 | 描述 |
388| -- | -- |
389| [OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)* component | 表示指向[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例的指针。 |
390| const void* window | 表示NativeWindow句柄。 |
391| double* x | 表示指向当前Surface相对于XComponent父组件左顶点x坐标的指针。 |
392| double* y | 表示指向当前Surface相对于XComponent父组件左顶点y坐标的指针。 |
393
394**返回:**
395
396| 类型 | 说明 |
397| -- | -- |
398| int32_t | 返回执行的状态代码。 |
399
400### OH_NativeXComponent_GetTouchEvent()
401
402```
403int32_t OH_NativeXComponent_GetTouchEvent(OH_NativeXComponent* component, const void* window, OH_NativeXComponent_TouchEvent* touchEvent)
404```
405
406**描述:**
407
408
409获取ArkUI XComponent调度的触摸事件。
410
411**起始版本:** 8
412
413
414**参数:**
415
416| 参数项 | 描述 |
417| -- | -- |
418| [OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)* component | 表示指向[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例的指针。 |
419| const void* window | 表示NativeWindow句柄。 |
420| [OH_NativeXComponent_TouchEvent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent-touchevent.md)* touchEvent | 表示指向当前触摸事件的指针。 |
421
422**返回:**
423
424| 类型 | 说明 |
425| -- | -- |
426| int32_t | 返回执行的状态代码。 |
427
428### OH_NativeXComponent_GetTouchPointToolType()
429
430```
431int32_t OH_NativeXComponent_GetTouchPointToolType(OH_NativeXComponent* component, uint32_t pointIndex,OH_NativeXComponent_TouchPointToolType* toolType)
432```
433
434**描述:**
435
436
437获取ArkUI XComponent触摸点工具类型。
438
439**起始版本:** 9
440
441
442**参数:**
443
444| 参数项 | 描述 |
445| -- | -- |
446| [OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)* component | 表示指向[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例的指针。 |
447| uint32_t pointIndex | 表示触摸点的指针索引。 |
448| [OH_NativeXComponent_TouchPointToolType](capi-native-interface-xcomponent-h.md#oh_nativexcomponent_touchpointtooltype)* toolType | 表示指向工具类型的指针。 |
449
450**返回:**
451
452| 类型 | 说明 |
453| -- | -- |
454| int32_t | 返回执行的状态代码。 |
455
456### OH_NativeXComponent_GetTouchPointTiltX()
457
458```
459int32_t OH_NativeXComponent_GetTouchPointTiltX(OH_NativeXComponent* component, uint32_t pointIndex, float* tiltX)
460```
461
462**描述:**
463
464
465获取ArkUI XComponent触摸点倾斜与X轴角度。
466
467**起始版本:** 9
468
469
470**参数:**
471
472| 参数项 | 描述 |
473| -- | -- |
474| [OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)* component | 表示指向[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例的指针。 |
475| uint32_t pointIndex | 表示触摸点的指针索引。 |
476| float* tiltX | 表示指向X倾斜度的指针。 |
477
478**返回:**
479
480| 类型 | 说明 |
481| -- | -- |
482| int32_t | 返回执行的状态代码。 |
483
484### OH_NativeXComponent_GetTouchPointTiltY()
485
486```
487int32_t OH_NativeXComponent_GetTouchPointTiltY(OH_NativeXComponent* component, uint32_t pointIndex, float* tiltY)
488```
489
490**描述:**
491
492
493获取ArkUI XComponent触摸点倾斜与Y轴角度。
494
495**起始版本:** 9
496
497
498**参数:**
499
500| 参数项 | 描述 |
501| -- | -- |
502| [OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)* component | 表示指向[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例的指针。 |
503| uint32_t pointIndex | 表示触摸点的指针索引。 |
504| float* tiltY | 表示指向Y倾斜度的指针。 |
505
506**返回:**
507
508| 类型 | 说明 |
509| -- | -- |
510| int32_t | 返回执行的状态代码。 |
511
512### OH_NativeXComponent_GetTouchPointWindowX()
513
514```
515int32_t OH_NativeXComponent_GetTouchPointWindowX(OH_NativeXComponent* component, uint32_t pointIndex, float* windowX)
516```
517
518**描述:**
519
520
521获取ArkUI XComponent触摸点相对于应用窗口左上角的X坐标。
522
523**起始版本:** 12
524
525
526**参数:**
527
528| 参数项 | 描述 |
529| -- | -- |
530| [OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)* component | 表示指向[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例的指针。 |
531| uint32_t pointIndex | 表示触摸点的指针索引。 |
532| float* windowX | 表示指向触摸点相对于应用窗口左上角的X坐标的指针。 |
533
534**返回:**
535
536| 类型 | 说明 |
537| -- | -- |
538| int32_t | 返回执行的状态代码。<br>[OH_NATIVEXCOMPONENT_RESULT_SUCCESS](capi-native-interface-xcomponent-h.md#anonymous) 获取windowX成功。<br>[OH_NATIVEXCOMPONENT_RESULT_BAD_PARAMETER](capi-native-interface-xcomponent-h.md#anonymous) component是空指针、windowX是空指针或者native XComponent是空指针。 |
539
540### OH_NativeXComponent_GetTouchPointWindowY()
541
542```
543int32_t OH_NativeXComponent_GetTouchPointWindowY(OH_NativeXComponent* component, uint32_t pointIndex, float* windowY)
544```
545
546**描述:**
547
548
549获取ArkUI XComponent触摸点相对于应用窗口左上角的Y坐标。
550
551**起始版本:** 12
552
553
554**参数:**
555
556| 参数项 | 描述 |
557| -- | -- |
558| [OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)* component | 表示指向[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例的指针。 |
559| uint32_t pointIndex | 表示触摸点的指针索引。 |
560| float* windowY | 表示指向触摸点相对于应用窗口左上角的Y坐标的指针。 |
561
562**返回:**
563
564| 类型 | 说明 |
565| -- | -- |
566| int32_t | 返回执行的状态代码。<br> [OH_NATIVEXCOMPONENT_RESULT_SUCCESS](capi-native-interface-xcomponent-h.md#anonymous) 获取windowY成功。<br> [OH_NATIVEXCOMPONENT_RESULT_BAD_PARAMETER](capi-native-interface-xcomponent-h.md#anonymous) component是空指针、windowY是空指针或者native XComponent是空指针。 |
567
568### OH_NativeXComponent_GetTouchPointDisplayX()
569
570```
571int32_t OH_NativeXComponent_GetTouchPointDisplayX(OH_NativeXComponent* component, uint32_t pointIndex, float* displayX)
572```
573
574**描述:**
575
576
577获取ArkUI XComponent触摸点相对于应用所在屏幕左上角的X坐标。
578
579**起始版本:** 12
580
581
582**参数:**
583
584| 参数项 | 描述 |
585| -- | -- |
586| [OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)* component | 表示指向[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例的指针。 |
587| uint32_t pointIndex | 表示触摸点的指针索引。 |
588| float* displayX | 表示指向触摸点相对于应用所在屏幕左上角的X坐标的指针。 |
589
590**返回:**
591
592| 类型 | 说明 |
593| -- | -- |
594| int32_t | 返回执行的状态代码。<br>[OH_NATIVEXCOMPONENT_RESULT_SUCCESS](capi-native-interface-xcomponent-h.md#anonymous) 获取displayX成功。<br>[OH_NATIVEXCOMPONENT_RESULT_BAD_PARAMETER](capi-native-interface-xcomponent-h.md#anonymous) component是空指针、displayX是空指针或者native XComponent是空指针。 |
595
596### OH_NativeXComponent_GetTouchPointDisplayY()
597
598```
599int32_t OH_NativeXComponent_GetTouchPointDisplayY(OH_NativeXComponent* component, uint32_t pointIndex, float* displayY)
600```
601
602**描述:**
603
604
605获取ArkUI XComponent触摸点相对于应用所在屏幕左上角的Y坐标。
606
607**起始版本:** 12
608
609
610**参数:**
611
612| 参数项 | 描述 |
613| -- | -- |
614| [OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)* component | 表示指向[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例的指针。 |
615| uint32_t pointIndex | 表示触摸点的指针索引。 |
616| float* displayY | 表示指向触摸点相对于应用所在屏幕左上角的Y坐标的指针。 |
617
618**返回:**
619
620| 类型 | 说明 |
621| -- | -- |
622| int32_t | 返回执行的状态代码。<br>[OH_NATIVEXCOMPONENT_RESULT_SUCCESS](capi-native-interface-xcomponent-h.md#anonymous) 获取displayY成功。<br>[OH_NATIVEXCOMPONENT_RESULT_BAD_PARAMETER](capi-native-interface-xcomponent-h.md#anonymous) component是空指针、displayY是空指针或者native XComponent是空指针。 |
623
624### OH_NativeXComponent_GetHistoricalPoints()
625
626```
627int32_t OH_NativeXComponent_GetHistoricalPoints(OH_NativeXComponent* component, const void* window,int32_t* size, OH_NativeXComponent_HistoricalPoint** historicalPoints)
628```
629
630**描述:**
631
632
633获取当前XComponent触摸事件的历史点信息。由于部分输入设备上报触点的频率非常高(最高可达每1 ms上报一次),而对输入事件的响应通常是为了使UI界面发生变化以响应用户操作,如果将触摸事件按照上报触点的频率如此高频率上报给应用,大多会造成冗余,因此触摸事件在一帧内只会上报一次给应用。在当前帧内上报的触点均作为历史点保存,如果应用需要直接处理这些数据,可调用该接口获取历史点信息。
634
635**起始版本:** 10
636
637
638**参数:**
639
640| 参数项 | 描述 |
641| -- | -- |
642| [OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)* component | 表示指向[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例的指针。 |
643| const void* window | 表示NativeWindow句柄。 |
644| int32_t* size | 表示当前历史接触点数组的长度。 |
645| [OH_NativeXComponent_HistoricalPoint](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent-historicalpoint.md)** historicalPoints | 表示指向当前历史接触点数组的指针。 |
646
647**返回:**
648
649| 类型 | 说明 |
650| -- | -- |
651| int32_t | 返回执行的状态代码。 |
652
653### OH_NativeXComponent_GetMouseEvent()
654
655```
656int32_t OH_NativeXComponent_GetMouseEvent(OH_NativeXComponent* component, const void* window, OH_NativeXComponent_MouseEvent* mouseEvent)
657```
658
659**描述:**
660
661
662获取ArkUI XComponent调度的鼠标事件。
663
664**起始版本:** 9
665
666
667**参数:**
668
669| 参数项 | 描述 |
670| -- | -- |
671| [OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)* component | 表示指向[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例的指针。 |
672| const void* window | 表示NativeWindow句柄。 |
673| [OH_NativeXComponent_MouseEvent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent-mouseevent.md)* mouseEvent | 表示指向当前鼠标事件的指针。 |
674
675**返回:**
676
677| 类型 | 说明 |
678| -- | -- |
679| int32_t | 返回执行的状态代码。 |
680
681### OH_NativeXComponent_RegisterCallback()
682
683```
684int32_t OH_NativeXComponent_RegisterCallback(OH_NativeXComponent* component, OH_NativeXComponent_Callback* callback)
685```
686
687**描述:**
688
689
690为此[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例注册回调。
691
692**起始版本:** 8
693
694
695**参数:**
696
697| 参数项 | 描述 |
698| -- | -- |
699| [OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)* component | 表示指向[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例的指针。 |
700| [OH_NativeXComponent_Callback](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent-callback.md)* callback | 表示指向Surface生命周期和触摸事件回调的指针。 |
701
702**返回:**
703
704| 类型 | 说明 |
705| -- | -- |
706| int32_t | 返回执行的状态代码。 |
707
708### OH_NativeXComponent_RegisterMouseEventCallback()
709
710```
711int32_t OH_NativeXComponent_RegisterMouseEventCallback(OH_NativeXComponent* component, OH_NativeXComponent_MouseEvent_Callback* callback)
712```
713
714**描述:**
715
716
717为此[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例注册鼠标事件回调。
718
719**起始版本:** 9
720
721
722**参数:**
723
724| 参数项 | 描述 |
725| -- | -- |
726| [OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)* component | 表示指向[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例的指针。 |
727| [OH_NativeXComponent_MouseEvent_Callback](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent-mouseevent-callback.md)* callback | 表示指向鼠标事件回调的指针。 |
728
729**返回:**
730
731| 类型 | 说明 |
732| -- | -- |
733| int32_t | 返回执行的状态代码。 |
734
735### OH_NativeXComponent_GetExtraMouseEventInfo()
736
737```
738int32_t OH_NativeXComponent_GetExtraMouseEventInfo(OH_NativeXComponent* component, OH_NativeXComponent_ExtraMouseEventInfo** extraMouseEventInfo)
739```
740
741**描述:**
742
743
744从此[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例中获取扩展的鼠标事件信息。
745
746**起始版本:** 20
747
748
749**参数:**
750
751| 参数项 | 描述 |
752| -- | -- |
753| [OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)* component | 表示指向[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例的指针。 |
754| [OH_NativeXComponent_ExtraMouseEventInfo](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent-extramouseeventinfo.md)** extraMouseEventInfo | 表示指向[OH_NativeXComponent_ExtraMouseEventInfo](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent-extramouseeventinfo.md)类型指针的地址。 |
755
756**返回:**
757
758| 类型 | 说明 |
759| -- | -- |
760| int32_t | 返回执行的状态代码。<br>返回 [ARKUI_ERROR_CODE_NO_ERROR](capi-native-type-h.md#arkui_errorcode) - 执行成功。<br>返回 [ARKUI_ERROR_CODE_PARAM_INVALID](capi-native-type-h.md#arkui_errorcode) - 传入参数异常。 |
761
762### OH_NativeXComponent_GetMouseEventModifierKeyStates()
763
764```
765int32_t OH_NativeXComponent_GetMouseEventModifierKeyStates(OH_NativeXComponent_ExtraMouseEventInfo* extraMouseEventInfo, uint64_t* keys)
766```
767
768**描述:**
769
770
771从[OH_NativeXComponent_ExtraMouseEventInfo](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent-extramouseeventinfo.md)实例中获取功能键按压状态信息。
772
773**起始版本:** 20
774
775
776**参数:**
777
778| 参数项 | 描述 |
779| -- | -- |
780| [OH_NativeXComponent_ExtraMouseEventInfo](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent-extramouseeventinfo.md)* extraMouseEventInfo | 表示指向扩展的鼠标事件信息实例的指针。 |
781| uint64_t* keys | 表示用于接收功能键按压状态信息的64位无符号整数的地址。 |
782
783**返回:**
784
785| 类型 | 说明 |
786| -- | -- |
787| int32_t | 返回执行的状态代码。<br>返回 [ARKUI_ERROR_CODE_NO_ERROR](capi-native-type-h.md#arkui_errorcode) - 执行成功。<br>返回 [ARKUI_ERROR_CODE_PARAM_INVALID](capi-native-type-h.md#arkui_errorcode) - 传入参数异常。 |
788
789### OH_NativeXComponent_RegisterFocusEventCallback()
790
791```
792int32_t OH_NativeXComponent_RegisterFocusEventCallback(OH_NativeXComponent* component, void (*callback)(OH_NativeXComponent* component, void* window))
793```
794
795**描述:**
796
797
798为此[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例注册获焦事件回调。
799
800**起始版本:** 10
801
802
803**参数:**
804
805| 参数项 | 描述 |
806| -- | -- |
807| [OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)* component | 表示指向[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例的指针。 |
808| void (\*callback)(OH_NativeXComponent* component, void* window) | 表示指向获焦事件回调的指针。- window: 表示NativeWindow句柄。 |
809
810**返回:**
811
812| 类型 | 说明 |
813| -- | -- |
814| int32_t | 返回执行的状态代码。 |
815
816### OH_NativeXComponent_RegisterKeyEventCallback()
817
818```
819int32_t OH_NativeXComponent_RegisterKeyEventCallback(OH_NativeXComponent* component, void (*callback)(OH_NativeXComponent* component, void* window))
820```
821
822**描述:**
823
824
825为此[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例注册按键事件回调。
826
827**起始版本:** 10
828
829
830**参数:**
831
832| 参数项 | 描述 |
833| -- | -- |
834| [OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)* component | 表示指向[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例的指针。 |
835| void (\*callback)(OH_NativeXComponent* component, void* window) | 表示指向按键事件回调的指针。- window: 表示NativeWindow句柄。 |
836
837**返回:**
838
839| 类型 | 说明 |
840| -- | -- |
841| int32_t  | 返回执行的状态代码。 |
842
843### OH_NativeXComponent_RegisterBlurEventCallback()
844
845```
846int32_t OH_NativeXComponent_RegisterBlurEventCallback(OH_NativeXComponent* component, void (*callback)(OH_NativeXComponent* component, void* window))
847```
848
849**描述:**
850
851
852为此[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例注册失焦事件回调。
853
854**起始版本:** 10
855
856
857**参数:**
858
859| 参数项 | 描述 |
860| -- | -- |
861| [OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)* component | 表示指向[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例的指针。 |
862| void (\*callback)(OH_NativeXComponent* component, void* window) | 表示指向失焦事件回调的指针。- window: 表示NativeWindow句柄。 |
863
864**返回:**
865
866| 类型 | 说明 |
867| -- | -- |
868| int32_t  | 返回执行的状态代码。 |
869
870### OH_NativeXComponent_GetKeyEvent()
871
872```
873int32_t OH_NativeXComponent_GetKeyEvent(OH_NativeXComponent* component, OH_NativeXComponent_KeyEvent** keyEvent)
874```
875
876**描述:**
877
878
879获取ArkUI XComponent调度的按键事件。
880
881**起始版本:** 10
882
883
884**参数:**
885
886| 参数项 | 描述 |
887| -- | -- |
888| [OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)* component | 表示指向[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例的指针。 |
889| [OH_NativeXComponent_KeyEvent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent-keyevent.md)** keyEvent | 表示指向当前按键事件指针的指针。 |
890
891**返回:**
892
893| 类型 | 说明 |
894| -- | -- |
895| int32_t | 返回执行的状态代码。 |
896
897### OH_NativeXComponent_GetKeyEventAction()
898
899```
900int32_t OH_NativeXComponent_GetKeyEventAction(OH_NativeXComponent_KeyEvent* keyEvent, OH_NativeXComponent_KeyAction* action)
901```
902
903**描述:**
904
905
906获取传入按键事件的动作。
907
908**起始版本:** 10
909
910
911**参数:**
912
913| 参数项 | 描述 |
914| -- | -- |
915| [OH_NativeXComponent_KeyEvent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent-keyevent.md)* keyEvent | 表示指向[OH_NativeXComponent_KeyEvent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent-keyevent.md)实例的指针。 |
916| [OH_NativeXComponent_KeyAction](capi-native-xcomponent-key-event-h.md#oh_nativexcomponent_keyaction)* action | 表示指向按键事件动作的指针。 |
917
918**返回:**
919
920| 类型 | 说明 |
921| -- | -- |
922| int32_t | 返回执行的状态代码。 |
923
924### OH_NativeXComponent_GetKeyEventCode()
925
926```
927int32_t OH_NativeXComponent_GetKeyEventCode(OH_NativeXComponent_KeyEvent* keyEvent, OH_NativeXComponent_KeyCode* code)
928```
929
930**描述:**
931
932
933获取传入按键事件的按键码。
934
935**起始版本:** 10
936
937
938**参数:**
939
940| 参数项 | 描述 |
941| -- | -- |
942| [OH_NativeXComponent_KeyEvent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent-keyevent.md)* keyEvent | 表示指向[OH_NativeXComponent_KeyEvent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent-keyevent.md)实例的指针。 |
943| [OH_NativeXComponent_KeyCode](capi-native-xcomponent-key-event-h.md#oh_nativexcomponent_keycode)* code | 表示指向按键事件按键码的指针。 |
944
945**返回:**
946
947| 类型 | 说明 |
948| -- | -- |
949| int32_t | 返回执行的状态代码。 |
950
951### OH_NativeXComponent_GetKeyEventSourceType()
952
953```
954int32_t OH_NativeXComponent_GetKeyEventSourceType(OH_NativeXComponent_KeyEvent* keyEvent, OH_NativeXComponent_EventSourceType* sourceType)
955```
956
957**描述:**
958
959
960获取传入按键事件的事件源类型。
961
962**起始版本:** 10
963
964
965**参数:**
966
967| 参数项 | 描述 |
968| -- | -- |
969| [OH_NativeXComponent_KeyEvent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent-keyevent.md)* keyEvent | 表示指向[OH_NativeXComponent_KeyEvent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent-keyevent.md)实例的指针。 |
970| [OH_NativeXComponent_EventSourceType](capi-native-interface-xcomponent-h.md#oh_nativexcomponent_eventsourcetype)* sourceType | 表示指向按键事件事件源类型的指针。 |
971
972**返回:**
973
974| 类型 | 说明 |
975| -- | -- |
976| int32_t | 返回执行的状态代码。 |
977
978### OH_NativeXComponent_GetKeyEventDeviceId()
979
980```
981int32_t OH_NativeXComponent_GetKeyEventDeviceId(OH_NativeXComponent_KeyEvent* keyEvent, int64_t* deviceId)
982```
983
984**描述:**
985
986
987获取传入按键事件的设备id。
988
989**起始版本:** 10
990
991
992**参数:**
993
994| 参数项 | 描述 |
995| -- | -- |
996| [OH_NativeXComponent_KeyEvent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent-keyevent.md)* keyEvent | 表示指向[OH_NativeXComponent_KeyEvent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent-keyevent.md)实例的指针。 |
997| int64_t* deviceId | 表示指向按键事件设备id的指针。 |
998
999**返回:**
1000
1001| 类型 | 说明 |
1002| -- | -- |
1003| int32_t | 返回执行的状态代码。 |
1004
1005### OH_NativeXComponent_GetKeyEventTimestamp()
1006
1007```
1008int32_t OH_NativeXComponent_GetKeyEventTimestamp(OH_NativeXComponent_KeyEvent* keyEvent, int64_t* timestamp)
1009```
1010
1011**描述:**
1012
1013
1014获取传入按键事件的时间戳。
1015
1016**起始版本:** 10
1017
1018
1019**参数:**
1020
1021| 参数项 | 描述 |
1022| -- | -- |
1023| [OH_NativeXComponent_KeyEvent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent-keyevent.md)* keyEvent | 表示指向[OH_NativeXComponent_KeyEvent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent-keyevent.md)实例的指针。 |
1024| int64_t* timestamp | 表示指向按键事件时间戳的指针。 |
1025
1026**返回:**
1027
1028| 类型 | 说明 |
1029| -- | -- |
1030| int32_t | 返回执行的状态代码。 |
1031
1032### OH_NativeXComponent_GetKeyEventModifierKeyStates()
1033
1034```
1035int32_t OH_NativeXComponent_GetKeyEventModifierKeyStates(OH_NativeXComponent_KeyEvent* keyEvent, uint64_t* keys)
1036```
1037
1038**描述:**
1039
1040
1041从按键事件中获取功能键按压状态信息。
1042
1043**起始版本:** 20
1044
1045
1046**参数:**
1047
1048| 参数项 | 描述 |
1049| -- | -- |
1050| [OH_NativeXComponent_KeyEvent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent-keyevent.md)* keyEvent | 表示指向按键事件的指针。 |
1051| uint64_t* keys | 表示用于接收功能键按压状态信息的64位无符号整数的地址。 |
1052
1053**返回:**
1054
1055| 类型 | 说明 |
1056| -- | -- |
1057| int32_t | 返回执行的状态代码。<br>返回 [ARKUI_ERROR_CODE_NO_ERROR](capi-native-type-h.md#arkui_errorcode) - 执行成功。<br>返回 [ARKUI_ERROR_CODE_PARAM_INVALID](capi-native-type-h.md#arkui_errorcode) - 传入参数异常。 |
1058
1059### OH_NativeXComponent_GetKeyEventNumLockState()
1060
1061```
1062int32_t OH_NativeXComponent_GetKeyEventNumLockState(OH_NativeXComponent_KeyEvent* keyEvent, bool* isNumLockOn)
1063```
1064
1065**描述:**
1066
1067
1068从按键事件中获取NumLock(小键盘锁定)键的状态信息。
1069
1070**起始版本:** 20
1071
1072
1073**参数:**
1074
1075| 参数项 | 描述 |
1076| -- | -- |
1077| [OH_NativeXComponent_KeyEvent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent-keyevent.md)* keyEvent | 表示指向按键事件的指针。 |
1078| bool* isNumLockOn | 表示用于接收NumLock(小键盘锁定)键状态的bool类型变量的地址。 |
1079
1080**返回:**
1081
1082| 类型 | 说明 |
1083| -- | -- |
1084| int32_t | 返回执行的状态代码。<br>返回 [ARKUI_ERROR_CODE_NO_ERROR](capi-native-type-h.md#arkui_errorcode) - 执行成功。<br>返回 [ARKUI_ERROR_CODE_PARAM_INVALID](capi-native-type-h.md#arkui_errorcode) - 传入参数异常。 |
1085
1086### OH_NativeXComponent_GetKeyEventCapsLockState()
1087
1088```
1089int32_t OH_NativeXComponent_GetKeyEventCapsLockState(OH_NativeXComponent_KeyEvent* keyEvent, bool* isCapsLockOn)
1090```
1091
1092**描述:**
1093
1094
1095从按键事件中获取CapsLock(大写锁定)键的状态信息。
1096
1097**起始版本:** 20
1098
1099
1100**参数:**
1101
1102| 参数项 | 描述 |
1103| -- | -- |
1104| [OH_NativeXComponent_KeyEvent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent-keyevent.md)* keyEvent | 表示指向按键事件的指针。 |
1105| bool* isCapsLockOn | 表示用于接收CapsLock(大写锁定)键状态的bool类型变量的地址。 |
1106
1107**返回:**
1108
1109| 类型 | 说明 |
1110| -- | -- |
1111| int32_t | 返回执行的状态代码。<br>返回 [ARKUI_ERROR_CODE_NO_ERROR](capi-native-type-h.md#arkui_errorcode) - 执行成功。<br>返回 [ARKUI_ERROR_CODE_PARAM_INVALID](capi-native-type-h.md#arkui_errorcode) - 传入参数异常。 |
1112
1113### OH_NativeXComponent_GetKeyEventScrollLockState()
1114
1115```
1116int32_t OH_NativeXComponent_GetKeyEventScrollLockState(OH_NativeXComponent_KeyEvent* keyEvent, bool* isScrollLockOn)
1117```
1118
1119**描述:**
1120
1121
1122从按键事件中获取ScrollLock(滚动锁定)键的状态信息。
1123
1124**起始版本:** 20
1125
1126
1127**参数:**
1128
1129| 参数项 | 描述 |
1130| -- | -- |
1131| [OH_NativeXComponent_KeyEvent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent-keyevent.md)* keyEvent | 表示指向按键事件的指针。 |
1132| bool* isScrollLockOn | 表示用于接收ScrollLock(滚动锁定)键状态的bool类型变量的地址。 |
1133
1134**返回:**
1135
1136| 类型 | 说明 |
1137| -- | -- |
1138| int32_t | 返回执行的状态代码。<br>返回 [ARKUI_ERROR_CODE_NO_ERROR](capi-native-type-h.md#arkui_errorcode) - 执行成功。<br>返回 [ARKUI_ERROR_CODE_PARAM_INVALID](capi-native-type-h.md#arkui_errorcode) - 传入参数异常。 |
1139
1140### OH_NativeXComponent_SetExpectedFrameRateRange()
1141
1142```
1143int32_t OH_NativeXComponent_SetExpectedFrameRateRange(OH_NativeXComponent* component, OH_NativeXComponent_ExpectedRateRange* range)
1144```
1145
1146**描述:**
1147
1148
1149设置期望帧率范围。
1150
1151**起始版本:** 11
1152
1153
1154**参数:**
1155
1156| 参数项 | 描述 |
1157| -- | -- |
1158| [OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)* component | 表示指向[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例的指针。 |
1159| [OH_NativeXComponent_ExpectedRateRange](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent-expectedraterange.md)* range | 表示指向[OH_NativeXComponent_ExpectedRateRange](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent-expectedraterange.md)类型的期望帧率信息对象的指针。 |
1160
1161**返回:**
1162
1163| 类型 | 说明 |
1164| -- | -- |
1165| int32_t | 返回执行的状态代码。 |
1166
1167### OH_NativeXComponent_RegisterOnFrameCallback()
1168
1169```
1170int32_t OH_NativeXComponent_RegisterOnFrameCallback(OH_NativeXComponent* component,void (*callback)(OH_NativeXComponent* component, uint64_t timestamp, uint64_t targetTimestamp))
1171```
1172
1173**描述:**
1174
1175
1176为此[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例注册显示更新回调,并使能每帧回调此函数。
1177
1178**起始版本:** 11
1179
1180
1181**参数:**
1182
1183| 参数项 | 描述 |
1184| -- | -- |
1185| [OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)* component | 表示指向[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例的指针。 |
1186| void (\*callback)(OH_NativeXComponent* component, uint64_t timestamp, uint64_t targetTimestamp) | 表示指向显示更新回调的指针。- timestamp: 当前帧到达的时间(单位:纳秒)。- targetTimestamp: 下一帧预期到达的时间(单位:纳秒)。 |
1187
1188**返回:**
1189
1190| 类型 | 说明 |
1191| -- | -- |
1192| int32_t  | 返回执行的状态代码。 |
1193
1194### OH_NativeXComponent_UnregisterOnFrameCallback()
1195
1196```
1197int32_t OH_NativeXComponent_UnregisterOnFrameCallback(OH_NativeXComponent* component)
1198```
1199
1200**描述:**
1201
1202
1203为此[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例取消注册回调函数,并关闭每帧回调此函数。
1204
1205**起始版本:** 11
1206
1207
1208**参数:**
1209
1210| 参数项 | 描述 |
1211| -- | -- |
1212| [OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)* component | 表示指向[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例的指针。 |
1213
1214**返回:**
1215
1216| 类型 | 说明 |
1217| -- | -- |
1218| int32_t | 返回执行的状态代码。 |
1219
1220### OH_NativeXComponent_AttachNativeRootNode()
1221
1222```
1223int32_t OH_NativeXComponent_AttachNativeRootNode(OH_NativeXComponent* component, ArkUI_NodeHandle root)
1224```
1225
1226**描述:**
1227
1228
1229将通过ArkUI的Native接口创建出来的UI组件挂载到当前XComponent上。
1230
1231**起始版本:** 12
1232
1233**废弃版本:** 20
1234
1235**替代接口:** [OH_ArkUI_NodeContent_AddNode](capi-native-node-h.md#oh_arkui_nodecontent_addnode)
1236
1237
1238**参数:**
1239
1240| 参数项 | 描述 |
1241| -- | -- |
1242| [OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)* component | 表示指向[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例的指针。 |
1243| [ArkUI_NodeHandle](capi-arkui-nativemodule-arkui-node8h.md) root | 表示指向Native接口创建的组件实例的指针。 |
1244
1245**返回:**
1246
1247| 类型 | 说明 |
1248| -- | -- |
1249| int32_t | 返回执行的状态代码。<br>返回 [OH_NATIVEXCOMPONENT_RESULT_SUCCESS](capi-native-interface-xcomponent-h.md#anonymous) - 成功。<br>返回 [OH_NATIVEXCOMPONENT_RESULT_BAD_PARAMETER](capi-native-interface-xcomponent-h.md#anonymous) - 参数异常。|
1250
1251### OH_NativeXComponent_DetachNativeRootNode()
1252
1253```
1254int32_t OH_NativeXComponent_DetachNativeRootNode(OH_NativeXComponent* component, ArkUI_NodeHandle root)
1255```
1256
1257**描述:**
1258
1259
1260将ArkUI的Native组件从当前XComponent上卸载。
1261
1262**起始版本:** 12
1263
1264**废弃版本:** 20
1265
1266**替代接口:** [OH_ArkUI_NodeContent_RemoveNode](capi-native-node-h.md#oh_arkui_nodecontent_removenode)
1267
1268
1269**参数:**
1270
1271| 参数项 | 描述 |
1272| -- | -- |
1273| [OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)* component | 表示指向[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例的指针。 |
1274| [ArkUI_NodeHandle](capi-arkui-nativemodule-arkui-node8h.md) root | 表示指向Native接口创建的组件实例的指针。 |
1275
1276**返回:**
1277
1278| 类型 | 说明 |
1279| -- | -- |
1280| int32_t | 返回执行的状态代码。<br>返回 [OH_NATIVEXCOMPONENT_RESULT_SUCCESS](capi-native-interface-xcomponent-h.md#anonymous) - 成功。<br>返回 [OH_NATIVEXCOMPONENT_RESULT_BAD_PARAMETER](capi-native-interface-xcomponent-h.md#anonymous) - 参数异常。|
1281
1282### OH_NativeXComponent_RegisterUIInputEventCallback()
1283
1284```
1285int32_t OH_NativeXComponent_RegisterUIInputEventCallback(OH_NativeXComponent *component,void (*callback)(OH_NativeXComponent *component, ArkUI_UIInputEvent *event,ArkUI_UIInputEvent_Type type),ArkUI_UIInputEvent_Type type)
1286```
1287
1288**描述:**
1289
1290
1291为此[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例注册UI输入事件回调,并使能收到UI输入事件时回调此函数。当前仅支持轴事件。
1292
1293**起始版本:** 12
1294
1295
1296**参数:**
1297
1298| 参数项 | 描述 |
1299| -- | -- |
1300| [OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md) *component | 表示指向[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例的指针。 |
1301| void (*callback)(OH_NativeXComponent *component, ArkUI_UIInputEvent *event,ArkUI_UIInputEvent_Type type) | 表示指向UI输入事件回调的指针。- event: 表示指向UI输入事件的指针。 |
1302| [ArkUI_UIInputEvent_Type](capi-ui-input-event-h.md#arkui_uiinputevent_type) type | 表示当前UI输入事件的类型。 |
1303
1304**返回:**
1305
1306| 类型 | 说明 |
1307| -- | -- |
1308| int32_t  | 返回执行的状态代码。<br>返回 [ARKUI_ERROR_CODE_NO_ERROR](capi-native-type-h.md#arkui_errorcode) - 成功。<br>返回 [ARKUI_ERROR_CODE_PARAM_INVALID](capi-native-type-h.md#arkui_errorcode) - 参数异常。 |
1309
1310### OH_NativeXComponent_RegisterOnTouchInterceptCallback()
1311
1312```
1313int32_t OH_NativeXComponent_RegisterOnTouchInterceptCallback(OH_NativeXComponent* component, HitTestMode (*callback)(OH_NativeXComponent* component, ArkUI_UIInputEvent* event))
1314```
1315
1316**描述:**
1317
1318
1319为此[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例注册自定义事件拦截回调,并使能在做触摸测试时回调此函数。通过该回调获取到的事件对象不支持UIInput相关信息操作接口,建议切换为通过注册native node上的[NODE_ON_TOUCH_INTERCEPT](capi-native-node-h.md#arkui_nodeeventtype)通用事件来支持。
1320
1321**起始版本:** 12
1322
1323
1324**参数:**
1325
1326| 参数项 | 描述 |
1327| -- | -- |
1328| [OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)* component | 表示指向[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例的指针。 |
1329| HitTestMode (\*callback)(OH_NativeXComponent* component, ArkUI_UIInputEvent* event) | 表示指向自定义事件拦截回调的指针。- event: 表示指向UI输入事件的指针。 |
1330
1331**返回:**
1332
1333| 类型 | 说明 |
1334| -- | -- |
1335| int32_t  | 返回执行的状态代码。<br>返回 [ARKUI_ERROR_CODE_NO_ERROR](capi-native-type-h.md#arkui_errorcode) - 成功。<br>返回 [ARKUI_ERROR_CODE_PARAM_INVALID](capi-native-type-h.md#arkui_errorcode) - 参数异常。 |
1336
1337### OH_NativeXComponent_SetNeedSoftKeyboard()
1338
1339```
1340int32_t OH_NativeXComponent_SetNeedSoftKeyboard(OH_NativeXComponent* component, bool needSoftKeyboard)
1341```
1342
1343**描述:**
1344
1345
1346为此[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例设置是否需要软键盘。
1347
1348**起始版本:** 12
1349
1350
1351**参数:**
1352
1353| 参数项 | 描述 |
1354| -- | -- |
1355| [OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)* component | 表示指向[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例的指针。 |
1356| bool needSoftKeyboard | 表示此[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例是否需要软键盘。默认值为false。 |
1357
1358**返回:**
1359
1360| 类型 | 说明 |
1361| -- | -- |
1362| int32_t | 返回执行的状态代码。 |
1363
1364### OH_NativeXComponent_RegisterSurfaceShowCallback()
1365
1366```
1367int32_t OH_NativeXComponent_RegisterSurfaceShowCallback(OH_NativeXComponent* component, void (*callback)(OH_NativeXComponent* component, void* window))
1368```
1369
1370**描述:**
1371
1372
1373为此[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例注册Surface显示回调,该回调在应用窗口已经从后台回到前台时触发。
1374
1375**起始版本:** 12
1376
1377
1378**参数:**
1379
1380| 参数项 | 描述 |
1381| -- | -- |
1382| [OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)* component | 表示指向[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例的指针。 |
1383| void (\*callback)(OH_NativeXComponent* component, void* window) | 表示指向Surface显示回调的指针。- window: 表示NativeWindow句柄。 |
1384
1385**返回:**
1386
1387| 类型 | 说明 |
1388| -- | -- |
1389| int32_t  | 返回执行的状态代码。 |
1390
1391### OH_NativeXComponent_RegisterSurfaceHideCallback()
1392
1393```
1394int32_t OH_NativeXComponent_RegisterSurfaceHideCallback(OH_NativeXComponent* component, void (*callback)(OH_NativeXComponent* component, void* window))
1395```
1396
1397**描述:**
1398
1399
1400为此[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例注册Surface隐藏回调,该回调在应用窗口已经从前台进入后台时触发。
1401
1402**起始版本:** 12
1403
1404
1405**参数:**
1406
1407| 参数项 | 描述 |
1408| -- | -- |
1409| [OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)* component | 表示指向[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例的指针。 |
1410| void (\*callback)(OH_NativeXComponent* component, void* window) | 表示指向Surface隐藏回调的指针。- window: 表示NativeWindow句柄。 |
1411
1412**返回:**
1413
1414| 类型 | 说明 |
1415| -- | -- |
1416| int32_t  | 返回执行的状态代码。 |
1417
1418### OH_NativeXComponent_GetTouchEventSourceType()
1419
1420```
1421int32_t OH_NativeXComponent_GetTouchEventSourceType(OH_NativeXComponent* component, int32_t pointId, OH_NativeXComponent_EventSourceType* sourceType)
1422```
1423
1424**描述:**
1425
1426
1427获取ArkUI XComponent触摸事件的输入设备类型。
1428
1429**起始版本:** 12
1430
1431
1432**参数:**
1433
1434| 参数项 | 描述 |
1435| -- | -- |
1436| [OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)* component | 表示指向[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例的指针。 |
1437| int32_t pointId | 表示触摸点的id。仅当传入的id为触发该touch事件的触点id时,可正确返回输入设备类型,否则返回OH_NATIVEXCOMPONENT_RESULT_BAD_PARAMETER。 |
1438| [OH_NativeXComponent_EventSourceType](capi-native-interface-xcomponent-h.md#oh_nativexcomponent_eventsourcetype)* sourceType | 表示指向返回设备类型的指针。 |
1439
1440**返回:**
1441
1442| 类型 | 说明 |
1443| -- | -- |
1444| int32_t | [OH_NATIVEXCOMPONENT_RESULT_SUCCESS](capi-native-interface-xcomponent-h.md#anonymous) - 成功。<br>[OH_NATIVEXCOMPONENT_RESULT_BAD_PARAMETER](capi-native-interface-xcomponent-h.md#anonymous) - 参数异常。<br>[OH_NATIVEXCOMPONENT_RESULT_FAILED](capi-native-interface-xcomponent-h.md#anonymous) - 其他错误。 |
1445
1446### OH_NativeXComponent_GetNativeXComponent()
1447
1448```
1449OH_NativeXComponent* OH_NativeXComponent_GetNativeXComponent(ArkUI_NodeHandle node)
1450```
1451
1452**描述:**
1453
1454
1455基于Native接口创建的组件实例获取[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)类型的指针。
1456
1457**起始版本:** 12
1458
1459
1460**参数:**
1461
1462| 参数项 | 描述 |
1463| -- | -- |
1464| [ArkUI_NodeHandle](capi-arkui-nativemodule-arkui-node8h.md) node | 指向Native接口创建的组件实例的指针。 |
1465
1466**返回:**
1467
1468| 类型                       | 说明 |
1469|--------------------------| -- |
1470| [OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)* | 表示指向[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例的指针。 |
1471
1472### OH_NativeXComponent_GetNativeAccessibilityProvider()
1473
1474```
1475int32_t OH_NativeXComponent_GetNativeAccessibilityProvider(OH_NativeXComponent* component, ArkUI_AccessibilityProvider** handle)
1476```
1477
1478**描述:**
1479
1480
1481获取ArkUI XComponent无障碍接入句柄指针。
1482
1483**起始版本:** 13
1484
1485
1486**参数:**
1487
1488| 参数项 | 描述 |
1489| -- | -- |
1490| [OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)* component | 表示指向[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例的指针。 |
1491| [ArkUI_AccessibilityProvider](capi-arkui-accessibility-arkui-accessibilityprovider.md)** handle | 表示指向[ArkUI_AccessibilityProvider](capi-arkui-accessibility-arkui-accessibilityprovider.md)实例的指针。 |
1492
1493**返回:**
1494
1495| 类型 | 说明 |
1496| -- | -- |
1497| int32_t | [OH_NATIVEXCOMPONENT_RESULT_SUCCESS](capi-native-interface-xcomponent-h.md#anonymous) - 成功。<br>[OH_NATIVEXCOMPONENT_RESULT_BAD_PARAMETER](capi-native-interface-xcomponent-h.md#anonymous) - 参数异常。<br>[OH_NATIVEXCOMPONENT_RESULT_FAILED](capi-native-interface-xcomponent-h.md#anonymous) - 其他错误。 |
1498
1499### OH_NativeXComponent_RegisterKeyEventCallbackWithResult()
1500
1501```
1502int32_t OH_NativeXComponent_RegisterKeyEventCallbackWithResult(OH_NativeXComponent* component, bool (*callback)(OH_NativeXComponent* component, void* window))
1503```
1504
1505**描述:**
1506
1507
1508为此[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例注册带有返回值的按键事件回调。通过此接口注册的按键事件回调都必须返回一个结果,即true或false。当返回值为true时,该事件将不会继续分发;当返回值为false时,该事件将按照事件处理流程继续分发。
1509
1510**起始版本:** 14
1511
1512
1513**参数:**
1514
1515| 参数项 | 描述 |
1516| -- | -- |
1517| [OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)* component | 表示指向[OH_NativeXComponent](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent.md)实例的指针。 |
1518| bool (\*callback)(OH_NativeXComponent* component, void* window) | 表示指向按键事件回调的指针。- window: 表示NativeWindow句柄。 |
1519
1520**返回:**
1521
1522| 类型 | 说明 |
1523| -- | -- |
1524| int32_t  | 返回执行的状态代码。<br>[OH_NATIVEXCOMPONENT_RESULT_SUCCESS](capi-native-interface-xcomponent-h.md#anonymous) - 回调函数注册成功。<br>[OH_NATIVEXCOMPONENT_RESULT_BAD_PARAMETER](capi-native-interface-xcomponent-h.md#anonymous) - 传入参数异常。 |
1525
1526### OH_ArkUI_XComponent_StartImageAnalyzer()
1527
1528```
1529int32_t OH_ArkUI_XComponent_StartImageAnalyzer(ArkUI_NodeHandle node, void* userData,void (*callback)(ArkUI_NodeHandle node, ArkUI_XComponent_ImageAnalyzerState statusCode, void* userData))
1530```
1531
1532**描述:**
1533
1534
1535为此XComponent组件实例开始图像AI分析,使用前需先使能图像AI分析能力。
1536
1537**起始版本:** 18
1538
1539
1540**参数:**
1541
1542| 参数项 | 描述 |
1543| -- | -- |
1544| [ArkUI_NodeHandle](capi-arkui-nativemodule-arkui-node8h.md) node | 表示XComponent组件实例。 |
1545|  void* userData | 表示开发者需要在回调函数执行时获取的数据的指针。 |
1546| void (\*callback)(ArkUI_NodeHandle node, ArkUI_XComponent_ImageAnalyzerState statusCode, void* userData) | 表示图像AI分析状态刷新时触发的回调函数。- statusCode: 回调函数的入参之一,表示当前的图像分析状态。 |
1547
1548**返回:**
1549
1550| 类型 | 说明 |
1551| -- | -- |
1552| int32_t  | 返回执行的状态代码。<br>返回 [ARKUI_ERROR_CODE_NO_ERROR](capi-native-type-h.md#arkui_errorcode) - 执行成功。<br>返回 [ARKUI_ERROR_CODE_PARAM_INVALID](capi-native-type-h.md#arkui_errorcode) - 传入参数异常。 |
1553
1554### OH_ArkUI_XComponent_StopImageAnalyzer()
1555
1556```
1557int32_t OH_ArkUI_XComponent_StopImageAnalyzer(ArkUI_NodeHandle node)
1558```
1559
1560**描述:**
1561
1562
1563为此XComponent组件实例停止图像AI分析。
1564
1565**起始版本:** 18
1566
1567
1568**参数:**
1569
1570| 参数项 | 描述 |
1571| -- | -- |
1572| [ArkUI_NodeHandle](capi-arkui-nativemodule-arkui-node8h.md) node | 表示XComponent组件实例。 |
1573
1574**返回:**
1575
1576| 类型 | 说明 |
1577| -- | -- |
1578| int32_t | 返回执行的状态代码。<br>返回 [ARKUI_ERROR_CODE_NO_ERROR](capi-native-type-h.md#arkui_errorcode) - 执行成功。<br>返回 [ARKUI_ERROR_CODE_PARAM_INVALID](capi-native-type-h.md#arkui_errorcode) - 传入参数异常。 |
1579
1580### OH_ArkUI_SurfaceHolder_Create()
1581
1582```
1583OH_ArkUI_SurfaceHolder* OH_ArkUI_SurfaceHolder_Create(ArkUI_NodeHandle node)
1584```
1585
1586**描述:**
1587
1588
1589创建XComponent组件的[OH_ArkUI_SurfaceHolder](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfaceholder.md)对象。
1590
1591**起始版本:** 19
1592
1593
1594**参数:**
1595
1596| 参数项 | 描述 |
1597| -- | -- |
1598| [ArkUI_NodeHandle](capi-arkui-nativemodule-arkui-node8h.md) node | 表示指向Native接口创建的XComponent组件实例的指针。 |
1599
1600**返回:**
1601
1602| 类型                          | 说明 |
1603|-----------------------------| -- |
1604| [OH_ArkUI_SurfaceHolder](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfaceholder.md)* | 返回被创建的[OH_ArkUI_SurfaceHolder](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfaceholder.md)对象的指针。 |
1605
1606### OH_ArkUI_SurfaceHolder_Dispose()
1607
1608```
1609void OH_ArkUI_SurfaceHolder_Dispose(OH_ArkUI_SurfaceHolder* surfaceHolder)
1610```
1611
1612**描述:**
1613
1614
1615销毁[OH_ArkUI_SurfaceHolder](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfaceholder.md)对象。
1616
1617**起始版本:** 19
1618
1619
1620**参数:**
1621
1622| 参数项 | 描述 |
1623| -- | -- |
1624| [OH_ArkUI_SurfaceHolder](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfaceholder.md)* surfaceHolder | 表示指向需要销毁的[OH_ArkUI_SurfaceHolder](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfaceholder.md)实例的指针。 |
1625
1626### OH_ArkUI_SurfaceHolder_SetUserData()
1627
1628```
1629int32_t OH_ArkUI_SurfaceHolder_SetUserData(OH_ArkUI_SurfaceHolder* surfaceHolder, void* userData)
1630```
1631
1632**描述:**
1633
1634
1635向[OH_ArkUI_SurfaceHolder](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfaceholder.md)实例存储自定义数据。
1636
1637**起始版本:** 19
1638
1639
1640**参数:**
1641
1642| 参数项 | 描述 |
1643| -- | -- |
1644| [OH_ArkUI_SurfaceHolder](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfaceholder.md)* surfaceHolder | 表示指向存储自定义数据的[OH_ArkUI_SurfaceHolder](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfaceholder.md)实例的指针。 |
1645| void* userData | 表示指向要存储的自定义数据的指针。 |
1646
1647**返回:**
1648
1649| 类型 | 说明 |
1650| -- | -- |
1651| int32_t | 返回执行的状态代码。<br>返回 [ARKUI_ERROR_CODE_NO_ERROR](capi-native-type-h.md#arkui_errorcode) - 执行成功。<br>返回 [ARKUI_ERROR_CODE_PARAM_INVALID](capi-native-type-h.md#arkui_errorcode) - 传入参数异常。 |
1652
1653### OH_ArkUI_SurfaceHolder_GetUserData()
1654
1655```
1656void* OH_ArkUI_SurfaceHolder_GetUserData(OH_ArkUI_SurfaceHolder* surfaceHolder)
1657```
1658
1659**描述:**
1660
1661
1662获取[OH_ArkUI_SurfaceHolder](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfaceholder.md)实例存储的自定义数据。
1663
1664**起始版本:** 19
1665
1666
1667**参数:**
1668
1669| 参数项 | 描述 |
1670| -- | -- |
1671| [OH_ArkUI_SurfaceHolder](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfaceholder.md)* surfaceHolder | 表示指向存储自定义数据的[OH_ArkUI_SurfaceHolder](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfaceholder.md)实例的指针。 |
1672
1673**返回:**
1674
1675| 类型 | 说明 |
1676| -- | -- |
1677| void* | 返回自定义数据。 |
1678
1679### OH_ArkUI_SurfaceCallback_Create()
1680
1681```
1682OH_ArkUI_SurfaceCallback* OH_ArkUI_SurfaceCallback_Create()
1683```
1684
1685**描述:**
1686
1687
1688创建[OH_ArkUI_SurfaceCallback](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfacecallback.md)对象。
1689
1690**起始版本:** 19
1691
1692**返回:**
1693
1694| 类型 | 说明 |
1695| -- | -- |
1696| [OH_ArkUI_SurfaceCallback](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfacecallback.md)* | 返回创建的[OH_ArkUI_SurfaceCallback](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfacecallback.md)对象的指针。 |
1697
1698### OH_ArkUI_SurfaceCallback_Dispose()
1699
1700```
1701void OH_ArkUI_SurfaceCallback_Dispose(OH_ArkUI_SurfaceCallback* callback)
1702```
1703
1704**描述:**
1705
1706
1707销毁[OH_ArkUI_SurfaceCallback](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfacecallback.md)对象。
1708
1709**起始版本:** 19
1710
1711
1712**参数:**
1713
1714| 参数项 | 描述 |
1715| -- | -- |
1716| [OH_ArkUI_SurfaceCallback](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfacecallback.md)* callback | 表示指向需要销毁的[OH_ArkUI_SurfaceCallback](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfacecallback.md)对象的指针。 |
1717
1718### OH_ArkUI_SurfaceCallback_SetSurfaceCreatedEvent()
1719
1720```
1721void OH_ArkUI_SurfaceCallback_SetSurfaceCreatedEvent(OH_ArkUI_SurfaceCallback* callback,void (*onSurfaceCreated)(OH_ArkUI_SurfaceHolder* surfaceHolder))
1722```
1723
1724**描述:**
1725
1726
1727设置Surface生命周期回调中的创建回调事件。
1728
1729**起始版本:** 19
1730
1731
1732**参数:**
1733
1734| 参数项 | 描述 |
1735| -- | -- |
1736| [OH_ArkUI_SurfaceCallback](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfacecallback.md)* callback | 表示指向Surface生命周期回调的指针。 |
1737| void (\*onSurfaceCreated)(OH_ArkUI_SurfaceHolder* surfaceHolder) | 表示声明Surface创建时会触发的回调事件。- surfaceHolder: 表示指向[OH_ArkUI_SurfaceHolder](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfaceholder.md)实例的指针。 |
1738
1739### OH_ArkUI_SurfaceCallback_SetSurfaceChangedEvent()
1740
1741```
1742void OH_ArkUI_SurfaceCallback_SetSurfaceChangedEvent(OH_ArkUI_SurfaceCallback* callback,void (*onSurfaceChanged)(OH_ArkUI_SurfaceHolder* surfaceHolder, uint64_t width, uint64_t height))
1743```
1744
1745**描述:**
1746
1747
1748设置Surface生命周期回调中的大小改变回调事件。
1749
1750**起始版本:** 19
1751
1752
1753**参数:**
1754
1755| 参数项 | 描述 |
1756| -- | -- |
1757| [OH_ArkUI_SurfaceCallback](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfacecallback.md)* callback | 表示指向Surface生命周期回调的指针。 |
1758| void (\*onSurfaceChanged)(OH_ArkUI_SurfaceHolder* surfaceHolder, uint64_t width, uint64_t height) | 表示声明Surface大小改变时会触发的回调事件。- surfaceHolder: 表示指向[OH_ArkUI_SurfaceHolder](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfaceholder.md)实例的指针。- width: 表示Surface大小变化后的宽度。- height: 表示Surface大小变化后的高度。 |
1759
1760### OH_ArkUI_SurfaceCallback_SetSurfaceDestroyedEvent()
1761
1762```
1763void OH_ArkUI_SurfaceCallback_SetSurfaceDestroyedEvent(OH_ArkUI_SurfaceCallback* callback,void (*onSurfaceDestroyed)(OH_ArkUI_SurfaceHolder* surfaceHolder))
1764```
1765
1766**描述:**
1767
1768
1769设置Surface生命周期回调中的销毁回调事件。
1770
1771**起始版本:** 19
1772
1773
1774**参数:**
1775
1776| 参数项 | 描述 |
1777| -- | -- |
1778| [OH_ArkUI_SurfaceCallback](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfacecallback.md)* callback | 表示指向Surface生命周期回调的指针。 |
1779| void (\*onSurfaceDestroyed)(OH_ArkUI_SurfaceHolder* surfaceHolder) | 表示声明Surface销毁时会触发的回调事件。- surfaceHolder: 表示指向[OH_ArkUI_SurfaceHolder](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfaceholder.md)实例的指针。 |
1780
1781### OH_ArkUI_SurfaceHolder_AddSurfaceCallback()
1782
1783```
1784int32_t OH_ArkUI_SurfaceHolder_AddSurfaceCallback(OH_ArkUI_SurfaceHolder* surfaceHolder,OH_ArkUI_SurfaceCallback* callback)
1785```
1786
1787**描述:**
1788
1789
1790添加Surface生命周期回调到[OH_ArkUI_SurfaceHolder](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfaceholder.md)实例。
1791
1792**起始版本:** 19
1793
1794
1795**参数:**
1796
1797| 参数项 | 描述 |
1798| -- | -- |
1799| [OH_ArkUI_SurfaceHolder](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfaceholder.md)* surfaceHolder | 表示指向[OH_ArkUI_SurfaceHolder](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfaceholder.md)实例的指针。 |
1800| [OH_ArkUI_SurfaceCallback](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfacecallback.md)* callback | 表示指向新回调的指针。 |
1801
1802**返回:**
1803
1804| 类型 | 说明 |
1805| -- | -- |
1806| int32_t | 返回执行的状态代码。<br>返回 [ARKUI_ERROR_CODE_NO_ERROR](capi-native-type-h.md#arkui_errorcode) - 执行成功。<br>返回 [ARKUI_ERROR_CODE_PARAM_INVALID](capi-native-type-h.md#arkui_errorcode) - 传入参数异常。 |
1807
1808### OH_ArkUI_SurfaceHolder_RemoveSurfaceCallback()
1809
1810```
1811int32_t OH_ArkUI_SurfaceHolder_RemoveSurfaceCallback(OH_ArkUI_SurfaceHolder* surfaceHolder,OH_ArkUI_SurfaceCallback* callback)
1812```
1813
1814**描述:**
1815
1816
1817删除[OH_ArkUI_SurfaceHolder](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfaceholder.md)实例的先前添加的Surface生命周期回调。
1818
1819**起始版本:** 19
1820
1821
1822**参数:**
1823
1824| 参数项 | 描述 |
1825| -- | -- |
1826| [OH_ArkUI_SurfaceHolder](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfaceholder.md)* surfaceHolder | 表示指向[OH_ArkUI_SurfaceHolder](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfaceholder.md)实例的指针。 |
1827| [OH_ArkUI_SurfaceCallback](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfacecallback.md)* callback | 表示指向需要删除的回调的指针。 |
1828
1829**返回:**
1830
1831| 类型 | 说明 |
1832| -- | -- |
1833| int32_t | 返回执行的状态代码。<br>返回 [ARKUI_ERROR_CODE_NO_ERROR](capi-native-type-h.md#arkui_errorcode) - 执行成功。<br>返回 [ARKUI_ERROR_CODE_PARAM_INVALID](capi-native-type-h.md#arkui_errorcode) - 传入参数异常。 |
1834
1835### OH_ArkUI_XComponent_GetNativeWindow()
1836
1837```
1838OHNativeWindow* OH_ArkUI_XComponent_GetNativeWindow(OH_ArkUI_SurfaceHolder* surfaceHolder)
1839```
1840
1841**描述:**
1842
1843
1844获取[OH_ArkUI_SurfaceHolder](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfaceholder.md)实例关联的NativeWindow。
1845
1846**起始版本:** 19
1847
1848
1849**参数:**
1850
1851| 参数项 | 描述 |
1852| -- | -- |
1853| [OH_ArkUI_SurfaceHolder](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfaceholder.md)* surfaceHolder | 表示指向[OH_ArkUI_SurfaceHolder](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfaceholder.md)实例的指针。 |
1854
1855**返回:**
1856
1857| 类型                  | 说明 |
1858|---------------------| -- |
1859| [OHNativeWindow](capi-oh-nativexcomponent-native-xcomponent-nativewindow.md)* | 返回[OH_ArkUI_SurfaceHolder](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfaceholder.md)实例关联的NativeWindow。 |
1860
1861### OH_ArkUI_XComponent_SetAutoInitialize()
1862
1863```
1864int32_t OH_ArkUI_XComponent_SetAutoInitialize(ArkUI_NodeHandle node, bool autoInitialize)
1865```
1866
1867**描述:**
1868
1869
1870设置XComponent组件是否需要自动初始化Surface的标志位。
1871
1872**起始版本:** 19
1873
1874
1875**参数:**
1876
1877| 参数项 | 描述 |
1878| -- | -- |
1879| [ArkUI_NodeHandle](capi-arkui-nativemodule-arkui-node8h.md) node | 表示指向XComponent组件实例的指针。 |
1880| bool autoInitialize | 表示XComponent组件是否需要自动初始化Surface。如果autoInitialize值是true,OnSurfaceCreated回调会在挂树时被触发,OnSurfaceDestroyed回调会在下树时被触发。autoInitialize默认值是true。 |
1881
1882**返回:**
1883
1884| 类型 | 说明 |
1885| -- | -- |
1886| int32_t | 返回执行的状态代码。<br>返回 [ARKUI_ERROR_CODE_NO_ERROR](capi-native-type-h.md#arkui_errorcode) - 执行成功。<br>返回 [ARKUI_ERROR_CODE_PARAM_INVALID](capi-native-type-h.md#arkui_errorcode) - 传入参数异常。 |
1887
1888### OH_ArkUI_XComponent_Initialize()
1889
1890```
1891int32_t OH_ArkUI_XComponent_Initialize(ArkUI_NodeHandle node)
1892```
1893
1894**描述:**
1895
1896
1897初始化XComponent组件持有的Surface。
1898
1899**起始版本:** 19
1900
1901
1902**参数:**
1903
1904| 参数项 | 描述 |
1905| -- | -- |
1906| [ArkUI_NodeHandle](capi-arkui-nativemodule-arkui-node8h.md) node | 表示指向XComponent组件实例的指针。 |
1907
1908**返回:**
1909
1910| 类型 | 说明 |
1911| -- | -- |
1912| int32_t | 返回执行的状态代码。<br>返回 [ARKUI_ERROR_CODE_NO_ERROR](capi-native-type-h.md#arkui_errorcode) - 执行成功。<br>返回 [ARKUI_ERROR_CODE_PARAM_INVALID](capi-native-type-h.md#arkui_errorcode) - 传入参数异常。<br>返回 [ARKUI_ERROR_CODE_XCOMPONENT_STATE_INVALID](capi-native-type-h.md#arkui_errorcode) - XComponent持有的Surface已经被初始化。 |
1913
1914### OH_ArkUI_XComponent_Finalize()
1915
1916```
1917int32_t OH_ArkUI_XComponent_Finalize(ArkUI_NodeHandle node)
1918```
1919
1920**描述:**
1921
1922
1923销毁XComponent组件持有的Surface。
1924
1925**起始版本:** 19
1926
1927
1928**参数:**
1929
1930| 参数项 | 描述 |
1931| -- | -- |
1932| [ArkUI_NodeHandle](capi-arkui-nativemodule-arkui-node8h.md) node | 表示指向XComponent组件实例的指针。 |
1933
1934**返回:**
1935
1936| 类型 | 说明 |
1937| -- | -- |
1938| int32_t | 返回执行的状态代码。<br>返回 [ARKUI_ERROR_CODE_NO_ERROR](capi-native-type-h.md#arkui_errorcode) - 执行成功。<br>返回 [ARKUI_ERROR_CODE_PARAM_INVALID](capi-native-type-h.md#arkui_errorcode) - 传入参数异常。<br>返回 [ARKUI_ERROR_CODE_XCOMPONENT_STATE_INVALID](capi-native-type-h.md#arkui_errorcode) - XComponent持有的Surface已经被销毁。 |
1939
1940### OH_ArkUI_XComponent_IsInitialized()
1941
1942```
1943int32_t OH_ArkUI_XComponent_IsInitialized(ArkUI_NodeHandle node, bool* isInitialized)
1944```
1945
1946**描述:**
1947
1948
1949获取XComponent组件是否已经初始化的标志位。
1950
1951**起始版本:** 19
1952
1953
1954**参数:**
1955
1956| 参数项 | 描述 |
1957| -- | -- |
1958| [ArkUI_NodeHandle](capi-arkui-nativemodule-arkui-node8h.md) node | 表示指向XComponent组件实例的指针。 |
1959| bool* isInitialized | 表示XComponent组件是否已经初始化Surface。 |
1960
1961**返回:**
1962
1963| 类型 | 说明 |
1964| -- | -- |
1965| int32_t | 返回执行的状态代码。<br>返回 [ARKUI_ERROR_CODE_NO_ERROR](capi-native-type-h.md#arkui_errorcode) - 执行成功。<br>返回 [ARKUI_ERROR_CODE_PARAM_INVALID](capi-native-type-h.md#arkui_errorcode) - 传入参数异常。 |
1966
1967### OH_ArkUI_XComponent_SetExpectedFrameRateRange()
1968
1969```
1970int32_t OH_ArkUI_XComponent_SetExpectedFrameRateRange(ArkUI_NodeHandle node, OH_NativeXComponent_ExpectedRateRange range)
1971```
1972
1973**描述:**
1974
1975
1976为此XComponent组件实例设置期望帧率。
1977
1978**起始版本:** 20
1979
1980
1981**参数:**
1982
1983| 参数项 | 描述 |
1984| -- | -- |
1985| [ArkUI_NodeHandle](capi-arkui-nativemodule-arkui-node8h.md) node | 表示XComponent组件实例。 |
1986| [OH_NativeXComponent_ExpectedRateRange](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent-expectedraterange.md) range | 表示[OH_NativeXComponent_ExpectedRateRange](capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent-expectedraterange.md)类型的期望帧率信息对象。 |
1987
1988**返回:**
1989
1990| 类型 | 说明 |
1991| -- | -- |
1992| int32_t | 返回执行的状态代码。<br>返回 [ARKUI_ERROR_CODE_NO_ERROR](capi-native-type-h.md#arkui_errorcode) - 执行成功。<br>返回 [ARKUI_ERROR_CODE_PARAM_INVALID](capi-native-type-h.md#arkui_errorcode) - 传入参数异常。 |
1993
1994### OH_ArkUI_XComponent_RegisterOnFrameCallback()
1995
1996```
1997int32_t OH_ArkUI_XComponent_RegisterOnFrameCallback(ArkUI_NodeHandle node,void (*callback)(ArkUI_NodeHandle node, uint64_t timestamp, uint64_t targetTimestamp))
1998```
1999
2000**描述:**
2001
2002
2003为此XComponent组件实例注册帧回调函数。
2004
2005**起始版本:** 20
2006
2007
2008**参数:**
2009
2010| 参数项 | 描述 |
2011| -- | -- |
2012| [ArkUI_NodeHandle](capi-arkui-nativemodule-arkui-node8h.md) node | 表示XComponent组件实例。 |
2013| void (*callback)(ArkUI_NodeHandle node, uint64_t timestamp, uint64_t targetTimestamp) | 表示执行帧回调函数的指针。- timestamp: 当前帧到达的时间(单位:纳秒)。- targetTimestamp: 下一帧预期到达的时间(单位:纳秒)。 |
2014
2015**返回:**
2016
2017| 类型 | 说明 |
2018| -- | -- |
2019| int32_t  | 返回执行的状态代码。<br>返回 [ARKUI_ERROR_CODE_NO_ERROR](capi-native-type-h.md#arkui_errorcode) - 执行成功。<br>返回 [ARKUI_ERROR_CODE_PARAM_INVALID](capi-native-type-h.md#arkui_errorcode) - 传入参数异常。 |
2020
2021### OH_ArkUI_XComponent_UnregisterOnFrameCallback()
2022
2023```
2024int32_t OH_ArkUI_XComponent_UnregisterOnFrameCallback(ArkUI_NodeHandle node)
2025```
2026
2027**描述:**
2028
2029
2030为此XComponent组件实例取消注册帧回调函数。
2031
2032**起始版本:** 20
2033
2034
2035**参数:**
2036
2037| 参数项 | 描述 |
2038| -- | -- |
2039| [ArkUI_NodeHandle](capi-arkui-nativemodule-arkui-node8h.md) node | 表示XComponent组件实例。 |
2040
2041**返回:**
2042
2043| 类型 | 说明 |
2044| -- | -- |
2045| int32_t | 返回执行的状态代码。<br>返回 [ARKUI_ERROR_CODE_NO_ERROR](capi-native-type-h.md#arkui_errorcode) - 执行成功。<br>返回 [ARKUI_ERROR_CODE_PARAM_INVALID](capi-native-type-h.md#arkui_errorcode) - 传入参数异常。 |
2046
2047### OH_ArkUI_XComponent_SetNeedSoftKeyboard()
2048
2049```
2050int32_t OH_ArkUI_XComponent_SetNeedSoftKeyboard(ArkUI_NodeHandle node, bool needSoftKeyboard)
2051```
2052
2053**描述:**
2054
2055
2056为此XComponent组件实例设置是否需要软键盘。
2057
2058**起始版本:** 20
2059
2060
2061**参数:**
2062
2063| 参数项 | 描述 |
2064| -- | -- |
2065| [ArkUI_NodeHandle](capi-arkui-nativemodule-arkui-node8h.md) node | 表示XComponent组件实例。 |
2066| bool needSoftKeyboard | 表示是否需要软键盘。默认值为false。 |
2067
2068**返回:**
2069
2070| 类型 | 说明 |
2071| -- | -- |
2072| int32_t | 返回执行的状态代码。<br>返回 [ARKUI_ERROR_CODE_NO_ERROR](capi-native-type-h.md#arkui_errorcode) - 执行成功。<br>返回 [ARKUI_ERROR_CODE_PARAM_INVALID](capi-native-type-h.md#arkui_errorcode) - 传入参数异常。 |
2073
2074### OH_ArkUI_AccessibilityProvider_Create()
2075
2076```
2077ArkUI_AccessibilityProvider* OH_ArkUI_AccessibilityProvider_Create(ArkUI_NodeHandle node)
2078```
2079
2080**描述:**
2081
2082
2083基于此XComponent实例创建[ArkUI_AccessibilityProvider](capi-arkui-accessibility-arkui-accessibilityprovider.md)实例。
2084
2085**起始版本:** 20
2086
2087
2088**参数:**
2089
2090| 参数项 | 描述 |
2091| -- | -- |
2092| [ArkUI_NodeHandle](capi-arkui-nativemodule-arkui-node8h.md) node | 表示XComponent组件实例。 |
2093
2094**返回:**
2095
2096| 类型                               | 说明 |
2097|----------------------------------| -- |
2098| [ArkUI_AccessibilityProvider](capi-arkui-accessibility-arkui-accessibilityprovider.md)* | [ArkUI_AccessibilityProvider](capi-arkui-accessibility-arkui-accessibilityprovider.md)类型的指针。 |
2099
2100### OH_ArkUI_AccessibilityProvider_Dispose()
2101
2102```
2103void OH_ArkUI_AccessibilityProvider_Dispose(ArkUI_AccessibilityProvider* provider)
2104```
2105
2106**描述:**
2107
2108
2109销毁由Native接口[OH_ArkUI_AccessibilityProvider_Create](capi-native-interface-xcomponent-h.md#oh_arkui_accessibilityprovider_create)创建的[ArkUI_AccessibilityProvider](capi-arkui-accessibility-arkui-accessibilityprovider.md)实例。
2110
2111**起始版本:** 20
2112
2113
2114**参数:**
2115
2116| 参数项 | 描述 |
2117| -- | -- |
2118| [ArkUI_AccessibilityProvider](capi-arkui-accessibility-arkui-accessibilityprovider.md)* provider | 表示由Native接口[OH_ArkUI_AccessibilityProvider_Create](capi-native-interface-xcomponent-h.md#oh_arkui_accessibilityprovider_create)创建的[ArkUI_AccessibilityProvider](capi-arkui-accessibility-arkui-accessibilityprovider.md)实例。 |
2119
2120### OH_ArkUI_SurfaceCallback_SetSurfaceShowEvent()
2121
2122```
2123void OH_ArkUI_SurfaceCallback_SetSurfaceShowEvent(OH_ArkUI_SurfaceCallback* callback,void (*onSurfaceShow)(OH_ArkUI_SurfaceHolder* surfaceHolder))
2124```
2125
2126**描述:**
2127
2128
2129为此[OH_ArkUI_SurfaceCallback](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfacecallback.md)实例设置Surface显示回调,该回调在应用窗口已经从后台回到前台时触发。
2130
2131**起始版本:** 20
2132
2133
2134**参数:**
2135
2136| 参数项                                    | 描述 |
2137|----------------------------------------| -- |
2138| [OH_ArkUI_SurfaceCallback](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfacecallback.md)* callback | 表示指向[OH_ArkUI_SurfaceCallback](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfacecallback.md)实例的指针。 |
2139| onSurfaceShow                          | 表示Surface显示回调函数指针。- surfaceHolder: 表示指向[OH_ArkUI_SurfaceHolder](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfaceholder.md)实例的指针。 |
2140
2141### OH_ArkUI_SurfaceCallback_SetSurfaceHideEvent()
2142
2143```
2144void OH_ArkUI_SurfaceCallback_SetSurfaceHideEvent(OH_ArkUI_SurfaceCallback* callback,void (*onSurfaceHide)(OH_ArkUI_SurfaceHolder* surfaceHolder))
2145```
2146
2147**描述:**
2148
2149
2150为此[OH_ArkUI_SurfaceCallback](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfacecallback.md)实例设置Surface隐藏回调,该回调在应用窗口已经从前台进入后台时触发。
2151
2152**起始版本:** 20
2153
2154
2155**参数:**
2156
2157| 参数项 | 描述 |
2158| -- | -- |
2159| [OH_ArkUI_SurfaceCallback](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfacecallback.md)* callback | 表示指向[OH_ArkUI_SurfaceCallback](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfacecallback.md)实例的指针。 |
2160| onSurfaceHide | 表示Surface隐藏回调函数指针。- surfaceHolder: 表示指向[OH_ArkUI_SurfaceHolder](capi-oh-nativexcomponent-native-xcomponent-oh-arkui-surfaceholder.md)实例的指针。 |
2161
2162
2163