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**.<br>**File to include**: <ace/xcomponent/native_interface_xcomponent.h><br>**Library**: libace_ndk.z.so| 20| [native_xcomponent_key_event.h](native__xcomponent__key__event_8h.md) | Declares the enums used to access **NativeXComponent** key events.<br>**File to include**: <ace/xcomponent/native_xcomponent_key_event.h><br>**Library**: libace_ndk.z.so| 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 ArkUI XComponent relative to the upper left vertex of the screen.| 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_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. | 76| [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. | 77| [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. | 78| [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. | 79| [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. | 80| [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. | 81| [OH_NativeXComponent_GetKeyEventTimeStamp](#oh_nativexcomponent_getkeyeventtimestamp) ([OH_NativeXComponent_KeyEvent](#oh_nativexcomponent_keyevent) \*keyEvent, int64_t \*timeStamp) | Obtains the timestamp of the specified key event. | 82| [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. | 83| [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.| 84| [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.| 85| 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. | 86| 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. | 87| 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. | 88| int32_t [OH_NativeXComponent_RegisterOnTouchInterceptCallback](#oh_nativexcomponent_registerontouchinterceptcallback) ([OH_NativeXComponent](#oh_nativexcomponent) \*component, [HitTestMode](_ark_u_i___native_module.md#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. | 89| 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. | 90| 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 whenever the application is switched to the foreground.| 91| 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 whenever the application is switched to the background.| 92| 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. | 93 94### Variables 95 96| Name | Description | 97| ---------------------------------------- | ------------------------------ | 98| **OH_XCOMPONENT_ID_LEN_MAX** = 128 | Maximum length of the ArkUI XComponent ID. | 99| **OH_MAX_TOUCH_POINTS_NUMBER** = 10 | Maximum number of identifiable touch points in a touch event. | 100| [OH_NativeXComponent_TouchPoint::id](#id-12) = 0 | Unique identifier of the finger. | 101| [OH_NativeXComponent_TouchPoint::screenX](#screenx-13) = 0.0 | X coordinate of the touch point relative to the left edge of the application window where the XComponent is located.| 102| [OH_NativeXComponent_TouchPoint::screenY](#screeny-13) = 0.0 | Y coordinate of the touch point relative to the left edge of the application window where the XComponent is located.| 103| [OH_NativeXComponent_TouchPoint::x](#x-13) = 0.0 | X coordinate of the touch point relative to the left edge of the XComponent. | 104| [OH_NativeXComponent_TouchPoint::y](#y-13) = 0.0 | Y coordinate of the touch point relative to the upper edge of the XComponent. | 105| [OH_NativeXComponent_TouchPoint::type](#type-12) = OH_NativeXComponent_TouchEventType::OH_NATIVEXCOMPONENT_UNKNOWN | Touch type of the touch event. | 106| [OH_NativeXComponent_TouchPoint::size](#size-12) = 0.0 | Contact area between the finger pad and the screen. | 107| [OH_NativeXComponent_TouchPoint::force](#force-12) = 0.0 | Pressure of the touch event. | 108| [OH_NativeXComponent_TouchPoint::timeStamp](#timestamp-12) = 0 | Timestamp of the touch point. | 109| [OH_NativeXComponent_TouchPoint::isPressed](#ispressed) = false | Whether the current point is pressed. | 110| [OH_NativeXComponent_TouchEvent::id](#id-22) = 0 | Unique identifier of the finger. | 111| [OH_NativeXComponent_TouchEvent::screenX](#screenx-23) = 0.0 | X coordinate of the touch point relative to the left edge of the screen. | 112| [OH_NativeXComponent_TouchEvent::screenY](#screeny-23) = 0.0 | Y coordinate of the touch point relative to the upper edge of the screen. | 113| [OH_NativeXComponent_TouchEvent::x](#x-23) = 0.0 | X coordinate of the touch point relative to the left edge of the XComponent. | 114| [OH_NativeXComponent_TouchEvent::y](#y-23) = 0.0 | Y coordinate of the touch point relative to the upper edge of the XComponent. | 115| [OH_NativeXComponent_TouchEvent::type](#type-22) = OH_NativeXComponent_TouchEventType::OH_NATIVEXCOMPONENT_UNKNOWN | Touch type of the touch event. | 116| [OH_NativeXComponent_TouchEvent::size](#size-22) = 0.0 | Contact area between the finger pad and the screen. | 117| [OH_NativeXComponent_TouchEvent::force](#force-22) = 0.0 | Pressure of the touch event. | 118| [OH_NativeXComponent_TouchEvent::deviceId](#deviceid) = 0 | ID of the device where the current touch event is triggered. | 119| [OH_NativeXComponent_TouchEvent::timeStamp](#timestamp-22) = 0 | Timestamp of the touch event. | 120| [OH_NativeXComponent_TouchEvent::touchPoints](#touchpoints) [OH_MAX_TOUCH_POINTS_NUMBER] | Array of the touch points. | 121| [OH_NativeXComponent_TouchEvent::numPoints](#numpoints) = 0 | Number of current touch points. | 122| [OH_NativeXComponent_MouseEvent::x](#x-33) = 0.0 | X coordinate of the clicked point relative to the upper left corner of the component. | 123| [OH_NativeXComponent_MouseEvent::y](#y-33)= 0.0 | Y coordinate of the clicked point relative to the upper left corner of the component. | 124| [OH_NativeXComponent_MouseEvent::screenX](#screenx-33)= 0.0 | X coordinate of the clicked point relative to the upper left corner of the screen. | 125| [OH_NativeXComponent_MouseEvent::screenY](#screeny-33)= 0.0 | Y coordinate of the clicked point relative to the upper left corner of the screen. | 126| [OH_NativeXComponent_MouseEvent::timestamp](#timestamp)= 0 | Timestamp of the mouse event. | 127| [OH_NativeXComponent_MouseEvent::action](#action)= [OH_NativeXComponent_MouseEventAction::OH_NATIVEXCOMPONENT_MOUSE_NONE](#oh_nativexcomponent_mouseeventaction) | Action of the mouse event. | 128| [OH_NativeXComponent_MouseEvent::button](#button)= [OH_NativeXComponent_MouseEventButton::OH_NATIVEXCOMPONENT_NONE_BUTTON](#oh_nativexcomponent_mouseeventbutton) | Enumerates the mouse event buttons. | 129| [OH_NativeXComponent_Callback::OnSurfaceCreated](#onsurfacecreated) | Invoked when a surface is created. | 130| [OH_NativeXComponent_Callback::OnSurfaceChanged](#onsurfacechanged) | Invoked when the surface changes. | 131| [OH_NativeXComponent_Callback::OnSurfaceDestroyed](#onsurfacedestroyed) | Invoked when the surface is destroyed. | 132| [OH_NativeXComponent_Callback::DispatchTouchEvent](#dispatchtouchevent) | Invoked when a touch event is triggered. | 133| [OH_NativeXComponent_MouseEvent_Callback::DispatchMouseEvent](#dispatchmouseevent) | Invoked when a mouse event is triggered. | 134| [OH_NativeXComponent_MouseEvent_Callback::DispatchHoverEvent](#dispatchhoverevent) | Invoked when a hover event is triggered. | 135 136 137## Type Description 138 139 140### OH_NativeXComponent 141 142``` 143typedef struct OH_NativeXComponent OH_NativeXComponent 144``` 145 146**Description** 147 148Provides an encapsulated **OH_NativeXComponent** instance. 149 150**Since** 151 1528 153 154 155### OH_NativeXComponent_Callback 156 157``` 158typedef struct OH_NativeXComponent_Callback OH_NativeXComponent_Callback 159``` 160 161**Description** 162 163Registers callbacks for the surface lifecycle and touch event. 164 165**Since** 166 1678 168 169 170### OH_NativeXComponent_KeyEvent 171 172``` 173typedef struct OH_NativeXComponent_KeyEvent OH_NativeXComponent_KeyEvent 174``` 175 176**Description** 177 178Provides an encapsulated **OH_NativeXComponent_KeyEvent** instance. 179 180**Since** 181 18210 183 184 185### OH_NativeXComponent_MouseEvent_Callback 186 187``` 188typedef struct OH_NativeXComponent_MouseEvent_Callback OH_NativeXComponent_MouseEvent_Callback 189``` 190 191**Description** 192 193Registers callbacks for the mouse event. 194 195**Since** 196 1979 198 199 200## Enum Description 201 202 203### anonymous enum 204 205``` 206anonymous enum 207``` 208 209**Description** 210 211Enumerates the API access states. 212 213| Value | Description | 214| ---------------------------------------- | ----- | 215| OH_NATIVEXCOMPONENT_RESULT_SUCCESS | Success.| 216| OH_NATIVEXCOMPONENT_RESULT_FAILED | Failure.| 217| OH_NATIVEXCOMPONENT_RESULT_BAD_PARAMETER | Invalid parameter.| 218 219**Since** 220 2218 222 223 224### OH_NativeXComponent_EventSourceType 225 226``` 227enum OH_NativeXComponent_EventSourceType 228``` 229 230**Description** 231 232Enumerates the touch event source types. 233 234| Value | Description | 235| ------------------------------------------- | ------------------------------------------------------ | 236| OH_NATIVEXCOMPONENT_SOURCE_TYPE_UNKNOWN | Unknown source type. | 237| OH_NATIVEXCOMPONENT_SOURCE_TYPE_MOUSE | Source that generates a mouse multi-click event. | 238| OH_NATIVEXCOMPONENT_SOURCE_TYPE_TOUCHSCREEN | Source that generates a touchscreen multi-touch event. | 239| OH_NATIVEXCOMPONENT_SOURCE_TYPE_TOUCHPAD | Source that generates a touchpad multi-touch event. | 240| OH_NATIVEXCOMPONENT_SOURCE_TYPE_JOYSTICK | Source that generates a joystick multi-touch event. | 241| OH_NATIVEXCOMPONENT_SOURCE_TYPE_KEYBOARD<sup>10+</sup> | Source that generates a key event. | 242 243**Since** 244 2459 246 247 248### OH_NativeXComponent_KeyAction 249 250``` 251enum OH_NativeXComponent_KeyAction 252``` 253 254**Description** 255 256Enumerates the key event actions. 257 258| Value | Description | 259| -------------------------------------- | -------- | 260| OH_NATIVEXCOMPONENT_KEY_ACTION_UNKNOWN | Unknown key event action.| 261| OH_NATIVEXCOMPONENT_KEY_ACTION_DOWN | Button press. | 262| OH_NATIVEXCOMPONENT_KEY_ACTION_UP | Button release. | 263 264**Since** 265 26610 267 268 269### OH_NativeXComponent_KeyCode 270 271``` 272enum OH_NativeXComponent_KeyCode 273``` 274 275**Description** 276 277Enumerates the mouse event key codes. 278 279| Value | Description | 280| ---------------------------- | --------------------------- | 281| KEY_UNKNOWN | Unknown key. | 282| KEY_FN | Function (Fn) key. | 283| KEY_HOME | Function (Home) key. | 284| KEY_BACK | Back key. | 285| KEY_MEDIA_PLAY_PAUSE | Multimedia key - play/pause. | 286| KEY_MEDIA_STOP | Multimedia key - stop. | 287| KEY_MEDIA_NEXT | Multimedia key - next song. | 288| KEY_MEDIA_PREVIOUS | Multimedia key - previous song. | 289| KEY_MEDIA_REWIND | Multimedia key - rewind. | 290| KEY_MEDIA_FAST_FORWARD | Multimedia key - fast-forward. | 291| KEY_VOLUME_UP | Volume Up key. | 292| KEY_VOLUME_DOWN | Volume Down key. | 293| KEY_POWER | Power key. | 294| KEY_CAMERA | Camera key. | 295| KEY_VOLUME_MUTE | Speaker Mute key. | 296| KEY_MUTE | Microphone Mute key. | 297| KEY_BRIGHTNESS_UP | Brightness key - turn up. | 298| KEY_BRIGHTNESS_DOWN | Brightness key - turn down. | 299| KEY_0 | Key **0**. | 300| KEY_1 | Key **1**. | 301| KEY_2 | Key **2**. | 302| KEY_3 | Key **3**. | 303| KEY_4 | Key **4**. | 304| KEY_5 | Key **5**. | 305| KEY_6 | Key **6**. | 306| KEY_7 | Key **7**. | 307| KEY_8 | Key **8**. | 308| KEY_9 | Key **9**. | 309| KEY_STAR | Key **\***. | 310| KEY_POUND | Key **\#**. | 311| KEY_DPAD_UP | Navigation key - up. | 312| KEY_DPAD_DOWN | Navigation key - down. | 313| KEY_DPAD_LEFT | Navigation key - left. | 314| KEY_DPAD_RIGHT | Navigation key - right. | 315| KEY_DPAD_CENTER | Navigation key - OK. | 316| KEY_A | Key **A**. | 317| KEY_B | Key **B**. | 318| KEY_C | Key **C**. | 319| KEY_D | Key **D**. | 320| KEY_E | Key **E**. | 321| KEY_F | Key **F**. | 322| KEY_G | Key **G**. | 323| KEY_H | Key **H**. | 324| KEY_I | Key **I**. | 325| KEY_J | Key **J**. | 326| KEY_K | Key **K**. | 327| KEY_L | Key **L**. | 328| KEY_M | Key **M**. | 329| KEY_N | Key **N**. | 330| KEY_O | Key **O**. | 331| KEY_P | Key **P**. | 332| KEY_Q | Key **Q**. | 333| KEY_R | Key **R**. | 334| KEY_S | Key **S**. | 335| KEY_T | Key **T**. | 336| KEY_U | Key **U**. | 337| KEY_V | Key **V**. | 338| KEY_W | Key **W**. | 339| KEY_X | Key **X**. | 340| KEY_Y | Key **Y**. | 341| KEY_Z | Key **Z**. | 342| KEY_COMMA | Key **,**. | 343| KEY_PERIOD | Key **.**. | 344| KEY_ALT_LEFT | Left Alt key. | 345| KEY_ALT_RIGHT | Right Alt key. | 346| KEY_SHIFT_LEFT | Left Shift key. | 347| KEY_SHIFT_RIGHT | Right Shift key. | 348| KEY_TAB | Tab key. | 349| KEY_SPACE | Space key. | 350| KEY_SYM | Symbol key. | 351| KEY_EXPLORER | Explorer key, which is used to start the explorer application. | 352| KEY_ENVELOPE | Email key, which is used to start the email application. | 353| KEY_ENTER | Enter key. | 354| KEY_DEL | Delete key. | 355| KEY_GRAVE | Key **`**. | 356| KEY_MINUS | Key **-**. | 357| KEY_EQUALS | Key **=**. | 358| KEY_LEFT_BRACKET | Key **[**. | 359| KEY_RIGHT_BRACKET | Key **]**. | 360| KEY_BACKSLASH | Key **\**. | 361| KEY_SEMICOLON | Key **;**. | 362| KEY_APOSTROPHE | Key **'**. | 363| KEY_SLASH | Key **/**. | 364| KEY_AT | Key **\@**. | 365| KEY_PLUS | Key **+**. | 366| KEY_MENU | Menu key. | 367| KEY_PAGE_UP | Page Up key. | 368| KEY_PAGE_DOWN | Page Down key. | 369| KEY_ESCAPE | ESC key. | 370| KEY_FORWARD_DEL | Delete key. | 371| KEY_CTRL_LEFT | Left Ctrl key. | 372| KEY_CTRL_RIGHT | Right Ctrl key. | 373| KEY_CAPS_LOCK | Caps Lock key. | 374| KEY_SCROLL_LOCK | Scroll Lock key. | 375| KEY_META_LEFT | Left Meta key. | 376| KEY_META_RIGHT | Right Meta key. | 377| KEY_FUNCTION | Function key. | 378| KEY_SYSRQ | System Request/Print Screen key. | 379| KEY_BREAK | Break/Pause key. | 380| KEY_MOVE_HOME | Move to Home key. | 381| KEY_MOVE_END | Move to End key. | 382| KEY_INSERT | Insert key. | 383| KEY_FORWARD | Forward key. | 384| KEY_MEDIA_PLAY | Multimedia key - play. | 385| KEY_MEDIA_PAUSE | Multimedia key - pause. | 386| KEY_MEDIA_CLOSE | Multimedia key - close. | 387| KEY_MEDIA_EJECT | Multimedia key - eject. | 388| KEY_MEDIA_RECORD | Multimedia key - record. | 389| KEY_F1 | F1 key. | 390| KEY_F2 | F2 key. | 391| KEY_F3 | F3 key. | 392| KEY_F4 | F4 key. | 393| KEY_F5 | F5 key. | 394| KEY_F6 | F6 key. | 395| KEY_F7 | F7 key. | 396| KEY_F8 | F8 key. | 397| KEY_F9 | F9 key. | 398| KEY_F10 | F10 key. | 399| KEY_F11 | F11 key. | 400| KEY_F12 | F12 key. | 401| KEY_NUM_LOCK | Number Lock key. | 402| KEY_NUMPAD_0 | Key **0** on numeric keypad. | 403| KEY_NUMPAD_1 | Key **1** on numeric keypad. | 404| KEY_NUMPAD_2 | Key **2** on numeric keypad. | 405| KEY_NUMPAD_3 | Key **3** on numeric keypad. | 406| KEY_NUMPAD_4 | Key **4** on numeric keypad. | 407| KEY_NUMPAD_5 | Key **5** on numeric keypad. | 408| KEY_NUMPAD_6 | Key **6** on numeric keypad. | 409| KEY_NUMPAD_7 | Key **7** on numeric keypad. | 410| KEY_NUMPAD_8 | Key **8** on numeric keypad. | 411| KEY_NUMPAD_9 | Key **9** on numeric keypad. | 412| KEY_NUMPAD_DIVIDE | Key **/** on numeric keypad. | 413| KEY_NUMPAD_MULTIPLY | Key ***** on numeric keypad. | 414| KEY_NUMPAD_SUBTRACT | Key **-** on numeric keypad. | 415| KEY_NUMPAD_ADD | Key **+** on numeric keypad. | 416| KEY_NUMPAD_DOT | Key **.** on numeric keypad. | 417| KEY_NUMPAD_COMMA | Key **,** on numeric keypad. | 418| KEY_NUMPAD_ENTER | Enter key on numeric keypad. | 419| KEY_NUMPAD_EQUALS | Key **=** on numeric keypad. | 420| KEY_NUMPAD_LEFT_PAREN | Key **(** on numeric keypad. | 421| KEY_NUMPAD_RIGHT_PAREN | Key **)** on numeric keypad. | 422| KEY_VIRTUAL_MULTITASK | Multi-task key. | 423| KEY_SLEEP | Sleep key. | 424| KEY_ZENKAKU_HANKAKU | Zenkaku/Hankaku key. | 425| KEY_102ND | 102nd key. | 426| KEY_RO | Ro key. | 427| KEY_KATAKANA | Katakana key. | 428| KEY_HIRAGANA | Hiragana key. | 429| KEY_HENKAN | Henkan key. | 430| KEY_KATAKANA_HIRAGANA | Katakana/Hiragana key. | 431| KEY_MUHENKAN | Muhenkan key. | 432| KEY_LINEFEED | Linefeed key. | 433| KEY_MACRO | Macro key. | 434| KEY_NUMPAD_PLUSMINUS | Plus/Minus key on the numeric keypad. | 435| KEY_SCALE | Scale key. | 436| KEY_HANGUEL | Hanguel key. | 437| KEY_HANJA | Hanja key. | 438| KEY_YEN | Yen key. | 439| KEY_STOP | Stop key. | 440| KEY_AGAIN | Again key. | 441| KEY_PROPS | Props key. | 442| KEY_UNDO | Undo key. | 443| KEY_COPY | Copy key. | 444| KEY_OPEN | Open key. | 445| KEY_PASTE | Paste key. | 446| KEY_FIND | Find key. | 447| KEY_CUT | Cut key. | 448| KEY_HELP | Help key. | 449| KEY_CALC | Calc key, which is used to start the calculator application. | 450| KEY_FILE | File key. | 451| KEY_BOOKMARKS | Bookmarks key. | 452| KEY_NEXT | Next key. | 453| KEY_PLAYPAUSE | Play/Pause key. | 454| KEY_PREVIOUS | Previous key. | 455| KEY_STOPCD | Stop CD key. | 456| KEY_CONFIG | Config key. | 457| KEY_REFRESH | Refresh key. | 458| KEY_EXIT | Exit key. | 459| KEY_EDIT | Edit key. | 460| KEY_SCROLLUP | Scroll Up key. | 461| KEY_SCROLLDOWN | Scroll Down key. | 462| KEY_NEW | New key. | 463| KEY_REDO | Redo key. | 464| KEY_CLOSE | Close key. | 465| KEY_PLAY | Play key. | 466| KEY_BASSBOOST | Bass Boost key. | 467| KEY_PRINT | Print key. | 468| KEY_CHAT | Chat key. | 469| KEY_FINANCE | Finance key. | 470| KEY_CANCEL | Cancel key. | 471| KEY_KBDILLUM_TOGGLE | Keyboard Illumination Toggle key. | 472| KEY_KBDILLUM_DOWN | Keyboard Illumination Up key. | 473| KEY_KBDILLUM_UP | Keyboard Illumination Down key. | 474| KEY_SEND | Send key. | 475| KEY_REPLY | Reply key. | 476| KEY_FORWARDMAIL | Forward Mail key. | 477| KEY_SAVE | Save key. | 478| KEY_DOCUMENTS | Documents key. | 479| KEY_VIDEO_NEXT | Next Video key. | 480| KEY_VIDEO_PREV | Previous Video key. | 481| KEY_BRIGHTNESS_CYCLE | Brightness Cycle key. | 482| KEY_BRIGHTNESS_ZERO | Brightness Zero key. | 483| KEY_DISPLAY_OFF | Display Off Key. | 484| KEY_BTN_MISC | Misc Button key. | 485| KEY_GOTO | Goto key. | 486| KEY_INFO | Info key. | 487| KEY_PROGRAM | Program key. | 488| KEY_PVR | PVR key. | 489| KEY_SUBTITLE | Subtitle key. | 490| KEY_FULL_SCREEN | Full Screen key. | 491| KEY_KEYBOARD | Keyboard. | 492| KEY_ASPECT_RATIO | Aspect Ratio key. | 493| KEY_PC | Port Control key. | 494| KEY_TV | TV key. | 495| KEY_TV2 | TV key 2. | 496| KEY_VCR | VCR key. | 497| KEY_VCR2 | VCR key 2. | 498| KEY_SAT | SAT key. | 499| KEY_CD | CD key. | 500| KEY_TAPE | Tape key. | 501| KEY_TUNER | Tuner key. | 502| KEY_PLAYER | Player key. | 503| KEY_DVD | DVD key. | 504| KEY_AUDIO | Audio key. | 505| KEY_VIDEO | Video key. | 506| KEY_MEMO | Memo key. | 507| KEY_CALENDAR | Calendar key. | 508| KEY_RED | Red indicator. | 509| KEY_GREEN | Green indicator. | 510| KEY_YELLOW | Yellow indicator. | 511| KEY_BLUE | Blue indicator. | 512| KEY_CHANNELUP | Channel Up key. | 513| KEY_CHANNELDOWN | Channel Down key. | 514| KEY_LAST | Last key. | 515| KEY_RESTART | Restart key. | 516| KEY_SLOW | Slow key. | 517| KEY_SHUFFLE | Shuffle key. | 518| KEY_VIDEOPHONE | Videophone key. | 519| KEY_GAMES | Games key. | 520| KEY_ZOOMIN | Zoom in key. | 521| KEY_ZOOMOUT | Zoom out key. | 522| KEY_ZOOMRESET | Zoom Reset key. | 523| KEY_WORDPROCESSOR | Word Processor key. | 524| KEY_EDITOR | Editor key. | 525| KEY_SPREADSHEET | Spreadsheet key. | 526| KEY_GRAPHICSEDITOR | Graphics Editor key. | 527| KEY_PRESENTATION | Presentation key. | 528| KEY_DATABASE | Database key. | 529| KEY_NEWS | News key. | 530| KEY_VOICEMAIL | Voicemail key. | 531| KEY_ADDRESSBOOK | Address book key. | 532| KEY_MESSENGER | Messenger key. | 533| KEY_BRIGHTNESS_TOGGLE | Brightness Toggle key. | 534| KEY_SPELLCHECK | Spell Check key. | 535| KEY_COFFEE | Coffee key, which is used to launch screen lock or screen saver. | 536| KEY_MEDIA_REPEAT | Media Repeat key. | 537| KEY_IMAGES | Images key. | 538| KEY_BUTTONCONFIG | Button Configuration key. | 539| KEY_TASKMANAGER | Task Manager key. | 540| KEY_JOURNAL | Log key. | 541| KEY_CONTROLPANEL | Control Panel key. | 542| KEY_APPSELECT | App Select key. | 543| KEY_SCREENSAVER | Screen Saver key. | 544| KEY_ASSISTANT | Assistant key. | 545| KEY_KBD_LAYOUT_NEXT | Next Keyboard Layout key. | 546| KEY_BRIGHTNESS_MIN | Min Brightness key. | 547| KEY_BRIGHTNESS_MAX | Max Brightness key. | 548| KEY_KBDINPUTASSIST_PREV | Keyboard Input-assisted Previous key. | 549| KEY_KBDINPUTASSIST_NEXT | Keyboard Input-assisted Next key. | 550| KEY_KBDINPUTASSIST_PREVGROUP | Keyboard Input-assisted Previous key. | 551| KEY_KBDINPUTASSIST_NEXTGROUP | Keyboard Input-assisted Next key. | 552| KEY_KBDINPUTASSIST_ACCEPT | Keyboard Input-assisted Accept key. | 553| KEY_KBDINPUTASSIST_CANCEL | Keyboard Input-assisted Cancel key. | 554| KEY_FRONT | Front key, which is used to launch the windshield defogger. | 555| KEY_SETUP | Setup key. | 556| KEY_WAKEUP | Wakeup key. | 557| KEY_SENDFILE | Send File key. | 558| KEY_DELETEFILE | Delete File key. | 559| KEY_XFER | XFER key, which is used to start file transfer. | 560| KEY_PROG1 | Program key 1. | 561| KEY_PROG2 | Program key 2. | 562| KEY_MSDOS | MS-DOS key. | 563| KEY_SCREENLOCK | Screen Lock key. | 564| KEY_DIRECTION_ROTATE_DISPLAY | Directional Rotation Display key. | 565| KEY_CYCLEWINDOWS | Windows Cycle key. | 566| KEY_COMPUTER | Keys. | 567| KEY_EJECTCLOSECD | Eject CD key. | 568| KEY_ISO | ISO key. | 569| KEY_MOVE | Move key. | 570| KEY_F13 | F13 key. | 571| KEY_F14 | F14 key. | 572| KEY_F15 | F15 key. | 573| KEY_F16 | F16 key. | 574| KEY_F17 | F17 key. | 575| KEY_F18 | F18 key. | 576| KEY_F19 | F19 key. | 577| KEY_F20 | F20 key. | 578| KEY_F21 | F21 key. | 579| KEY_F22 | F22 key. | 580| KEY_F23 | F23 key. | 581| KEY_F24 | F24 key. | 582| KEY_PROG3 | Program key 3. | 583| KEY_PROG4 | Program key 4. | 584| KEY_DASHBOARD | Dashboard. | 585| KEY_SUSPEND | Suspend key. | 586| KEY_HP | HP key. | 587| KEY_SOUND | Sound key. | 588| KEY_QUESTION | Question key. | 589| KEY_CONNECT | Connect key. | 590| KEY_SPORT | Sport key. | 591| KEY_SHOP | Shop key. | 592| KEY_ALTERASE | Alternate key. | 593| KEY_SWITCHVIDEOMODE | Switch Video Mode key (monitor, LCD, and TV, etc.).| 594| KEY_BATTERY | Battery key. | 595| KEY_BLUETOOTH | Bluetooth key. | 596| KEY_WLAN | WLAN key. | 597| KEY_UWB | Ultra-wideband key. | 598| KEY_WWAN_WIMAX | WWAN WiMAX key. | 599| KEY_RFKILL | RF Kill key. | 600| KEY_CHANNEL | Channel key. | 601| KEY_BTN_0 | Button 0. | 602| KEY_BTN_1 | Button 1. | 603| KEY_BTN_2 | Button 2. | 604| KEY_BTN_3 | Button 3. | 605| KEY_BTN_4 | Button 4. | 606| KEY_BTN_5 | Button 5. | 607| KEY_BTN_6 | Button 6. | 608| KEY_BTN_7 | Button 7. | 609| KEY_BTN_8 | Button 8. | 610| KEY_BTN_9 | Button 9. | 611 612**Since** 613 61410 615 616 617### OH_NativeXComponent_MouseEventAction 618 619``` 620enum OH_NativeXComponent_MouseEventAction 621``` 622 623**Description** 624 625Enumerates the mouse event actions. 626 627| Value | Description | 628| --------------------------------- | ---------------- | 629| OH_NATIVEXCOMPONENT_MOUSE_NONE | Invalid mouse event. | 630| OH_NATIVEXCOMPONENT_MOUSE_PRESS | Mouse button press. | 631| OH_NATIVEXCOMPONENT_MOUSE_RELEASE | Mouse button release. | 632| OH_NATIVEXCOMPONENT_MOUSE_MOVE | Mouse movement.| 633 634**Since** 635 6369 637 638 639### OH_NativeXComponent_MouseEventButton 640 641``` 642enum OH_NativeXComponent_MouseEventButton 643``` 644 645**Description** 646 647Enumerates the mouse event buttons. 648 649| Value | Description | 650| ---------------------------------- | ----------------- | 651| OH_NATIVEXCOMPONENT_NONE_BUTTON | No button. | 652| OH_NATIVEXCOMPONENT_LEFT_BUTTON | Left mouse button. | 653| OH_NATIVEXCOMPONENT_RIGHT_BUTTON | Right mouse button. | 654| OH_NATIVEXCOMPONENT_MIDDLE_BUTTON | Middle mouse button. | 655| OH_NATIVEXCOMPONENT_BACK_BUTTON | Back button on the left of the mouse.| 656| OH_NATIVEXCOMPONENT_FORWARD_BUTTON | Forward key on the left of the mouse.| 657 658**Since** 659 6609 661 662 663### OH_NativeXComponent_TouchEventType 664 665``` 666enum OH_NativeXComponent_TouchEventType 667``` 668 669**Description** 670 671Enumerates the touch event types. 672 673| Value | Description | 674| --------------------------- | --------------------- | 675| OH_NATIVEXCOMPONENT_DOWN | The touch event is triggered when a finger is pressed. | 676| OH_NATIVEXCOMPONENT_UP | The touch event is triggered when a finger is lifted. | 677| OH_NATIVEXCOMPONENT_MOVE | The touch event is triggered when a finger is moved on the screen.| 678| OH_NATIVEXCOMPONENT_CANCEL | The event is triggered when a touch event is canceled. | 679| OH_NATIVEXCOMPONENT_UNKNOWN | Invalid touch type. | 680 681**Since** 682 6838 684 685 686### OH_NativeXComponent_TouchPointToolType 687 688``` 689enum OH_NativeXComponent_TouchPointToolType 690``` 691 692**Description** 693 694Enumerates the touch point tool types. 695 696| Value | Description | 697| -------------------------------------- | -------- | 698| OH_NATIVEXCOMPONENT_TOOL_TYPE_UNKNOWN | Unknown tool type.| 699| OH_NATIVEXCOMPONENT_TOOL_TYPE_FINGER | Finger. | 700| OH_NATIVEXCOMPONENT_TOOL_TYPE_PEN | Stylus. | 701| OH_NATIVEXCOMPONENT_TOOL_TYPE_RUBBER | Rubber. | 702| OH_NATIVEXCOMPONENT_TOOL_TYPE_BRUSH | Brush. | 703| OH_NATIVEXCOMPONENT_TOOL_TYPE_PENCIL | Pencil. | 704| OH_NATIVEXCOMPONENT_TOOL_TYPE_AIRBRUSH | Air brush. | 705| OH_NATIVEXCOMPONENT_TOOL_TYPE_MOUSE | Mouse. | 706| OH_NATIVEXCOMPONENT_TOOL_TYPE_LENS | Lens. | 707 708**Since** 709 7109 711 712 713## Function Description 714 715### OH_NativeXComponent_AttachNativeRootNode() 716 717``` 718int32_t OH_NativeXComponent_AttachNativeRootNode (OH_NativeXComponent * component, ArkUI_NodeHandle root ) 719``` 720**Description** 721 722Attaches the UI component created through the native API of ArkUI to this **OH_NativeXComponent** instance. 723 724**Since**: 12 725 726**Parameters** 727 728| Name| Description| 729| -------- | -------- | 730| component | Pointer to the **OH_NativeXComponent** instance. | 731| root | Pointer to the component instance created through the native API. | 732 733**Returns** 734 735**0**: success 736 737**401**: parameter error 738 739 740### OH_NativeXComponent_DetachNativeRootNode() 741 742``` 743int32_t OH_NativeXComponent_DetachNativeRootNode (OH_NativeXComponent * component, ArkUI_NodeHandle root ) 744``` 745**Description** 746 747Detaches the native component of ArkUI from this **OH_NativeXComponent** instance. 748 749**Since**: 12 750 751**Parameters** 752 753| Name| Description| 754| -------- | -------- | 755| component | Pointer to the **OH_NativeXComponent** instance. | 756| root | Pointer to the component instance created through the native API. | 757 758**Returns** 759 760**0**: success 761 762**401**: parameter error 763 764 765 766### OH_NativeXComponent_GetKeyEvent() 767 768``` 769int32_t OH_NativeXComponent_GetKeyEvent (OH_NativeXComponent * component, OH_NativeXComponent_KeyEvent ** keyEvent ) 770``` 771 772**Description** 773 774Obtains the key event scheduled by ArkUI XComponent. 775 776**Parameters** 777 778| Name | Description | 779| --------- | ----------------------------- | 780| component | Pointer to the **OH_NativeXComponent** instance.| 781| keyEvent | Pointer to the current key event. | 782 783**Returns** 784 785Returns the status code of the execution. 786 787**Since** 788 78910 790 791 792### OH_NativeXComponent_GetKeyEventAction() 793 794``` 795int32_t OH_NativeXComponent_GetKeyEventAction (OH_NativeXComponent_KeyEvent * keyEvent, OH_NativeXComponent_KeyAction * action ) 796``` 797 798**Description** 799 800Obtains the action of the specified key event. 801 802**Parameters** 803 804| Name | Description | 805| -------- | -------------------------------------- | 806| keyEvent | Pointer to the **OH_NativeXComponent_KeyEvent** instance.| 807| action | Pointer to the key event action. | 808 809**Returns** 810 811Returns the status code of the execution. 812 813**Since** 814 81510 816 817 818### OH_NativeXComponent_GetKeyEventCode() 819 820``` 821int32_t OH_NativeXComponent_GetKeyEventCode (OH_NativeXComponent_KeyEvent * keyEvent, OH_NativeXComponent_KeyCode * code ) 822``` 823 824**Description** 825 826Obtains the key code of the specified key event. 827 828**Parameters** 829 830| Name | Description | 831| -------- | -------------------------------------- | 832| keyEvent | Pointer to the **OH_NativeXComponent_KeyEvent** instance.| 833| code | Pointer to the key code of the key event. | 834 835**Returns** 836 837Returns the status code of the execution. 838 839**Since** 840 84110 842 843 844### OH_NativeXComponent_GetKeyEventDeviceId() 845 846``` 847int32_t OH_NativeXComponent_GetKeyEventDeviceId (OH_NativeXComponent_KeyEvent * keyEvent, int64_t * deviceId ) 848``` 849 850**Description** 851 852Obtains the device ID of the specified key event. 853 854**Parameters** 855 856| Name | Description | 857| -------- | -------------------------------------- | 858| keyEvent | Pointer to the **OH_NativeXComponent_KeyEvent** instance.| 859| deviceId | Pointer to the device ID of the key event. | 860 861**Returns** 862 863Returns the status code of the execution. 864 865**Since** 866 86710 868 869 870### OH_NativeXComponent_GetKeyEventSourceType() 871 872``` 873int32_t OH_NativeXComponent_GetKeyEventSourceType (OH_NativeXComponent_KeyEvent * keyEvent, OH_NativeXComponent_EventSourceType * sourceType ) 874``` 875 876**Description** 877 878Obtains the source type of the specified key event. 879 880**Parameters** 881 882| Name | Description | 883| ---------- | -------------------------------------- | 884| keyEvent | Pointer to the **OH_NativeXComponent_KeyEvent** instance.| 885| sourceType | Pointer to the source type of the key event. | 886 887**Returns** 888 889Returns the status code of the execution. 890 891**Since** 892 89310 894 895 896### OH_NativeXComponent_GetKeyEventTimeStamp() 897 898``` 899int32_t OH_NativeXComponent_GetKeyEventTimeStamp (OH_NativeXComponent_KeyEvent * keyEvent, int64_t * timeStamp ) 900``` 901 902**Description** 903 904Obtains the timestamp of the specified key event. 905 906**Parameters** 907 908| Name | Description | 909| --------- | -------------------------------------- | 910| keyEvent | Pointer to the **OH_NativeXComponent_KeyEvent** instance.| 911| timeStamp | Pointer to the timestamp of the key event. | 912 913**Returns** 914 915Returns the status code of the execution. 916 917**Since** 918 91910 920 921 922### OH_NativeXComponent_GetMouseEvent() 923 924``` 925int32_t OH_NativeXComponent_GetMouseEvent (OH_NativeXComponent * component, const void * window, OH_NativeXComponent_MouseEvent * mouseEvent ) 926``` 927 928**Description** 929 930Obtains the mouse event scheduled by ArkUI XComponent. 931 932**Parameters** 933 934| Name | Description | 935| ---------- | ----------------------------- | 936| component | Pointer to the **OH_NativeXComponent** instance.| 937| window | Handle to the **NativeWindow** instance. | 938| mouseEvent | Pointer to the current mouse event. | 939 940**Returns** 941 942Returns the status code of the execution. 943 944**Since** 945 9469 947 948 949### OH_NativeXComponent_GetTouchEvent() 950 951``` 952int32_t OH_NativeXComponent_GetTouchEvent (OH_NativeXComponent * component, const void * window, OH_NativeXComponent_TouchEvent * touchEvent ) 953``` 954 955**Description** 956 957Obtains the touch event scheduled by the ArkUI XComponent. 958 959**Parameters** 960 961| Name | Description | 962| ---------- | ----------------------------- | 963| component | Pointer to the **OH_NativeXComponent** instance.| 964| window | Handle to the **NativeWindow** instance. | 965| touchEvent | Pointer to the current touch event. | 966 967**Returns** 968 969Returns the status code of the execution. 970 971**Since** 972 9738 974 975 976### OH_NativeXComponent_GetTouchPointTiltX() 977 978``` 979int32_t OH_NativeXComponent_GetTouchPointTiltX (OH_NativeXComponent * component, uint32_t pointIndex, float * tiltX ) 980``` 981 982**Description** 983 984Obtains the angle between the Y-Z plane of the ArkUI XComponent touch point and the x-axis. 985 986**Parameters** 987 988| Name | Description | 989| ---------- | ----------------------------- | 990| component | Pointer to the **OH_NativeXComponent** instance.| 991| pointIndex | Pointer to the index of the touch point. | 992| tiltX | Pointer to the angle between the Y-Z plane of the touch point and the x-axis. | 993 994**Returns** 995 996Returns the status code of the execution. 997 998**Since** 999 10009 1001 1002 1003### OH_NativeXComponent_GetTouchPointTiltY() 1004 1005``` 1006int32_t OH_NativeXComponent_GetTouchPointTiltY (OH_NativeXComponent * component, uint32_t pointIndex, float * tiltY ) 1007``` 1008 1009**Description** 1010 1011Obtains the angle between the X-Z plane of the ArkUI XComponent touch point and the y-axis. 1012 1013**Parameters** 1014 1015| Name | Description | 1016| ---------- | ----------------------------- | 1017| component | Pointer to the **OH_NativeXComponent** instance.| 1018| pointIndex | Pointer to the index of the touch point. | 1019| tiltY | Pointer to the angle between the X-Z plane of the touch point and the y-axis. | 1020 1021**Returns** 1022 1023Returns the status code of the execution. 1024 1025**Since** 1026 10279 1028 1029 1030### OH_NativeXComponent_GetTouchPointToolType() 1031 1032``` 1033int32_t OH_NativeXComponent_GetTouchPointToolType (OH_NativeXComponent * component, uint32_t pointIndex, OH_NativeXComponent_TouchPointToolType * toolType ) 1034``` 1035 1036**Description** 1037 1038Obtains the ArkUI XComponent touch point tool type. 1039 1040**Parameters** 1041 1042| Name | Description | 1043| ---------- | ----------------------------- | 1044| component | Pointer to the **OH_NativeXComponent** instance.| 1045| pointIndex | Pointer to the index of the touch point. | 1046| toolType | Pointer to the tool type. | 1047 1048**Returns** 1049 1050Returns the status code of the execution. 1051 1052**Since** 1053 10549 1055 1056 1057### OH_NativeXComponent_GetXComponentId() 1058 1059``` 1060int32_t OH_NativeXComponent_GetXComponentId (OH_NativeXComponent * component, char * id, uint64_t * size ) 1061``` 1062 1063**Description** 1064 1065Obtain the ID of ArkUI XComponent. 1066 1067**Parameters** 1068 1069| Name | Description | 1070| --------- | ------------------------------------------------------------ | 1071| component | Pointer to the **OH_NativeXComponent** instance. | 1072| 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].| 1073| size | Pointer to the ID length, which is used to receive the ID length information. | 1074 1075**Returns** 1076 1077Returns the status code of the execution. 1078 1079**Since** 1080 10818 1082 1083 1084### OH_NativeXComponent_GetXComponentOffset() 1085 1086``` 1087int32_t OH_NativeXComponent_GetXComponentOffset (OH_NativeXComponent * component, const void * window, double * x, double * y ) 1088``` 1089 1090**Description** 1091 1092Obtains the offset of the ArkUI XComponent relative to the upper left vertex of the screen. 1093 1094**Parameters** 1095 1096| Name | Description | 1097| --------- | ----------------------------- | 1098| component | Pointer to the **OH_NativeXComponent** instance.| 1099| window | Handle to the **NativeWindow** instance. | 1100| x | Pointer to the x coordinate of the current surface. | 1101| y | Pointer to the y coordinate of the current surface. | 1102 1103**Returns** 1104 1105Returns the status code of the execution. 1106 1107**Since** 1108 11098 1110 1111 1112### OH_NativeXComponent_GetXComponentSize() 1113 1114``` 1115int32_t OH_NativeXComponent_GetXComponentSize (OH_NativeXComponent * component, const void * window, uint64_t * width, uint64_t * height ) 1116``` 1117 1118**Description** 1119 1120Obtains the size of the surface held by the ArkUI XComponent. 1121 1122**Parameters** 1123 1124| Name | Description | 1125| --------- | ----------------------------- | 1126| component | Pointer to the **OH_NativeXComponent** instance.| 1127| window | Handle to the **NativeWindow** instance. | 1128| width | Pointer to the width of the current surface. | 1129| height | Pointer to the height of the current surface. | 1130 1131**Returns** 1132 1133Returns the status code of the execution. 1134 1135**Since** 1136 11378 1138 1139 1140### OH_NativeXComponent_RegisterBlurEventCallback() 1141 1142``` 1143int32_t OH_NativeXComponent_RegisterBlurEventCallback (OH_NativeXComponent * component, void(*callback)(OH_NativeXComponent *component, void *window)) 1144``` 1145 1146**Description** 1147 1148Registers the focus loss event callback for this **OH_NativeXComponent** instance. 1149 1150**Parameters** 1151 1152| Name | Description | 1153| --------- | ----------------------------- | 1154| component | Pointer to the **OH_NativeXComponent** instance.| 1155| callback | Pointer to the focus loss event callback. | 1156 1157**Returns** 1158 1159Returns the status code of the execution. 1160 1161**Since** 1162 116310 1164 1165 1166### OH_NativeXComponent_RegisterCallback() 1167 1168``` 1169int32_t OH_NativeXComponent_RegisterCallback (OH_NativeXComponent * component, OH_NativeXComponent_Callback * callback ) 1170``` 1171 1172**Description** 1173 1174Registers a callback for this **OH_NativeXComponent** instance. 1175 1176**Parameters** 1177 1178| Name | Description | 1179| --------- | ----------------------------- | 1180| component | Pointer to the **OH_NativeXComponent** instance.| 1181| callback | Pointer to the surface lifecycle and touch event callback. | 1182 1183**Returns** 1184 1185Returns the status code of the execution. 1186 1187**Since** 1188 11898 1190 1191 1192### OH_NativeXComponent_RegisterFocusEventCallback() 1193 1194``` 1195int32_t OH_NativeXComponent_RegisterFocusEventCallback (OH_NativeXComponent * component, void(*callback)(OH_NativeXComponent *component, void *window)) 1196``` 1197 1198**Description** 1199 1200Registers the focus obtaining event callback for this **OH_NativeXComponent** instance. 1201 1202**Parameters** 1203 1204| Name | Description | 1205| --------- | ----------------------------- | 1206| component | Pointer to the **OH_NativeXComponent** instance.| 1207| callback | Pointer to the focus obtaining event callback. | 1208 1209**Returns** 1210 1211Returns the status code of the execution. 1212 1213**Since** 1214 121510 1216 1217 1218### OH_NativeXComponent_RegisterKeyEventCallback() 1219 1220``` 1221int32_t OH_NativeXComponent_RegisterKeyEventCallback (OH_NativeXComponent * component, void(*callback)(OH_NativeXComponent *component, void *window)) 1222``` 1223 1224**Description** 1225 1226Registers the key event callback for this **OH_NativeXComponent** instance. 1227 1228**Parameters** 1229 1230| Name | Description | 1231| --------- | ----------------------------- | 1232| component | Pointer to the **OH_NativeXComponent** instance.| 1233| callback | Pointer to the key event callback. | 1234 1235**Returns** 1236 1237Returns the status code of the execution. 1238 1239**Since** 1240 124110 1242 1243 1244### OH_NativeXComponent_RegisterMouseEventCallback() 1245 1246``` 1247int32_t OH_NativeXComponent_RegisterMouseEventCallback (OH_NativeXComponent * component, OH_NativeXComponent_MouseEvent_Callback * callback ) 1248``` 1249 1250**Description** 1251 1252Registers the mouse event callback for this **OH_NativeXComponent** instance. 1253 1254**Parameters** 1255 1256| Name | Description | 1257| --------- | ----------------------------- | 1258| component | Pointer to the **OH_NativeXComponent** instance.| 1259| callback | Pointer to the mouse event callback. | 1260 1261**Returns** 1262 1263Returns the status code of the execution. 1264 1265**Since** 1266 12679 1268 1269### OH_NativeXComponent_RegisterOnFrameCallback() 1270 1271``` 1272int32_t OH_NativeXComponent_RegisterOnFrameCallback (OH_NativeXComponent* component, void (*callback)(OH_NativeXComponent *component, uint64_t timestamp, uint64_t targetTimestamp)) 1273``` 1274**Description** 1275 1276Registers the display update callback for this **OH_NativeXComponent** instance and enables the callback for each frame. 1277 1278**Parameters** 1279 1280| Name| Description| 1281| -------- | -------- | 1282| component | Pointer to the **OH_NativeXComponent** instance. | 1283| callback | Pointer to the display update callback. | 1284 1285**Returns** 1286 1287Returns the status code of the execution. 1288 1289**Since** 1290 129111 1292 1293### OH_NativeXComponent_RegisterOnTouchInterceptCallback() 1294 1295``` 1296int32_t OH_NativeXComponent_RegisterOnTouchInterceptCallback (OH_NativeXComponent * component, HitTestMode(*callback)(OH_NativeXComponent *component, ArkUI_UIInputEvent *event)) 1297``` 1298**Description** 1299 1300Registers a custom event intercept callback for an **OH_NativeXComponent** and enables the callback during the hit test. 1301 1302**Since**: 12 1303 1304**Parameters** 1305 1306| Name| Description| 1307| -------- | -------- | 1308| component | Pointer to the **OH_NativeXComponent** instance. | 1309| callback | Pointer to the custom event intercept callback. | 1310 1311**Returns** 1312 1313Returns **0** if the operation is successful; returns **401** if a parameter error occurs. 1314 1315### OH_NativeXComponent_RegisterUIInputEventCallback() 1316 1317``` 1318int32_t OH_NativeXComponent_RegisterUIInputEventCallback (OH_NativeXComponent * component, void(*callback)(OH_NativeXComponent *component, ArkUI_UIInputEvent *event, ArkUI_UIInputEvent_Type type), ArkUI_UIInputEvent_Type type ) 1319``` 1320**Description** 1321 1322Registers a UI input event callback for an **OH_NativeXComponent** instance and enables the callback to be invoked when a UI input event is received. 1323 1324**Since**: 12 1325 1326**Parameters** 1327 1328| Name| Description| 1329| -------- | -------- | 1330| component | Pointer to the **OH_NativeXComponent** instance. | 1331| callback | Pointer to the UI input event callback. | 1332| type | Type of the current UI input event. | 1333 1334**Returns** 1335 1336Returns the status code of the execution. 1337 1338### OH_NativeXComponent_SetExpectedFrameRateRange() 1339 1340``` 1341int32_t OH_NativeXComponent_SetExpectedFrameRateRange (OH_NativeXComponent * component, OH_NativeXComponent_ExpectedRateRange * range ) 1342``` 1343**Description** 1344 1345Sets the expected frame rate range. 1346 1347**Parameters** 1348 1349| Name| Description| 1350| -------- | -------- | 1351| component | Pointer to the **OH_NativeXComponent** instance. | 1352| range | Pointer to the expected frame rate range.| 1353 1354**Returns** 1355 1356Returns the status code of the execution. 1357 1358**Since** 1359 136011 1361 1362 1363### OH_NativeXComponent_UnregisterOnFrameCallback() 1364 1365``` 1366int32_t OH_NativeXComponent_UnregisterOnFrameCallback (OH_NativeXComponent * component) 1367``` 1368**Description** 1369 1370Deregisters the display update callback for this **OH_NativeXComponent** instance and disables the callback for each frame. 1371 1372**Parameters** 1373 1374| Name| Description| 1375| -------- | -------- | 1376| component | Pointer to the **OH_NativeXComponent** instance. | 1377 1378**Returns** 1379 1380Returns the status code of the execution. 1381 1382**Since** 1383 138411 1385 1386### OH_NativeXComponent_SetNeedSoftKeyboard() 1387 1388``` 1389int32_t OH_NativeXComponent_SetNeedSoftKeyboard(OH_NativeXComponent* component, bool isNeedSoftKeyboard) 1390``` 1391 1392**Description** 1393 1394Sets whether the soft keyboard is required for an **OH_NativeXComponent** instance. 1395 1396**Parameters** 1397 1398| Name | Description | 1399| ------------------ | --------------------------------------------- | 1400| component | Pointer to the **OH_NativeXComponent** instance. | 1401| isNeedSoftKeyboard | Whether the soft keyboard is required for the **OH_NativeXComponent** instance.| 1402 1403**Returns** 1404 1405Returns the status code of the execution. 1406 1407**Since** 1408 140912 1410 1411### OH_NativeXComponent_RegisterSurfaceShowCallback() 1412 1413``` 1414int32_t OH_NativeXComponent_RegisterSurfaceShowCallback (OH_NativeXComponent * component, void(*callback)(OH_NativeXComponent *component, void *window)) 1415``` 1416 1417**Description** 1418 1419Registers a surface display callback for an **OH_NativeXComponent** instance. The callback is invoked whenever the application is switched to the foreground. 1420 1421**Parameters** 1422 1423| Name | Description | 1424| --------- | ----------------------------- | 1425| component | Pointer to the **OH_NativeXComponent** instance.| 1426| callback | Pointer to the surface display callback. | 1427 1428**Returns** 1429 1430Returns the status code of the execution. 1431 1432**Since** 1433 143412 1435 1436### OH_NativeXComponent_RegisterSurfaceHideCallback() 1437 1438``` 1439int32_t OH_NativeXComponent_RegisterSurfaceHideCallback (OH_NativeXComponent * component, void(*callback)(OH_NativeXComponent *component, void *window)) 1440``` 1441 1442**Description** 1443 1444Registers a surface hiding callback for an **OH_NativeXComponent** instance. The callback is invoked whenever the application is switched to the background. 1445 1446**Parameters** 1447 1448| Name | Description | 1449| --------- | ----------------------------- | 1450| component | Pointer to the **OH_NativeXComponent** instance.| 1451| callback | Pointer to the surface hiding callback. | 1452 1453**Returns** 1454 1455Returns the status code of the execution. 1456 1457**Since** 1458 145912 1460 1461### OH_NativeXComponent_GetTouchEventSourceType() 1462 1463``` 1464int32_t OH_NativeXComponent_GetTouchEventSourceType (OH_NativeXComponent* component, int32_t pointId, OH_NativeXComponent_EventSourceType* sourceType); 1465``` 1466 1467**Description** 1468 1469Obtains the touch event source type of an **OH_NativeXComponent** instance. 1470 1471**Parameters** 1472 1473| Name | Description | 1474| --------- | ----------------------------- | 1475| component | Pointer to the **OH_NativeXComponent** instance.| 1476| 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.| 1477| sourceType | Pointer to the touch event source type.| 1478 1479**Returns** 1480 1481Returns **OH_NATIVEXCOMPONENT_RESULT_SUCCESS** if the operation is successful. 1482 1483Returns **OH_NATIVEXCOMPONENT_RESULT_BAD_PARAMETER** if a parameter error occurs. 1484 1485Returns **OH_NATIVEXCOMPONENT_RESULT_FAILED** if any other error occurs. 1486 1487**Since** 1488 148912 1490 1491<!-- --> 1492 1493## Variable Description 1494 1495 1496### OH_XCOMPONENT_ID_LEN_MAX 1497 1498``` 1499const uint32_t OH_XCOMPONENT_ID_LEN_MAX = 128 1500``` 1501 1502 1503**Description** 1504 1505 1506Maximum length of the ArkUI XComponent ID. 1507 1508 1509**Since** 1510 1511 15128 1513 1514 1515### OH_MAX_TOUCH_POINTS_NUMBER 1516 1517``` 1518const uint32_t OH_MAX_TOUCH_POINTS_NUMBER = 10 1519``` 1520 1521**Description** 1522 1523Maximum number of identifiable touch points in a touch event. 1524 1525**Since** 1526 15278 1528 1529 1530### action 1531 1532``` 1533OH_NativeXComponent_MouseEventAction OH_NativeXComponent_MouseEvent::action 1534``` 1535 1536**Description** 1537 1538Action of the mouse event. 1539 1540**Since** 1541 15428 1543 1544 1545### button 1546 1547``` 1548OH_NativeXComponent_MouseEventButton OH_NativeXComponent_MouseEvent::button 1549``` 1550 1551**Description** 1552 1553Mouse event button. 1554 1555**Since** 1556 15578 1558 1559 1560### deviceId 1561 1562``` 1563int64_t OH_NativeXComponent_TouchEvent::deviceId = 0 1564``` 1565 1566**Description** 1567 1568ID of the device where the current touch event is triggered. 1569 1570**Since** 1571 15728 1573 1574 1575### DispatchHoverEvent 1576 1577``` 1578void(* OH_NativeXComponent_MouseEvent_Callback::DispatchHoverEvent) (OH_NativeXComponent *component, bool isHover) 1579``` 1580 1581**Description** 1582 1583Invoked when a hover event is triggered. 1584 1585**Since** 1586 15878 1588 1589 1590### DispatchMouseEvent 1591 1592``` 1593void(* OH_NativeXComponent_MouseEvent_Callback::DispatchMouseEvent) (OH_NativeXComponent *component, void *window) 1594``` 1595 1596**Description** 1597 1598Invoked when a mouse event is triggered. 1599 1600**Since** 1601 16028 1603 1604 1605### DispatchTouchEvent 1606 1607``` 1608void(* OH_NativeXComponent_Callback::DispatchTouchEvent) (OH_NativeXComponent *component, void *window) 1609``` 1610 1611**Description** 1612 1613Invoked when a touch event is triggered. 1614 1615**Since** 1616 16178 1618 1619 1620### force [1/2] 1621 1622``` 1623float OH_NativeXComponent_TouchPoint::force = 0.0 1624``` 1625 1626**Description** 1627 1628Pressure of the touch event. 1629 1630**Since** 1631 16328 1633 1634 1635### force [2/2] 1636 1637``` 1638float OH_NativeXComponent_TouchEvent::force = 0.0 1639``` 1640 1641**Description** 1642 1643Pressure of the touch event. 1644 1645**Since** 1646 16478 1648 1649 1650### id [1/2] 1651 1652``` 1653int32_t OH_NativeXComponent_TouchPoint::id = 0 1654``` 1655 1656**Description** 1657 1658Unique identifier of the finger. 1659 1660**Since** 1661 16628 1663 1664 1665### id [2/2] 1666 1667``` 1668int32_t OH_NativeXComponent_TouchEvent::id = 0 1669``` 1670 1671**Description** 1672 1673Unique identifier of the finger. 1674 1675**Since** 1676 16778 1678 1679 1680### isPressed 1681 1682``` 1683bool OH_NativeXComponent_TouchPoint::isPressed = false 1684``` 1685 1686**Description** 1687 1688Whether the current point is pressed. 1689 1690**Since** 1691 16928 1693 1694 1695### numPoints 1696 1697``` 1698uint32_t OH_NativeXComponent_TouchEvent::numPoints = 0 1699``` 1700 1701**Description** 1702 1703Number of current touch points. 1704 1705**Since** 1706 17078 1708 1709 1710### OnSurfaceChanged 1711 1712``` 1713void(* OH_NativeXComponent_Callback::OnSurfaceChanged) (OH_NativeXComponent *component, void *window) 1714``` 1715 1716**Description** 1717 1718Invoked when the surface changes. 1719 1720**Since** 1721 17228 1723 1724 1725### OnSurfaceCreated 1726 1727``` 1728void(* OH_NativeXComponent_Callback::OnSurfaceCreated) (OH_NativeXComponent *component, void *window) 1729``` 1730 1731**Description** 1732 1733Invoked when a surface is created. 1734 1735**Since** 1736 17378 1738 1739 1740### OnSurfaceDestroyed 1741 1742``` 1743void(* OH_NativeXComponent_Callback::OnSurfaceDestroyed) (OH_NativeXComponent *component, void *window) 1744``` 1745 1746**Description** 1747 1748Invoked when the surface is destroyed. 1749 1750**Since** 1751 17528 1753 1754 1755### screenX [1/3] 1756 1757``` 1758float OH_NativeXComponent_TouchPoint::screenX = 0.0 1759``` 1760 1761**Description** 1762 1763X coordinate of the touch point relative to the left edge of the application window where the XComponent is located. 1764 1765**Since** 1766 17678 1768 1769 1770### screenX [2/3] 1771 1772``` 1773float OH_NativeXComponent_TouchEvent::screenX = 0.0 1774``` 1775 1776**Description** 1777 1778X coordinate of the touch point relative to the left edge of the screen. 1779 1780**Since** 1781 17828 1783 1784 1785### screenX [3/3] 1786 1787``` 1788float OH_NativeXComponent_MouseEvent::screenX 1789``` 1790 1791**Description** 1792 1793X coordinate of the clicked point relative to the upper left corner of the screen. 1794 1795**Since** 1796 17978 1798 1799 1800### screenY [1/3] 1801 1802``` 1803float OH_NativeXComponent_TouchPoint::screenY = 0.0 1804``` 1805 1806**Description** 1807 1808Y coordinate of the touch point relative to the left edge of the application window where the XComponent is located. 1809 1810**Since** 1811 18128 1813 1814 1815### screenY [2/3] 1816 1817``` 1818float OH_NativeXComponent_TouchEvent::screenY = 0.0 1819``` 1820 1821**Description** 1822 1823Y coordinate of the touch point relative to the upper edge of the screen. 1824 1825**Since** 1826 18278 1828 1829 1830### screenY [3/3] 1831 1832``` 1833float OH_NativeXComponent_MouseEvent::screenY 1834``` 1835 1836**Description** 1837 1838Y coordinate of the clicked point relative to the upper left corner of the screen. 1839 1840**Since** 1841 18428 1843 1844 1845### size [1/2] 1846 1847``` 1848double OH_NativeXComponent_TouchPoint::size = 0.0 1849``` 1850 1851**Description** 1852 1853Contact area between the finger pad and the screen. 1854 1855**Since** 1856 18578 1858 1859 1860### size [2/2] 1861 1862``` 1863double OH_NativeXComponent_TouchEvent::size = 0.0 1864``` 1865 1866**Description** 1867 1868Contact area between the finger pad and the screen. 1869 1870**Since** 1871 18728 1873 1874 1875### timeStamp [1/2] 1876 1877``` 1878long long OH_NativeXComponent_TouchPoint::timeStamp = 0 1879``` 1880 1881**Description** 1882 1883Timestamp of the touch point. 1884 1885**Since** 1886 18878 1888 1889 1890### timeStamp [2/2] 1891 1892``` 1893long long OH_NativeXComponent_TouchEvent::timeStamp = 0 1894``` 1895 1896**Description** 1897 1898Timestamp of the touch point. 1899 1900**Since** 1901 19028 1903 1904 1905### timestamp 1906 1907``` 1908int64_t OH_NativeXComponent_MouseEvent::timestamp 1909``` 1910 1911**Description** 1912 1913Timestamp of the mouse event. 1914 1915**Since** 1916 19178 1918 1919 1920### touchPoints 1921 1922``` 1923OH_NativeXComponent_TouchPoint OH_NativeXComponent_TouchEvent::touchPoints[OH_MAX_TOUCH_POINTS_NUMBER] 1924``` 1925 1926**Description** 1927 1928Array of the touch points. 1929 1930**Since** 1931 19328 1933 1934 1935### type [1/2] 1936 1937``` 1938OH_NativeXComponent_TouchEventType OH_NativeXComponent_TouchPoint::type = OH_NativeXComponent_TouchEventType::OH_NATIVEXCOMPONENT_UNKNOWN 1939``` 1940 1941**Description** 1942 1943Touch type of the touch point. 1944 1945**Since** 1946 19478 1948 1949 1950### type [2/2] 1951 1952``` 1953OH_NativeXComponent_TouchEventType OH_NativeXComponent_TouchEvent::type = OH_NativeXComponent_TouchEventType::OH_NATIVEXCOMPONENT_UNKNOWN 1954``` 1955 1956**Description** 1957 1958Touch type of the touch point. 1959 1960**Since** 1961 19628 1963 1964 1965### x [1/3] 1966 1967``` 1968float OH_NativeXComponent_TouchPoint::x = 0.0 1969``` 1970 1971**Description** 1972 1973X coordinate of the touch point relative to the left edge of the XComponent. 1974 1975**Since** 1976 19778 1978 1979 1980### x [2/3] 1981 1982``` 1983float OH_NativeXComponent_TouchEvent::x = 0.0 1984``` 1985 1986**Description** 1987 1988X coordinate of the touch point relative to the left edge of the XComponent. 1989 1990**Since** 1991 19928 1993 1994 1995### x [3/3] 1996 1997``` 1998float OH_NativeXComponent_MouseEvent::x 1999``` 2000 2001**Description** 2002 2003X coordinate of the clicked point relative to the upper left corner of the component. 2004 2005**Since** 2006 20078 2008 2009 2010### y [1/3] 2011 2012``` 2013float OH_NativeXComponent_TouchPoint::y = 0.0 2014``` 2015 2016**Description** 2017 2018Y coordinate of the touch point relative to the upper edge of the XComponent. 2019 2020**Since** 2021 20228 2023 2024 2025### y [2/3] 2026 2027``` 2028float OH_NativeXComponent_TouchEvent::y = 0.0 2029``` 2030 2031**Description** 2032 2033Y coordinate of the touch point relative to the upper edge of the XComponent. 2034 2035**Since** 2036 20378 2038 2039 2040### y [3/3] 2041 2042``` 2043float OH_NativeXComponent_MouseEvent::y 2044``` 2045 2046**Description** 2047 2048Y coordinate of the clicked point relative to the upper left corner of the component. 2049 2050**Since** 2051 20528 2053 2054### expected 2055 2056``` 2057int32_t OH_NativeXComponent_ExpectedRateRange::expected 2058``` 2059**Description** 2060 2061Expected frame rate range. 2062 2063**Since** 2064 206511 2066 2067### max 2068 2069``` 2070int32_t OH_NativeXComponent_ExpectedRateRange::max 2071``` 2072**Description** 2073 2074Maximum value of the expected frame rate range. 2075 2076**Since** 2077 207811 2079 2080 2081### min 2082 2083``` 2084int32_t OH_NativeXComponent_ExpectedRateRange::min 2085``` 2086**Description** 2087 2088Minimum value of the expected frame rate range. 2089 2090**Since** 2091 209211 2093