• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Native XComponent
2
3
4## Overview
5
6Describes 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 [Native XComponent](../../ui/napi-xcomponent-guidelines.md).
7
8> **NOTE**
9>
10> The APIs of this module are supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
11
12## Summary
13
14
15### Files
16
17| Name                                      | Description                                      |
18| ---------------------------------------- | ---------------------------------------- |
19| [native_interface_xcomponent.h](native__interface__xcomponent_8h.md) | Declares the APIs for accessing **NativeXComponent**.|
20| [native_xcomponent_key_event.h](native__xcomponent__key__event_8h.md) | Declares the enums used to access **NativeXComponent** key events.|
21
22
23### Structs
24
25| Name                                      | Description                   |
26| ---------------------------------------- | --------------------- |
27| [OH_NativeXComponent_TouchPoint](_o_h___native_x_component___touch_point.md) | Describes the touch point of the touch event.         |
28| [OH_NativeXComponent_TouchEvent](_o_h___native_x_component___touch_event.md) | Describes the touch event.                |
29| [OH_NativeXComponent_MouseEvent](_o_h___native_x_component___mouse_event.md) | Describes the mouse event.                |
30| [OH_NativeXComponent_Callback](_o_h___native_x_component___callback.md) | Registers callbacks for the surface lifecycle and touch event.|
31| [OH_NativeXComponent_MouseEvent_Callback](_o_h___native_x_component___mouse_event___callback.md) | Registers callbacks for the mouse event.           |
32| [OH_NativeXComponent_ExpectedRateRange](_o_h___native_x_component___expected_rate_range.md) | Defines the expected frame rate range. |
33
34
35### Types
36
37| Name                                      | Description                                  |
38| ---------------------------------------- | ------------------------------------ |
39| [OH_NativeXComponent](#oh_nativexcomponent) | Provides an encapsulated **OH_NativeXComponent** instance.         |
40| [OH_NativeXComponent_Callback](#oh_nativexcomponent_callback) | Registers callbacks for the surface lifecycle and touch event.               |
41| [OH_NativeXComponent_MouseEvent_Callback](#oh_nativexcomponent_mouseevent_callback) | Registers callbacks for the mouse event.                          |
42| [OH_NativeXComponent_KeyEvent](#oh_nativexcomponent_keyevent) | Provides an encapsulated **OH_NativeXComponent_KeyEvent** instance.|
43
44
45### Enums
46
47| Name                                      | Description        |
48| ---------------------------------------- | ---------- |
49| { OH_NATIVEXCOMPONENT_RESULT_SUCCESS = 0, OH_NATIVEXCOMPONENT_RESULT_FAILED = -1, OH_NATIVEXCOMPONENT_RESULT_BAD_PARAMETER = -2 } | Enumerates the API access states.|
50| [OH_NativeXComponent_TouchEventType](#oh_nativexcomponent_toucheventtype) {<br>OH_NATIVEXCOMPONENT_DOWN = 0, OH_NATIVEXCOMPONENT_UP, OH_NATIVEXCOMPONENT_MOVE, OH_NATIVEXCOMPONENT_CANCEL,<br>OH_NATIVEXCOMPONENT_UNKNOWN<br>} | Enumerates the touch event types.   |
51| [OH_NativeXComponent_TouchPointToolType](#oh_nativexcomponent_touchpointtooltype) {<br>OH_NATIVEXCOMPONENT_TOOL_TYPE_UNKNOWN = 0, OH_NATIVEXCOMPONENT_TOOL_TYPE_FINGER, OH_NATIVEXCOMPONENT_TOOL_TYPE_PEN, OH_NATIVEXCOMPONENT_TOOL_TYPE_RUBBER,<br>OH_NATIVEXCOMPONENT_TOOL_TYPE_BRUSH, OH_NATIVEXCOMPONENT_TOOL_TYPE_PENCIL, OH_NATIVEXCOMPONENT_TOOL_TYPE_AIRBRUSH, OH_NATIVEXCOMPONENT_TOOL_TYPE_MOUSE,<br>OH_NATIVEXCOMPONENT_TOOL_TYPE_LENS<br>} | Enumerates the touch point tool types.  |
52| [OH_NativeXComponent_EventSourceType](#oh_nativexcomponent_eventsourcetype) {<br>OH_NATIVEXCOMPONENT_SOURCE_TYPE_UNKNOWN = 0, OH_NATIVEXCOMPONENT_SOURCE_TYPE_MOUSE, OH_NATIVEXCOMPONENT_SOURCE_TYPE_TOUCHSCREEN, OH_NATIVEXCOMPONENT_SOURCE_TYPE_TOUCHPAD,<br>OH_NATIVEXCOMPONENT_SOURCE_TYPE_JOYSTICK, OH_NATIVEXCOMPONENT_SOURCE_TYPE_KEYBOARD<br>} | Enumerates the touch event source types.  |
53| [OH_NativeXComponent_MouseEventAction](#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.   |
54| [OH_NativeXComponent_MouseEventButton](#oh_nativexcomponent_mouseeventbutton) {<br>OH_NATIVEXCOMPONENT_NONE_BUTTON = 0, OH_NATIVEXCOMPONENT_LEFT_BUTTON = 0x01, OH_NATIVEXCOMPONENT_RIGHT_BUTTON = 0x02, OH_NATIVEXCOMPONENT_MIDDLE_BUTTON = 0x04,<br>OH_NATIVEXCOMPONENT_BACK_BUTTON = 0x08, OH_NATIVEXCOMPONENT_FORWARD_BUTTON = 0x10<br>} | Enumerates the mouse event buttons.   |
55| [OH_NativeXComponent_KeyCode](#oh_nativexcomponent_keycode) {<br>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,<br>KEY_MEDIA_REWIND = 14, KEY_MEDIA_FAST_FORWARD = 15, KEY_VOLUME_UP = 16, KEY_VOLUME_DOWN = 17,<br>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,<br>KEY_2 = 2002, KEY_3 = 2003, KEY_4 = 2004, KEY_5 = 2005,<br>KEY_6 = 2006, KEY_7 = 2007, KEY_8 = 2008, KEY_9 = 2009,<br>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,<br>KEY_A = 2017,<br>KEY_B = 2018, KEY_C = 2019, KEY_D = 2020, KEY_E = 2021,<br>KEY_F = 2022, KEY_G = 2023, KEY_H = 2024, KEY_I = 2025,<br>KEY_J = 2026, KEY_K = 2027, KEY_L = 2028, KEY_M = 2029,<br>KEY_N = 2030, KEY_O = 2031, KEY_P = 2032, KEY_Q = 2033,<br>KEY_R = 2034, KEY_S = 2035, KEY_T = 2036, KEY_U = 2037,<br>KEY_V = 2038, KEY_W = 2039, KEY_X = 2040, KEY_Y = 2041,<br>KEY_Z = 2042, KEY_COMMA = 2043, KEY_PERIOD = 2044, KEY_ALT_LEFT = 2045,<br>KEY_ALT_RIGHT = 2046, KEY_SHIFT_LEFT = 2047, KEY_SHIFT_RIGHT = 2048, KEY_TAB = 2049,<br>KEY_SPACE = 2050, KEY_SYM = 2051, KEY_EXPLORER = 2052, KEY_ENVELOPE = 2053,<br>KEY_ENTER = 2054, KEY_DEL = 2055, KEY_GRAVE = 2056, KEY_MINUS = 2057,<br>KEY_EQUALS = 2058, KEY_LEFT_BRACKET = 2059, KEY_RIGHT_BRACKET = 2060, KEY_BACKSLASH = 2061,<br>KEY_SEMICOLON = 2062, KEY_APOSTROPHE = 2063, KEY_SLASH = 2064, KEY_AT = 2065,<br>KEY_PLUS = 2066, KEY_MENU = 2067, KEY_PAGE_UP = 2068, KEY_PAGE_DOWN = 2069,<br>KEY_ESCAPE = 2070, KEY_FORWARD_DEL = 2071, KEY_CTRL_LEFT = 2072, KEY_CTRL_RIGHT = 2073,<br>KEY_CAPS_LOCK = 2074, KEY_SCROLL_LOCK = 2075, KEY_META_LEFT = 2076, KEY_META_RIGHT = 2077,<br>KEY_FUNCTION = 2078, KEY_SYSRQ = 2079, KEY_BREAK = 2080, KEY_MOVE_HOME = 2081,<br>KEY_MOVE_END = 2082, KEY_INSERT = 2083, KEY_FORWARD = 2084, KEY_MEDIA_PLAY = 2085,<br>KEY_MEDIA_PAUSE = 2086, KEY_MEDIA_CLOSE = 2087, KEY_MEDIA_EJECT = 2088, KEY_MEDIA_RECORD = 2089,<br>KEY_F1 = 2090, KEY_F2 = 2091, KEY_F3 = 2092, KEY_F4 = 2093,<br>KEY_F5 = 2094, KEY_F6 = 2095, KEY_F7 = 2096, KEY_F8 = 2097,<br>KEY_F9 = 2098, KEY_F10 = 2099, KEY_F11 = 2100, KEY_F12 = 2101,<br>KEY_NUM_LOCK = 2102, KEY_NUMPAD_0 = 2103, KEY_NUMPAD_1 = 2104, KEY_NUMPAD_2 = 2105,<br>KEY_NUMPAD_3 = 2106, KEY_NUMPAD_4 = 2107, KEY_NUMPAD_5 = 2108, KEY_NUMPAD_6 = 2109,<br>KEY_NUMPAD_7 = 2110, KEY_NUMPAD_8 = 2111, KEY_NUMPAD_9 = 2112, KEY_NUMPAD_DIVIDE = 2113,<br>KEY_NUMPAD_MULTIPLY = 2114, KEY_NUMPAD_SUBTRACT = 2115, KEY_NUMPAD_ADD = 2116, KEY_NUMPAD_DOT = 2117,<br>KEY_NUMPAD_COMMA = 2118, KEY_NUMPAD_ENTER = 2119, KEY_NUMPAD_EQUALS = 2120, KEY_NUMPAD_LEFT_PAREN = 2121,<br>KEY_NUMPAD_RIGHT_PAREN = 2122, KEY_VIRTUAL_MULTITASK = 2210, KEY_SLEEP = 2600, KEY_ZENKAKU_HANKAKU = 2601,<br>KEY_102ND = 2602, KEY_RO = 2603, KEY_KATAKANA = 2604, KEY_HIRAGANA = 2605,<br>KEY_HENKAN = 2606, KEY_KATAKANA_HIRAGANA = 2607, KEY_MUHENKAN = 2608, KEY_LINEFEED = 2609,<br>KEY_MACRO = 2610, KEY_NUMPAD_PLUSMINUS = 2611, KEY_SCALE = 2612, KEY_HANGUEL = 2613,<br>KEY_HANJA = 2614, KEY_YEN = 2615, KEY_STOP = 2616, KEY_AGAIN = 2617,<br>KEY_PROPS = 2618, KEY_UNDO = 2619, KEY_COPY = 2620, KEY_OPEN = 2621,<br>KEY_PASTE = 2622, KEY_FIND = 2623, KEY_CUT = 2624, KEY_HELP = 2625,<br>KEY_CALC = 2626, KEY_FILE = 2627, KEY_BOOKMARKS = 2628, KEY_NEXT = 2629,<br>KEY_PLAYPAUSE = 2630, KEY_PREVIOUS = 2631, KEY_STOPCD = 2632, KEY_CONFIG = 2634,<br>KEY_REFRESH = 2635, KEY_EXIT = 2636, KEY_EDIT = 2637, KEY_SCROLLUP = 2638,<br>KEY_SCROLLDOWN = 2639, KEY_NEW = 2640, KEY_REDO = 2641, KEY_CLOSE = 2642,<br>KEY_PLAY = 2643, KEY_BASSBOOST = 2644, KEY_PRINT = 2645, KEY_CHAT = 2646,<br>KEY_FINANCE = 2647, KEY_CANCEL = 2648, KEY_KBDILLUM_TOGGLE = 2649, KEY_KBDILLUM_DOWN = 2650,<br>KEY_KBDILLUM_UP = 2651, KEY_SEND = 2652, KEY_REPLY = 2653, KEY_FORWARDMAIL = 2654,<br>KEY_SAVE = 2655, KEY_DOCUMENTS = 2656, KEY_VIDEO_NEXT = 2657, KEY_VIDEO_PREV = 2658,<br>KEY_BRIGHTNESS_CYCLE = 2659, KEY_BRIGHTNESS_ZERO = 2660, KEY_DISPLAY_OFF = 2661, KEY_BTN_MISC = 2662,<br>KEY_GOTO = 2663, KEY_INFO = 2664, KEY_PROGRAM = 2665, KEY_PVR = 2666,<br>KEY_SUBTITLE = 2667, KEY_FULL_SCREEN = 2668, KEY_KEYBOARD = 2669, KEY_ASPECT_RATIO = 2670,<br>KEY_PC = 2671, KEY_TV = 2672, KEY_TV2 = 2673, KEY_VCR = 2674,<br>KEY_VCR2 = 2675, KEY_SAT = 2676, KEY_CD = 2677, KEY_TAPE = 2678,<br>KEY_TUNER = 2679, KEY_PLAYER = 2680, KEY_DVD = 2681, KEY_AUDIO = 2682,<br>KEY_VIDEO = 2683, KEY_MEMO = 2684, KEY_CALENDAR = 2685, KEY_RED = 2686,<br>KEY_GREEN = 2687, KEY_YELLOW = 2688, KEY_BLUE = 2689, KEY_CHANNELUP = 2690,<br>KEY_CHANNELDOWN = 2691, KEY_LAST = 2692, KEY_RESTART = 2693, KEY_SLOW = 2694,<br>KEY_SHUFFLE = 2695, KEY_VIDEOPHONE = 2696, KEY_GAMES = 2697, KEY_ZOOMIN = 2698,<br>KEY_ZOOMOUT = 2699, KEY_ZOOMRESET = 2700, KEY_WORDPROCESSOR = 2701, KEY_EDITOR = 2702,<br>KEY_SPREADSHEET = 2703, KEY_GRAPHICSEDITOR = 2704, KEY_PRESENTATION = 2705, KEY_DATABASE = 2706,<br>KEY_NEWS = 2707, KEY_VOICEMAIL = 2708, KEY_ADDRESSBOOK = 2709, KEY_MESSENGER = 2710,<br>KEY_BRIGHTNESS_TOGGLE = 2711, KEY_SPELLCHECK = 2712, KEY_COFFEE = 2713, KEY_MEDIA_REPEAT = 2714,<br>KEY_IMAGES = 2715, KEY_BUTTONCONFIG = 2716, KEY_TASKMANAGER = 2717, KEY_JOURNAL = 2718,<br>KEY_CONTROLPANEL = 2719, KEY_APPSELECT = 2720, KEY_SCREENSAVER = 2721, KEY_ASSISTANT = 2722,<br>KEY_KBD_LAYOUT_NEXT = 2723, KEY_BRIGHTNESS_MIN = 2724, KEY_BRIGHTNESS_MAX = 2725, KEY_KBDINPUTASSIST_PREV = 2726,<br>KEY_KBDINPUTASSIST_NEXT = 2727, KEY_KBDINPUTASSIST_PREVGROUP = 2728, KEY_KBDINPUTASSIST_NEXTGROUP = 2729, KEY_KBDINPUTASSIST_ACCEPT = 2730,<br>KEY_KBDINPUTASSIST_CANCEL = 2731, KEY_FRONT = 2800, KEY_SETUP = 2801, KEY_WAKEUP = 2802,<br>KEY_SENDFILE = 2803, KEY_DELETEFILE = 2804, KEY_XFER = 2805, KEY_PROG1 = 2806,<br>KEY_PROG2 = 2807, KEY_MSDOS = 2808, KEY_SCREENLOCK = 2809, KEY_DIRECTION_ROTATE_DISPLAY = 2810,<br>KEY_CYCLEWINDOWS = 2811, KEY_COMPUTER = 2812, KEY_EJECTCLOSECD = 2813, KEY_ISO = 2814,<br>KEY_MOVE = 2815, KEY_F13 = 2816, KEY_F14 = 2817, KEY_F15 = 2818,<br>KEY_F16 = 2819, KEY_F17 = 2820, KEY_F18 = 2821, KEY_F19 = 2822,<br>KEY_F20 = 2823, KEY_F21 = 2824, KEY_F22 = 2825, KEY_F23 = 2826,<br>KEY_F24 = 2827, KEY_PROG3 = 2828, KEY_PROG4 = 2829, KEY_DASHBOARD = 2830,<br>KEY_SUSPEND = 2831, KEY_HP = 2832, KEY_SOUND = 2833, KEY_QUESTION = 2834,<br>KEY_CONNECT = 2836, KEY_SPORT = 2837, KEY_SHOP = 2838, KEY_ALTERASE = 2839,<br>KEY_SWITCHVIDEOMODE = 2841, KEY_BATTERY = 2842, KEY_BLUETOOTH = 2843, KEY_WLAN = 2844,<br>KEY_UWB = 2845, KEY_WWAN_WIMAX = 2846, KEY_RFKILL = 2847, KEY_CHANNEL = 3001,<br>KEY_BTN_0 = 3100, KEY_BTN_1 = 3101, KEY_BTN_2 = 3102, KEY_BTN_3 = 3103,<br>KEY_BTN_4 = 3104, KEY_BTN_5 = 3105, KEY_BTN_6 = 3106, KEY_BTN_7 = 3107,<br>KEY_BTN_8 = 3108, KEY_BTN_9 = 3109<br>} | Enumerates the mouse event key codes.  |
56| [OH_NativeXComponent_KeyAction](#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.   |
57
58
59### Functions
60
61| Name                                      | Description                                    |
62| ---------------------------------------- | -------------------------------------- |
63| [OH_NativeXComponent_GetXComponentId](#oh_nativexcomponent_getxcomponentid) ([OH_NativeXComponent](#oh_nativexcomponent) \*component, char \*id, uint64_t \*size) | Obtains the ID of the ArkUI XComponent.           |
64| [OH_NativeXComponent_GetXComponentSize](#oh_nativexcomponent_getxcomponentsize) ([OH_NativeXComponent](#oh_nativexcomponent) \*component, const void \*window, uint64_t \*width, uint64_t \*height) | Obtains the size of the surface held by the ArkUI XComponent. |
65| [OH_NativeXComponent_GetXComponentOffset](#oh_nativexcomponent_getxcomponentoffset) ([OH_NativeXComponent](#oh_nativexcomponent) \*component, const void \*window, double \*x, double \*y) | Obtains the offset of the surface held by the XComponent relative to the upper left corner of its parent component.|
66| [OH_NativeXComponent_GetTouchEvent](#oh_nativexcomponent_gettouchevent) ([OH_NativeXComponent](#oh_nativexcomponent) \*component, const void \*window, [OH_NativeXComponent_TouchEvent](_o_h___native_x_component___touch_event.md) \*touchEvent) | Obtains the touch event scheduled by the ArkUI XComponent.       |
67| [OH_NativeXComponent_GetTouchPointToolType](#oh_nativexcomponent_gettouchpointtooltype) ([OH_NativeXComponent](#oh_nativexcomponent) \*component, uint32_t pointIndex, [OH_NativeXComponent_TouchPointToolType](#oh_nativexcomponent_touchpointtooltype) \*toolType) | Obtains the ArkUI XComponent touch point tool type.       |
68| [OH_NativeXComponent_GetTouchPointTiltX](#oh_nativexcomponent_gettouchpointtiltx) ([OH_NativeXComponent](#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.    |
69| [OH_NativeXComponent_GetTouchPointTiltY](#oh_nativexcomponent_gettouchpointtilty) ([OH_NativeXComponent](#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.    |
70| [OH_NativeXComponent_GetMouseEvent](#oh_nativexcomponent_getmouseevent) ([OH_NativeXComponent](#oh_nativexcomponent) \*component, const void \*window, [OH_NativeXComponent_MouseEvent](_o_h___native_x_component___mouse_event.md) \*mouseEvent) | Obtains the mouse event scheduled by ArkUI XComponent.       |
71| [OH_NativeXComponent_RegisterCallback](#oh_nativexcomponent_registercallback) ([OH_NativeXComponent](#oh_nativexcomponent) \*component, [OH_NativeXComponent_Callback](_o_h___native_x_component___callback.md) \*callback) | Registers a callback for this **OH_NativeXComponent** instance.          |
72| [OH_NativeXComponent_RegisterMouseEventCallback](#oh_nativexcomponent_registermouseeventcallback) ([OH_NativeXComponent](#oh_nativexcomponent) \*component, [OH_NativeXComponent_MouseEvent_Callback](_o_h___native_x_component___mouse_event___callback.md) \*callback) | Registers the mouse event callback for this **OH_NativeXComponent** instance.      |
73| [OH_NativeXComponent_RegisterFocusEventCallback](#oh_nativexcomponent_registerfocuseventcallback) ([OH_NativeXComponent](#oh_nativexcomponent) \*component, void(\*callback)([OH_NativeXComponent](#oh_nativexcomponent) \*component, void \*window)) | Registers the focus obtaining event callback for this **OH_NativeXComponent** instance.      |
74| [OH_NativeXComponent_RegisterKeyEventCallback](#oh_nativexcomponent_registerkeyeventcallback) ([OH_NativeXComponent](#oh_nativexcomponent) \*component, void(\*callback)([OH_NativeXComponent](#oh_nativexcomponent) \*component, void \*window)) | Registers the key event callback for this **OH_NativeXComponent** instance.      |
75| [OH_NativeXComponent_RegisterKeyEventCallbackWithResult](#oh_nativexcomponent_registerkeyeventcallbackwithresult) ([OH_NativeXComponent](#oh_nativexcomponent) \*component, bool(\*callback)([OH_NativeXComponent](#oh_nativexcomponent) \*component, void \*window)) | Registers a key event callback with a return value for this **OH_NativeXComponent** instance.      |
76| [OH_NativeXComponent_RegisterBlurEventCallback](#oh_nativexcomponent_registerblureventcallback) ([OH_NativeXComponent](#oh_nativexcomponent) \*component, void(\*callback)([OH_NativeXComponent](#oh_nativexcomponent) \*component, void \*window)) | Registers the focus loss event callback for this **OH_NativeXComponent** instance.      |
77| [OH_NativeXComponent_GetKeyEvent](#oh_nativexcomponent_getkeyevent) ([OH_NativeXComponent](#oh_nativexcomponent) \*component, [OH_NativeXComponent_KeyEvent](#oh_nativexcomponent_keyevent) \*\*keyEvent) | Obtains the key event scheduled by the ArkUI XComponent.       |
78| [OH_NativeXComponent_GetKeyEventAction](#oh_nativexcomponent_getkeyeventaction) ([OH_NativeXComponent_KeyEvent](#oh_nativexcomponent_keyevent) \*keyEvent, [OH_NativeXComponent_KeyAction](#oh_nativexcomponent_keyaction) \*action) | Obtains the action of the specified key event.                          |
79| [OH_NativeXComponent_GetKeyEventCode](#oh_nativexcomponent_getkeyeventcode) ([OH_NativeXComponent_KeyEvent](#oh_nativexcomponent_keyevent) \*keyEvent, [OH_NativeXComponent_KeyCode](#oh_nativexcomponent_keycode) \*code) | Obtains the key code of the specified key event.                         |
80| [OH_NativeXComponent_GetKeyEventSourceType](#oh_nativexcomponent_getkeyeventsourcetype) ([OH_NativeXComponent_KeyEvent](#oh_nativexcomponent_keyevent) \*keyEvent, [OH_NativeXComponent_EventSourceType](#oh_nativexcomponent_eventsourcetype) \*sourceType) | Obtains the source type of the specified key event.                       |
81| [OH_NativeXComponent_GetKeyEventDeviceId](#oh_nativexcomponent_getkeyeventdeviceid) ([OH_NativeXComponent_KeyEvent](#oh_nativexcomponent_keyevent) \*keyEvent, int64_t \*deviceId) | Obtains the device ID of the specified key event.                        |
82| [OH_NativeXComponent_GetKeyEventTimeStamp](#oh_nativexcomponent_getkeyeventtimestamp) ([OH_NativeXComponent_KeyEvent](#oh_nativexcomponent_keyevent) \*keyEvent, int64_t \*timeStamp) | Obtains the timestamp of the specified key event.                         |
83| [OH_NativeXComponent_SetExpectedFrameRateRange](#oh_nativexcomponent_setexpectedframeraterange) ([OH_NativeXComponent](#oh_nativexcomponent) \*component, [OH_NativeXComponent_ExpectedRateRange](_o_h___native_x_component___expected_rate_range.md) \*range) | Sets the expected frame rate range.                                          |
84| [OH_NativeXComponent_RegisterOnFrameCallback](#oh_nativexcomponent_registeronframecallback) ([OH_NativeXComponent](#oh_nativexcomponent) \*component, void(\*callback)([OH_NativeXComponent](#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.|
85| [OH_NativeXComponent_UnregisterOnFrameCallback](#oh_nativexcomponent_unregisteronframecallback) ([OH_NativeXComponent](#oh_nativexcomponent) \*component) | Deregisters the display update callback for this **OH_NativeXComponent** instance and disables the callback for each frame.|
86| int32_t [OH_NativeXComponent_AttachNativeRootNode](#oh_nativexcomponent_attachnativerootnode) ([OH_NativeXComponent](#oh_nativexcomponent) \*component, [ArkUI_NodeHandle](_ark_u_i___native_module.md#arkui_nodehandle) root) | Attaches the UI component created through the native API of ArkUI to this **OH_NativeXComponent** instance. |
87| int32_t [OH_NativeXComponent_DetachNativeRootNode](#oh_nativexcomponent_detachnativerootnode) ([OH_NativeXComponent](#oh_nativexcomponent) \*component, [ArkUI_NodeHandle](_ark_u_i___native_module.md#arkui_nodehandle) root) | Detaches the native component of ArkUI from this **OH_NativeXComponent** instance. |
88| int32_t [OH_NativeXComponent_RegisterUIInputEventCallback](#oh_nativexcomponent_registeruiinputeventcallback) ([OH_NativeXComponent](#oh_nativexcomponent) \*component, void(\*callback)([OH_NativeXComponent](#oh_nativexcomponent) \*component, [ArkUI_UIInputEvent](_ark_u_i___event_module.md#arkui_uiinputevent) \*event, [ArkUI_UIInputEvent_Type](_ark_u_i___event_module.md#arkui_uiinputevent_type) type), [ArkUI_UIInputEvent_Type](_ark_u_i___event_module.md#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. |
89| int32_t [OH_NativeXComponent_RegisterOnTouchInterceptCallback](#oh_nativexcomponent_registerontouchinterceptcallback) ([OH_NativeXComponent](#oh_nativexcomponent) \*component, [HitTestMode](_ark_u_i___native_module.md#arkui_hittestmode)(\*callback)([OH_NativeXComponent](#oh_nativexcomponent) \*component, [ArkUI_UIInputEvent](_ark_u_i___event_module.md#arkui_uiinputevent) \*event)) | Registers a custom event intercept callback for an **OH_NativeXComponent** and enables the callback during the hit test. |
90| int32_t [OH_NativeXComponent_SetNeedSoftKeyboard](#oh_nativexcomponent_setneedsoftkeyboard) ([OH_NativeXComponent](#oh_nativexcomponent) \*component, bool isNeedSoftKeyboard) | Sets whether the soft keyboard is required for an **OH_NativeXComponent** instance. |
91| int32_t [OH_NativeXComponent_RegisterSurfaceShowCallback](#oh_nativexcomponent_registersurfaceshowcallback) ([OH_NativeXComponent](#oh_nativexcomponent) \*component, void(\*callback)([OH_NativeXComponent](#oh_nativexcomponent) \*component, void \*window)) | Registers a surface display callback for an **OH_NativeXComponent** instance. The callback is invoked after the application is switched to the foreground.|
92| int32_t [OH_NativeXComponent_RegisterSurfaceHideCallback](#oh_nativexcomponent_registersurfacehidecallback) ([OH_NativeXComponent](#oh_nativexcomponent) \*component, void(\*callback)([OH_NativeXComponent](#oh_nativexcomponent) \*component, void \*window)) | Registers a surface hiding callback for an **OH_NativeXComponent** instance. The callback is invoked after the application is switched to the background.|
93| int32_t [OH_NativeXComponent_GetTouchEventSourceType](#oh_nativexcomponent_gettoucheventsourcetype) ([OH_NativeXComponent](#oh_nativexcomponent) \*component, int32_t pointId, [OH_NativeXComponent_EventSourceType](#oh_nativexcomponent_eventsourcetype) \*sourceType) | Obtains the touch event source type of an **OH_NativeXComponent** instance. |
94| [OH_NativeXComponent](#oh_nativexcomponent) \* [OH_NativeXComponent_GetNativeXComponent](#oh_nativexcomponent_getnativexcomponent) ([ArkUI_NodeHandle](_ark_u_i___native_module.md#arkui_nodehandle) node) | Obtains the pointer to an **OH_NativeXComponent** instance based on the specified component instance created by the native API. |
95| int32_t OH_NativeXComponent_GetNativeAccessibilityProvider(OH_NativeXComponent* component, ArkUI_AccessibilityProvider** handle); |  |
96| int32_t [OH_NativeXComponent_RegisterKeyEventCallbackWithResult](#oh_nativexcomponent_registerkeyeventcallbackwithresult) ([OH_NativeXComponent](#oh_nativexcomponent) \*component, bool(\*callback)([OH_NativeXComponent](#oh_nativexcomponent) \*component, void \*window)) | Registers a key event callback with a return value for this **OH_NativeXComponent** instance. |
97
98### Variables
99
100| Name                                      | Description                            |
101| ---------------------------------------- | ------------------------------ |
102| **OH_XCOMPONENT_ID_LEN_MAX** = 128 | Maximum length of the ArkUI XComponent ID. |
103| **OH_MAX_TOUCH_POINTS_NUMBER** = 10 | Maximum number of identifiable touch points in a touch event.           |
104| [OH_NativeXComponent_TouchPoint::id](#id-12) = 0 | Unique identifier of the finger.                     |
105| [OH_NativeXComponent_TouchPoint::screenX](#screenx-13) = 0.0 | X coordinate of the touch point relative to the upper left corner of the application window where the XComponent is located.|
106| [OH_NativeXComponent_TouchPoint::screenY](#screeny-13) = 0.0 | Y coordinate of the touch point relative to the upper left corner of the application window where the XComponent is located.|
107| [OH_NativeXComponent_TouchPoint::x](#x-13) = 0.0 | X coordinate of the touch point relative to the left edge of the XComponent.    |
108| [OH_NativeXComponent_TouchPoint::y](#y-13) = 0.0 | Y coordinate of the touch point relative to the upper edge of the XComponent.    |
109| [OH_NativeXComponent_TouchPoint::type](#type-12) = OH_NativeXComponent_TouchEventType::OH_NATIVEXCOMPONENT_UNKNOWN | Touch type of the touch event.                    |
110| [OH_NativeXComponent_TouchPoint::size](#size-12) = 0.0 | Contact area between the finger pad and the screen.                 |
111| [OH_NativeXComponent_TouchPoint::force](#force-12) = 0.0 | Pressure of the touch event.                    |
112| [OH_NativeXComponent_TouchPoint::timeStamp](#timestamp-12) = 0 | Timestamp of the touch point.                   |
113| [OH_NativeXComponent_TouchPoint::isPressed](#ispressed) = false | Whether the current point is pressed.                     |
114| [OH_NativeXComponent_TouchEvent::id](#id-22) = 0 | Unique identifier of the finger.                     |
115| [OH_NativeXComponent_TouchEvent::screenX](#screenx-23) = 0.0 | X coordinate of the touch point relative to the left edge of the screen.              |
116| [OH_NativeXComponent_TouchEvent::screenY](#screeny-23) = 0.0 | Y coordinate of the touch point relative to the upper edge of the screen.              |
117| [OH_NativeXComponent_TouchEvent::x](#x-23) = 0.0 | X coordinate of the touch point relative to the left edge of the XComponent.    |
118| [OH_NativeXComponent_TouchEvent::y](#y-23) = 0.0 | Y coordinate of the touch point relative to the upper edge of the XComponent.    |
119| [OH_NativeXComponent_TouchEvent::type](#type-22) = OH_NativeXComponent_TouchEventType::OH_NATIVEXCOMPONENT_UNKNOWN | Touch type of the touch event.                    |
120| [OH_NativeXComponent_TouchEvent::size](#size-22) = 0.0 | Contact area between the finger pad and the screen.                 |
121| [OH_NativeXComponent_TouchEvent::force](#force-22) = 0.0 | Pressure of the touch event.                    |
122| [OH_NativeXComponent_TouchEvent::deviceId](#deviceid) = 0 | ID of the device where the current touch event is triggered.               |
123| [OH_NativeXComponent_TouchEvent::timeStamp](#timestamp-22) = 0 | Timestamp of the touch event.                   |
124| [OH_NativeXComponent_TouchEvent::touchPoints](#touchpoints) [OH_MAX_TOUCH_POINTS_NUMBER] | Array of the touch points.                     |
125| [OH_NativeXComponent_TouchEvent::numPoints](#numpoints) = 0 | Number of current touch points.                     |
126| [OH_NativeXComponent_MouseEvent::x](#x-33) = 0.0 | X coordinate of the clicked point relative to the upper left corner of the component.          |
127| [OH_NativeXComponent_MouseEvent::y](#y-33)= 0.0 | Y coordinate of the clicked point relative to the upper left corner of the component.          |
128| [OH_NativeXComponent_MouseEvent::screenX](#screenx-33)= 0.0 | X coordinate of the clicked point relative to the upper left corner of the screen.            |
129| [OH_NativeXComponent_MouseEvent::screenY](#screeny-33)= 0.0 | Y coordinate of the clicked point relative to the upper left corner of the screen.            |
130| [OH_NativeXComponent_MouseEvent::timestamp](#timestamp)= 0 | Timestamp of the mouse event.                   |
131| [OH_NativeXComponent_MouseEvent::action](#action)= [OH_NativeXComponent_MouseEventAction::OH_NATIVEXCOMPONENT_MOUSE_NONE](#oh_nativexcomponent_mouseeventaction) | Action of the mouse event.                     |
132| [OH_NativeXComponent_MouseEvent::button](#button)= [OH_NativeXComponent_MouseEventButton::OH_NATIVEXCOMPONENT_NONE_BUTTON](#oh_nativexcomponent_mouseeventbutton) | Enumerates the mouse event buttons.                       |
133| [OH_NativeXComponent_Callback::OnSurfaceCreated](#onsurfacecreated) | Invoked when a surface is created.                 |
134| [OH_NativeXComponent_Callback::OnSurfaceChanged](#onsurfacechanged) | Invoked when the surface changes.                |
135| [OH_NativeXComponent_Callback::OnSurfaceDestroyed](#onsurfacedestroyed) | Invoked when the surface is destroyed.               |
136| [OH_NativeXComponent_Callback::DispatchTouchEvent](#dispatchtouchevent) | Invoked when a touch event is triggered.                  |
137| [OH_NativeXComponent_MouseEvent_Callback::DispatchMouseEvent](#dispatchmouseevent) | Invoked when a mouse event is triggered.                  |
138| [OH_NativeXComponent_MouseEvent_Callback::DispatchHoverEvent](#dispatchhoverevent) | Invoked when a hover event is triggered.                  |
139
140
141## Type Description
142
143
144### OH_NativeXComponent
145
146```
147typedef struct OH_NativeXComponent OH_NativeXComponent
148```
149
150**Description**
151
152Provides an encapsulated **OH_NativeXComponent** instance.
153
154**Since**
155
1568
157
158
159### OH_NativeXComponent_Callback
160
161```
162typedef struct OH_NativeXComponent_Callback OH_NativeXComponent_Callback
163```
164
165**Description**
166
167Registers callbacks for the surface lifecycle and touch event.
168
169**Since**
170
1718
172
173
174### OH_NativeXComponent_KeyEvent
175
176```
177typedef struct OH_NativeXComponent_KeyEvent OH_NativeXComponent_KeyEvent
178```
179
180**Description**
181
182Provides an encapsulated **OH_NativeXComponent_KeyEvent** instance.
183
184**Since**
185
18610
187
188
189### OH_NativeXComponent_MouseEvent_Callback
190
191```
192typedef struct OH_NativeXComponent_MouseEvent_Callback OH_NativeXComponent_MouseEvent_Callback
193```
194
195**Description**
196
197Registers callbacks for the mouse event.
198
199**Since**
200
2019
202
203
204## Enum Description
205
206
207### anonymous enum
208
209```
210anonymous enum
211```
212
213**Description**
214
215Enumerates the API access states.
216
217| Value                                     | Description   |
218| ---------------------------------------- | ----- |
219| OH_NATIVEXCOMPONENT_RESULT_SUCCESS       | Success.|
220| OH_NATIVEXCOMPONENT_RESULT_FAILED        | Failure.|
221| OH_NATIVEXCOMPONENT_RESULT_BAD_PARAMETER | Invalid parameter.|
222
223**Since**
224
2258
226
227
228### OH_NativeXComponent_EventSourceType
229
230```
231enum OH_NativeXComponent_EventSourceType
232```
233
234**Description**
235
236Enumerates the touch event source types.
237
238| Value                                     | Description                                                  |
239| ------------------------------------------- | ------------------------------------------------------ |
240| OH_NATIVEXCOMPONENT_SOURCE_TYPE_UNKNOWN     | Unknown source type.                                    |
241| OH_NATIVEXCOMPONENT_SOURCE_TYPE_MOUSE       | Source that generates a mouse multi-click event.                      |
242| OH_NATIVEXCOMPONENT_SOURCE_TYPE_TOUCHSCREEN | Source that generates a touchscreen multi-touch event.                |
243| OH_NATIVEXCOMPONENT_SOURCE_TYPE_TOUCHPAD    | Source that generates a touchpad multi-touch event.                |
244| OH_NATIVEXCOMPONENT_SOURCE_TYPE_JOYSTICK    | Source that generates a joystick multi-touch event.                |
245| OH_NATIVEXCOMPONENT_SOURCE_TYPE_KEYBOARD<sup>10+</sup>    | Source that generates a key event.           |
246
247**Since**
248
2499
250
251
252### OH_NativeXComponent_KeyAction
253
254```
255enum OH_NativeXComponent_KeyAction
256```
257
258**Description**
259
260Enumerates the key event actions.
261
262| Value                                   | Description      |
263| -------------------------------------- | -------- |
264| OH_NATIVEXCOMPONENT_KEY_ACTION_UNKNOWN | Unknown key event action.|
265| OH_NATIVEXCOMPONENT_KEY_ACTION_DOWN    | Button press. |
266| OH_NATIVEXCOMPONENT_KEY_ACTION_UP      | Button release. |
267
268**Since**
269
27010
271
272
273### OH_NativeXComponent_KeyCode
274
275```
276enum OH_NativeXComponent_KeyCode
277```
278
279**Description**
280
281Enumerates the mouse event key codes.
282
283| Value                         | Description                         |
284| ---------------------------- | --------------------------- |
285| KEY_UNKNOWN                  | Unknown key.                       |
286| KEY_FN                       | Function (Fn) key.                    |
287| KEY_HOME                     | Function (Home) key.                  |
288| KEY_BACK                     | Back key.                        |
289| KEY_MEDIA_PLAY_PAUSE         | Multimedia key - play/pause.            |
290| KEY_MEDIA_STOP               | Multimedia key - stop.               |
291| KEY_MEDIA_NEXT               | Multimedia key - next song.              |
292| KEY_MEDIA_PREVIOUS           | Multimedia key - previous song.              |
293| KEY_MEDIA_REWIND             | Multimedia key - rewind.               |
294| KEY_MEDIA_FAST_FORWARD       | Multimedia key - fast-forward.               |
295| KEY_VOLUME_UP                | Volume Up key.                      |
296| KEY_VOLUME_DOWN              | Volume Down key.                      |
297| KEY_POWER                    | Power key.                        |
298| KEY_CAMERA                   | Camera key.                        |
299| KEY_VOLUME_MUTE              | Speaker Mute key.                     |
300| KEY_MUTE                     | Microphone Mute key.                      |
301| KEY_BRIGHTNESS_UP            | Brightness key - turn up.             |
302| KEY_BRIGHTNESS_DOWN          | Brightness key - turn down.             |
303| KEY_0                        | Key **0**.                      |
304| KEY_1                        | Key **1**.                      |
305| KEY_2                        | Key **2**.                      |
306| KEY_3                        | Key **3**.                      |
307| KEY_4                        | Key **4**.                      |
308| KEY_5                        | Key **5**.                      |
309| KEY_6                        | Key **6**.                      |
310| KEY_7                        | Key **7**.                      |
311| KEY_8                        | Key **8**.                      |
312| KEY_9                        | Key **9**.                      |
313| KEY_STAR                     | Key **\***.                     |
314| KEY_POUND                    | Key **\#**.                     |
315| KEY_DPAD_UP                  | Navigation key - up.                |
316| KEY_DPAD_DOWN                | Navigation key - down.                |
317| KEY_DPAD_LEFT                | Navigation key - left.                |
318| KEY_DPAD_RIGHT               | Navigation key - right.                |
319| KEY_DPAD_CENTER              | Navigation key - OK.               |
320| KEY_A                        | Key **A**.                      |
321| KEY_B                        | Key **B**.                      |
322| KEY_C                        | Key **C**.                      |
323| KEY_D                        | Key **D**.                      |
324| KEY_E                        | Key **E**.                      |
325| KEY_F                        | Key **F**.                      |
326| KEY_G                        | Key **G**.                      |
327| KEY_H                        | Key **H**.                      |
328| KEY_I                        | Key **I**.                      |
329| KEY_J                        | Key **J**.                      |
330| KEY_K                        | Key **K**.                      |
331| KEY_L                        | Key **L**.                      |
332| KEY_M                        | Key **M**.                      |
333| KEY_N                        | Key **N**.                      |
334| KEY_O                        | Key **O**.                      |
335| KEY_P                        | Key **P**.                      |
336| KEY_Q                        | Key **Q**.                      |
337| KEY_R                        | Key **R**.                      |
338| KEY_S                        | Key **S**.                      |
339| KEY_T                        | Key **T**.                      |
340| KEY_U                        | Key **U**.                      |
341| KEY_V                        | Key **V**.                      |
342| KEY_W                        | Key **W**.                      |
343| KEY_X                        | Key **X**.                      |
344| KEY_Y                        | Key **Y**.                      |
345| KEY_Z                        | Key **Z**.                      |
346| KEY_COMMA                    | Key **,**.                      |
347| KEY_PERIOD                   | Key **.**.                      |
348| KEY_ALT_LEFT                 | Left Alt key.                      |
349| KEY_ALT_RIGHT                | Right Alt key.                      |
350| KEY_SHIFT_LEFT               | Left Shift key.                    |
351| KEY_SHIFT_RIGHT              | Right Shift key.                    |
352| KEY_TAB                      | Tab key.                       |
353| KEY_SPACE                    | Space key.                        |
354| KEY_SYM                      | Symbol key.                    |
355| KEY_EXPLORER                 | Explorer key, which is used to start the explorer application.      |
356| KEY_ENVELOPE                 | Email key, which is used to start the email application.    |
357| KEY_ENTER                    | Enter key.                        |
358| KEY_DEL                      | Delete key.                        |
359| KEY_GRAVE                    | Key **`**.                      |
360| KEY_MINUS                    | Key **-**.                      |
361| KEY_EQUALS                   | Key **=**.                      |
362| KEY_LEFT_BRACKET             | Key **[**.                      |
363| KEY_RIGHT_BRACKET            | Key **]**.                      |
364| KEY_BACKSLASH                | Key **\**.                      |
365| KEY_SEMICOLON                | Key **;**.                      |
366| KEY_APOSTROPHE               | Key **'**.           |
367| KEY_SLASH                    | Key **/**.                      |
368| KEY_AT                       | Key **\@**.                     |
369| KEY_PLUS                     | Key **+**.                      |
370| KEY_MENU                     | Menu key.                        |
371| KEY_PAGE_UP                  | Page Up key.                      |
372| KEY_PAGE_DOWN                | Page Down key.                      |
373| KEY_ESCAPE                   | ESC key.                       |
374| KEY_FORWARD_DEL              | Delete key.                        |
375| KEY_CTRL_LEFT                | Left Ctrl key.                     |
376| KEY_CTRL_RIGHT               | Right Ctrl key.                     |
377| KEY_CAPS_LOCK                | Caps Lock key.                      |
378| KEY_SCROLL_LOCK              | Scroll Lock key.                      |
379| KEY_META_LEFT                | Left Meta key.                     |
380| KEY_META_RIGHT               | Right Meta key.                     |
381| KEY_FUNCTION                 | Function key.                        |
382| KEY_SYSRQ                    | System Request/Print Screen key.                 |
383| KEY_BREAK                    | Break/Pause key.               |
384| KEY_MOVE_HOME                | Move to Home key.                   |
385| KEY_MOVE_END                 | Move to End key.                   |
386| KEY_INSERT                   | Insert key.                        |
387| KEY_FORWARD                  | Forward key.                        |
388| KEY_MEDIA_PLAY               | Multimedia key - play.               |
389| KEY_MEDIA_PAUSE              | Multimedia key - pause.               |
390| KEY_MEDIA_CLOSE              | Multimedia key - close.               |
391| KEY_MEDIA_EJECT              | Multimedia key - eject.               |
392| KEY_MEDIA_RECORD             | Multimedia key - record.               |
393| KEY_F1                       | F1 key.                     |
394| KEY_F2                       | F2 key.                     |
395| KEY_F3                       | F3 key.                     |
396| KEY_F4                       | F4 key.                     |
397| KEY_F5                       | F5 key.                     |
398| KEY_F6                       | F6 key.                     |
399| KEY_F7                       | F7 key.                     |
400| KEY_F8                       | F8 key.                     |
401| KEY_F9                       | F9 key.                     |
402| KEY_F10                      | F10 key.                    |
403| KEY_F11                      | F11 key.                    |
404| KEY_F12                      | F12 key.                    |
405| KEY_NUM_LOCK                 | Number Lock key.                       |
406| KEY_NUMPAD_0                 | Key **0** on numeric keypad.                   |
407| KEY_NUMPAD_1                 | Key **1** on numeric keypad.                   |
408| KEY_NUMPAD_2                 | Key **2** on numeric keypad.                   |
409| KEY_NUMPAD_3                 | Key **3** on numeric keypad.                   |
410| KEY_NUMPAD_4                 | Key **4** on numeric keypad.                   |
411| KEY_NUMPAD_5                 | Key **5** on numeric keypad.                   |
412| KEY_NUMPAD_6                 | Key **6** on numeric keypad.                   |
413| KEY_NUMPAD_7                 | Key **7** on numeric keypad.                   |
414| KEY_NUMPAD_8                 | Key **8** on numeric keypad.                   |
415| KEY_NUMPAD_9                 | Key **9** on numeric keypad.                   |
416| KEY_NUMPAD_DIVIDE            | Key **/** on numeric keypad.                   |
417| KEY_NUMPAD_MULTIPLY          | Key ***** on numeric keypad.                  |
418| KEY_NUMPAD_SUBTRACT          | Key **-** on numeric keypad.                   |
419| KEY_NUMPAD_ADD               | Key **+** on numeric keypad.                   |
420| KEY_NUMPAD_DOT               | Key **.** on numeric keypad.                   |
421| KEY_NUMPAD_COMMA             | Key **,** on numeric keypad.                   |
422| KEY_NUMPAD_ENTER             | Enter key on numeric keypad.                    |
423| KEY_NUMPAD_EQUALS            | Key **=** on numeric keypad.                   |
424| KEY_NUMPAD_LEFT_PAREN        | Key **(** on numeric keypad.                   |
425| KEY_NUMPAD_RIGHT_PAREN       | Key **)** on numeric keypad.                   |
426| KEY_VIRTUAL_MULTITASK        | Multi-task key.                     |
427| KEY_SLEEP                    | Sleep key.                        |
428| KEY_ZENKAKU_HANKAKU          | Zenkaku/Hankaku key.                   |
429| KEY_102ND                    | 102nd key.                    |
430| KEY_RO                       | Ro key.                      |
431| KEY_KATAKANA                 | Katakana key.                     |
432| KEY_HIRAGANA                 | Hiragana key.                     |
433| KEY_HENKAN                   | Henkan key.                      |
434| KEY_KATAKANA_HIRAGANA        | Katakana/Hiragana key.                 |
435| KEY_MUHENKAN                 | Muhenkan key.                     |
436| KEY_LINEFEED                 | Linefeed key.                        |
437| KEY_MACRO                    | Macro key.                         |
438| KEY_NUMPAD_PLUSMINUS         | Plus/Minus key on the numeric keypad.               |
439| KEY_SCALE                    | Scale key.                        |
440| KEY_HANGUEL                  | Hanguel key.                      |
441| KEY_HANJA                    | Hanja key.                      |
442| KEY_YEN                      | Yen key.                        |
443| KEY_STOP                     | Stop key.                        |
444| KEY_AGAIN                    | Again key.                        |
445| KEY_PROPS                    | Props key.                        |
446| KEY_UNDO                     | Undo key.                        |
447| KEY_COPY                     | Copy key.                        |
448| KEY_OPEN                     | Open key.                        |
449| KEY_PASTE                    | Paste key.                        |
450| KEY_FIND                     | Find key.                        |
451| KEY_CUT                      | Cut key.                        |
452| KEY_HELP                     | Help key.                        |
453| KEY_CALC                     | Calc key, which is used to start the calculator application.       |
454| KEY_FILE                     | File key.                       |
455| KEY_BOOKMARKS                | Bookmarks key.                        |
456| KEY_NEXT                     | Next key.                      |
457| KEY_PLAYPAUSE                | Play/Pause key.                     |
458| KEY_PREVIOUS                 | Previous key.                      |
459| KEY_STOPCD                   | Stop CD key.                      |
460| KEY_CONFIG                   | Config key.                        |
461| KEY_REFRESH                  | Refresh key.                        |
462| KEY_EXIT                     | Exit key.                        |
463| KEY_EDIT                     | Edit key.                        |
464| KEY_SCROLLUP                 | Scroll Up key.                      |
465| KEY_SCROLLDOWN               | Scroll Down key.                      |
466| KEY_NEW                      | New key.                        |
467| KEY_REDO                     | Redo key.                        |
468| KEY_CLOSE                    | Close key.                        |
469| KEY_PLAY                     | Play key.                        |
470| KEY_BASSBOOST                | Bass Boost key.                      |
471| KEY_PRINT                    | Print key.                        |
472| KEY_CHAT                     | Chat key.                        |
473| KEY_FINANCE                  | Finance key.                        |
474| KEY_CANCEL                   | Cancel key.                        |
475| KEY_KBDILLUM_TOGGLE          | Keyboard Illumination Toggle key.                    |
476| KEY_KBDILLUM_DOWN            | Keyboard Illumination Up key.                    |
477| KEY_KBDILLUM_UP              | Keyboard Illumination Down key.                    |
478| KEY_SEND                     | Send key.                        |
479| KEY_REPLY                    | Reply key.                        |
480| KEY_FORWARDMAIL              | Forward Mail key.                      |
481| KEY_SAVE                     | Save key.                        |
482| KEY_DOCUMENTS                | Documents key.                        |
483| KEY_VIDEO_NEXT               | Next Video key.                     |
484| KEY_VIDEO_PREV               | Previous Video key.                     |
485| KEY_BRIGHTNESS_CYCLE         | Brightness Cycle key.                      |
486| KEY_BRIGHTNESS_ZERO          | Brightness Zero key.                    |
487| KEY_DISPLAY_OFF              | Display Off Key.                      |
488| KEY_BTN_MISC                 | Misc Button key.                 |
489| KEY_GOTO                     | Goto key.                        |
490| KEY_INFO                     | Info key.                      |
491| KEY_PROGRAM                  | Program key.                        |
492| KEY_PVR                      | PVR key.                |
493| KEY_SUBTITLE                 | Subtitle key.                        |
494| KEY_FULL_SCREEN              | Full Screen key.                        |
495| KEY_KEYBOARD                 | Keyboard.                         |
496| KEY_ASPECT_RATIO             | Aspect Ratio key.                   |
497| KEY_PC                       | Port Control key.                      |
498| KEY_TV                       | TV key.                        |
499| KEY_TV2                      | TV key 2.                       |
500| KEY_VCR                      | VCR key.                     |
501| KEY_VCR2                     | VCR key 2.                    |
502| KEY_SAT                      | SAT key.            |
503| KEY_CD                       | CD key.                        |
504| KEY_TAPE                     | Tape key.                        |
505| KEY_TUNER                    | Tuner key.                       |
506| KEY_PLAYER                   | Player key.                       |
507| KEY_DVD                      | DVD key.                       |
508| KEY_AUDIO                    | Audio key.                        |
509| KEY_VIDEO                    | Video key.                        |
510| KEY_MEMO                     | Memo key.                       |
511| KEY_CALENDAR                 | Calendar key.                        |
512| KEY_RED                      | Red indicator.                      |
513| KEY_GREEN                    | Green indicator.                      |
514| KEY_YELLOW                   | Yellow indicator.                      |
515| KEY_BLUE                     | Blue indicator.                      |
516| KEY_CHANNELUP                | Channel Up key.                      |
517| KEY_CHANNELDOWN              | Channel Down key.                      |
518| KEY_LAST                     | Last key.                        |
519| KEY_RESTART                  | Restart key.                        |
520| KEY_SLOW                     | Slow key.                        |
521| KEY_SHUFFLE                  | Shuffle key.                      |
522| KEY_VIDEOPHONE               | Videophone key.                      |
523| KEY_GAMES                    | Games key.                        |
524| KEY_ZOOMIN                   | Zoom in key.                        |
525| KEY_ZOOMOUT                  | Zoom out key.                        |
526| KEY_ZOOMRESET                | Zoom Reset key.                      |
527| KEY_WORDPROCESSOR            | Word Processor key.                      |
528| KEY_EDITOR                   | Editor key.                       |
529| KEY_SPREADSHEET              | Spreadsheet key.                      |
530| KEY_GRAPHICSEDITOR           | Graphics Editor key.                     |
531| KEY_PRESENTATION             | Presentation key.                      |
532| KEY_DATABASE                 | Database key.                      |
533| KEY_NEWS                     | News key.                        |
534| KEY_VOICEMAIL                | Voicemail key.                       |
535| KEY_ADDRESSBOOK              | Address book key.                        |
536| KEY_MESSENGER                | Messenger key.                        |
537| KEY_BRIGHTNESS_TOGGLE        | Brightness Toggle key.                      |
538| KEY_SPELLCHECK               | Spell Check key.                     |
539| KEY_COFFEE                   | Coffee key, which is used to launch screen lock or screen saver.                 |
540| KEY_MEDIA_REPEAT             | Media Repeat key.                      |
541| KEY_IMAGES                   | Images key.                        |
542| KEY_BUTTONCONFIG             | Button Configuration key.                      |
543| KEY_TASKMANAGER              | Task Manager key.                      |
544| KEY_JOURNAL                  | Log key.                       |
545| KEY_CONTROLPANEL             | Control Panel key.                      |
546| KEY_APPSELECT                | App Select key.                    |
547| KEY_SCREENSAVER              | Screen Saver key.                    |
548| KEY_ASSISTANT                | Assistant key.                        |
549| KEY_KBD_LAYOUT_NEXT          | Next Keyboard Layout key.                   |
550| KEY_BRIGHTNESS_MIN           | Min Brightness key.                      |
551| KEY_BRIGHTNESS_MAX           | Max Brightness key.                      |
552| KEY_KBDINPUTASSIST_PREV      | Keyboard Input-assisted Previous key.        |
553| KEY_KBDINPUTASSIST_NEXT      | Keyboard Input-assisted Next key.            |
554| KEY_KBDINPUTASSIST_PREVGROUP | Keyboard Input-assisted Previous key.        |
555| KEY_KBDINPUTASSIST_NEXTGROUP | Keyboard Input-assisted Next key.            |
556| KEY_KBDINPUTASSIST_ACCEPT    | Keyboard Input-assisted Accept key.          |
557| KEY_KBDINPUTASSIST_CANCEL    | Keyboard Input-assisted Cancel key.          |
558| KEY_FRONT                    | Front key, which is used to launch the windshield defogger.                  |
559| KEY_SETUP                    | Setup key.                        |
560| KEY_WAKEUP                   | Wakeup key.                        |
561| KEY_SENDFILE                 | Send File key.                     |
562| KEY_DELETEFILE               | Delete File key.                     |
563| KEY_XFER                     | XFER key, which is used to start file transfer.               |
564| KEY_PROG1                    | Program key 1.                       |
565| KEY_PROG2                    | Program key 2.                       |
566| KEY_MSDOS                    | MS-DOS key.           |
567| KEY_SCREENLOCK               | Screen Lock key.                      |
568| KEY_DIRECTION_ROTATE_DISPLAY | Directional Rotation Display key.                    |
569| KEY_CYCLEWINDOWS             | Windows Cycle key.                 |
570| KEY_COMPUTER                 | Keys.                         |
571| KEY_EJECTCLOSECD             | Eject CD key.                      |
572| KEY_ISO                      | ISO key.                       |
573| KEY_MOVE                     | Move key.                        |
574| KEY_F13                      | F13 key.                    |
575| KEY_F14                      | F14 key.                    |
576| KEY_F15                      | F15 key.                    |
577| KEY_F16                      | F16 key.                    |
578| KEY_F17                      | F17 key.                    |
579| KEY_F18                      | F18 key.                    |
580| KEY_F19                      | F19 key.                    |
581| KEY_F20                      | F20 key.                    |
582| KEY_F21                      | F21 key.                    |
583| KEY_F22                      | F22 key.                    |
584| KEY_F23                      | F23 key.                    |
585| KEY_F24                      | F24 key.                    |
586| KEY_PROG3                    | Program key 3.                       |
587| KEY_PROG4                    | Program key 4.                       |
588| KEY_DASHBOARD                | Dashboard.                        |
589| KEY_SUSPEND                  | Suspend key.                        |
590| KEY_HP                       | HP key.                      |
591| KEY_SOUND                    | Sound key.                        |
592| KEY_QUESTION                 | Question key.                       |
593| KEY_CONNECT                  | Connect key.                        |
594| KEY_SPORT                    | Sport key.                       |
595| KEY_SHOP                     | Shop key.                        |
596| KEY_ALTERASE                 | Alternate key.                        |
597| KEY_SWITCHVIDEOMODE          | Switch Video Mode key (monitor, LCD, and TV, etc.).|
598| KEY_BATTERY                  | Battery key.                       |
599| KEY_BLUETOOTH                | Bluetooth key.                       |
600| KEY_WLAN                     | WLAN key.                      |
601| KEY_UWB                      | Ultra-wideband key.                   |
602| KEY_WWAN_WIMAX               | WWAN WiMAX key.          |
603| KEY_RFKILL                   | RF Kill key.                  |
604| KEY_CHANNEL                  | Channel key.                      |
605| KEY_BTN_0                    | Button 0.                        |
606| KEY_BTN_1                    | Button 1.                        |
607| KEY_BTN_2                    | Button 2.                        |
608| KEY_BTN_3                    | Button 3.                        |
609| KEY_BTN_4                    | Button 4.                        |
610| KEY_BTN_5                    | Button 5.                        |
611| KEY_BTN_6                    | Button 6.                        |
612| KEY_BTN_7                    | Button 7.                        |
613| KEY_BTN_8                    | Button 8.                        |
614| KEY_BTN_9                    | Button 9.                        |
615
616**Since**
617
61810
619
620
621### OH_NativeXComponent_MouseEventAction
622
623```
624enum OH_NativeXComponent_MouseEventAction
625```
626
627**Description**
628
629Enumerates the mouse event actions.
630
631| Value                              | Description              |
632| --------------------------------- | ---------------- |
633| OH_NATIVEXCOMPONENT_MOUSE_NONE    | Invalid mouse event.   |
634| OH_NATIVEXCOMPONENT_MOUSE_PRESS   | Mouse button press.  |
635| OH_NATIVEXCOMPONENT_MOUSE_RELEASE | Mouse button release.  |
636| OH_NATIVEXCOMPONENT_MOUSE_MOVE    | Mouse movement.|
637
638**Since**
639
6409
641
642
643### OH_NativeXComponent_MouseEventButton
644
645```
646enum OH_NativeXComponent_MouseEventButton
647```
648
649**Description**
650
651Enumerates the mouse event buttons.
652
653| Value                               | Description               |
654| ---------------------------------- | ----------------- |
655| OH_NATIVEXCOMPONENT_NONE_BUTTON    | No button.  |
656| OH_NATIVEXCOMPONENT_LEFT_BUTTON    | Left mouse button.   |
657| OH_NATIVEXCOMPONENT_RIGHT_BUTTON   | Right mouse button.   |
658| OH_NATIVEXCOMPONENT_MIDDLE_BUTTON  | Middle mouse button.   |
659| OH_NATIVEXCOMPONENT_BACK_BUTTON    | Back button on the left of the mouse.|
660| OH_NATIVEXCOMPONENT_FORWARD_BUTTON | Forward key on the left of the mouse.|
661
662**Since**
663
6649
665
666
667### OH_NativeXComponent_TouchEventType
668
669```
670enum OH_NativeXComponent_TouchEventType
671```
672
673**Description**
674
675Enumerates the touch event types.
676
677| Value                        | Description                   |
678| --------------------------- | --------------------- |
679| OH_NATIVEXCOMPONENT_DOWN    | The touch event is triggered when a finger is pressed.         |
680| OH_NATIVEXCOMPONENT_UP      | The touch event is triggered when a finger is lifted.         |
681| OH_NATIVEXCOMPONENT_MOVE    | The touch event is triggered when a finger is moved on the screen.|
682| OH_NATIVEXCOMPONENT_CANCEL  | The event is triggered when a touch event is canceled.         |
683| OH_NATIVEXCOMPONENT_UNKNOWN | Invalid touch type.             |
684
685**Since**
686
6878
688
689
690### OH_NativeXComponent_TouchPointToolType
691
692```
693enum OH_NativeXComponent_TouchPointToolType
694```
695
696**Description**
697
698Enumerates the touch point tool types.
699
700| Value                                   | Description      |
701| -------------------------------------- | -------- |
702| OH_NATIVEXCOMPONENT_TOOL_TYPE_UNKNOWN  | Unknown tool type.|
703| OH_NATIVEXCOMPONENT_TOOL_TYPE_FINGER   | Finger.  |
704| OH_NATIVEXCOMPONENT_TOOL_TYPE_PEN      | Stylus.  |
705| OH_NATIVEXCOMPONENT_TOOL_TYPE_RUBBER   | Rubber. |
706| OH_NATIVEXCOMPONENT_TOOL_TYPE_BRUSH    | Brush.  |
707| OH_NATIVEXCOMPONENT_TOOL_TYPE_PENCIL   | Pencil.  |
708| OH_NATIVEXCOMPONENT_TOOL_TYPE_AIRBRUSH | Air brush.  |
709| OH_NATIVEXCOMPONENT_TOOL_TYPE_MOUSE    | Mouse.  |
710| OH_NATIVEXCOMPONENT_TOOL_TYPE_LENS     | Lens. |
711
712**Since**
713
7149
715
716
717## Function Description
718
719### OH_NativeXComponent_AttachNativeRootNode()
720
721```
722int32_t OH_NativeXComponent_AttachNativeRootNode (OH_NativeXComponent * component, ArkUI_NodeHandle root )
723```
724**Description**
725
726Attaches the UI component created through the native API of ArkUI to this **OH_NativeXComponent** instance.
727
728**Since**: 12
729
730**Parameters**
731
732| Name| Description|
733| -------- | -------- |
734| component | Pointer to the **OH_NativeXComponent** instance. |
735| root | Pointer to the component instance created through the native API. |
736
737**Returns**
738
739**0**: success
740
741-**2**: parameter error
742
743
744### OH_NativeXComponent_DetachNativeRootNode()
745
746```
747int32_t OH_NativeXComponent_DetachNativeRootNode (OH_NativeXComponent * component, ArkUI_NodeHandle root )
748```
749**Description**
750
751Detaches the native component of ArkUI from this **OH_NativeXComponent** instance.
752
753**Since**: 12
754
755**Parameters**
756
757| Name| Description|
758| -------- | -------- |
759| component | Pointer to the **OH_NativeXComponent** instance. |
760| root | Pointer to the component instance created through the native API. |
761
762**Returns**
763
764**0**: success
765
766-**2**: parameter error
767
768
769
770### OH_NativeXComponent_GetKeyEvent()
771
772```
773int32_t OH_NativeXComponent_GetKeyEvent (OH_NativeXComponent * component, OH_NativeXComponent_KeyEvent ** keyEvent )
774```
775
776**Description**
777
778Obtains the key event scheduled by ArkUI XComponent.
779
780**Parameters**
781
782| Name       | Description                           |
783| --------- | ----------------------------- |
784| component | Pointer to the **OH_NativeXComponent** instance.|
785| keyEvent  | Pointer to the current key event.             |
786
787**Returns**
788
789Returns the status code of the execution.
790
791**Since**
792
79310
794
795
796### OH_NativeXComponent_GetKeyEventAction()
797
798```
799int32_t OH_NativeXComponent_GetKeyEventAction (OH_NativeXComponent_KeyEvent * keyEvent, OH_NativeXComponent_KeyAction * action )
800```
801
802**Description**
803
804Obtains the action of the specified key event.
805
806**Parameters**
807
808| Name      | Description                                    |
809| -------- | -------------------------------------- |
810| keyEvent | Pointer to the **OH_NativeXComponent_KeyEvent** instance.|
811| action   | Pointer to the key event action.                        |
812
813**Returns**
814
815Returns the status code of the execution.
816
817**Since**
818
81910
820
821
822### OH_NativeXComponent_GetKeyEventCode()
823
824```
825int32_t OH_NativeXComponent_GetKeyEventCode (OH_NativeXComponent_KeyEvent * keyEvent, OH_NativeXComponent_KeyCode * code )
826```
827
828**Description**
829
830Obtains the key code of the specified key event.
831
832**Parameters**
833
834| Name      | Description                                    |
835| -------- | -------------------------------------- |
836| keyEvent | Pointer to the **OH_NativeXComponent_KeyEvent** instance.|
837| code     | Pointer to the key code of the key event.                       |
838
839**Returns**
840
841Returns the status code of the execution.
842
843**Since**
844
84510
846
847
848### OH_NativeXComponent_GetKeyEventDeviceId()
849
850```
851int32_t OH_NativeXComponent_GetKeyEventDeviceId (OH_NativeXComponent_KeyEvent * keyEvent, int64_t * deviceId )
852```
853
854**Description**
855
856Obtains the device ID of the specified key event.
857
858**Parameters**
859
860| Name      | Description                                    |
861| -------- | -------------------------------------- |
862| keyEvent | Pointer to the **OH_NativeXComponent_KeyEvent** instance.|
863| deviceId | Pointer to the device ID of the key event.                      |
864
865**Returns**
866
867Returns the status code of the execution.
868
869**Since**
870
87110
872
873
874### OH_NativeXComponent_GetKeyEventSourceType()
875
876```
877int32_t OH_NativeXComponent_GetKeyEventSourceType (OH_NativeXComponent_KeyEvent * keyEvent, OH_NativeXComponent_EventSourceType * sourceType )
878```
879
880**Description**
881
882Obtains the source type of the specified key event.
883
884**Parameters**
885
886| Name        | Description                                    |
887| ---------- | -------------------------------------- |
888| keyEvent   | Pointer to the **OH_NativeXComponent_KeyEvent** instance.|
889| sourceType | Pointer to the source type of the key event.                     |
890
891**Returns**
892
893Returns the status code of the execution.
894
895**Since**
896
89710
898
899
900### OH_NativeXComponent_GetKeyEventTimeStamp()
901
902```
903int32_t OH_NativeXComponent_GetKeyEventTimeStamp (OH_NativeXComponent_KeyEvent * keyEvent, int64_t * timeStamp )
904```
905
906**Description**
907
908Obtains the timestamp of the specified key event.
909
910**Parameters**
911
912| Name       | Description                                    |
913| --------- | -------------------------------------- |
914| keyEvent  | Pointer to the **OH_NativeXComponent_KeyEvent** instance.|
915| timeStamp | Pointer to the timestamp of the key event.                       |
916
917**Returns**
918
919Returns the status code of the execution.
920
921**Since**
922
92310
924
925
926### OH_NativeXComponent_GetMouseEvent()
927
928```
929int32_t OH_NativeXComponent_GetMouseEvent (OH_NativeXComponent * component, const void * window, OH_NativeXComponent_MouseEvent * mouseEvent )
930```
931
932**Description**
933
934Obtains the mouse event scheduled by ArkUI XComponent.
935
936**Parameters**
937
938| Name        | Description                           |
939| ---------- | ----------------------------- |
940| component  | Pointer to the **OH_NativeXComponent** instance.|
941| window     | Handle to the **NativeWindow** instance.             |
942| mouseEvent | Pointer to the current mouse event.               |
943
944**Returns**
945
946Returns the status code of the execution.
947
948**Since**
949
9509
951
952### OH_NativeXComponent_GetNativeXComponent()
953
954```
955OH_NativeXComponent* OH_NativeXComponent_GetNativeXComponent (ArkUI_NodeHandle node)
956```
957**Description**
958
959Obtains the pointer to an **OH_NativeXComponent** instance based on the specified component instance created by the native API.
960
961**Since**: 12
962
963**Parameters**
964
965| Name| Description|
966| -------- | -------- |
967| node | Pointer to the component instance created through the native API. |
968
969**Returns**
970
971Pointer to the **OH_NativeXComponent** instance.
972
973
974### OH_NativeXComponent_GetTouchEvent()
975
976```
977int32_t OH_NativeXComponent_GetTouchEvent (OH_NativeXComponent * component, const void * window, OH_NativeXComponent_TouchEvent * touchEvent )
978```
979
980**Description**
981
982Obtains the touch event scheduled by the ArkUI XComponent.
983
984**Parameters**
985
986| Name        | Description                           |
987| ---------- | ----------------------------- |
988| component  | Pointer to the **OH_NativeXComponent** instance.|
989| window     | Handle to the **NativeWindow** instance.            |
990| touchEvent | Pointer to the current touch event.               |
991
992**Returns**
993
994Returns the status code of the execution.
995
996**Since**
997
9988
999
1000
1001### OH_NativeXComponent_GetTouchPointTiltX()
1002
1003```
1004int32_t OH_NativeXComponent_GetTouchPointTiltX (OH_NativeXComponent * component, uint32_t pointIndex, float * tiltX )
1005```
1006
1007**Description**
1008
1009Obtains the angle between the Y-Z plane of the ArkUI XComponent touch point and the x-axis.
1010
1011**Parameters**
1012
1013| Name        | Description                           |
1014| ---------- | ----------------------------- |
1015| component  | Pointer to the **OH_NativeXComponent** instance.|
1016| pointIndex | Pointer to the index of the touch point.                  |
1017| tiltX      | Pointer to the angle between the Y-Z plane of the touch point and the x-axis.                 |
1018
1019**Returns**
1020
1021Returns the status code of the execution.
1022
1023**Since**
1024
10259
1026
1027
1028### OH_NativeXComponent_GetTouchPointTiltY()
1029
1030```
1031int32_t OH_NativeXComponent_GetTouchPointTiltY (OH_NativeXComponent * component, uint32_t pointIndex, float * tiltY )
1032```
1033
1034**Description**
1035
1036Obtains the angle between the X-Z plane of the ArkUI XComponent touch point and the y-axis.
1037
1038**Parameters**
1039
1040| Name        | Description                           |
1041| ---------- | ----------------------------- |
1042| component  | Pointer to the **OH_NativeXComponent** instance.|
1043| pointIndex | Pointer to the index of the touch point.                  |
1044| tiltY      | Pointer to the angle between the X-Z plane of the touch point and the y-axis.                 |
1045
1046**Returns**
1047
1048Returns the status code of the execution.
1049
1050**Since**
1051
10529
1053
1054
1055### OH_NativeXComponent_GetTouchPointWindowX()
1056
1057```
1058int32_t OH_NativeXComponent_GetTouchPointWindowX(OH_NativeXComponent * component, uint32_t pointIndex, float * windowX )
1059```
1060
1061**Description**
1062
1063Obtains the X coordinate of the touch point relative to the upper left corner of the application window where the ArkUI XComponent is located.
1064
1065**Parameters**
1066
1067| Name        | Description                           |
1068| ---------- | ----------------------------- |
1069| component  | Pointer to the **OH_NativeXComponent** instance.       |
1070| pointIndex | Pointer to the index of the touch point.                         |
1071| windowX    | Pointer to the X coordinate of the touch point relative to the upper left corner of the application window. |
1072
1073**Returns**
1074
1075Returns the status code of the execution.
1076
1077**Since**
1078
107912
1080
1081
1082### OH_NativeXComponent_GetTouchPointWindowY()
1083
1084```
1085int32_t OH_NativeXComponent_GetTouchPointWindowY(OH_NativeXComponent * component, uint32_t pointIndex, float * windowY )
1086```
1087
1088**Description**
1089
1090Obtains the Y coordinate of the touch point relative to the upper left corner of the application window where the ArkUI XComponent is located.
1091
1092**Parameters**
1093
1094| Name        | Description                           |
1095| ---------- | ----------------------------- |
1096| component  | Pointer to the **OH_NativeXComponent** instance.       |
1097| pointIndex | Pointer to the index of the touch point.                         |
1098| windowY    | Pointer to the Y coordinate of the touch point relative to the upper left corner of the application window. |
1099
1100**Returns**
1101
1102Returns the status code of the execution.
1103
1104**Since**
1105
110612
1107
1108
1109### OH_NativeXComponent_GetTouchPointDisplayX()
1110
1111```
1112int32_t OH_NativeXComponent_GetTouchPointDisplayX(OH_NativeXComponent * component, uint32_t pointIndex, float * displayX )
1113```
1114
1115**Description**
1116
1117Obtains the X coordinate of the touch point relative to the upper left corner of the screen where the ArkUI XComponent is located.
1118
1119**Parameters**
1120
1121| Name        | Description                           |
1122| ---------- | ----------------------------- |
1123| component  | Pointer to the **OH_NativeXComponent** instance.       |
1124| pointIndex | Pointer to the index of the touch point.                         |
1125| displayX    | Pointer to the X coordinate of the touch point relative to the upper left corner of the screen. |
1126
1127**Returns**
1128
1129Returns the status code of the execution.
1130
1131**Since**
1132
113312
1134
1135
1136### OH_NativeXComponent_GetTouchPointDisplayY()
1137
1138```
1139int32_t OH_NativeXComponent_GetTouchPointDisplayY(OH_NativeXComponent * component, uint32_t pointIndex, float * displayY )
1140```
1141
1142**Description**
1143
1144Obtains the Y coordinate of the touch point relative to the upper left corner of the screen where the ArkUI XComponent is located.
1145
1146**Parameters**
1147
1148| Name        | Description                           |
1149| ---------- | ----------------------------- |
1150| component  | Pointer to the **OH_NativeXComponent** instance.       |
1151| pointIndex | Pointer to the index of the touch point.                         |
1152| displayY    | Pointer to the Y coordinate of the touch point relative to the upper left corner of the screen. |
1153
1154**Returns**
1155
1156Returns the status code of the execution.
1157
1158**Since**
1159
116012
1161
1162
1163### OH_NativeXComponent_GetTouchPointToolType()
1164
1165```
1166int32_t OH_NativeXComponent_GetTouchPointToolType (OH_NativeXComponent * component, uint32_t pointIndex, OH_NativeXComponent_TouchPointToolType * toolType )
1167```
1168
1169**Description**
1170
1171Obtains the ArkUI XComponent touch point tool type.
1172
1173**Parameters**
1174
1175| Name        | Description                           |
1176| ---------- | ----------------------------- |
1177| component  | Pointer to the **OH_NativeXComponent** instance.|
1178| pointIndex | Pointer to the index of the touch point.                  |
1179| toolType   | Pointer to the tool type.                 |
1180
1181**Returns**
1182
1183Returns the status code of the execution.
1184
1185**Since**
1186
11879
1188
1189
1190### OH_NativeXComponent_GetXComponentId()
1191
1192```
1193int32_t OH_NativeXComponent_GetXComponentId (OH_NativeXComponent * component, char * id, uint64_t * size )
1194```
1195
1196**Description**
1197
1198Obtains the ID of ArkUI XComponent.
1199
1200**Parameters**
1201
1202| Name     | Description                                                        |
1203| --------- | ------------------------------------------------------------ |
1204| component | Pointer to the **OH_NativeXComponent** instance.                     |
1205| 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].|
1206| size      | Pointer to the ID length, which is used to receive the ID length information.                |
1207
1208**Returns**
1209
1210Returns the status code of the execution.
1211
1212**Since**
1213
12148
1215
1216
1217### OH_NativeXComponent_GetXComponentOffset()
1218
1219```
1220int32_t OH_NativeXComponent_GetXComponentOffset (OH_NativeXComponent * component, const void * window, double * x, double * y )
1221```
1222
1223**Description**
1224
1225Obtains the offset of the surface held by the XComponent relative to the upper left corner of its parent component.
1226
1227**Parameters**
1228
1229| Name       | Description                           |
1230| --------- | ----------------------------- |
1231| component | Pointer to the **OH_NativeXComponent** instance.|
1232| window    | Handle to the **NativeWindow** instance.            |
1233| x         | Pointer to the X coordinate of the current surface relative to the upper left corner of the XComponent's parent component.        |
1234| y         | Pointer to the Y coordinate of the current surface relative to the upper left corner of the XComponent's parent component.        |
1235
1236**Returns**
1237
1238Returns the status code of the execution.
1239
1240**Since**
1241
12428
1243
1244
1245### OH_NativeXComponent_GetXComponentSize()
1246
1247```
1248int32_t OH_NativeXComponent_GetXComponentSize (OH_NativeXComponent * component, const void * window, uint64_t * width, uint64_t * height )
1249```
1250
1251**Description**
1252
1253Obtains the size of the surface held by the ArkUI XComponent.
1254
1255**Parameters**
1256
1257| Name       | Description                           |
1258| --------- | ----------------------------- |
1259| component | Pointer to the **OH_NativeXComponent** instance.|
1260| window    | Handle to the **NativeWindow** instance.            |
1261| width     | Pointer to the width of the current surface.          |
1262| height    | Pointer to the height of the current surface.          |
1263
1264**Returns**
1265
1266Returns the status code of the execution.
1267
1268**Since**
1269
12708
1271
1272
1273### OH_NativeXComponent_RegisterBlurEventCallback()
1274
1275```
1276int32_t OH_NativeXComponent_RegisterBlurEventCallback (OH_NativeXComponent * component, void(*callback)(OH_NativeXComponent *component, void *window))
1277```
1278
1279**Description**
1280
1281Registers the focus loss event callback for this **OH_NativeXComponent** instance.
1282
1283**Parameters**
1284
1285| Name       | Description                           |
1286| --------- | ----------------------------- |
1287| component | Pointer to the **OH_NativeXComponent** instance.|
1288| callback  | Pointer to the focus loss event callback.               |
1289
1290**Returns**
1291
1292Returns the status code of the execution.
1293
1294**Since**
1295
129610
1297
1298
1299### OH_NativeXComponent_RegisterCallback()
1300
1301```
1302int32_t OH_NativeXComponent_RegisterCallback (OH_NativeXComponent * component, OH_NativeXComponent_Callback * callback )
1303```
1304
1305**Description**
1306
1307Registers a callback for this **OH_NativeXComponent** instance.
1308
1309**Parameters**
1310
1311| Name       | Description                           |
1312| --------- | ----------------------------- |
1313| component | Pointer to the **OH_NativeXComponent** instance.|
1314| callback  | Pointer to the surface lifecycle and touch event callback.   |
1315
1316**Returns**
1317
1318Returns the status code of the execution.
1319
1320**Since**
1321
13228
1323
1324
1325### OH_NativeXComponent_RegisterFocusEventCallback()
1326
1327```
1328int32_t OH_NativeXComponent_RegisterFocusEventCallback (OH_NativeXComponent * component, void(*callback)(OH_NativeXComponent *component, void *window))
1329```
1330
1331**Description**
1332
1333Registers the focus obtaining event callback for this **OH_NativeXComponent** instance.
1334
1335**Parameters**
1336
1337| Name       | Description                           |
1338| --------- | ----------------------------- |
1339| component | Pointer to the **OH_NativeXComponent** instance.|
1340| callback  | Pointer to the focus obtaining event callback.               |
1341
1342**Returns**
1343
1344Returns the status code of the execution.
1345
1346**Since**
1347
134810
1349
1350
1351### OH_NativeXComponent_RegisterKeyEventCallback()
1352
1353```
1354int32_t OH_NativeXComponent_RegisterKeyEventCallback (OH_NativeXComponent * component, void(*callback)(OH_NativeXComponent *component, void *window))
1355```
1356
1357**Description**
1358
1359Registers the key event callback for this **OH_NativeXComponent** instance.
1360
1361**Parameters**
1362
1363| Name       | Description                           |
1364| --------- | ----------------------------- |
1365| component | Pointer to the **OH_NativeXComponent** instance.|
1366| callback  | Pointer to the key event callback.               |
1367
1368**Returns**
1369
1370Returns the status code of the execution.
1371
1372**Since**
1373
137410
1375
1376
1377### OH_NativeXComponent_RegisterKeyEventCallbackWithResult()
1378
1379```
1380int32_t OH_NativeXComponent_RegisterKeyEventCallbackWithResult (OH_NativeXComponent * component, bool(*callback)(OH_NativeXComponent *component, void *window))
1381```
1382
1383**Description**
1384
1385Registers a key event callback with a return value for this **OH_NativeXComponent** instance. The callback must return a result (**true** or **false**). If the callback returns **true**, the event will not be further propagated. If it returns **false**, the event will continue to be processed according to the normal event handling flow.
1386
1387**Parameters**
1388
1389| Name       | Description                           |
1390| --------- | ----------------------------- |
1391| component | Pointer to the **OH_NativeXComponent** instance.|
1392| callback  | Pointer to the key event callback.               |
1393
1394**Returns**
1395
1396Returns the status code of the execution.
1397
1398**Since**
1399
140014
1401
1402
1403### OH_NativeXComponent_RegisterMouseEventCallback()
1404
1405```
1406int32_t OH_NativeXComponent_RegisterMouseEventCallback (OH_NativeXComponent * component, OH_NativeXComponent_MouseEvent_Callback * callback )
1407```
1408
1409**Description**
1410
1411Registers the mouse event callback for this **OH_NativeXComponent** instance.
1412
1413**Parameters**
1414
1415| Name       | Description                           |
1416| --------- | ----------------------------- |
1417| component | Pointer to the **OH_NativeXComponent** instance.|
1418| callback  | Pointer to the mouse event callback.               |
1419
1420**Returns**
1421
1422Returns the status code of the execution.
1423
1424**Since**
1425
14269
1427
1428### OH_NativeXComponent_RegisterOnFrameCallback()
1429
1430```
1431int32_t OH_NativeXComponent_RegisterOnFrameCallback (OH_NativeXComponent* component, void (*callback)(OH_NativeXComponent *component, uint64_t timestamp, uint64_t targetTimestamp))
1432```
1433**Description**
1434
1435Registers the display update callback for this **OH_NativeXComponent** instance and enables the callback for each frame.
1436
1437**Parameters**
1438
1439| Name| Description|
1440| -------- | -------- |
1441| component | Pointer to the **OH_NativeXComponent** instance. |
1442| callback | Pointer to the display update callback. |
1443| timestamp | Time when the current frame arrives, in nanoseconds.|
1444| targetTimestamp | Expected arrival time of the next frame, in nanoseconds.|
1445
1446**Returns**
1447
1448Returns the status code of the execution.
1449
1450**Since**
1451
145211
1453
1454### OH_NativeXComponent_RegisterOnTouchInterceptCallback()
1455
1456```
1457int32_t OH_NativeXComponent_RegisterOnTouchInterceptCallback (OH_NativeXComponent * component, HitTestMode(*callback)(OH_NativeXComponent *component, ArkUI_UIInputEvent *event))
1458```
1459**Description**
1460
1461Registers a custom event intercept callback for an **OH_NativeXComponent** and enables the callback during the hit test.
1462
1463**Since**: 12
1464
1465**Parameters**
1466
1467| Name| Description|
1468| -------- | -------- |
1469| component | Pointer to the **OH_NativeXComponent** instance. |
1470| callback | Pointer to the custom event intercept callback. |
1471
1472**Returns**
1473
1474Returns **0** if the operation is successful; returns **401** if a parameter error occurs.
1475
1476### OH_NativeXComponent_RegisterUIInputEventCallback()
1477
1478```
1479int32_t OH_NativeXComponent_RegisterUIInputEventCallback (OH_NativeXComponent * component, void(*callback)(OH_NativeXComponent *component, ArkUI_UIInputEvent *event, ArkUI_UIInputEvent_Type type), ArkUI_UIInputEvent_Type type )
1480```
1481**Description**
1482
1483Registers a UI input event callback for an **OH_NativeXComponent** instance and enables the callback to be invoked when a UI input event is received.
1484
1485**Since**: 12
1486
1487**Parameters**
1488
1489| Name| Description|
1490| -------- | -------- |
1491| component | Pointer to the **OH_NativeXComponent** instance. |
1492| callback | Pointer to the UI input event callback. |
1493| type | Type of the current UI input event. |
1494
1495**Returns**
1496
1497Returns the status code of the execution.
1498
1499### OH_NativeXComponent_SetExpectedFrameRateRange()
1500
1501```
1502int32_t OH_NativeXComponent_SetExpectedFrameRateRange (OH_NativeXComponent * component, OH_NativeXComponent_ExpectedRateRange * range )
1503```
1504**Description**
1505
1506Sets the expected frame rate range.
1507
1508**Parameters**
1509
1510| Name| Description|
1511| -------- | -------- |
1512| component | Pointer to the **OH_NativeXComponent** instance. |
1513| range | Pointer to the expected frame rate range.|
1514
1515**Returns**
1516
1517Returns the status code of the execution.
1518
1519**Since**
1520
152111
1522
1523
1524### OH_NativeXComponent_UnregisterOnFrameCallback()
1525
1526```
1527int32_t OH_NativeXComponent_UnregisterOnFrameCallback (OH_NativeXComponent * component)
1528```
1529**Description**
1530
1531Deregisters the display update callback for this **OH_NativeXComponent** instance and disables the callback for each frame.
1532
1533**Parameters**
1534
1535| Name| Description|
1536| -------- | -------- |
1537| component | Pointer to the **OH_NativeXComponent** instance. |
1538
1539**Returns**
1540
1541Returns the status code of the execution.
1542
1543**Since**
1544
154511
1546
1547### OH_NativeXComponent_SetNeedSoftKeyboard()
1548
1549```
1550int32_t OH_NativeXComponent_SetNeedSoftKeyboard(OH_NativeXComponent* component, bool isNeedSoftKeyboard)
1551```
1552
1553**Description**
1554
1555Sets whether the soft keyboard is required for an **OH_NativeXComponent** instance.
1556
1557**Parameters**
1558
1559| Name              | Description                                         |
1560| ------------------ | --------------------------------------------- |
1561| component          | Pointer to the **OH_NativeXComponent** instance.      |
1562| isNeedSoftKeyboard | Whether the soft keyboard is required for the **OH_NativeXComponent** instance.|
1563
1564**Returns**
1565
1566Returns the status code of the execution.
1567
1568**Since**
1569
157012
1571
1572### OH_NativeXComponent_RegisterSurfaceShowCallback()
1573
1574```
1575int32_t OH_NativeXComponent_RegisterSurfaceShowCallback (OH_NativeXComponent * component, void(*callback)(OH_NativeXComponent *component, void *window))
1576```
1577
1578**Description**
1579
1580Registers a surface display callback for an **OH_NativeXComponent** instance. The callback is invoked after the application is switched to the foreground.
1581
1582**Parameters**
1583
1584| Name       | Description                           |
1585| --------- | ----------------------------- |
1586| component | Pointer to the **OH_NativeXComponent** instance.|
1587| callback  | Pointer to the surface display callback.               |
1588
1589**Returns**
1590
1591Returns the status code of the execution.
1592
1593**Since**
1594
159512
1596
1597### OH_NativeXComponent_RegisterSurfaceHideCallback()
1598
1599```
1600int32_t OH_NativeXComponent_RegisterSurfaceHideCallback (OH_NativeXComponent * component, void(*callback)(OH_NativeXComponent *component, void *window))
1601```
1602
1603**Description**
1604
1605Registers a surface hiding callback for an **OH_NativeXComponent** instance. The callback is invoked after the application is switched to the background.
1606
1607**Parameters**
1608
1609| Name       | Description                           |
1610| --------- | ----------------------------- |
1611| component | Pointer to the **OH_NativeXComponent** instance.|
1612| callback  | Pointer to the surface hiding callback.               |
1613
1614**Returns**
1615
1616Returns the status code of the execution.
1617
1618**Since**
1619
162012
1621
1622### OH_NativeXComponent_GetTouchEventSourceType()
1623
1624```
1625int32_t OH_NativeXComponent_GetTouchEventSourceType (OH_NativeXComponent* component, int32_t pointId, OH_NativeXComponent_EventSourceType* sourceType);
1626```
1627
1628**Description**
1629
1630Obtains the touch event source type of an **OH_NativeXComponent** instance.
1631
1632**Parameters**
1633
1634| Name       | Description                           |
1635| --------- | ----------------------------- |
1636| component | Pointer to the **OH_NativeXComponent** instance.|
1637| pointId  | ID of the touch point.<br>**NOTE**<br>The touch event source type can be correctly returned only when the ID passed in is the ID of the touch point that triggers the touch event. Otherwise, **OH_NATIVEXCOMPONENT_RESULT_BAD_PARAMETER** is returned.|
1638| sourceType  | Pointer to the touch event source type.|
1639
1640**Returns**
1641
1642Returns **OH_NATIVEXCOMPONENT_RESULT_SUCCESS** if the operation is successful.
1643
1644Returns **OH_NATIVEXCOMPONENT_RESULT_BAD_PARAMETER** if a parameter error occurs.
1645
1646Returns **OH_NATIVEXCOMPONENT_RESULT_FAILED** if any other error occurs.
1647
1648**Since**
1649
165012
1651
1652### OH_NativeXComponent_GetNativeAccessibilityProvider()
1653
1654```
1655int32_t OH_NativeXComponent_GetNativeAccessibilityProvider(
1656    OH_NativeXComponent* component, ArkUI_AccessibilityProvider** handle);
1657```
1658
1659**Description**
1660
1661Obtains the accessibility provider handle for an ArkUI XComponent.
1662
1663**Parameters**
1664
1665| Name     | Description                                   |
1666| --------- | --------------------------------------- |
1667| component | Pointer to the **OH_NativeXComponent** instance.|
1668| handle    | Pointer to the accessibility provider handle.               |
1669
1670**Returns**
1671
1672Returns **OH_NATIVEXCOMPONENT_RESULT_SUCCESS** if the operation is successful.
1673
1674Returns **OH_NATIVEXCOMPONENT_RESULT_BAD_PARAMETER** if a parameter error occurs.
1675
1676Returns **OH_NATIVEXCOMPONENT_RESULT_FAILED** if any other error occurs.
1677
1678**Since**
1679
168013
1681
1682
1683
1684<!--  -->
1685
1686## Variable Description
1687
1688
1689### OH_XCOMPONENT_ID_LEN_MAX
1690
1691```
1692const uint32_t OH_XCOMPONENT_ID_LEN_MAX = 128
1693```
1694
1695
1696**Description**
1697
1698
1699Maximum length of the ArkUI XComponent ID.
1700
1701
1702**Since**
1703
1704
17058
1706
1707
1708### OH_MAX_TOUCH_POINTS_NUMBER
1709
1710```
1711const uint32_t OH_MAX_TOUCH_POINTS_NUMBER = 10
1712```
1713
1714**Description**
1715
1716Maximum number of identifiable touch points in a touch event.
1717
1718**Since**
1719
17208
1721
1722
1723### action
1724
1725```
1726OH_NativeXComponent_MouseEventAction OH_NativeXComponent_MouseEvent::action
1727```
1728
1729**Description**
1730
1731Action of the mouse event.
1732
1733**Since**
1734
17358
1736
1737
1738### button
1739
1740```
1741OH_NativeXComponent_MouseEventButton OH_NativeXComponent_MouseEvent::button
1742```
1743
1744**Description**
1745
1746Mouse event button.
1747
1748**Since**
1749
17508
1751
1752
1753### deviceId
1754
1755```
1756int64_t OH_NativeXComponent_TouchEvent::deviceId = 0
1757```
1758
1759**Description**
1760
1761ID of the device where the current touch event is triggered.
1762
1763**Since**
1764
17658
1766
1767
1768### DispatchHoverEvent
1769
1770```
1771void(* OH_NativeXComponent_MouseEvent_Callback::DispatchHoverEvent) (OH_NativeXComponent *component, bool isHover)
1772```
1773
1774**Description**
1775
1776Invoked when a hover event is triggered.
1777
1778**Since**
1779
17808
1781
1782
1783### DispatchMouseEvent
1784
1785```
1786void(* OH_NativeXComponent_MouseEvent_Callback::DispatchMouseEvent) (OH_NativeXComponent *component, void *window)
1787```
1788
1789**Description**
1790
1791Invoked when a mouse event is triggered.
1792
1793**Parameters**
1794
1795| Name       | Description                           |
1796| --------- | ----------------------------- |
1797| component | Pointer to the **OH_NativeXComponent** instance.|
1798| window  | Handle to the **NativeWindow** instance.             |
1799
1800**Since**
1801
18028
1803
1804
1805### DispatchTouchEvent
1806
1807```
1808void(* OH_NativeXComponent_Callback::DispatchTouchEvent) (OH_NativeXComponent *component, void *window)
1809```
1810
1811**Description**
1812
1813Invoked when a touch event is triggered.
1814
1815**Since**
1816
18178
1818
1819
1820### force [1/2]
1821
1822```
1823float OH_NativeXComponent_TouchPoint::force = 0.0
1824```
1825
1826**Description**
1827
1828Pressure of the touch event.
1829
1830**Since**
1831
18328
1833
1834
1835### force [2/2]
1836
1837```
1838float OH_NativeXComponent_TouchEvent::force = 0.0
1839```
1840
1841**Description**
1842
1843Pressure of the touch event.
1844
1845**Since**
1846
18478
1848
1849
1850### id [1/2]
1851
1852```
1853int32_t OH_NativeXComponent_TouchPoint::id = 0
1854```
1855
1856**Description**
1857
1858Unique identifier of the finger.
1859
1860**Since**
1861
18628
1863
1864
1865### id [2/2]
1866
1867```
1868int32_t OH_NativeXComponent_TouchEvent::id = 0
1869```
1870
1871**Description**
1872
1873Unique identifier of the finger.
1874
1875**Since**
1876
18778
1878
1879
1880### isPressed
1881
1882```
1883bool OH_NativeXComponent_TouchPoint::isPressed = false
1884```
1885
1886**Description**
1887
1888Whether the current point is pressed.
1889
1890**Since**
1891
18928
1893
1894
1895### numPoints
1896
1897```
1898uint32_t OH_NativeXComponent_TouchEvent::numPoints = 0
1899```
1900
1901**Description**
1902
1903Number of current touch points.
1904
1905**Since**
1906
19078
1908
1909
1910### OnSurfaceChanged
1911
1912```
1913void(* OH_NativeXComponent_Callback::OnSurfaceChanged) (OH_NativeXComponent *component, void *window)
1914```
1915
1916**Description**
1917
1918Invoked when the surface changes.
1919
1920**Parameters**
1921
1922| Name       | Description                           |
1923| --------- | ----------------------------- |
1924| component | Pointer to the **OH_NativeXComponent** instance.|
1925| window  | Handle to the **NativeWindow** instance.             |
1926
1927**Since**
1928
19298
1930
1931
1932### OnSurfaceCreated
1933
1934```
1935void(* OH_NativeXComponent_Callback::OnSurfaceCreated) (OH_NativeXComponent *component, void *window)
1936```
1937
1938**Description**
1939
1940Invoked when a surface is created.
1941
1942**Parameters**
1943
1944| Name       | Description                           |
1945| --------- | ----------------------------- |
1946| component | Pointer to the **OH_NativeXComponent** instance.|
1947| window  | Handle to the **NativeWindow** instance.             |
1948
1949**Since**
1950
19518
1952
1953
1954### OnSurfaceDestroyed
1955
1956```
1957void(* OH_NativeXComponent_Callback::OnSurfaceDestroyed) (OH_NativeXComponent *component, void *window)
1958```
1959
1960**Description**
1961
1962Invoked when the surface is destroyed.
1963
1964**Parameters**
1965
1966| Name       | Description                           |
1967| --------- | ----------------------------- |
1968| component | Pointer to the **OH_NativeXComponent** instance.|
1969| window  | Handle to the **NativeWindow** instance.             |
1970
1971**Since**
1972
19738
1974
1975
1976### screenX [1/3]
1977
1978```
1979float OH_NativeXComponent_TouchPoint::screenX = 0.0
1980```
1981
1982**Description**
1983
1984X coordinate of the touch point relative to the upper left corner of the application window where the XComponent is located.
1985
1986**Since**
1987
19888
1989
1990
1991### screenX [2/3]
1992
1993```
1994float OH_NativeXComponent_TouchEvent::screenX = 0.0
1995```
1996
1997**Description**
1998
1999X coordinate of the touch point relative to the upper left corner of the application window where the XComponent is located.
2000
2001**Since**
2002
20038
2004
2005
2006### screenX [3/3]
2007
2008```
2009float OH_NativeXComponent_MouseEvent::screenX
2010```
2011
2012**Description**
2013
2014X coordinate of the click point relative to the upper left corner of the application screen where the XComponent is located.
2015
2016**Since**
2017
20188
2019
2020
2021### screenY [1/3]
2022
2023```
2024float OH_NativeXComponent_TouchPoint::screenY = 0.0
2025```
2026
2027**Description**
2028
2029Y coordinate of the touch point relative to the upper left corner of the application window where the XComponent is located.
2030
2031**Since**
2032
20338
2034
2035
2036### screenY [2/3]
2037
2038```
2039float OH_NativeXComponent_TouchEvent::screenY = 0.0
2040```
2041
2042**Description**
2043
2044Y coordinate of the touch point relative to the upper left corner of the application window where the XComponent is located.
2045
2046**Since**
2047
20488
2049
2050
2051### screenY [3/3]
2052
2053```
2054float OH_NativeXComponent_MouseEvent::screenY
2055```
2056
2057**Description**
2058
2059Y coordinate of the click point relative to the upper left corner of the application window where the XComponent is located.
2060
2061**Since**
2062
20638
2064
2065
2066### size [1/2]
2067
2068```
2069double OH_NativeXComponent_TouchPoint::size = 0.0
2070```
2071
2072**Description**
2073
2074Contact area between the finger pad and the screen.
2075
2076**Since**
2077
20788
2079
2080
2081### size [2/2]
2082
2083```
2084double OH_NativeXComponent_TouchEvent::size = 0.0
2085```
2086
2087**Description**
2088
2089Contact area between the finger pad and the screen.
2090
2091**Since**
2092
20938
2094
2095
2096### timeStamp [1/2]
2097
2098```
2099long long OH_NativeXComponent_TouchPoint::timeStamp = 0
2100```
2101
2102**Description**
2103
2104Timestamp of the touch point.
2105
2106**Since**
2107
21088
2109
2110
2111### timeStamp [2/2]
2112
2113```
2114long long OH_NativeXComponent_TouchEvent::timeStamp = 0
2115```
2116
2117**Description**
2118
2119Timestamp of the touch point.
2120
2121**Since**
2122
21238
2124
2125
2126### timestamp
2127
2128```
2129int64_t OH_NativeXComponent_MouseEvent::timestamp
2130```
2131
2132**Description**
2133
2134Timestamp of the mouse event.
2135
2136**Since**
2137
21388
2139
2140
2141### touchPoints
2142
2143```
2144OH_NativeXComponent_TouchPoint OH_NativeXComponent_TouchEvent::touchPoints[OH_MAX_TOUCH_POINTS_NUMBER]
2145```
2146
2147**Description**
2148
2149Array of the touch points.
2150
2151**Since**
2152
21538
2154
2155
2156### type [1/2]
2157
2158```
2159OH_NativeXComponent_TouchEventType OH_NativeXComponent_TouchPoint::type = OH_NativeXComponent_TouchEventType::OH_NATIVEXCOMPONENT_UNKNOWN
2160```
2161
2162**Description**
2163
2164Touch type of the touch point.
2165
2166**Since**
2167
21688
2169
2170
2171### type [2/2]
2172
2173```
2174OH_NativeXComponent_TouchEventType OH_NativeXComponent_TouchEvent::type = OH_NativeXComponent_TouchEventType::OH_NATIVEXCOMPONENT_UNKNOWN
2175```
2176
2177**Description**
2178
2179Touch type of the touch point.
2180
2181**Since**
2182
21838
2184
2185
2186### x [1/3]
2187
2188```
2189float OH_NativeXComponent_TouchPoint::x = 0.0
2190```
2191
2192**Description**
2193
2194X coordinate of the touch point relative to the left edge of the XComponent.
2195
2196**Since**
2197
21988
2199
2200
2201### x [2/3]
2202
2203```
2204float OH_NativeXComponent_TouchEvent::x = 0.0
2205```
2206
2207**Description**
2208
2209X coordinate of the touch point relative to the left edge of the XComponent.
2210
2211**Since**
2212
22138
2214
2215
2216### x [3/3]
2217
2218```
2219float OH_NativeXComponent_MouseEvent::x
2220```
2221
2222**Description**
2223
2224X coordinate of the clicked point relative to the upper left corner of the component.
2225
2226**Since**
2227
22288
2229
2230
2231### y [1/3]
2232
2233```
2234float OH_NativeXComponent_TouchPoint::y = 0.0
2235```
2236
2237**Description**
2238
2239Y coordinate of the touch point relative to the upper edge of the XComponent.
2240
2241**Since**
2242
22438
2244
2245
2246### y [2/3]
2247
2248```
2249float OH_NativeXComponent_TouchEvent::y = 0.0
2250```
2251
2252**Description**
2253
2254Y coordinate of the touch point relative to the upper edge of the XComponent.
2255
2256**Since**
2257
22588
2259
2260
2261### y [3/3]
2262
2263```
2264float OH_NativeXComponent_MouseEvent::y
2265```
2266
2267**Description**
2268
2269Y coordinate of the clicked point relative to the upper left corner of the component.
2270
2271**Since**
2272
22738
2274
2275### expected
2276
2277```
2278int32_t OH_NativeXComponent_ExpectedRateRange::expected
2279```
2280**Description**
2281
2282Expected frame rate range.
2283
2284**Since**
2285
228611
2287
2288### max
2289
2290```
2291int32_t OH_NativeXComponent_ExpectedRateRange::max
2292```
2293**Description**
2294
2295Maximum value of the expected frame rate range.
2296
2297**Since**
2298
229911
2300
2301
2302### min
2303
2304```
2305int32_t OH_NativeXComponent_ExpectedRateRange::min
2306```
2307**Description**
2308
2309Minimum value of the expected frame rate range.
2310
2311**Since**
2312
231311
2314