harmony 鸿蒙Native XComponent

  • 2023-06-24
  • 浏览 (897)

Native XComponent

Overview

Describes the surface and touch event held by the ArkUI XComponent, which can be used for the EGL/OpenGL ES and media data input and displayed on the ArkUI XComponent. For details, see XComponent Development

Since

8

Summary

Files

Name Description
native_interface_xcomponent.h Declares the APIs for accessing NativeXComponent.
File to include: <ace/xcomponent/native_interface_xcomponent.h>
Library: libace_ndk.z.so
native_xcomponent_key_event.h Declares the enums used to access NativeXComponent key events.
File to include: <ace/xcomponent/native_xcomponent_key_event.h>
Library: libace_ndk.z.so

Structs

Name Description
OH_NativeXComponent_TouchPoint Describes the touch point of the touch event.
OH_NativeXComponent_TouchEvent Describes the touch event.
OH_NativeXComponent_MouseEvent Describes the mouse event.
OH_NativeXComponent_Callback Registers callbacks for the surface lifecycle and touch event.
OH_NativeXComponent_MouseEvent_Callback Registers callbacks for the mouse event.

Types

Name Description
OH_NativeXComponent Provides an encapsulated OH_NativeXComponent instance.
OH_NativeXComponent_Callback Registers callbacks for the surface lifecycle and touch event.
OH_NativeXComponent_MouseEvent_Callback Registers callbacks for the mouse event.
OH_NativeXComponent_KeyEvent Provides an encapsulated OH_NativeXComponent_KeyEvent instance.

Enums

Name Description
{ 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.
OH_NativeXComponent_KeyCode {
KEY_UNKNOWN = -1, KEY_FN = 0, KEY_HOME = 1, KEY_BACK = 2,KEY_MEDIA_PLAY_PAUSE = 10, KEY_MEDIA_STOP = 11, KEY_MEDIA_NEXT = 12, KEY_MEDIA_PREVIOUS = 13,
KEY_MEDIA_REWIND = 14, KEY_MEDIA_FAST_FORWARD = 15, KEY_VOLUME_UP = 16, KEY_VOLUME_DOWN = 17,
KEY_POWER = 18, KEY_CAMERA = 19, KEY_VOLUME_MUTE = 22, KEY_MUTE = 23,KEY_BRIGHTNESS_UP = 40, KEY_BRIGHTNESS_DOWN = 41, KEY_0 = 2000, KEY_1 = 2001,
KEY_2 = 2002, KEY_3 = 2003, KEY_4 = 2004, KEY_5 = 2005,
KEY_6 = 2006, KEY_7 = 2007, KEY_8 = 2008, KEY_9 = 2009,
KEY_STAR = 2010, KEY_POUND = 2011, KEY_DPAD_UP = 2012, KEY_DPAD_DOWN = 2013,KEY_DPAD_LEFT = 2014, KEY_DPAD_RIGHT = 2015, KEY_DPAD_CENTER = 2016,
KEY_A = 2017,
KEY_B = 2018, KEY_C = 2019, KEY_D = 2020, KEY_E = 2021,
KEY_F = 2022, KEY_G = 2023, KEY_H = 2024, KEY_I = 2025,
KEY_J = 2026, KEY_K = 2027, KEY_L = 2028, KEY_M = 2029,
KEY_N = 2030, KEY_O = 2031, KEY_P = 2032, KEY_Q = 2033,
KEY_R = 2034, KEY_S = 2035, KEY_T = 2036, KEY_U = 2037,
KEY_V = 2038, KEY_W = 2039, KEY_X = 2040, KEY_Y = 2041,
KEY_Z = 2042, KEY_COMMA = 2043, KEY_PERIOD = 2044, KEY_ALT_LEFT = 2045,
KEY_ALT_RIGHT = 2046, KEY_SHIFT_LEFT = 2047, KEY_SHIFT_RIGHT = 2048, KEY_TAB = 2049,
KEY_SPACE = 2050, KEY_SYM = 2051, KEY_EXPLORER = 2052, KEY_ENVELOPE = 2053,
KEY_ENTER = 2054, KEY_DEL = 2055, KEY_GRAVE = 2056, KEY_MINUS = 2057,
KEY_EQUALS = 2058, KEY_LEFT_BRACKET = 2059, KEY_RIGHT_BRACKET = 2060, KEY_BACKSLASH = 2061,
KEY_SEMICOLON = 2062, KEY_APOSTROPHE = 2063, KEY_SLASH = 2064, KEY_AT = 2065,
KEY_PLUS = 2066, KEY_MENU = 2067, KEY_PAGE_UP = 2068, KEY_PAGE_DOWN = 2069,
KEY_ESCAPE = 2070, KEY_FORWARD_DEL = 2071, KEY_CTRL_LEFT = 2072, KEY_CTRL_RIGHT = 2073,
KEY_CAPS_LOCK = 2074, KEY_SCROLL_LOCK = 2075, KEY_META_LEFT = 2076, KEY_META_RIGHT = 2077,
KEY_FUNCTION = 2078, KEY_SYSRQ = 2079, KEY_BREAK = 2080, KEY_MOVE_HOME = 2081,
KEY_MOVE_END = 2082, KEY_INSERT = 2083, KEY_FORWARD = 2084, KEY_MEDIA_PLAY = 2085,
KEY_MEDIA_PAUSE = 2086, KEY_MEDIA_CLOSE = 2087, KEY_MEDIA_EJECT = 2088, KEY_MEDIA_RECORD = 2089,
KEY_F1 = 2090, KEY_F2 = 2091, KEY_F3 = 2092, KEY_F4 = 2093,
KEY_F5 = 2094, KEY_F6 = 2095, KEY_F7 = 2096, KEY_F8 = 2097,
KEY_F9 = 2098, KEY_F10 = 2099, KEY_F11 = 2100, KEY_F12 = 2101,
KEY_NUM_LOCK = 2102, KEY_NUMPAD_0 = 2103, KEY_NUMPAD_1 = 2104, KEY_NUMPAD_2 = 2105,
KEY_NUMPAD_3 = 2106, KEY_NUMPAD_4 = 2107, KEY_NUMPAD_5 = 2108, KEY_NUMPAD_6 = 2109,
KEY_NUMPAD_7 = 2110, KEY_NUMPAD_8 = 2111, KEY_NUMPAD_9 = 2112, KEY_NUMPAD_DIVIDE = 2113,
KEY_NUMPAD_MULTIPLY = 2114, KEY_NUMPAD_SUBTRACT = 2115, KEY_NUMPAD_ADD = 2116, KEY_NUMPAD_DOT = 2117,
KEY_NUMPAD_COMMA = 2118, KEY_NUMPAD_ENTER = 2119, KEY_NUMPAD_EQUALS = 2120, KEY_NUMPAD_LEFT_PAREN = 2121,
KEY_NUMPAD_RIGHT_PAREN = 2122, KEY_VIRTUAL_MULTITASK = 2210, KEY_SLEEP = 2600, KEY_ZENKAKU_HANKAKU = 2601,
KEY_102ND = 2602, KEY_RO = 2603, KEY_KATAKANA = 2604, KEY_HIRAGANA = 2605,
KEY_HENKAN = 2606, KEY_KATAKANA_HIRAGANA = 2607, KEY_MUHENKAN = 2608, KEY_LINEFEED = 2609,
KEY_MACRO = 2610, KEY_NUMPAD_PLUSMINUS = 2611, KEY_SCALE = 2612, KEY_HANGUEL = 2613,
KEY_HANJA = 2614, KEY_YEN = 2615, KEY_STOP = 2616, KEY_AGAIN = 2617,
KEY_PROPS = 2618, KEY_UNDO = 2619, KEY_COPY = 2620, KEY_OPEN = 2621,
KEY_PASTE = 2622, KEY_FIND = 2623, KEY_CUT = 2624, KEY_HELP = 2625,
KEY_CALC = 2626, KEY_FILE = 2627, KEY_BOOKMARKS = 2628, KEY_NEXT = 2629,
KEY_PLAYPAUSE = 2630, KEY_PREVIOUS = 2631, KEY_STOPCD = 2632, KEY_CONFIG = 2634,
KEY_REFRESH = 2635, KEY_EXIT = 2636, KEY_EDIT = 2637, KEY_SCROLLUP = 2638,
KEY_SCROLLDOWN = 2639, KEY_NEW = 2640, KEY_REDO = 2641, KEY_CLOSE = 2642,
KEY_PLAY = 2643, KEY_BASSBOOST = 2644, KEY_PRINT = 2645, KEY_CHAT = 2646,
KEY_FINANCE = 2647, KEY_CANCEL = 2648, KEY_KBDILLUM_TOGGLE = 2649, KEY_KBDILLUM_DOWN = 2650,
KEY_KBDILLUM_UP = 2651, KEY_SEND = 2652, KEY_REPLY = 2653, KEY_FORWARDMAIL = 2654,
KEY_SAVE = 2655, KEY_DOCUMENTS = 2656, KEY_VIDEO_NEXT = 2657, KEY_VIDEO_PREV = 2658,
KEY_BRIGHTNESS_CYCLE = 2659, KEY_BRIGHTNESS_ZERO = 2660, KEY_DISPLAY_OFF = 2661, KEY_BTN_MISC = 2662,
KEY_GOTO = 2663, KEY_INFO = 2664, KEY_PROGRAM = 2665, KEY_PVR = 2666,
KEY_SUBTITLE = 2667, KEY_FULL_SCREEN = 2668, KEY_KEYBOARD = 2669, KEY_ASPECT_RATIO = 2670,
KEY_PC = 2671, KEY_TV = 2672, KEY_TV2 = 2673, KEY_VCR = 2674,
KEY_VCR2 = 2675, KEY_SAT = 2676, KEY_CD = 2677, KEY_TAPE = 2678,
KEY_TUNER = 2679, KEY_PLAYER = 2680, KEY_DVD = 2681, KEY_AUDIO = 2682,
KEY_VIDEO = 2683, KEY_MEMO = 2684, KEY_CALENDAR = 2685, KEY_RED = 2686,
KEY_GREEN = 2687, KEY_YELLOW = 2688, KEY_BLUE = 2689, KEY_CHANNELUP = 2690,
KEY_CHANNELDOWN = 2691, KEY_LAST = 2692, KEY_RESTART = 2693, KEY_SLOW = 2694,
KEY_SHUFFLE = 2695, KEY_VIDEOPHONE = 2696, KEY_GAMES = 2697, KEY_ZOOMIN = 2698,
KEY_ZOOMOUT = 2699, KEY_ZOOMRESET = 2700, KEY_WORDPROCESSOR = 2701, KEY_EDITOR = 2702,
KEY_SPREADSHEET = 2703, KEY_GRAPHICSEDITOR = 2704, KEY_PRESENTATION = 2705, KEY_DATABASE = 2706,
KEY_NEWS = 2707, KEY_VOICEMAIL = 2708, KEY_ADDRESSBOOK = 2709, KEY_MESSENGER = 2710,
KEY_BRIGHTNESS_TOGGLE = 2711, KEY_SPELLCHECK = 2712, KEY_COFFEE = 2713, KEY_MEDIA_REPEAT = 2714,
KEY_IMAGES = 2715, KEY_BUTTONCONFIG = 2716, KEY_TASKMANAGER = 2717, KEY_JOURNAL = 2718,
KEY_CONTROLPANEL = 2719, KEY_APPSELECT = 2720, KEY_SCREENSAVER = 2721, KEY_ASSISTANT = 2722,
KEY_KBD_LAYOUT_NEXT = 2723, KEY_BRIGHTNESS_MIN = 2724, KEY_BRIGHTNESS_MAX = 2725, KEY_KBDINPUTASSIST_PREV = 2726,
KEY_KBDINPUTASSIST_NEXT = 2727, KEY_KBDINPUTASSIST_PREVGROUP = 2728, KEY_KBDINPUTASSIST_NEXTGROUP = 2729, KEY_KBDINPUTASSIST_ACCEPT = 2730,
KEY_KBDINPUTASSIST_CANCEL = 2731, KEY_FRONT = 2800, KEY_SETUP = 2801, KEY_WAKEUP = 2802,
KEY_SENDFILE = 2803, KEY_DELETEFILE = 2804, KEY_XFER = 2805, KEY_PROG1 = 2806,
KEY_PROG2 = 2807, KEY_MSDOS = 2808, KEY_SCREENLOCK = 2809, KEY_DIRECTION_ROTATE_DISPLAY = 2810,
KEY_CYCLEWINDOWS = 2811, KEY_COMPUTER = 2812, KEY_EJECTCLOSECD = 2813, KEY_ISO = 2814,
KEY_MOVE = 2815, KEY_F13 = 2816, KEY_F14 = 2817, KEY_F15 = 2818,
KEY_F16 = 2819, KEY_F17 = 2820, KEY_F18 = 2821, KEY_F19 = 2822,
KEY_F20 = 2823, KEY_F21 = 2824, KEY_F22 = 2825, KEY_F23 = 2826,
KEY_F24 = 2827, KEY_PROG3 = 2828, KEY_PROG4 = 2829, KEY_DASHBOARD = 2830,
KEY_SUSPEND = 2831, KEY_HP = 2832, KEY_SOUND = 2833, KEY_QUESTION = 2834,
KEY_CONNECT = 2836, KEY_SPORT = 2837, KEY_SHOP = 2838, KEY_ALTERASE = 2839,
KEY_SWITCHVIDEOMODE = 2841, KEY_BATTERY = 2842, KEY_BLUETOOTH = 2843, KEY_WLAN = 2844,
KEY_UWB = 2845, KEY_WWAN_WIMAX = 2846, KEY_RFKILL = 2847, KEY_CHANNEL = 3001,
KEY_BTN_0 = 3100, KEY_BTN_1 = 3101, KEY_BTN_2 = 3102, KEY_BTN_3 = 3103,
KEY_BTN_4 = 3104, KEY_BTN_5 = 3105, KEY_BTN_6 = 3106, KEY_BTN_7 = 3107,
KEY_BTN_8 = 3108, KEY_BTN_9 = 3109
}
Enumerates the mouse event key codes.
OH_NativeXComponent_KeyAction { OH_NATIVEXCOMPONENT_KEY_ACTION_UNKNOWN = -1, OH_NATIVEXCOMPONENT_KEY_ACTION_DOWN = 0, OH_NATIVEXCOMPONENT_KEY_ACTION_UP } Enumerates the key event actions.

Functions

Name Description
OH_NativeXComponent_GetXComponentId (OH_NativeXComponent *component, char *id, uint64_t *size) Obtains the ID of the ArkUI XComponent.
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.
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.
OH_NativeXComponent_GetTouchEvent (OH_NativeXComponent *component, const void *window, OH_NativeXComponent_TouchEvent *touchEvent) Obtains the touch event scheduled by the ArkUI XComponent.
OH_NativeXComponent_GetTouchPointToolType (OH_NativeXComponent *component, uint32_t pointIndex, OH_NativeXComponent_TouchPointToolType *toolType) Obtains the ArkUI XComponent touch point tool type.
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.
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.
OH_NativeXComponent_GetMouseEvent (OH_NativeXComponent *component, const void *window, OH_NativeXComponent_MouseEvent *mouseEvent) Obtains the mouse event scheduled by ArkUI XComponent.
OH_NativeXComponent_RegisterCallback (OH_NativeXComponent *component, OH_NativeXComponent_Callback *callback) Registers a callback for this OH_NativeXComponent instance.
OH_NativeXComponent_RegisterMouseEventCallback (OH_NativeXComponent *component, OH_NativeXComponent_MouseEvent_Callback *callback) Registers the mouse event callback for this OH_NativeXComponent instance.
OH_NativeXComponent_RegisterFocusEventCallback (OH_NativeXComponent *component, void(*callback)(OH_NativeXComponent *component, void *window)) Registers the focus obtaining event callback for this OH_NativeXComponent instance.
OH_NativeXComponent_RegisterKeyEventCallback (OH_NativeXComponent *component, void(*callback)(OH_NativeXComponent *component, void *window)) Registers the key event callback for this OH_NativeXComponent instance.
OH_NativeXComponent_RegisterBlurEventCallback (OH_NativeXComponent *component, void(*callback)(OH_NativeXComponent *component, void *window)) Registers the focus loss event callback for this OH_NativeXComponent instance.
OH_NativeXComponent_GetKeyEvent (OH_NativeXComponent *component, OH_NativeXComponent_KeyEvent **keyEvent) Obtains the key event scheduled by the ArkUI XComponent.
OH_NativeXComponent_GetKeyEventAction (OH_NativeXComponent_KeyEvent *keyEvent, OH_NativeXComponent_KeyAction *action) Obtains the action of the specified key event.
OH_NativeXComponent_GetKeyEventCode (OH_NativeXComponent_KeyEvent *keyEvent, OH_NativeXComponent_KeyCode *code) Obtains the key code of the specified key event.
OH_NativeXComponent_GetKeyEventSourceType (OH_NativeXComponent_KeyEvent *keyEvent, OH_NativeXComponent_EventSourceType *sourceType) Obtains the source type of the specified key event.
OH_NativeXComponent_GetKeyEventDeviceId (OH_NativeXComponent_KeyEvent *keyEvent, int64_t *deviceId) Obtains the device ID of the specified key event.
OH_NativeXComponent_GetKeyEventTimeStamp (OH_NativeXComponent_KeyEvent *keyEvent, int64_t *timeStamp) Obtains the timestamp of the specified key event.

Variables

Name Description
OH_XCOMPONENT_ID_LEN_MAX = 128 Maximum length of the ArkUI XComponent ID.
OH_MAX_TOUCH_POINTS_NUMBER = 10 Maximum number of identifiable touch points in a touch event.
OH_NativeXComponent_TouchPoint::id = 0 Unique identifier of the finger.
OH_NativeXComponent_TouchPoint::screenX = 0.0 X coordinate of the touch point relative to the left edge of the application window where the XComponent is located.
OH_NativeXComponent_TouchPoint::screenY = 0.0 Y coordinate of the touch point relative to the left edge of the application window where the XComponent is located.
OH_NativeXComponent_TouchPoint::x = 0.0 X coordinate of the touch point relative to the left edge of the XComponent.
OH_NativeXComponent_TouchPoint::y = 0.0 Y coordinate of the touch point relative to the upper edge of the XComponent.
OH_NativeXComponent_TouchPoint::type = OH_NativeXComponent_TouchEventType::OH_NATIVEXCOMPONENT_UNKNOWN Touch type of the touch event.
OH_NativeXComponent_TouchPoint::size = 0.0 Contact area between the finger pad and the screen.
OH_NativeXComponent_TouchPoint::force = 0.0 Pressure of the touch event.
OH_NativeXComponent_TouchPoint::timeStamp = 0 Timestamp of the touch point.
OH_NativeXComponent_TouchPoint::isPressed = false Whether the current point is pressed.
OH_NativeXComponent_TouchEvent::id = 0 Unique identifier of the finger.
OH_NativeXComponent_TouchEvent::screenX = 0.0 X coordinate of the touch point relative to the left edge of the screen.
OH_NativeXComponent_TouchEvent::screenY = 0.0 Y coordinate of the touch point relative to the upper edge of the screen.
OH_NativeXComponent_TouchEvent::x = 0.0 X coordinate of the touch point relative to the left edge of the XComponent.
OH_NativeXComponent_TouchEvent::y = 0.0 Y coordinate of the touch point relative to the upper edge of the XComponent.
OH_NativeXComponent_TouchEvent::type = OH_NativeXComponent_TouchEventType::OH_NATIVEXCOMPONENT_UNKNOWN Touch type of the touch event.
OH_NativeXComponent_TouchEvent::size = 0.0 Contact area between the finger pad and the screen.
OH_NativeXComponent_TouchEvent::force = 0.0 Pressure of the touch event.
OH_NativeXComponent_TouchEvent::deviceId = 0 ID of the device where the current touch event is triggered.
OH_NativeXComponent_TouchEvent::timeStamp = 0 Timestamp of the touch event.
OH_NativeXComponent_TouchEvent::touchPoints [OH_MAX_TOUCH_POINTS_NUMBER] Array of the touch points.
OH_NativeXComponent_TouchEvent::numPoints = 0 Number of current touch points.
OH_NativeXComponent_MouseEvent::x = 0.0 X coordinate of the clicked point relative to the upper left corner of the component.
OH_NativeXComponent_MouseEvent::y= 0.0 Y coordinate of the clicked point relative to the upper left corner of the component.
OH_NativeXComponent_MouseEvent::screenX= 0.0 X coordinate of the clicked point relative to the upper left corner of the screen.
OH_NativeXComponent_MouseEvent::screenY= 0.0 Y coordinate of the clicked point relative to the upper left corner of the screen.
OH_NativeXComponent_MouseEvent::timestamp= 0 Timestamp of the mouse event.
OH_NativeXComponent_MouseEvent::action= OH_NativeXComponent_MouseEventAction::OH_NATIVEXCOMPONENT_MOUSE_NONE Action of the mouse event.
OH_NativeXComponent_MouseEvent::button= OH_NativeXComponent_MouseEventButton::OH_NATIVEXCOMPONENT_NONE_BUTTON Enumerates the mouse event buttons.
OH_NativeXComponent_Callback::OnSurfaceCreated Invoked when a surface is created.
OH_NativeXComponent_Callback::OnSurfaceChanged Invoked when the surface changes.
OH_NativeXComponent_Callback::OnSurfaceDestroyed Invoked when the surface is destroyed.
OH_NativeXComponent_Callback::DispatchTouchEvent Invoked when a touch event is triggered.
OH_NativeXComponent_MouseEvent_Callback::DispatchMouseEvent Invoked when a mouse event is triggered.
OH_NativeXComponent_MouseEvent_Callback::DispatchHoverEvent Invoked when a hover event is triggered.

Type Description

OH_NativeXComponent

typedef struct OH_NativeXComponent OH_NativeXComponent

Description

Provides an encapsulated OH_NativeXComponent instance.

Since

8

OH_NativeXComponent_Callback

typedef struct OH_NativeXComponent_Callback OH_NativeXComponent_Callback

Description

Registers callbacks for the surface lifecycle and touch event.

Since

8

OH_NativeXComponent_KeyEvent

typedef struct OH_NativeXComponent_KeyEvent OH_NativeXComponent_KeyEvent

Description

Provides an encapsulated OH_NativeXComponent_KeyEvent instance.

Since

10

OH_NativeXComponent_MouseEvent_Callback

typedef struct OH_NativeXComponent_MouseEvent_Callback OH_NativeXComponent_MouseEvent_Callback

Description

Registers callbacks for the mouse event.

Since

9

Enum Description

anonymous enum

anonymous enum

Description

Enumerates the API access states.

Value Description
OH_NATIVEXCOMPONENT_RESULT_SUCCESS Success.
OH_NATIVEXCOMPONENT_RESULT_FAILED Failure.
OH_NATIVEXCOMPONENT_RESULT_BAD_PARAMETER Invalid parameter.

Since

8

OH_NativeXComponent_EventSourceType

enum OH_NativeXComponent_EventSourceType

Description

Enumerates the touch event source types.

Value Description
OH_NATIVEXCOMPONENT_SOURCE_TYPE_UNKNOWN Unknown source type.
OH_NATIVEXCOMPONENT_SOURCE_TYPE_MOUSE Source that generates a mouse multi-click event.
OH_NATIVEXCOMPONENT_SOURCE_TYPE_TOUCHSCREEN Source that generates a touchscreen multi-touch event.
OH_NATIVEXCOMPONENT_SOURCE_TYPE_TOUCHPAD Source that generates a touchpad multi-touch event.
OH_NATIVEXCOMPONENT_SOURCE_TYPE_JOYSTICK Source that generates a joystick multi-touch event.
OH_NATIVEXCOMPONENT_SOURCE_TYPE_KEYBOARD Source that generates a key event.

Since

9

OH_NativeXComponent_KeyAction

enum OH_NativeXComponent_KeyAction

Description

Enumerates the key event actions.

Value Description
OH_NATIVEXCOMPONENT_KEY_ACTION_UNKNOWN Unknown key event action.
OH_NATIVEXCOMPONENT_KEY_ACTION_DOWN Button press.
OH_NATIVEXCOMPONENT_KEY_ACTION_UP Button release.

Since

10

OH_NativeXComponent_KeyCode

enum OH_NativeXComponent_KeyCode

Description

Enumerates the mouse event key codes.

Value Description
KEY_UNKNOWN Unknown key.
KEY_FN Function (Fn) key.
KEY_HOME Function (Home) key.
KEY_BACK Back key.
KEY_MEDIA_PLAY_PAUSE Multimedia key - play/pause.
KEY_MEDIA_STOP Multimedia key - stop.
KEY_MEDIA_NEXT Multimedia key - next song.
KEY_MEDIA_PREVIOUS Multimedia key - previous song.
KEY_MEDIA_REWIND Multimedia key - rewind.
KEY_MEDIA_FAST_FORWARD Multimedia key - fast-forward.
KEY_VOLUME_UP Volume Up key.
KEY_VOLUME_DOWN Volume Down key.
KEY_POWER Power key.
KEY_CAMERA Camera key.
KEY_VOLUME_MUTE Speaker Mute key.
KEY_MUTE Microphone Mute key.
KEY_BRIGHTNESS_UP Brightness key - turn up.
KEY_BRIGHTNESS_DOWN Brightness key - turn down.
KEY_0 Key 0.
KEY_1 Key 1.
KEY_2 Key 2.
KEY_3 Key 3.
KEY_4 Key 4.
KEY_5 Key 5.
KEY_6 Key 6.
KEY_7 Key 7.
KEY_8 Key 8.
KEY_9 Key 9.
KEY_STAR Key *.
KEY_POUND Key #.
KEY_DPAD_UP Navigation key - up.
KEY_DPAD_DOWN Navigation key - down.
KEY_DPAD_LEFT Navigation key - left.
KEY_DPAD_RIGHT Navigation key - right.
KEY_DPAD_CENTER Navigation key - OK.
KEY_A Key A.
KEY_B Key B.
KEY_C Key C.
KEY_D Key D.
KEY_E Key E.
KEY_F Key F.
KEY_G Key G.
KEY_H Key H.
KEY_I Key I.
KEY_J Key J.
KEY_K Key K.
KEY_L Key L.
KEY_M Key M.
KEY_N Key N.
KEY_O Key O.
KEY_P Key P.
KEY_Q Key Q.
KEY_R Key R.
KEY_S Key S.
KEY_T Key T.
KEY_U Key U.
KEY_V Key V.
KEY_W Key W.
KEY_X Key X.
KEY_Y Key Y.
KEY_Z Key Z.
KEY_COMMA Key ,.
KEY_PERIOD Key ..
KEY_ALT_LEFT Left Alt key.
KEY_ALT_RIGHT Right Alt key.
KEY_SHIFT_LEFT Left Shift key.
KEY_SHIFT_RIGHT Right Shift key.
KEY_TAB Tab key.
KEY_SPACE Space key.
KEY_SYM Symbol key.
KEY_EXPLORER Explorer key, which is used to start the explorer application.
KEY_ENVELOPE Email key, which is used to start the email application.
KEY_ENTER Enter key.
KEY_DEL Delete key.
KEY_GRAVE Key `.
KEY_MINUS Key -.
KEY_EQUALS Key =.
KEY_LEFT_BRACKET Key [.
KEY_RIGHT_BRACKET Key ].
KEY_BACKSLASH Key **.
KEY_SEMICOLON Key ;.
KEY_APOSTROPHE Key .
KEY_SLASH Key /.
KEY_AT Key \@.
KEY_PLUS Key +.
KEY_MENU Menu key.
KEY_PAGE_UP Page Up key.
KEY_PAGE_DOWN Page Down key.
KEY_ESCAPE ESC key.
KEY_FORWARD_DEL Delete key.
KEY_CTRL_LEFT Left Ctrl key.
KEY_CTRL_RIGHT Right Ctrl key.
KEY_CAPS_LOCK Caps Lock key.
KEY_SCROLL_LOCK Scroll Lock key.
KEY_META_LEFT Left Meta key.
KEY_META_RIGHT Right Meta key.
KEY_FUNCTION Function key.
KEY_SYSRQ System Request/Print Screen key.
KEY_BREAK Break/Pause key.
KEY_MOVE_HOME Move to Home key.
KEY_MOVE_END Move to End key.
KEY_INSERT Insert key.
KEY_FORWARD Forward key.
KEY_MEDIA_PLAY Multimedia key - play.
KEY_MEDIA_PAUSE Multimedia key - pause.
KEY_MEDIA_CLOSE Multimedia key - close.
KEY_MEDIA_EJECT Multimedia key - eject.
KEY_MEDIA_RECORD Multimedia key - record.
KEY_F1 F1 key.
KEY_F2 F2 key.
KEY_F3 F3 key.
KEY_F4 F4 key.
KEY_F5 F5 key.
KEY_F6 F6 key.
KEY_F7 F7 key.
KEY_F8 F8 key.
KEY_F9 F9 key.
KEY_F10 F10 key.
KEY_F11 F11 key.
KEY_F12 F12 key.
KEY_NUM_LOCK Number Lock key.
KEY_NUMPAD_0 Key 0 on numeric keypad.
KEY_NUMPAD_1 Key 1 on numeric keypad.
KEY_NUMPAD_2 Key 2 on numeric keypad.
KEY_NUMPAD_3 Key 3 on numeric keypad.
KEY_NUMPAD_4 Key 4 on numeric keypad.
KEY_NUMPAD_5 Key 5 on numeric keypad.
KEY_NUMPAD_6 Key 6 on numeric keypad.
KEY_NUMPAD_7 Key 7 on numeric keypad.
KEY_NUMPAD_8 Key 8 on numeric keypad.
KEY_NUMPAD_9 Key 9 on numeric keypad.
KEY_NUMPAD_DIVIDE Key / on numeric keypad.
KEY_NUMPAD_MULTIPLY Key ***** on numeric keypad.
KEY_NUMPAD_SUBTRACT Key - on numeric keypad.
KEY_NUMPAD_ADD Key + on numeric keypad.
KEY_NUMPAD_DOT Key . on numeric keypad.
KEY_NUMPAD_COMMA Key , on numeric keypad.
KEY_NUMPAD_ENTER Enter key on numeric keypad.
KEY_NUMPAD_EQUALS Key = on numeric keypad.
KEY_NUMPAD_LEFT_PAREN Key ( on numeric keypad.
KEY_NUMPAD_RIGHT_PAREN Key ) on numeric keypad.
KEY_VIRTUAL_MULTITASK Multi-task key.
KEY_SLEEP Sleep key.
KEY_ZENKAKU_HANKAKU Zenkaku/Hankaku key.
KEY_102ND 102nd key.
KEY_RO Ro key.
KEY_KATAKANA Katakana key.
KEY_HIRAGANA Hiragana key.
KEY_HENKAN Henkan key.
KEY_KATAKANA_HIRAGANA Katakana/Hiragana key.
KEY_MUHENKAN Muhenkan key.
KEY_LINEFEED Linefeed key.
KEY_MACRO Macro key.
KEY_NUMPAD_PLUSMINUS Plus/Minus key on the numeric keypad.
KEY_SCALE Scale key.
KEY_HANGUEL Hanguel key.
KEY_HANJA Hanja key.
KEY_YEN Yen key.
KEY_STOP Stop key.
KEY_AGAIN Again key.
KEY_PROPS Props key.
KEY_UNDO Undo key.
KEY_COPY Copy key.
KEY_OPEN Open key.
KEY_PASTE Paste key.
KEY_FIND Find key.
KEY_CUT Cut key.
KEY_HELP Help key.
KEY_CALC Calc key, which is used to start the calculator application.
KEY_FILE File key.
KEY_BOOKMARKS Bookmarks key.
KEY_NEXT Next key.
KEY_PLAYPAUSE Play/Pause key.
KEY_PREVIOUS Previous key.
KEY_STOPCD Stop CD key.
KEY_CONFIG Config key.
KEY_REFRESH Refresh key.
KEY_EXIT Exit key.
KEY_EDIT Edit key.
KEY_SCROLLUP Scroll Up key.
KEY_SCROLLDOWN Scroll Down key.
KEY_NEW New key.
KEY_REDO Redo key.
KEY_CLOSE Close key.
KEY_PLAY Play key.
KEY_BASSBOOST Bass Boost key.
KEY_PRINT Print key.
KEY_CHAT Chat key.
KEY_FINANCE Finance key.
KEY_CANCEL Cancel key.
KEY_KBDILLUM_TOGGLE Keyboard Illumination Toggle key.
KEY_KBDILLUM_DOWN Keyboard Illumination Up key.
KEY_KBDILLUM_UP Keyboard Illumination Down key.
KEY_SEND Send key.
KEY_REPLY Reply key.
KEY_FORWARDMAIL Forward Mail key.
KEY_SAVE Save key.
KEY_DOCUMENTS Documents key.
KEY_VIDEO_NEXT Next Video key.
KEY_VIDEO_PREV Previous Video key.
KEY_BRIGHTNESS_CYCLE Brightness Cycle key.
KEY_BRIGHTNESS_ZERO Brightness Zero key.
KEY_DISPLAY_OFF Display Off Key.
KEY_BTN_MISC Misc Button key.
KEY_GOTO Goto key.
KEY_INFO Info key.
KEY_PROGRAM Program key.
KEY_PVR PVR key.
KEY_SUBTITLE Subtitle key.
KEY_FULL_SCREEN Full Screen key.
KEY_KEYBOARD Keyboard.
KEY_ASPECT_RATIO Aspect Ratio key.
KEY_PC Port Control key.
KEY_TV TV key.
KEY_TV2 TV key 2.
KEY_VCR VCR key.
KEY_VCR2 VCR key 2.
KEY_SAT SAT key.
KEY_CD CD key.
KEY_TAPE Tape key.
KEY_TUNER Tuner key.
KEY_PLAYER Player key.
KEY_DVD DVD key.
KEY_AUDIO Audio key.
KEY_VIDEO Video key.
KEY_MEMO Memo key.
KEY_CALENDAR Calendar key.
KEY_RED Red indicator.
KEY_GREEN Green indicator.
KEY_YELLOW Yellow indicator.
KEY_BLUE Blue indicator.
KEY_CHANNELUP Channel Up key.
KEY_CHANNELDOWN Channel Down key.
KEY_LAST Last key.
KEY_RESTART Restart key.
KEY_SLOW Slow key.
KEY_SHUFFLE Shuffle key.
KEY_VIDEOPHONE Videophone key.
KEY_GAMES Games key.
KEY_ZOOMIN Zoom in key.
KEY_ZOOMOUT Zoom out key.
KEY_ZOOMRESET Zoom Reset key.
KEY_WORDPROCESSOR Word Processor key.
KEY_EDITOR Editor key.
KEY_SPREADSHEET Spreadsheet key.
KEY_GRAPHICSEDITOR Graphics Editor key.
KEY_PRESENTATION Presentation key.
KEY_DATABASE Database key.
KEY_NEWS News key.
KEY_VOICEMAIL Voicemail key.
KEY_ADDRESSBOOK Address book key.
KEY_MESSENGER Messenger key.
KEY_BRIGHTNESS_TOGGLE Brightness Toggle key.
KEY_SPELLCHECK Spell Check key.
KEY_COFFEE Coffee key, which is used to launch screen lock or screen saver.
KEY_MEDIA_REPEAT Media Repeat key.
KEY_IMAGES Images key.
KEY_BUTTONCONFIG Button Configuration key.
KEY_TASKMANAGER Task Manager key.
KEY_JOURNAL Log key.
KEY_CONTROLPANEL Control Panel key.
KEY_APPSELECT App Select key.
KEY_SCREENSAVER Screen Saver key.
KEY_ASSISTANT Assistant key.
KEY_KBD_LAYOUT_NEXT Next Keyboard Layout key.
KEY_BRIGHTNESS_MIN Min Brightness key.
KEY_BRIGHTNESS_MAX Max Brightness key.
KEY_KBDINPUTASSIST_PREV Keyboard Input-assisted Previous key.
KEY_KBDINPUTASSIST_NEXT Keyboard Input-assisted Next key.
KEY_KBDINPUTASSIST_PREVGROUP Keyboard Input-assisted Previous key.
KEY_KBDINPUTASSIST_NEXTGROUP Keyboard Input-assisted Next key.
KEY_KBDINPUTASSIST_ACCEPT Keyboard Input-assisted Accept key.
KEY_KBDINPUTASSIST_CANCEL Keyboard Input-assisted Cancel key.
KEY_FRONT Front key, which is used to launch the windshield defogger.
KEY_SETUP Setup key.
KEY_WAKEUP Wakeup key.
KEY_SENDFILE Send File key.
KEY_DELETEFILE Delete File key.
KEY_XFER XFER key, which is used to start file transfer.
KEY_PROG1 Program key 1.
KEY_PROG2 Program key 2.
KEY_MSDOS MS-DOS key.
KEY_SCREENLOCK Screen Lock key.
KEY_DIRECTION_ROTATE_DISPLAY Directional Rotation Display key.
KEY_CYCLEWINDOWS Windows Cycle key.
KEY_COMPUTER Keys.
KEY_EJECTCLOSECD Eject CD key.
KEY_ISO ISO key.
KEY_MOVE Move key.
KEY_F13 F13 key.
KEY_F14 F14 key.
KEY_F15 F15 key.
KEY_F16 F16 key.
KEY_F17 F17 key.
KEY_F18 F18 key.
KEY_F19 F19 key.
KEY_F20 F20 key.
KEY_F21 F21 key.
KEY_F22 F22 key.
KEY_F23 F23 key.
KEY_F24 F24 key.
KEY_PROG3 Program key 3.
KEY_PROG4 Program key 4.
KEY_DASHBOARD Dashboard.
KEY_SUSPEND Suspend key.
KEY_HP HP key.
KEY_SOUND Sound key.
KEY_QUESTION Question key.
KEY_CONNECT Connect key.
KEY_SPORT Sport key.
KEY_SHOP Shop key.
KEY_ALTERASE Alternate key.
KEY_SWITCHVIDEOMODE Switch Video Mode key (monitor, LCD, and TV, etc.).
KEY_BATTERY Battery key.
KEY_BLUETOOTH Bluetooth key.
KEY_WLAN WLAN key.
KEY_UWB Ultra-wideband key.
KEY_WWAN_WIMAX WWAN WiMAX key.
KEY_RFKILL RF Kill key.
KEY_CHANNEL Channel key.
KEY_BTN_0 Button 0.
KEY_BTN_1 Button 1.
KEY_BTN_2 Button 2.
KEY_BTN_3 Button 3.
KEY_BTN_4 Button 4.
KEY_BTN_5 Button 5.
KEY_BTN_6 Button 6.
KEY_BTN_7 Button 7.
KEY_BTN_8 Button 8.
KEY_BTN_9 Button 9.

Since

10

OH_NativeXComponent_MouseEventAction

enum OH_NativeXComponent_MouseEventAction

Description

Enumerates the mouse event actions.

Value Description
OH_NATIVEXCOMPONENT_MOUSE_NONE Invalid mouse event.
OH_NATIVEXCOMPONENT_MOUSE_PRESS Mouse button press.
OH_NATIVEXCOMPONENT_MOUSE_RELEASE Mouse button release.
OH_NATIVEXCOMPONENT_MOUSE_MOVE Mouse movement.

Since

9

OH_NativeXComponent_MouseEventButton

enum OH_NativeXComponent_MouseEventButton

Description

Enumerates the mouse event buttons.

Value Description
OH_NATIVEXCOMPONENT_NONE_BUTTON No button.
OH_NATIVEXCOMPONENT_LEFT_BUTTON Left mouse button.
OH_NATIVEXCOMPONENT_RIGHT_BUTTON Right mouse button.
OH_NATIVEXCOMPONENT_MIDDLE_BUTTON Middle mouse button.
OH_NATIVEXCOMPONENT_BACK_BUTTON Back button on the left of the mouse.
OH_NATIVEXCOMPONENT_FORWARD_BUTTON Forward key on the left of the mouse.

Since

9

OH_NativeXComponent_TouchEventType

enum OH_NativeXComponent_TouchEventType

Description

Enumerates the touch event types.

Value Description
OH_NATIVEXCOMPONENT_DOWN The touch event is triggered when a finger is pressed.
OH_NATIVEXCOMPONENT_UP The touch event is triggered when a finger is lifted.
OH_NATIVEXCOMPONENT_MOVE The touch event is triggered when a finger is moved on the screen.
OH_NATIVEXCOMPONENT_CANCEL The event is triggered when a touch event is canceled.
OH_NATIVEXCOMPONENT_UNKNOWN Invalid touch type.

Since

8

OH_NativeXComponent_TouchPointToolType

enum OH_NativeXComponent_TouchPointToolType

Description

Enumerates the touch point tool types.

Value Description
OH_NATIVEXCOMPONENT_TOOL_TYPE_UNKNOWN Unknown tool type.
OH_NATIVEXCOMPONENT_TOOL_TYPE_FINGER Finger.
OH_NATIVEXCOMPONENT_TOOL_TYPE_PEN Stylus.
OH_NATIVEXCOMPONENT_TOOL_TYPE_RUBBER Rubber.
OH_NATIVEXCOMPONENT_TOOL_TYPE_BRUSH Brush.
OH_NATIVEXCOMPONENT_TOOL_TYPE_PENCIL Pencil.
OH_NATIVEXCOMPONENT_TOOL_TYPE_AIRBRUSH Air brush.
OH_NATIVEXCOMPONENT_TOOL_TYPE_MOUSE Mouse.
OH_NATIVEXCOMPONENT_TOOL_TYPE_LENS Lens.

Since

9

Function Description

OH_NativeXComponent_GetKeyEvent()

int32_t OH_NativeXComponent_GetKeyEvent (OH_NativeXComponent * component, OH_NativeXComponent_KeyEvent ** keyEvent )

Description

Obtains the key event scheduled by ArkUI XComponent.

Parameters

Name Description
component Pointer to the OH_NativeXComponent instance.
keyEvent Pointer to the current key event.

Returns

Returns the status code of the execution.

Since

10

OH_NativeXComponent_GetKeyEventAction()

int32_t OH_NativeXComponent_GetKeyEventAction (OH_NativeXComponent_KeyEvent * keyEvent, OH_NativeXComponent_KeyAction * action )

Description

Obtains the action of the specified key event.

Parameters

Name Description
keyEvent Pointer to the OH_NativeXComponent_KeyEvent instance.
action Pointer to the key event action.

Returns

Returns the status code of the execution.

Since

10

OH_NativeXComponent_GetKeyEventCode()

int32_t OH_NativeXComponent_GetKeyEventCode (OH_NativeXComponent_KeyEvent * keyEvent, OH_NativeXComponent_KeyCode * code )

Description

Obtains the key code of the specified key event.

Parameters

Name Description
keyEvent Pointer to the OH_NativeXComponent_KeyEvent instance.
code Pointer to the key code of the key event.

Returns

Returns the status code of the execution.

Since

10

OH_NativeXComponent_GetKeyEventDeviceId()

int32_t OH_NativeXComponent_GetKeyEventDeviceId (OH_NativeXComponent_KeyEvent * keyEvent, int64_t * deviceId )

Description

Obtains the device ID of the specified key event.

Parameters

Name Description
keyEvent Pointer to the OH_NativeXComponent_KeyEvent instance.
deviceId Pointer to the device ID of the key event.

Returns

Returns the status code of the execution.

Since

10

OH_NativeXComponent_GetKeyEventSourceType()

int32_t OH_NativeXComponent_GetKeyEventSourceType (OH_NativeXComponent_KeyEvent * keyEvent, OH_NativeXComponent_EventSourceType * sourceType )

Description

Obtains the source type of the specified key event.

Parameters

Name Description
keyEvent Pointer to the OH_NativeXComponent_KeyEvent instance.
sourceType Pointer to the source type of the key event.

Returns

Returns the status code of the execution.

Since

10

OH_NativeXComponent_GetKeyEventTimeStamp()

int32_t OH_NativeXComponent_GetKeyEventTimeStamp (OH_NativeXComponent_KeyEvent * keyEvent, int64_t * timeStamp )

Description

Obtains the timestamp of the specified key event.

Parameters

Name Description
keyEvent Pointer to the OH_NativeXComponent_KeyEvent instance.
timeStamp Pointer to the timestamp of the key event.

Returns

Returns the status code of the execution.

Since

10

OH_NativeXComponent_GetMouseEvent()

int32_t OH_NativeXComponent_GetMouseEvent (OH_NativeXComponent * component, const void * window, OH_NativeXComponent_MouseEvent * mouseEvent )

Description

Obtains the mouse event scheduled by ArkUI XComponent.

Parameters

Name Description
component Pointer to the OH_NativeXComponent instance.
window Handle to the NativeWindow instance.
mouseEvent Pointer to the current mouse event.

Returns

Returns the status code of the execution.

Since

9

OH_NativeXComponent_GetTouchEvent()

int32_t OH_NativeXComponent_GetTouchEvent (OH_NativeXComponent * component, const void * window, OH_NativeXComponent_TouchEvent * touchEvent )

Description

Obtains the touch event scheduled by the ArkUI XComponent.

Parameters

Name Description
component Pointer to the OH_NativeXComponent instance.
window Handle to the NativeWindow instance.
touchEvent Pointer to the current touch event.

Returns

Returns the status code of the execution.

Since

8

OH_NativeXComponent_GetTouchPointTiltX()

int32_t OH_NativeXComponent_GetTouchPointTiltX (OH_NativeXComponent * component, uint32_t pointIndex, float * tiltX )

Description

Obtains the angle between the Y-Z plane of the ArkUI XComponent touch point and the x-axis.

Parameters

Name Description
component Pointer to the OH_NativeXComponent instance.
pointIndex Pointer to the index of the touch point.
tiltX Pointer to the angle between the Y-Z plane of the touch point and the x-axis.

Returns

Returns the status code of the execution.

Since

9

OH_NativeXComponent_GetTouchPointTiltY()

int32_t OH_NativeXComponent_GetTouchPointTiltY (OH_NativeXComponent * component, uint32_t pointIndex, float * tiltY )

Description

Obtains the angle between the X-Z plane of the ArkUI XComponent touch point and the x-axis.

Parameters

Name Description
component Pointer to the OH_NativeXComponent instance.
pointIndex Pointer to the index of the touch point.
tiltY Pointer to the angle between the X-Z plane of the touch point and the y-axis.

Returns

Returns the status code of the execution.

Since

9

OH_NativeXComponent_GetTouchPointToolType()

int32_t OH_NativeXComponent_GetTouchPointToolType (OH_NativeXComponent * component, uint32_t pointIndex, OH_NativeXComponent_TouchPointToolType * toolType )

Description

Obtains the ArkUI XComponent touch point tool type.

Parameters

Name Description
component Pointer to the OH_NativeXComponent instance.
pointIndex Pointer to the index of the touch point.
toolType Pointer to the tool type.

Returns

Returns the status code of the execution.

Since

9

OH_NativeXComponent_GetXComponentId()

int32_t OH_NativeXComponent_GetXComponentId (OH_NativeXComponent * component, char * id, uint64_t * size )

Description

Obtain the ID of ArkUI XComponent.

Parameters

Name Description
component Pointer to the OH_NativeXComponent instance.
id Pointer to the character buffer for storing the ID of the OH_NativeXComponent instance. Note that null terminators will be attached to the character buffer, so the size of the character buffer should be at least one unit greater than the length of the real ID. The recommended size is [OH_XCOMPONENT_ID_LEN_MAX + 1].
size Pointer to the length of the ID.

Returns

Returns the status code of the execution.

Since

8

OH_NativeXComponent_GetXComponentOffset()

int32_t OH_NativeXComponent_GetXComponentOffset (OH_NativeXComponent * component, const void * window, double * x, double * y )

Description

Obtains the offset of the ArkUI XComponent relative to the upper left vertex of the screen.

Parameters

Name Description
component Pointer to the OH_NativeXComponent instance.
window Handle to the NativeWindow instance.
x Pointer to the x coordinate of the current surface.
y Pointer to the y coordinate of the current surface.

Returns

Returns the status code of the execution.

Since

8

OH_NativeXComponent_GetXComponentSize()

int32_t OH_NativeXComponent_GetXComponentSize (OH_NativeXComponent * component, const void * window, uint64_t * width, uint64_t * height )

Description

Obtains the size of the surface held by the ArkUI XComponent.

Parameters

Name Description
component Pointer to the OH_NativeXComponent instance.
window Handle to the NativeWindow instance.
width Pointer to the width of the current surface.
height Pointer to the height of the current surface.

Returns

Returns the status code of the execution.

Since

8

OH_NativeXComponent_RegisterBlurEventCallback()

int32_t OH_NativeXComponent_RegisterBlurEventCallback (OH_NativeXComponent * component, void(*)(OH_NativeXComponent *component, void *window) callback )

Description

Registers the focus loss event callback for this OH_NativeXComponent instance.

Parameters

Name Description
component Pointer to the OH_NativeXComponent instance.
callback Pointer to the focus loss event callback.

Returns

Returns the status code of the execution.

Since

8

OH_NativeXComponent_RegisterCallback()

int32_t OH_NativeXComponent_RegisterCallback (OH_NativeXComponent * component, OH_NativeXComponent_Callback * callback )

Description

Registers a callback for this OH_NativeXComponent instance.

Parameters

Name Description
component Pointer to the OH_NativeXComponent instance.
callback Pointer to the surface lifecycle and touch event callback.

Returns

Returns the status code of the execution.

Since

8

OH_NativeXComponent_RegisterFocusEventCallback()

int32_t OH_NativeXComponent_RegisterFocusEventCallback (OH_NativeXComponent * component, void(*)(OH_NativeXComponent *component, void *window) callback )

Description

Registers the focus obtaining event callback for this OH_NativeXComponent instance.

Parameters

Name Description
component Pointer to the OH_NativeXComponent instance.
callback Pointer to the focus obtaining event callback.

Returns

Returns the status code of the execution.

Since

10

OH_NativeXComponent_RegisterKeyEventCallback()

int32_t OH_NativeXComponent_RegisterKeyEventCallback (OH_NativeXComponent * component, void(*)(OH_NativeXComponent *component, void *window) callback )

Description

Registers the key event callback for this OH_NativeXComponent instance.

Parameters

Name Description
component Pointer to the OH_NativeXComponent instance.
callback Pointer to the key event callback.

Returns

Returns the status code of the execution.

Since

10

OH_NativeXComponent_RegisterMouseEventCallback()

int32_t OH_NativeXComponent_RegisterMouseEventCallback (OH_NativeXComponent * component, OH_NativeXComponent_MouseEvent_Callback * callback )

Description

Registers the mouse event callback for this OH_NativeXComponent instance.

Parameters

Name Description
component Pointer to the OH_NativeXComponent instance.
callback Pointer to the mouse event callback.

Returns

Returns the status code of the execution.

Since

9

Variable Description

OH_XCOMPONENT_ID_LEN_MAX

const uint32_t OH_XCOMPONENT_ID_LEN_MAX = 128

Description

Maximum length of the ArkUI XComponent ID.

Since

8

OH_MAX_TOUCH_POINTS_NUMBER

const uint32_t OH_MAX_TOUCH_POINTS_NUMBER = 10

Description

Maximum number of identifiable touch points in a touch event.

Since

8

action

OH_NativeXComponent_MouseEventAction OH_NativeXComponent_MouseEvent::action

Description

Action of the mouse event.

Since

8

button

OH_NativeXComponent_MouseEventButton OH_NativeXComponent_MouseEvent::button

Description

Mouse event button.

Since

8

deviceId

int64_t OH_NativeXComponent_TouchEvent::deviceId = 0

Description

ID of the device where the current touch event is triggered.

Since

8

DispatchHoverEvent

void(* OH_NativeXComponent_MouseEvent_Callback::DispatchHoverEvent) (OH_NativeXComponent *component, bool isHover)

Description

Invoked when a hover event is triggered.

Since

8

DispatchMouseEvent

void(* OH_NativeXComponent_MouseEvent_Callback::DispatchMouseEvent) (OH_NativeXComponent *component, void *window)

Description

Invoked when a mouse event is triggered.

Since

8

DispatchTouchEvent

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

Description

Invoked when a touch event is triggered.

Since

8

force [12]

float OH_NativeXComponent_TouchPoint::force = 0.0

Description

Pressure of the touch event.

Since

8

force [22]

float OH_NativeXComponent_TouchEvent::force = 0.0

Description

Pressure of the touch event.

Since

8

id [12]

int32_t OH_NativeXComponent_TouchPoint::id = 0

Description

Unique identifier of the finger.

Since

8

id [22]

int32_t OH_NativeXComponent_TouchEvent::id = 0

Description

Unique identifier of the finger.

Since

8

isPressed

bool OH_NativeXComponent_TouchPoint::isPressed = false

Description

Whether the current point is pressed.

Since

8

numPoints

uint32_t OH_NativeXComponent_TouchEvent::numPoints = 0

Description

Number of current touch points.

Since

8

OnSurfaceChanged

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

Description

Invoked when the surface changes.

Since

8

OnSurfaceCreated

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

Description

Invoked when a surface is created.

Since

8

OnSurfaceDestroyed

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

Description

Invoked when the surface is destroyed.

Since

8

screenX [13]

float OH_NativeXComponent_TouchPoint::screenX = 0.0

Description

X coordinate of the touch point relative to the left edge of the application window where the XComponent is located.

Since

8

screenX [23]

float OH_NativeXComponent_TouchEvent::screenX = 0.0

Description

X coordinate of the touch point relative to the left edge of the screen.

Since

8

screenX [33]

float OH_NativeXComponent_MouseEvent::screenX

Description

X coordinate of the clicked point relative to the upper left corner of the screen.

Since

8

screenY [13]

float OH_NativeXComponent_TouchPoint::screenY = 0.0

Description

Y coordinate of the touch point relative to the left edge of the application window where the XComponent is located.

Since

8

screenY [23]

float OH_NativeXComponent_TouchEvent::screenY = 0.0

Description

Y coordinate of the touch point relative to the upper edge of the screen.

Since

8

screenY [33]

float OH_NativeXComponent_MouseEvent::screenY

Description

Y coordinate of the clicked point relative to the upper left corner of the screen.

Since

8

size [12]

double OH_NativeXComponent_TouchPoint::size = 0.0

Description

Contact area between the finger pad and the screen.

Since

8

size [22]

double OH_NativeXComponent_TouchEvent::size = 0.0

Description

Contact area between the finger pad and the screen.

Since

8

timeStamp [12]

long long OH_NativeXComponent_TouchPoint::timeStamp = 0

Description

Timestamp of the touch point.

Since

8

timeStamp [22]

long long OH_NativeXComponent_TouchEvent::timeStamp = 0

Description

Timestamp of the touch event.

Since

8

timestamp

int64_t OH_NativeXComponent_MouseEvent::timestamp

Description

Timestamp of the mouse event.

Since

8

touchPoints

OH_NativeXComponent_TouchPoint OH_NativeXComponent_TouchEvent::touchPoints[OH_MAX_TOUCH_POINTS_NUMBER]

Description

Array of the touch points.

Since

8

type [12]

OH_NativeXComponent_TouchEventType OH_NativeXComponent_TouchPoint::type = OH_NativeXComponent_TouchEventType::OH_NATIVEXCOMPONENT_UNKNOWN

Description

Touch type of the touch point.

Since

8

type [22]

OH_NativeXComponent_TouchEventType OH_NativeXComponent_TouchEvent::type = OH_NativeXComponent_TouchEventType::OH_NATIVEXCOMPONENT_UNKNOWN

Description

Touch type of the touch event.

Since

8

x [13]

float OH_NativeXComponent_TouchPoint::x = 0.0

Description

X coordinate of the touch point relative to the left edge of the XComponent.

Since

8

x [23]

float OH_NativeXComponent_TouchEvent::x = 0.0

Description

X coordinate of the touch point relative to the left edge of the XComponent.

Since

8

x [33]

float OH_NativeXComponent_MouseEvent::x

Description

X coordinate of the clicked point relative to the upper left corner of the component.

Since

8

y [13]

float OH_NativeXComponent_TouchPoint::y = 0.0

Description

Y coordinate of the touch point relative to the upper edge of the XComponent.

Since

8

y [23]

float OH_NativeXComponent_TouchEvent::y = 0.0

Description

Y coordinate of the touch point relative to the upper edge of the XComponent.

Since

8

y [33]

float OH_NativeXComponent_MouseEvent::y

Description

Y coordinate of the clicked point relative to the upper left corner of the component.

Since

8

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Native APIs

harmony 鸿蒙AVCapability

harmony 鸿蒙AVDemuxer

harmony 鸿蒙AVMuxer

harmony 鸿蒙AVScreenCapture

harmony 鸿蒙AVSource

harmony 鸿蒙AudioDecoder

harmony 鸿蒙AudioEncoder

harmony 鸿蒙CodecBase

harmony 鸿蒙Core

0  赞