openharmony 鸿蒙 capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent-callback

2026-08-25 浏览 (1)

OH_NativeXComponent_Callback

typedef struct OH_NativeXComponent_Callback {...} OH_NativeXComponent_Callback

Overview

Registers callbacks for the surface lifecycle and touch event.

Since: 8

Related module: OH_NativeXComponent Native XComponent

Header file: native_interface_xcomponent.h

Summary

Member Functions

NameDescription
void (*OnSurfaceCreated)(OH_NativeXComponent* component, void* window)Invoked when a surface is created.
void (*OnSurfaceChanged)(OH_NativeXComponent* component, void* window)Invoked when the surface changes.
void (*OnSurfaceDestroyed)(OH_NativeXComponent* component, void* window)Invoked when the surface is destroyed.
void (*DispatchTouchEvent)(OH_NativeXComponent* component, void* window)Invoked when a touch event is triggered.

Member Function Description

OnSurfaceCreated()

void (*OnSurfaceCreated)(OH_NativeXComponent* component, void* window)

Description

Invoked when a surface is created.

Since: 8

Parameters

NameDescription
OH_NativeXComponent* componentPointer to an OH_NativeXComponent instance.
void* windowHandle to the NativeWindow instance.
The NativeWindow instance obtained through the XComponent lifecycle callback is held by the system side with a reference count. After the OnSurfaceDestroyed callback is triggered, the reference count is decreased by one. After the reference count reaches zero, the NativeWindow instance will be released.

OnSurfaceChanged()

void (*OnSurfaceChanged)(OH_NativeXComponent* component, void* window)

Description

Invoked when the surface changes.

Since: 8

Parameters

NameDescription
OH_NativeXComponent* componentPointer to an OH_NativeXComponent instance.
void* windowHandle to the NativeWindow instance.

OnSurfaceDestroyed()

void (*OnSurfaceDestroyed)(OH_NativeXComponent* component, void* window)

Description

Invoked when the surface is destroyed.

Since: 8

Parameters

NameDescription
OH_NativeXComponent* componentPointer to an OH_NativeXComponent instance.
void* windowHandle to the NativeWindow instance.

DispatchTouchEvent()

void (*DispatchTouchEvent)(OH_NativeXComponent* component, void* window)

Description

Invoked when a touch event is triggered.

Since: 8

Parameters

NameDescription
OH_NativeXComponent* componentPointer to an OH_NativeXComponent instance.
void* windowHandle to the NativeWindow instance.

你可能感兴趣的鸿蒙文章

openharmony 鸿蒙 arkts-apis-uicontext-contextmenucontroller

openharmony 鸿蒙 errorcode-canvas

openharmony 鸿蒙 capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent

openharmony 鸿蒙 errorcode-bindSheet

openharmony 鸿蒙 js-apis-arkui-uiExtension-sys

openharmony 鸿蒙 capi-arkui-accessibility-arkui-accessibilityeventinfo

openharmony 鸿蒙 capi-arkui-rendernodeutils

openharmony 鸿蒙 js-apis-arkui-node

openharmony 鸿蒙 capi-native-node-h

openharmony 鸿蒙 capi-arkui-nativemodule-arkui-listitemswipeactionitem

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