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

Name Description
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

Name Description
OH_NativeXComponent* component Pointer to an OH_NativeXComponent instance.
void* window Handle 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

Name Description
OH_NativeXComponent* component Pointer to an OH_NativeXComponent instance.
void* window Handle to the NativeWindow instance.

OnSurfaceDestroyed()

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

Description

Invoked when the surface is destroyed.

Since: 8

Parameters

Name Description
OH_NativeXComponent* component Pointer to an OH_NativeXComponent instance.
void* window Handle to the NativeWindow instance.

DispatchTouchEvent()

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

Description

Invoked when a touch event is triggered.

Since: 8

Parameters

Name Description
OH_NativeXComponent* component Pointer to an OH_NativeXComponent instance.
void* window Handle to the NativeWindow instance.