harmony 鸿蒙native_interface_xcomponent.h

2025-06-12 浏览 (1)

native_interface_xcomponent.h

Overview

Declares the APIs for accessing NativeXComponent.

Library: libace_ndk.z.so

Since: 8

Related module: Native XComponent

Summary

Structs

NameDescription
struct OH_NativeXComponent_TouchPointDescribes the touch point of the touch event.
struct OH_NativeXComponent_TouchEventDescribes the touch event.
struct OH_NativeXComponent_MouseEventDescribes the mouse event.
struct OH_NativeXComponent_CallbackRegisters callbacks for the surface lifecycle and touch event.
struct OH_NativeXComponent_MouseEvent_CallbackRegisters callbacks for the mouse event.
struct OH_NativeXComponent_ExpectedRateRangeDefines the expected frame rate range.

Types

NameDescription
typedef struct OH_NativeXComponentOH_NativeXComponentProvides an encapsulated OH_NativeXComponent instance.
typedef struct OH_NativeXComponent_CallbackOH_NativeXComponent_CallbackRegisters callbacks for the surface lifecycle and touch event.
typedef struct OH_NativeXComponent_MouseEvent_CallbackOH_NativeXComponent_MouseEvent_CallbackRegisters callbacks for the mouse event.
typedef struct OH_NativeXComponent_KeyEventOH_NativeXComponent_KeyEventProvides an encapsulated OH_NativeXComponent_KeyEvent instance.

Enums

NameDescription
{ OH_NATIVEXCOMPONENT_RESULT_SUCCESS = 0, OH_NATIVEXCOMPONENT_RESULT_FAILED = -1, OH_NATIVEXCOMPONENT_RESULT_BAD_PARAMETER = -2 }Enumerates the API access states.
OH_NativeXComponent_TouchEventType {
OH_NATIVEXCOMPONENT_DOWN = 0, OH_NATIVEXCOMPONENT_UP, OH_NATIVEXCOMPONENT_MOVE, OH_NATIVEXCOMPONENT_CANCEL,
OH_NATIVEXCOMPONENT_UNKNOWN
}
Enumerates the touch event types.
OH_NativeXComponent_TouchPointToolType {
OH_NATIVEXCOMPONENT_TOOL_TYPE_UNKNOWN = 0, OH_NATIVEXCOMPONENT_TOOL_TYPE_FINGER, OH_NATIVEXCOMPONENT_TOOL_TYPE_PEN, OH_NATIVEXCOMPONENT_TOOL_TYPE_RUBBER,
OH_NATIVEXCOMPONENT_TOOL_TYPE_BRUSH, OH_NATIVEXCOMPONENT_TOOL_TYPE_PENCIL, OH_NATIVEXCOMPONENT_TOOL_TYPE_AIRBRUSH, OH_NATIVEXCOMPONENT_TOOL_TYPE_MOUSE,
OH_NATIVEXCOMPONENT_TOOL_TYPE_LENS
}
Enumerates the touch point tool types.
OH_NativeXComponent_EventSourceType {
OH_NATIVEXCOMPONENT_SOURCE_TYPE_UNKNOWN = 0, OH_NATIVEXCOMPONENT_SOURCE_TYPE_MOUSE, OH_NATIVEXCOMPONENT_SOURCE_TYPE_TOUCHSCREEN, OH_NATIVEXCOMPONENT_SOURCE_TYPE_TOUCHPAD,
OH_NATIVEXCOMPONENT_SOURCE_TYPE_JOYSTICK, OH_NATIVEXCOMPONENT_SOURCE_TYPE_KEYBOARD
}
Enumerates the touch event source types.
OH_NativeXComponent_MouseEventAction { OH_NATIVEXCOMPONENT_MOUSE_NONE = 0, OH_NATIVEXCOMPONENT_MOUSE_PRESS, OH_NATIVEXCOMPONENT_MOUSE_RELEASE, OH_NATIVEXCOMPONENT_MOUSE_MOVE }Enumerates the mouse event actions.
OH_NativeXComponent_MouseEventButton {
OH_NATIVEXCOMPONENT_NONE_BUTTON = 0, OH_NATIVEXCOMPONENT_LEFT_BUTTON = 0x01, OH_NATIVEXCOMPONENT_RIGHT_BUTTON = 0x02, OH_NATIVEXCOMPONENT_MIDDLE_BUTTON = 0x04,
OH_NATIVEXCOMPONENT_BACK_BUTTON = 0x08, OH_NATIVEXCOMPONENT_FORWARD_BUTTON = 0x10
}
Enumerates the mouse event buttons.

Functions

NameDescription
int32_t OH_NativeXComponent_GetXComponentId (OH_NativeXComponent *component, char *id, uint64_t *size)Obtains the ID of ArkUI XComponent.
int32_t OH_NativeXComponent_GetXComponentSize (OH_NativeXComponent *component, const void *window, uint64_t *width, uint64_t *height)Obtains the size of the surface held by the ArkUI XComponent.
int32_t OH_NativeXComponent_GetXComponentOffset (OH_NativeXComponent *component, const void *window, double *x, double *y)Obtains the offset of the ArkUI XComponent relative to the upper left vertex of the screen.
int32_t OH_NativeXComponent_GetTouchEvent (OH_NativeXComponent *component, const void *window, OH_NativeXComponent_TouchEvent *touchEvent)Obtains the touch event scheduled by the ArkUI XComponent.
int32_t OH_NativeXComponent_GetTouchPointToolType (OH_NativeXComponent *component, uint32_t pointIndex, OH_NativeXComponent_TouchPointToolType *toolType)Obtains the ArkUI XComponent touch point tool type.
int32_t OH_NativeXComponent_GetTouchPointTiltX (OH_NativeXComponent *component, uint32_t pointIndex, float *tiltX)Obtains the angle between the Y-Z plane of the ArkUI XComponent touch point and the x-axis.
int32_t OH_NativeXComponent_GetTouchPointTiltY (OH_NativeXComponent *component, uint32_t pointIndex, float *tiltY)Obtains the angle between the X-Z plane of the ArkUI XComponent touch point and the y-axis.
int32_t OH_NativeXComponent_GetMouseEvent (OH_NativeXComponent *component, const void *window, OH_NativeXComponent_MouseEvent *mouseEvent)Obtains the mouse event scheduled by ArkUI XComponent.
int32_t OH_NativeXComponent_RegisterCallback (OH_NativeXComponent *component, OH_NativeXComponent_Callback *callback)Registers a callback for this OH_NativeXComponent instance.
int32_t OH_NativeXComponent_RegisterMouseEventCallback (OH_NativeXComponent *component, OH_NativeXComponent_MouseEvent_Callback *callback)Registers the mouse event callback for this OH_NativeXComponent instance.
int32_t OH_NativeXComponent_RegisterFocusEventCallback (OH_NativeXComponent *component, void(*callback)(OH_NativeXComponent *component, void *window))Registers the focus obtaining event callback for this OH_NativeXComponent instance.
int32_t OH_NativeXComponent_RegisterKeyEventCallback (OH_NativeXComponent *component, void(*callback)(OH_NativeXComponent *component, void *window))Registers the key event callback for this OH_NativeXComponent instance.
int32_t OH_NativeXComponent_RegisterBlurEventCallback (OH_NativeXComponent *component, void(*callback)(OH_NativeXComponent *component, void *window))Registers the focus loss event callback for this OH_NativeXComponent instance.
int32_t OH_NativeXComponent_GetKeyEvent (OH_NativeXComponent *component, OH_NativeXComponent_KeyEvent **keyEvent)Obtains the key event scheduled by ArkUI XComponent.
int32_t OH_NativeXComponent_GetKeyEventAction (OH_NativeXComponent_KeyEvent *keyEvent, OH_NativeXComponent_KeyAction *action)Obtains the action of the specified key event.
int32_t OH_NativeXComponent_GetKeyEventCode (OH_NativeXComponent_KeyEvent *keyEvent, OH_NativeXComponent_KeyCode *code)Obtains the key code of the specified key event.
int32_t OH_NativeXComponent_GetKeyEventSourceType (OH_NativeXComponent_KeyEvent *keyEvent, OH_NativeXComponent_EventSourceType *sourceType)Obtains the source type of the specified key event.
int32_t OH_NativeXComponent_GetKeyEventDeviceId (OH_NativeXComponent_KeyEvent *keyEvent, int64_t *deviceId)Obtains the device ID of the specified key event.
int32_t OH_NativeXComponent_GetKeyEventTimeStamp (OH_NativeXComponent_KeyEvent *keyEvent, int64_t *timeStamp)Obtains the timestamp of the specified key event.
int32_t OH_NativeXComponent_SetExpectedFrameRateRange (OH_NativeXComponent *component, OH_NativeXComponent_ExpectedRateRange *range)Sets the expected frame rate range.
int32_t OH_NativeXComponent_RegisterOnFrameCallback (OH_NativeXComponent *component, void(*callback)(OH_NativeXComponent *component, uint64_t timestamp, uint64_t targetTimestamp))Registers the display update callback for this OH_NativeXComponent instance and enables the callback for each frame.
int32_t OH_NativeXComponent_UnregisterOnFrameCallback (OH_NativeXComponent *component)Deregisters the display update callback for this OH_NativeXComponent instance and disables the callback for each frame.
int32_t OH_NativeXComponent_AttachNativeRootNode (OH_NativeXComponent *component, ArkUI_NodeHandle root)Attaches the UI component created through the native API of ArkUI to this OH_NativeXComponent instance.
int32_t OH_NativeXComponent_DetachNativeRootNode (OH_NativeXComponent *component, ArkUI_NodeHandle root)Detaches the native component of ArkUI from this OH_NativeXComponent instance.
int32_t OH_NativeXComponent_RegisterUIInputEventCallback (OH_NativeXComponent *component, void(*callback)(OH_NativeXComponent *component, ArkUI_UIInputEvent *event, ArkUI_UIInputEvent_Type type), ArkUI_UIInputEvent_Type type)Registers a UI input event callback for an OH_NativeXComponent instance and enables the callback to be invoked when a UI input event is received.
int32_t OH_NativeXComponent_RegisterOnTouchInterceptCallback (OH_NativeXComponent *component, HitTestMode(*callback)(OH_NativeXComponent *component, ArkUI_UIInputEvent *event))Registers a custom event intercept callback for an OH_NativeXComponent and enables the callback during the hit test.
int32_t OH_NativeXComponent_SetNeedSoftKeyboard (OH_NativeXComponent *component, bool needSoftKeyboard)Sets whether the soft keyboard is required for an OH_NativeXComponent instance.
int32_t OH_NativeXComponent_RegisterSurfaceShowCallback (OH_NativeXComponent *component, void(*callback)(OH_NativeXComponent *component, void *window))Registers a surface display callback for an OH_NativeXComponent instance. The callback is invoked whenever the application is switched to the foreground.
int32_t OH_NativeXComponent_RegisterSurfaceHideCallback (OH_NativeXComponent *component, void(*callback)(OH_NativeXComponent *component, void *window))Registers a surface hiding callback for an OH_NativeXComponent instance. The callback is invoked whenever the application is switched to the background.
int32_t OH_NativeXComponent_GetTouchEventSourceType (OH_NativeXComponent *component, int32_t pointId, OH_NativeXComponent_EventSourceType *sourceType)Obtains the touch event source type of an OH_NativeXComponent instance.
OH_NativeXComponent * OH_NativeXComponent_GetNativeXComponent (ArkUI_NodeHandle node)Obtains the pointer to an OH_NativeXComponent instance based on the specified component instance created by the native API.

Variables

NameDescription
const uint32_t OH_XCOMPONENT_ID_LEN_MAX = 128Maximum length of the ArkUI XComponent ID.
const uint32_t OH_MAX_TOUCH_POINTS_NUMBER = 10Maximum number of identifiable touch points in a touch event.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙ArkUI

harmony 鸿蒙ARKUI_TextPickerCascadeRangeContent

harmony 鸿蒙ARKUI_TextPickerRangeContent

harmony 鸿蒙ArkUI_AnimateCompleteCallback

harmony 鸿蒙ArkUI_AttributeItem

harmony 鸿蒙ArkUI_ColorStop

harmony 鸿蒙ArkUI_ContextCallback

harmony 鸿蒙ArkUI_EventModule

harmony 鸿蒙ArkUI_ExpectedFrameRateRange

harmony 鸿蒙ArkUI_IntOffset

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