1# ui_input_event.h
2
3
4## Overview
5
6Provides ArkUI event definitions on the native side.
7
8**Library**: libace_ndk.z.so
9
10**System capability**: SystemCapability.ArkUI.ArkUI.Full
11
12**Since**: 12
13
14**Related module**: [ArkUI_EventModule](_ark_u_i___event_module.md)
15
16
17## Summary
18
19
20### Types
21
22| Name| Description|
23| -------- | -------- |
24| typedef struct [ArkUI_UIInputEvent](_ark_u_i___event_module.md#arkui_uiinputevent) [ArkUI_UIInputEvent](_ark_u_i___event_module.md#arkui_uiinputevent) | Defines the UI input event. |
25
26
27### Enums
28
29| Name| Description|
30| -------- | -------- |
31| [ArkUI_UIInputEvent_Type](_ark_u_i___event_module.md#arkui_uiinputevent_type) { **ARKUI_UIINPUTEVENT_TYPE_UNKNOWN** = 0, **ARKUI_UIINPUTEVENT_TYPE_TOUCH** = 1, **ARKUI_UIINPUTEVENT_TYPE_AXIS** = 2, **ARKUI_UIINPUTEVENT_TYPE_MOUSE** = 3 } | Enumerates the UI input event types. |
32| {<br>[OH_NATIVEXCOMPONENT_RESULT_SUCCESS](_ark_u_i___event_module.md) = 0, [OH_NATIVEXCOMPONENT_RESULT_FAILED](_ark_u_i___event_module.md) = -1, [OH_NATIVEXCOMPONENT_RESULT_BAD_PARAMETER](_ark_u_i___event_module.md) = -2, [UI_TOUCH_EVENT_ACTION_CANCEL](_ark_u_i___event_module.md) = 0,<br>[UI_TOUCH_EVENT_ACTION_DOWN](_ark_u_i___event_module.md) = 1, [UI_TOUCH_EVENT_ACTION_MOVE](_ark_u_i___event_module.md) = 2, [UI_TOUCH_EVENT_ACTION_UP](_ark_u_i___event_module.md) = 3<br>} | Enumerates the action codes of the input event. |
33| {<br>[UI_INPUT_EVENT_TOOL_TYPE_UNKNOWN](_ark_u_i___event_module.md) = 0, [UI_INPUT_EVENT_TOOL_TYPE_FINGER](_ark_u_i___event_module.md) = 1, [UI_INPUT_EVENT_TOOL_TYPE_PEN](_ark_u_i___event_module.md) = 2, [UI_INPUT_EVENT_TOOL_TYPE_MOUSE](_ark_u_i___event_module.md) = 3,<br>[UI_INPUT_EVENT_TOOL_TYPE_TOUCHPAD](_ark_u_i___event_module.md) = 4, [UI_INPUT_EVENT_TOOL_TYPE_JOYSTICK](_ark_u_i___event_module.md) = 5<br>} | Enumerates the tool types of the input event. |
34| { [UI_INPUT_EVENT_SOURCE_TYPE_UNKNOWN](_ark_u_i___event_module.md) = 0, [UI_INPUT_EVENTT_SOURCE_TYPE_MOUSE](_ark_u_i___event_module.md) = 1, [UI_INPUT_EVENTT_SOURCE_TYPE_TOUCH_SCREEN](_ark_u_i___event_module.md) = 2 } | Enumerates the source types of the input event. |
35| [HitTestMode](_ark_u_i___event_module.md#hittestmode) { [HTMDEFAULT](_ark_u_i___event_module.md) = 0, [HTMBLOCK](_ark_u_i___event_module.md), [HTMTRANSPARENT](_ark_u_i___event_module.md), [HTMNONE](_ark_u_i___event_module.md) } | Enumerates the hit test modes. |
36| { [UI_MOUSE_EVENT_ACTION_UNKNOWN](_ark_u_i___event_module.md) = 0, [UI_MOUSE_EVENT_ACTION_PRESS](_ark_u_i___event_module.md) = 1, [UI_MOUSE_EVENT_ACTION_RELEASE](_ark_u_i___event_module.md) = 2, [UI_MOUSE_EVENT_ACTION_MOVE](_ark_u_i___event_module.md) = 3 } | Enumerates the action codes of the mouse event. |
37| {<br>[UI_MOUSE_EVENT_BUTTON_NONE](_ark_u_i___event_module.md) = 0, [UI_MOUSE_EVENT_BUTTON_LEFT](_ark_u_i___event_module.md) = 1, [UI_MOUSE_EVENT_BUTTON_RIGHT](_ark_u_i___event_module.md) = 2, [UI_MOUSE_EVENT_BUTTON_MIDDLE](_ark_u_i___event_module.md) = 3,<br>[UI_MOUSE_EVENT_BUTTON_BACK](_ark_u_i___event_module.md) = 4, [UI_MOUSE_EVENT_BUTTON_FORWARD](_ark_u_i___event_module.md) = 5<br>} | Enumerates the button types of the mouse event. |
38| [ArkUI_ModifierKeyName](_ark_u_i___event_module.md#arkui_modifierkeyname) { [ARKUI_MODIFIER_KEY_CTRL](_ark_u_i___event_module.md) = 1 &lt;&lt; 0, [ARKUI_MODIFIER_KEY_SHIFT](_ark_u_i___event_module.md) = 1 &lt;&lt; 1, [ARKUI_MODIFIER_KEY_ALT](_ark_u_i___event_module.md) = 1 &lt;&lt; 2, [ARKUI_MODIFIER_KEY_FN](_ark_u_i___event_module.md) = 1 &lt;&lt; 3 } | Enumerates the modifier keys. |
39
40
41### Functions
42
43| Name| Description|
44| -------- | -------- |
45| int32_t [OH_ArkUI_UIInputEvent_GetType](_ark_u_i___event_module.md#oh_arkui_uiinputevent_gettype) (const [ArkUI_UIInputEvent](_ark_u_i___event_module.md#arkui_uiinputevent) \*event) | Obtains the type of a UI input event. |
46| int32_t [OH_ArkUI_UIInputEvent_GetAction](_ark_u_i___event_module.md#oh_arkui_uiinputevent_getaction) (const [ArkUI_UIInputEvent](_ark_u_i___event_module.md#arkui_uiinputevent) \*event) | Obtains the action type of this UI input event. |
47| int32_t [OH_ArkUI_UIInputEvent_GetSourceType](_ark_u_i___event_module.md#oh_arkui_uiinputevent_getsourcetype) (const [ArkUI_UIInputEvent](_ark_u_i___event_module.md#arkui_uiinputevent) \*event) | Obtains the source type of a UI input event. |
48| int32_t [OH_ArkUI_UIInputEvent_GetToolType](_ark_u_i___event_module.md#oh_arkui_uiinputevent_gettooltype) (const [ArkUI_UIInputEvent](_ark_u_i___event_module.md#arkui_uiinputevent) \*event) | Obtains the tool type of a UI input event. |
49| int64_t [OH_ArkUI_UIInputEvent_GetEventTime](_ark_u_i___event_module.md#oh_arkui_uiinputevent_geteventtime) (const [ArkUI_UIInputEvent](_ark_u_i___event_module.md#arkui_uiinputevent) \*event) | Obtains the time when a specified UI input event occurs. |
50| uint32_t [OH_ArkUI_PointerEvent_GetPointerCount](_ark_u_i___event_module.md#oh_arkui_pointerevent_getpointercount) (const [ArkUI_UIInputEvent](_ark_u_i___event_module.md#arkui_uiinputevent) \*event) | Obtains the number of touch points from a directional input event (such as a touch event, mouse event, or axis event). |
51| int32_t [OH_ArkUI_PointerEvent_GetPointerId](_ark_u_i___event_module.md#oh_arkui_pointerevent_getpointerid) (const [ArkUI_UIInputEvent](_ark_u_i___event_module.md#arkui_uiinputevent) \*event, uint32_t pointerIndex) | Obtains the ID of a touch point from a directional input event (such as a touch event, mouse event, or axis event). |
52| float [OH_ArkUI_PointerEvent_GetX](_ark_u_i___event_module.md#oh_arkui_pointerevent_getx) (const [ArkUI_UIInputEvent](_ark_u_i___event_module.md#arkui_uiinputevent) \*event) | Obtains the X-coordinate relative to the upper left corner of the current component from a directional input event (such as a touch event, mouse event, or axis event). |
53| float [OH_ArkUI_PointerEvent_GetXByIndex](_ark_u_i___event_module.md#oh_arkui_pointerevent_getxbyindex) (const [ArkUI_UIInputEvent](_ark_u_i___event_module.md#arkui_uiinputevent) \*event, uint32_t pointerIndex) | Obtains the X-coordinate of a specific touch point relative to the upper left corner of the current component from a directional input event (such as a touch event, mouse event, or axis event). |
54| float [OH_ArkUI_PointerEvent_GetY](_ark_u_i___event_module.md#oh_arkui_pointerevent_gety) (const [ArkUI_UIInputEvent](_ark_u_i___event_module.md#arkui_uiinputevent) \*event) | Obtains the Y-coordinate relative to the upper left corner of the current component from a directional input event (such as a touch event, mouse event, or axis event). |
55| float [OH_ArkUI_PointerEvent_GetYByIndex](_ark_u_i___event_module.md#oh_arkui_pointerevent_getybyindex) (const [ArkUI_UIInputEvent](_ark_u_i___event_module.md#arkui_uiinputevent) \*event, uint32_t pointerIndex) | Obtains the Y-coordinate of a specific touch point relative to the upper left corner of the current component from a directional input event (such as a touch event, mouse event, or axis event). |
56| float [OH_ArkUI_PointerEvent_GetWindowX](_ark_u_i___event_module.md#oh_arkui_pointerevent_getwindowx) (const [ArkUI_UIInputEvent](_ark_u_i___event_module.md#arkui_uiinputevent) \*event) | Obtains the X-coordinate relative to the upper left corner of the current application window from a directional input event (such as a touch event, mouse event, or axis event). |
57| float [OH_ArkUI_PointerEvent_GetWindowXByIndex](_ark_u_i___event_module.md#oh_arkui_pointerevent_getwindowxbyindex) (const [ArkUI_UIInputEvent](_ark_u_i___event_module.md#arkui_uiinputevent) \*event, uint32_t pointerIndex) | Obtains the X-coordinate of a specific touch point relative to the upper left corner of the current application window from a directional input event (such as a touch event, mouse event, or axis event). |
58| float [OH_ArkUI_PointerEvent_GetWindowY](_ark_u_i___event_module.md#oh_arkui_pointerevent_getwindowy) (const [ArkUI_UIInputEvent](_ark_u_i___event_module.md#arkui_uiinputevent) \*event) | Obtains the Y-coordinate relative to the upper left corner of the current application window from a directional input event (such as a touch event, mouse event, or axis event). |
59| float [OH_ArkUI_PointerEvent_GetWindowYByIndex](_ark_u_i___event_module.md#oh_arkui_pointerevent_getwindowybyindex) (const [ArkUI_UIInputEvent](_ark_u_i___event_module.md#arkui_uiinputevent) \*event, uint32_t pointerIndex) | Obtains the Y-coordinate of a specific touch point relative to the upper left corner of the current application window from a directional input event (such as a touch event, mouse event, or axis event). |
60| float [OH_ArkUI_PointerEvent_GetDisplayX](_ark_u_i___event_module.md#oh_arkui_pointerevent_getdisplayx) (const [ArkUI_UIInputEvent](_ark_u_i___event_module.md#arkui_uiinputevent) \*event) | Obtains the X-coordinate relative to the upper left corner of the current screen from a directional input event (such as a touch event, mouse event, or axis event). |
61| float [OH_ArkUI_PointerEvent_GetDisplayXByIndex](_ark_u_i___event_module.md#oh_arkui_pointerevent_getdisplayxbyindex) (const [ArkUI_UIInputEvent](_ark_u_i___event_module.md#arkui_uiinputevent) \*event, uint32_t pointerIndex) | Obtains the X-coordinate of a specific touch point relative to the upper left corner of the current screen from a directional input event (such as a touch event, mouse event, or axis event). |
62| float [OH_ArkUI_PointerEvent_GetDisplayY](_ark_u_i___event_module.md#oh_arkui_pointerevent_getdisplayy) (const [ArkUI_UIInputEvent](_ark_u_i___event_module.md#arkui_uiinputevent) \*event) | Obtains the Y-coordinate relative to the upper left corner of the current screen from a directional input event (such as a touch event, mouse event, or axis event). |
63| float [OH_ArkUI_PointerEvent_GetDisplayYByIndex](_ark_u_i___event_module.md#oh_arkui_pointerevent_getdisplayybyindex) (const [ArkUI_UIInputEvent](_ark_u_i___event_module.md#arkui_uiinputevent) \*event, uint32_t pointerIndex) | Obtains the Y-coordinate of a specific touch point relative to the upper left corner of the current screen from a directional input event (such as a touch event, mouse event, or axis event). |
64| float [OH_ArkUI_PointerEvent_GetPressure](_ark_u_i___event_module.md#oh_arkui_pointerevent_getpressure) (const [ArkUI_UIInputEvent](_ark_u_i___event_module.md#arkui_uiinputevent) \*event, uint32_t pointerIndex) | Obtains the pressure applied to the touchscreen from a directional input event (for example, a touch event). |
65| float [OH_ArkUI_PointerEvent_GetTiltX](_ark_u_i___event_module.md#oh_arkui_pointerevent_gettiltx) (const [ArkUI_UIInputEvent](_ark_u_i___event_module.md#arkui_uiinputevent) \*event, uint32_t pointerIndex) | Obtains the angle relative to the YZ plane from a directional input event (for example, a touch event). The value range is [-90, 90]. A positive value indicates a rightward tilt. |
66| float [OH_ArkUI_PointerEvent_GetTiltY](_ark_u_i___event_module.md#oh_arkui_pointerevent_gettilty) (const [ArkUI_UIInputEvent](_ark_u_i___event_module.md#arkui_uiinputevent) \*event, uint32_t pointerIndex) | Obtains the angle relative to the XZ plane from a directional input event (for example, a touch event). The value range is [-90, 90]. A positive value indicates a downward tilt. |
67| float [OH_ArkUI_PointerEvent_GetTouchAreaWidth](_ark_u_i___event_module.md#oh_arkui_pointerevent_gettouchareawidth) (const [ArkUI_UIInputEvent](_ark_u_i___event_module.md#arkui_uiinputevent) \*event, uint32_t pointerIndex) | Obtains the width of the touch area from a directional input event (for example, a touch event). |
68| float [OH_ArkUI_PointerEvent_GetTouchAreaHeight](_ark_u_i___event_module.md#oh_arkui_pointerevent_gettouchareaheight) (const [ArkUI_UIInputEvent](_ark_u_i___event_module.md#arkui_uiinputevent) \*event, uint32_t pointerIndex) | Obtains the height of the touch area from a directional input event (for example, a touch event). |
69| uint32_t [OH_ArkUI_PointerEvent_GetHistorySize](_ark_u_i___event_module.md#oh_arkui_pointerevent_gethistorysize) (const [ArkUI_UIInputEvent](_ark_u_i___event_module.md#arkui_uiinputevent) \*event) | Obtains the number of historical events from a directional input event (such as a touch event, mouse event, or axis event). |
70| int64_t [OH_ArkUI_PointerEvent_GetHistoryEventTime](_ark_u_i___event_module.md#oh_arkui_pointerevent_gethistoryeventtime) (const [ArkUI_UIInputEvent](_ark_u_i___event_module.md#arkui_uiinputevent) \*event, uint32_t historyIndex) | Obtains the occurrence time of a historical event from a directional input event (such as a touch event, mouse event, or axis event). |
71| uint32_t [OH_ArkUI_PointerEvent_GetHistoryPointerCount](_ark_u_i___event_module.md#oh_arkui_pointerevent_gethistorypointercount) (const [ArkUI_UIInputEvent](_ark_u_i___event_module.md#arkui_uiinputevent) \*event, uint32_t historyIndex) | Obtains the number of touch points in a specific historical event from a directional input event (such as a touch event, mouse event, or axis event). |
72| int32_t [OH_ArkUI_PointerEvent_GetHistoryPointerId](_ark_u_i___event_module.md#oh_arkui_pointerevent_gethistorypointerid) (const [ArkUI_UIInputEvent](_ark_u_i___event_module.md#arkui_uiinputevent) \*event, uint32_t pointerIndex, uint32_t historyIndex) | Obtains the ID of a touch point from a directional input event (such as a touch event, mouse event, or axis event). |
73| float [OH_ArkUI_PointerEvent_GetHistoryX](_ark_u_i___event_module.md#oh_arkui_pointerevent_gethistoryx) (const [ArkUI_UIInputEvent](_ark_u_i___event_module.md#arkui_uiinputevent) \*event, uint32_t pointerIndex, uint32_t historyIndex) | Obtains the X-coordinate of a specific touch point in a specific historical event relative to the upper left corner of the current component from a directional input event (such as a touch event, mouse event, or axis event). |
74| float [OH_ArkUI_PointerEvent_GetHistoryY](_ark_u_i___event_module.md#oh_arkui_pointerevent_gethistoryy) (const [ArkUI_UIInputEvent](_ark_u_i___event_module.md#arkui_uiinputevent) \*event, uint32_t pointerIndex, uint32_t historyIndex) | Obtains the Y-coordinate of a specific touch point in a specific historical event relative to the upper left corner of the current component from a directional input event (such as a touch event, mouse event, or axis event). |
75| float [OH_ArkUI_PointerEvent_GetHistoryWindowX](_ark_u_i___event_module.md#oh_arkui_pointerevent_gethistorywindowx) (const [ArkUI_UIInputEvent](_ark_u_i___event_module.md#arkui_uiinputevent) \*event, uint32_t pointerIndex, uint32_t historyIndex) | Obtains the X-coordinate of a specific touch point in a specific historical event relative to the upper left corner of the current application window from a directional input event (such as a touch event, mouse event, or axis event). |
76| float [OH_ArkUI_PointerEvent_GetHistoryWindowY](_ark_u_i___event_module.md#oh_arkui_pointerevent_gethistorywindowy) (const [ArkUI_UIInputEvent](_ark_u_i___event_module.md#arkui_uiinputevent) \*event, uint32_t pointerIndex, uint32_t historyIndex) | Obtains the Y-coordinate of a specific touch point in a specific historical event relative to the upper left corner of the current application window from a directional input event (such as a touch event, mouse event, or axis event). |
77| float [OH_ArkUI_PointerEvent_GetHistoryDisplayX](_ark_u_i___event_module.md#oh_arkui_pointerevent_gethistorydisplayx) (const [ArkUI_UIInputEvent](_ark_u_i___event_module.md#arkui_uiinputevent) \*event, uint32_t pointerIndex, uint32_t historyIndex) | Obtains the X-coordinate of a specific touch point in a specific historical event relative to the upper left corner of the current screen from a directional input event (such as a touch event, mouse event, or axis event). |
78| float [OH_ArkUI_PointerEvent_GetHistoryDisplayY](_ark_u_i___event_module.md#oh_arkui_pointerevent_gethistorydisplayy) (const [ArkUI_UIInputEvent](_ark_u_i___event_module.md#arkui_uiinputevent) \*event, uint32_t pointerIndex, uint32_t historyIndex) | Obtains the Y-coordinate of a specific touch point in a specific historical event relative to the upper left corner of the current screen from a directional input event (such as a touch event, mouse event, or axis event). |
79| float [OH_ArkUI_PointerEvent_GetHistoryPressure](_ark_u_i___event_module.md#oh_arkui_pointerevent_gethistorypressure) (const [ArkUI_UIInputEvent](_ark_u_i___event_module.md#arkui_uiinputevent) \*event, uint32_t pointerIndex, uint32_t historyIndex) | Obtains the pressure applied to the touchscreen in a specific historical event from a directional input event (for example, a touch event).. |
80| float [OH_ArkUI_PointerEvent_GetHistoryTiltX](_ark_u_i___event_module.md#oh_arkui_pointerevent_gethistorytiltx) (const [ArkUI_UIInputEvent](_ark_u_i___event_module.md#arkui_uiinputevent) \*event, uint32_t pointerIndex, uint32_t historyIndex) | Obtains the angle relative to the YZ plane in a specific historical event from a directional input event (for example, a touch event). The value range is [-90, 90]. A positive value indicates a rightward tilt. |
81| float [OH_ArkUI_PointerEvent_GetHistoryTiltY](_ark_u_i___event_module.md#oh_arkui_pointerevent_gethistorytilty) (const [ArkUI_UIInputEvent](_ark_u_i___event_module.md#arkui_uiinputevent) \*event, uint32_t pointerIndex, uint32_t historyIndex) | Obtains the angle relative to the XZ plane in a specific historical event from a directional input event (for example, a touch event). The value range is [-90, 90]. A positive value indicates a downward tilt. |
82| float [OH_ArkUI_PointerEvent_GetHistoryTouchAreaWidth](_ark_u_i___event_module.md#oh_arkui_pointerevent_gethistorytouchareawidth) (const [ArkUI_UIInputEvent](_ark_u_i___event_module.md#arkui_uiinputevent) \*event, uint32_t pointerIndex, uint32_t historyIndex) | Obtains the width of the touch area in a specific historical event from a directional input event (for example, a touch event). |
83| float [OH_ArkUI_PointerEvent_GetHistoryTouchAreaHeight](_ark_u_i___event_module.md#oh_arkui_pointerevent_gethistorytouchareaheight) (const [ArkUI_UIInputEvent](_ark_u_i___event_module.md#arkui_uiinputevent) \*event, uint32_t pointerIndex, uint32_t historyIndex) | Obtains the height of the touch area in a specific historical event from a directional input event (for example, a touch event). |
84| double [OH_ArkUI_AxisEvent_GetVerticalAxisValue](_ark_u_i___event_module.md#oh_arkui_axisevent_getverticalaxisvalue) (const [ArkUI_UIInputEvent](_ark_u_i___event_module.md#arkui_uiinputevent) \*event) | Obtains the value of the vertical scroll axis for this axis event. |
85| double [OH_ArkUI_AxisEvent_GetHorizontalAxisValue](_ark_u_i___event_module.md#oh_arkui_axisevent_gethorizontalaxisvalue) (const [ArkUI_UIInputEvent](_ark_u_i___event_module.md#arkui_uiinputevent) \*event) | Obtains the value of the horizontal scroll axis for this axis event. |
86| double [OH_ArkUI_AxisEvent_GetPinchAxisScaleValue](_ark_u_i___event_module.md#oh_arkui_axisevent_getpinchaxisscalevalue) (const [ArkUI_UIInputEvent](_ark_u_i___event_module.md#arkui_uiinputevent) \*event) | Obtains the scale value of the pinch axis for this axis event. |
87| int32_t [OH_ArkUI_PointerEvent_SetInterceptHitTestMode](_ark_u_i___event_module.md#oh_arkui_pointerevent_setintercepthittestmode) (const [ArkUI_UIInputEvent](_ark_u_i___event_module.md#arkui_uiinputevent) \*event, [HitTestMode](_ark_u_i___event_module.md#hittestmode) mode) | Sets how the component behaves during hit testing. |
88| int32_t [OH_ArkUI_MouseEvent_GetMouseButton](_ark_u_i___event_module.md#oh_arkui_mouseevent_getmousebutton) (const [ArkUI_UIInputEvent](_ark_u_i___event_module.md#arkui_uiinputevent) \*event) | Obtains the button type of a mouse event. |
89| int32_t [OH_ArkUI_MouseEvent_GetMouseAction](_ark_u_i___event_module.md#oh_arkui_mouseevent_getmouseaction) (const [ArkUI_UIInputEvent](_ark_u_i___event_module.md#arkui_uiinputevent) \*event) | Obtains the action type of a mouse event. |
90| int32_t [OH_ArkUI_PointerEvent_SetStopPropagation](_ark_u_i___event_module.md#oh_arkui_pointerevent_setstoppropagation) (const [ArkUI_UIInputEvent](_ark_u_i___event_module.md#arkui_uiinputevent) \*event, bool stopPropagation) | Sets whether to stop event propagation. |
91