harmony 鸿蒙native_interface_xcomponent.h

  • 2022-08-09
  • 浏览 (714)

native_interface_xcomponent.h

概述

声明用于访问Native XComponent的API。

起始版本:

8

相关模块:

Native XComponent

汇总

结构体

名称 描述
OH_NativeXComponent_TouchPoint 触摸事件中触摸点的信息。
OH_NativeXComponent_TouchEvent 触摸事件。
OH_NativeXComponent_MouseEvent 鼠标事件。
OH_NativeXComponent_Callback 注册surface生命周期和触摸事件回调。
OH_NativeXComponent_MouseEvent_Callback 注册鼠标事件的回调。

类型定义

名称 描述
OH_NativeXComponent 提供封装的OH_NativeXComponent实例。
OH_NativeXComponent_Callback 注册surface生命周期和触摸事件回调。
OH_NativeXComponent_MouseEvent_Callback 注册鼠标事件的回调。
OH_NativeXComponent_KeyEvent 提供封装的OH_NativeXComponent_KeyEvent实例。

枚举

枚举名称 描述
{ OH_NATIVEXCOMPONENT_RESULT_SUCCESS = 0, OH_NATIVEXCOMPONENT_RESULT_FAILED = -1, OH_NATIVEXCOMPONENT_RESULT_BAD_PARAMETER = -2 } 枚举API访问状态。
OH_NativeXComponent_TouchEventType {
OH_NATIVEXCOMPONENT_DOWN = 0, OH_NATIVEXCOMPONENT_UP, OH_NATIVEXCOMPONENT_MOVE, OH_NATIVEXCOMPONENT_CANCEL,
OH_NATIVEXCOMPONENT_UNKNOWN
}
触摸事件类型。
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
}
触摸点工具类型。
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
}
触摸事件源类型。
OH_NativeXComponent_MouseEventAction { OH_NATIVEXCOMPONENT_MOUSE_NONE = 0, OH_NATIVEXCOMPONENT_MOUSE_PRESS, OH_NATIVEXCOMPONENT_MOUSE_RELEASE, OH_NATIVEXCOMPONENT_MOUSE_MOVE } 鼠标事件动作。
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
}
鼠标事件按键。

函数

名称 描述
OH_NativeXComponent_GetXComponentId (OH_NativeXComponent *component, char *id, uint64_t *size) 获取ArkUI XComponent的id。
OH_NativeXComponent_GetXComponentSize (OH_NativeXComponent *component, const void *window, uint64_t *width, uint64_t *height) 获取ArkUI XComponent持有的surface的大小。
OH_NativeXComponent_GetXComponentOffset (OH_NativeXComponent *component, const void *window, double *x, double *y) 获取ArkUI XComponent组件相对屏幕左上顶点的偏移量。
OH_NativeXComponent_GetTouchEvent (OH_NativeXComponent *component, const void *window, OH_NativeXComponent_TouchEvent *touchEvent) 获取ArkUI XComponent调度的触摸事件。
OH_NativeXComponent_GetTouchPointToolType (OH_NativeXComponent *component, uint32_t pointIndex, OH_NativeXComponent_TouchPointToolType *toolType) 获取ArkUI XComponent触摸点工具类型。
OH_NativeXComponent_GetTouchPointTiltX (OH_NativeXComponent *component, uint32_t pointIndex, float *tiltX) 获取ArkUI XComponent触摸点倾斜与X轴角度。
OH_NativeXComponent_GetTouchPointTiltY (OH_NativeXComponent *component, uint32_t pointIndex, float *tiltY) 获取ArkUI XComponent触摸点倾斜与Y轴角度。
OH_NativeXComponent_GetMouseEvent (OH_NativeXComponent *component, const void *window, OH_NativeXComponent_MouseEvent *mouseEvent) 获取ArkUI XComponent调度的鼠标事件。
OH_NativeXComponent_RegisterCallback (OH_NativeXComponent *component, OH_NativeXComponent_Callback *callback) 为此OH_NativeXComponent实例注册回调。
OH_NativeXComponent_RegisterMouseEventCallback (OH_NativeXComponent *component, OH_NativeXComponent_MouseEvent_Callback *callback) 为此OH_NativeXComponent实例注册鼠标事件回调。
OH_NativeXComponent_RegisterFocusEventCallback (OH_NativeXComponent *component, void(*callback)(OH_NativeXComponent *component, void *window)) 为此OH_NativeXComponent实例注册获焦事件回调。
OH_NativeXComponent_RegisterKeyEventCallback (OH_NativeXComponent *component, void(*callback)(OH_NativeXComponent *component, void *window)) 为此OH_NativeXComponent实例注册按键事件回调。
OH_NativeXComponent_RegisterBlurEventCallback (OH_NativeXComponent *component, void(*callback)(OH_NativeXComponent *component, void *window)) 为此OH_NativeXComponent实例注册失焦事件回调。
OH_NativeXComponent_GetKeyEvent (OH_NativeXComponent *component, OH_NativeXComponent_KeyEvent **keyEvent) 获取ArkUI XComponent调度的按键事件。
OH_NativeXComponent_GetKeyEventAction (OH_NativeXComponent_KeyEvent *keyEvent, OH_NativeXComponent_KeyAction *action) 获取传入按键事件的动作。
OH_NativeXComponent_GetKeyEventCode (OH_NativeXComponent_KeyEvent *keyEvent, OH_NativeXComponent_KeyCode *code) 获取传入按键事件的按键码。
OH_NativeXComponent_GetKeyEventSourceType (OH_NativeXComponent_KeyEvent *keyEvent, OH_NativeXComponent_EventSourceType *sourceType) 获取传入按键事件的事件源类型。
OH_NativeXComponent_GetKeyEventDeviceId (OH_NativeXComponent_KeyEvent *keyEvent, int64_t *deviceId) 获取传入按键事件的设备id。
OH_NativeXComponent_GetKeyEventTimeStamp (OH_NativeXComponent_KeyEvent *keyEvent, int64_t *timeStamp) 获取传入按键事件的时间戳。

变量

名称 描述
OH_XCOMPONENT_ID_LEN_MAX = 128 ArkUI XComponent的id的最大长度。
OH_MAX_TOUCH_POINTS_NUMBER = 10 触摸事件中的可识别的触摸点个数最大值。

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Native API

harmony 鸿蒙AVCapability

harmony 鸿蒙AVDemuxer

harmony 鸿蒙AVMuxer

harmony 鸿蒙AVScreenCapture

harmony 鸿蒙AVSource

harmony 鸿蒙AudioDecoder

harmony 鸿蒙AudioEncoder

harmony 鸿蒙CodecBase

harmony 鸿蒙Core

0  赞