• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 /**
17  * @addtogroup ArkUI_EventModule
18  * @{
19  *
20  * @brief Declares the UI input event capabilities provided by ArkUI on the native side.
21  *
22  * @since 12
23  */
24 
25 /**
26  * @file ui_input_event.h
27  *
28  * @brief Provides ArkUI event definitions on the native side.
29  *
30  * @library libace_ndk.z.so
31  * @syscap SystemCapability.ArkUI.ArkUI.Full
32  * @since 12
33  */
34 
35 #ifndef _ARKUI_UI_INPUT_EVENT_H_
36 #define _ARKUI_UI_INPUT_EVENT_H_
37 
38 #include "native_type.h"
39 #ifdef __cplusplus
40 #include <cstdint>
41 #else
42 #include <stdint.h>
43 #endif
44 
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
48 
49 /**
50  * @brief Defines the UI input event.
51  *
52  * @since 12
53  */
54 typedef struct ArkUI_UIInputEvent ArkUI_UIInputEvent;
55 
56 /**
57  * @brief Enumerates the UI input event types.
58  *
59  * @since 12
60  */
61 typedef enum {
62     ARKUI_UIINPUTEVENT_TYPE_UNKNOWN = 0,
63     ARKUI_UIINPUTEVENT_TYPE_TOUCH = 1,
64     ARKUI_UIINPUTEVENT_TYPE_AXIS = 2,
65     ARKUI_UIINPUTEVENT_TYPE_MOUSE = 3,
66 } ArkUI_UIInputEvent_Type;
67 
68 /**
69  * @brief Defines the action code of the input event.
70  *
71  * @since 12
72  */
73 enum {
74     /** Cancellation of touch. */
75     UI_TOUCH_EVENT_ACTION_CANCEL = 0,
76     /** Pressing of a touch point. */
77     UI_TOUCH_EVENT_ACTION_DOWN = 1,
78     /** Moving of a touch point. */
79     UI_TOUCH_EVENT_ACTION_MOVE = 2,
80     /** Lifting of a touch point. */
81     UI_TOUCH_EVENT_ACTION_UP = 3,
82 };
83 
84 /**
85  * @brief Defines the tool type of the touch event.
86  *
87  * @since 12
88  */
89 enum {
90     /** Unknown tool type. */
91     UI_INPUT_EVENT_TOOL_TYPE_UNKNOWN = 0,
92 
93     /** Finger. */
94     UI_INPUT_EVENT_TOOL_TYPE_FINGER = 1,
95 
96     /** Pen. */
97     UI_INPUT_EVENT_TOOL_TYPE_PEN = 2,
98 
99     /** Mouse. */
100     UI_INPUT_EVENT_TOOL_TYPE_MOUSE = 3,
101 
102     /** TouchPad. */
103     UI_INPUT_EVENT_TOOL_TYPE_TOUCHPAD = 4,
104 
105     /** JoyStick. */
106     UI_INPUT_EVENT_TOOL_TYPE_JOYSTICK = 5,
107 };
108 
109 /**
110  * @brief Defines the source type of the touch event.
111  *
112  * @since 12
113  */
114 enum {
115     /** Unknown source type. */
116     UI_INPUT_EVENT_SOURCE_TYPE_UNKNOWN = 0,
117     /** Mouse. */
118     UI_INPUT_EVENTT_SOURCE_TYPE_MOUSE = 1,
119     /** Touchscreen. */
120     UI_INPUT_EVENTT_SOURCE_TYPE_TOUCH_SCREEN = 2,
121 };
122 
123 /**
124  * @brief Enumerates the hit test modes.
125  *
126  * @since 12
127  */
128 typedef enum {
129     /** Both the node and its child node respond to the hit test of a touch event, but its sibling node is blocked from
130      *  the hit test.
131      */
132     HTM_DEFAULT = 0,
133 
134     /** The node responds to the hit test of a touch event, but its child node and sibling node are blocked from the hit
135      *  test.
136      */
137     HTM_BLOCK,
138 
139     /** Both the node and its child node respond to the hit test of a touch event, and its sibling node is also
140      *  considered during the hit test.
141      */
142     HTM_TRANSPARENT,
143 
144     /** The node does not respond to the hit test of a touch event, but its child node and sibling node are considered
145      *  during the hit test.
146      */
147     HTM_NONE,
148 } HitTestMode;
149 
150 /**
151  * @brief 定义鼠标事件的Action Code。
152  *
153  * @since 12
154  */
155 enum {
156     /** 无效行为 */
157     UI_MOUSE_EVENT_ACTION_UNKNOWN = 0,
158     /** 鼠标按键按下。 */
159     UI_MOUSE_EVENT_ACTION_PRESS = 1,
160     /** 鼠标按键松开。 */
161     UI_MOUSE_EVENT_ACTION_RELEASE = 2,
162     /** 鼠标移动。 */
163     UI_MOUSE_EVENT_ACTION_MOVE = 3,
164 };
165 
166 /**
167  * @brief 定义鼠标事件的按键类型。
168  *
169  * @since 12
170  */
171 enum {
172     /** 无按键。 */
173     UI_MOUSE_EVENT_BUTTON_NONE = 0,
174     /** 鼠标左键。 */
175     UI_MOUSE_EVENT_BUTTON_LEFT = 1,
176     /** 鼠标右键。 */
177     UI_MOUSE_EVENT_BUTTON_RIGHT = 2,
178     /** 鼠标中键。 */
179     UI_MOUSE_EVENT_BUTTON_MIDDLE = 3,
180     /** 鼠标左侧后退键。 */
181     UI_MOUSE_EVENT_BUTTON_BACK = 4,
182     /** 鼠标左侧前进键。 */
183     UI_MOUSE_EVENT_BUTTON_FORWARD = 5,
184 };
185 
186 /**
187  * @brief Defines an enum for modifier keys.
188  *
189  * @since 12
190  */
191 typedef enum {
192     /** Ctrl. */
193     ARKUI_MODIFIER_KEY_CTRL = 1 << 0,
194     /** Shift. */
195     ARKUI_MODIFIER_KEY_SHIFT = 1 << 1,
196     /** Alt. */
197     ARKUI_MODIFIER_KEY_ALT = 1 << 2,
198     /** Fn. */
199     ARKUI_MODIFIER_KEY_FN = 1 << 3,
200 } ArkUI_ModifierKeyName;
201 
202 /**
203  * @brief Defines interaction hand for touch event.
204  *
205  * @since 15
206  */
207 typedef enum {
208     /** UnKnown. */
209     ARKUI_EVENT_HAND_NONE = 0,
210     /** Left hand. */
211     ARKUI_EVENT_HAND_LEFT = 1,
212     /** Right hand. */
213     ARKUI_EVENT_HAND_RIGHT = 2,
214 } ArkUI_InteractionHand;
215 
216 /**
217  * @brief Enumerates the action types for axis events.
218  *
219  * @since 15
220  */
221 enum {
222     /** The axis event is abnormal. */
223     UI_AXIS_EVENT_ACTION_NONE = 0,
224     /** The axis event begins. */
225     UI_AXIS_EVENT_ACTION_BEGIN = 1,
226     /** The axis event is updated. */
227     UI_AXIS_EVENT_ACTION_UPDATE = 2,
228     /** The axis event ends. */
229     UI_AXIS_EVENT_ACTION_END = 3,
230     /** The axis event is canceled. */
231     UI_AXIS_EVENT_ACTION_CANCEL = 4,
232 };
233 
234 /**
235  * @brief Defines an enum for the axis types for focus axis events.
236  *
237  * @since 15
238  */
239 enum {
240     /** ABS_X. */
241     UI_FOCUS_AXIS_EVENT_ABS_X = 0,
242     /** ABS_Y. */
243     UI_FOCUS_AXIS_EVENT_ABS_Y = 1,
244     /** ABS_Z. */
245     UI_FOCUS_AXIS_EVENT_ABS_Z = 2,
246     /** ABS_RZ. */
247     UI_FOCUS_AXIS_EVENT_ABS_RZ = 3,
248     /** ABS_GAS. */
249     UI_FOCUS_AXIS_EVENT_ABS_GAS = 4,
250     /** ABS_BRAKE. */
251     UI_FOCUS_AXIS_EVENT_ABS_BRAKE = 5,
252     /** ABS_HAT0X. */
253     UI_FOCUS_AXIS_EVENT_ABS_HAT0X = 6,
254     /** ABS_HAT0Y. */
255     UI_FOCUS_AXIS_EVENT_ABS_HAT0Y = 7,
256 };
257 
258 /**
259  * @brief Obtains the type of this UI input event.
260  *
261  * @param event Indicates the pointer to the current UI input event.
262  * @return Returns the type of the current UI input event; returns <b>0</b> if any parameter error occurs.
263  * @since 12
264  */
265 int32_t OH_ArkUI_UIInputEvent_GetType(const ArkUI_UIInputEvent* event);
266 
267 /**
268  * @brief Obtains the action type of this UI input event.
269  *
270  * @param event Indicates the pointer to the current UI input event.
271  * @return Returns the action type of the current UI input event; returns <b>0</b> if any parameter error occurs.
272  * @since 12
273  */
274 int32_t OH_ArkUI_UIInputEvent_GetAction(const ArkUI_UIInputEvent* event);
275 
276 /**
277  * @brief Obtains the source type of this UI input event.
278  *
279  * @param event Indicates the pointer to the current UI input event.
280  * @return Returns the source type of the current UI input event.
281  * @since 12
282  */
283 int32_t OH_ArkUI_UIInputEvent_GetSourceType(const ArkUI_UIInputEvent* event);
284 
285 /**
286  * @brief Obtains the tool type of this UI input event.
287  *
288  * @param event Indicates the pointer to the current UI input event.
289  * @return Returns the tool type of the current UI input event.
290  * @since 12
291  */
292 int32_t OH_ArkUI_UIInputEvent_GetToolType(const ArkUI_UIInputEvent* event);
293 
294 /**
295  * @brief Obtains the time when this UI input event occurs.
296  *
297  * @param event Indicates the pointer to the current UI input event.
298  * @return Returns the time when the UI input event occurs; returns <b>0</b> if any parameter error occurs.
299  * @since 12
300  */
301 int64_t OH_ArkUI_UIInputEvent_GetEventTime(const ArkUI_UIInputEvent* event);
302 
303 /**
304  * @brief Obtains the number of touch points from a directional input event (such as a touch event, mouse event,
305  * or axis event).
306  *
307  * @param event Indicates the pointer to the current UI input event.
308  * @return Returns the number of touch points for the directional input event.
309  * @since 12
310  */
311 uint32_t OH_ArkUI_PointerEvent_GetPointerCount(const ArkUI_UIInputEvent* event);
312 
313 /**
314  * @brief Obtains the ID of a touch point from a directional input event (such as a touch event, mouse event,
315  * or axis event).
316  *
317  * @param event Indicates the pointer to the current UI input event.
318  * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list.
319  * @return Returns the ID of the corresponding touch point.
320  * @since 12
321  */
322 int32_t OH_ArkUI_PointerEvent_GetPointerId(const ArkUI_UIInputEvent* event, uint32_t pointerIndex);
323 
324 /**
325  * @brief Obtains the X coordinate relative to the upper left corner of the current component from a directional
326  * input event (such as a touch event, mouse event, or axis event).
327  *
328  * @param event Indicates the pointer to the directional input event.
329  * @return Returns the X coordinate relative to the upper left corner of the current component;
330  * returns <b>0</b> if any parameter error occurs.
331  * @since 12
332  */
333 float OH_ArkUI_PointerEvent_GetX(const ArkUI_UIInputEvent* event);
334 
335 /**
336  * @brief Obtains the X coordinate of a specific touch point relative to the upper left corner of the current component
337  * from a directional input event (such as a touch event, mouse event, or axis event).
338  *
339  * @param event Indicates the pointer to the current UI input event.
340  * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list.
341  * @return Returns the X coordinate relative to the upper left corner of the current component;
342  * returns <b>0.0f</b> if any parameter error occurs.
343  * @since 12
344  */
345 float OH_ArkUI_PointerEvent_GetXByIndex(const ArkUI_UIInputEvent* event, uint32_t pointerIndex);
346 
347 /**
348  * @brief Obtains the Y coordinate relative to the upper left corner of the current component from a directional
349  * input event (such as a touch event, mouse event, or axis event).
350  *
351  * @param event Indicates the pointer to the UI input event.
352  * @return Returns the Y coordinate relative to the upper left corner of the current component;
353  * returns <b>0</b> if any parameter error occurs.
354  * @since 12
355  */
356 float OH_ArkUI_PointerEvent_GetY(const ArkUI_UIInputEvent* event);
357 
358 /**
359  * @brief Obtains the Y coordinate of a specific touch point relative to the upper left corner of the current component
360  * from a directional input event (such as a touch event, mouse event, or axis event).
361  *
362  * @param event Indicates the pointer to the current UI input event.
363  * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list.
364  * @return Returns the Y coordinate relative to the upper left corner of the current component;
365  * returns <b>0.0f</b> if any parameter error occurs.
366  * @since 12
367  */
368 float OH_ArkUI_PointerEvent_GetYByIndex(const ArkUI_UIInputEvent* event, uint32_t pointerIndex);
369 
370 /**
371  * @brief Obtains the X coordinate relative to the upper left corner of the current application window from a
372  * directional input event (such as a touch event, mouse event, or axis event).
373  *
374  * @param event Indicates the pointer to the UI input event.
375  * @return Returns the X coordinate relative to the upper left corner of the current application window;
376  * returns <b>0</b> if any parameter error occurs.
377  * @since 12
378  */
379 float OH_ArkUI_PointerEvent_GetWindowX(const ArkUI_UIInputEvent* event);
380 
381 /**
382  * @brief Obtains the X coordinate of a specific touch point relative to the upper left corner of the current
383  * application window from a directional input event (such as a touch event, mouse event, or axis event).
384  *
385  * @param event Indicates the pointer to the current UI input event.
386  * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list.
387  * @return Returns the X coordinate relative to the upper left corner of the current application window;
388  * returns <b>0.0f</b> if any parameter error occurs.
389  * @since 12
390  */
391 float OH_ArkUI_PointerEvent_GetWindowXByIndex(const ArkUI_UIInputEvent* event, uint32_t pointerIndex);
392 
393 /**
394  * @brief Obtains the Y coordinate relative to the upper left corner of the current application window from a
395  * directional input event (such as a touch event, mouse event, or axis event).
396  *
397  * @param event Indicates the pointer to the UI input event.
398  * @return Returns the Y coordinate relative to the upper left corner of the current application window;
399  * returns <b>0</b> if any parameter error occurs.
400  * @since 12
401  */
402 float OH_ArkUI_PointerEvent_GetWindowY(const ArkUI_UIInputEvent* event);
403 
404 /**
405  * @brief Obtains the Y coordinate of a specific touch point relative to the upper left corner of the current
406  * application window from a directional input event (such as a touch event, mouse event, or axis event).
407  *
408  * @param event Indicates the pointer to the current UI input event.
409  * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list.
410  * @return Returns the Y coordinate relative to the upper left corner of the current application window;
411  * returns <b>0.0f</b> if any parameter error occurs.
412  * @since 12
413  */
414 float OH_ArkUI_PointerEvent_GetWindowYByIndex(const ArkUI_UIInputEvent* event, uint32_t pointerIndex);
415 
416 /**
417  * @brief Obtains the X coordinate relative to the upper left corner of the current screen from a directional input
418  * event (such as a touch event, mouse event, or axis event).
419  *
420  * @param event Indicates the pointer to the UI input event.
421  * @return Returns the X coordinate relative to the upper left corner of the current screen;
422  * returns <b>0</b> if any parameter error occurs.
423  * @since 12
424  */
425 float OH_ArkUI_PointerEvent_GetDisplayX(const ArkUI_UIInputEvent* event);
426 
427 /**
428  * @brief Obtains the X coordinate of a specific touch point relative to the upper left corner of the current screen
429  * from a directional input event (such as a touch event, mouse event, or axis event).
430  *
431  * @param event Indicates the pointer to the current UI input event.
432  * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list.
433  * @return Returns the X coordinate relative to the upper left corner of the current screen;
434  * returns <b>0.0f</b> if any parameter error occurs.
435  * @since 12
436  */
437 float OH_ArkUI_PointerEvent_GetDisplayXByIndex(const ArkUI_UIInputEvent* event, uint32_t pointerIndex);
438 
439 /**
440  * @brief Obtains the Y coordinate relative to the upper left corner of the current screen from a directional input
441  * event (such as a touch event, mouse event, or axis event).
442  *
443  * @param event Indicates the pointer to the UI input event.
444  * @return Returns the Y coordinate relative to the upper left corner of the current screen;
445  * returns <b>0</b> if any parameter error occurs.
446  * @since 12
447  */
448 float OH_ArkUI_PointerEvent_GetDisplayY(const ArkUI_UIInputEvent* event);
449 
450 /**
451  * @brief Obtains the Y coordinate of a specific touch point relative to the upper left corner of the current screen
452  * from a directional input event (such as a touch event, mouse event, or axis event).
453  *
454  * @param event Indicates the pointer to the current UI input event.
455  * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list.
456  * @return Returns the Y coordinate relative to the upper left corner of the current screen;
457  * returns <b>0.0f</b> if any parameter error occurs.
458  * @since 12
459  */
460 float OH_ArkUI_PointerEvent_GetDisplayYByIndex(const ArkUI_UIInputEvent* event, uint32_t pointerIndex);
461 
462 /**
463  * @brief Obtains the pressure applied to the touchscreen from a directional input event (for example, a touch event).
464  *
465  * @param event Indicates the pointer to the current UI input event.
466  * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list.
467  * @return Returns the pressure applied to the touchscreen; returns <b>0.0f</b> if any parameter error occurs.
468  * @since 12
469  */
470 float OH_ArkUI_PointerEvent_GetPressure(const ArkUI_UIInputEvent* event, uint32_t pointerIndex);
471 
472 /**
473  * @brief Obtains the angle relative to the YZ plane from a directional input event (for example, a touch event).
474  * The value range is [-90, 90]. A positive value indicates a rightward tilt.
475  *
476  * @param event Indicates the pointer to the current UI input event.
477  * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list.
478  * @return Returns the angle relative to the YZ plane.
479  * @since 12
480  */
481 float OH_ArkUI_PointerEvent_GetTiltX(const ArkUI_UIInputEvent* event, uint32_t pointerIndex);
482 
483 /**
484  * @brief Obtains the angle relative to the XZ plane from a directional input event (for example, a touch event).
485  * The value range is [-90, 90]. A positive value indicates a downward tilt.
486  *
487  * @param event Indicates the pointer to the current UI input event.
488  * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list.
489  * @return Returns the angle relative to the XZ plane.
490  * @since 12
491  */
492 float OH_ArkUI_PointerEvent_GetTiltY(const ArkUI_UIInputEvent* event, uint32_t pointerIndex);
493 
494 /**
495  * @brief Obtains the interaction hand of a touch point.
496  *
497  * @param event Indicates the pointer to the current UI input event.
498  * @param hand Indicates the interaction hand of a touch point.
499  * @return Returns the result code.
500  *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
501  *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs.
502  * @since 15
503  */
504 int32_t OH_ArkUI_PointerEvent_GetInteractionHand(const ArkUI_UIInputEvent *event, ArkUI_InteractionHand *hand);
505 
506 /**
507  * @brief Obtains the interaction hand of a touch point.
508  *
509  * @param event Indicates the pointer to the current UI input event.
510  * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list.
511  * @param hand Indicates the interaction hand of a touch point.
512  * @return Returns the result code.
513  *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
514  *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs.
515  * @since 15
516  */
517 int32_t OH_ArkUI_PointerEvent_GetInteractionHandByIndex(
518     const ArkUI_UIInputEvent *event, int32_t pointerIndex, ArkUI_InteractionHand *hand);
519 
520 /**
521  * @brief Obtains the width of the touch area from a directional input event (for example, a touch event).
522  *
523  * @param event Indicates the pointer to the current UI input event.
524  * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list.
525  * @return Returns the width of the touch area.
526  * @since 12
527  */
528 float OH_ArkUI_PointerEvent_GetTouchAreaWidth(const ArkUI_UIInputEvent* event, uint32_t pointerIndex);
529 
530 /**
531  * @brief Obtains the height of the touch area from a directional input event (for example, a touch event).
532  *
533  * @param event Indicates the pointer to the current UI input event.
534  * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list.
535  * @return Returns the height of the touch area.
536  * @since 12
537  */
538 float OH_ArkUI_PointerEvent_GetTouchAreaHeight(const ArkUI_UIInputEvent* event, uint32_t pointerIndex);
539 
540 /**
541  * @brief Obtains the ID of a touch point which info has been changed.
542  *
543  * @param event Indicates the changed pointer to the current UI input event.
544  * @param pointerIndex Indicates the index of the changed touch point in the multi-touch data list.
545  * @return Returns the result code.
546  *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
547  *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
548  * @since 15
549  */
550 int32_t OH_ArkUI_PointerEvent_GetChangedPointerId(const ArkUI_UIInputEvent* event, uint32_t* pointerIndex);
551 
552 /**
553  * @brief Obtains the number of historical events from a directional input event (such as a touch event, mouse event,
554  * or axis event).
555  *
556  * @param event Indicates the pointer to the current UI input event.
557  * @return Returns the number of historical events.
558  * @since 12
559  */
560 uint32_t OH_ArkUI_PointerEvent_GetHistorySize(const ArkUI_UIInputEvent* event);
561 
562 /**
563  * @brief Obtains the occurrence time of a historical event from a directional input event (such as a touch event,
564  * mouse event, or axis event).
565  *
566  * @param event Indicates the pointer to the current UI input event.
567  * @param historyIndex Indicates the index of the target historical event.
568  * @return Returns the time when the UI input event occurs; returns <b>0</b> if any parameter error occurs.
569  * @since 12
570  */
571 int64_t OH_ArkUI_PointerEvent_GetHistoryEventTime(const ArkUI_UIInputEvent* event, uint32_t historyIndex);
572 
573 /**
574  * @brief Obtains the number of touch points in a specific historical event from a directional input event (such as
575  * a touch event, mouse event, or axis event).
576  *
577  * @param event Indicates the pointer to the current UI input event.
578  * @param historyIndex Indicates the index of the target historical event.
579  * @return Returns the number of touch points in the specified historical event
580  * @since 12
581  */
582 uint32_t OH_ArkUI_PointerEvent_GetHistoryPointerCount(const ArkUI_UIInputEvent* event, uint32_t historyIndex);
583 
584 /**
585  * @brief Obtains the ID of a touch point in a specific historical event from a directional input event (such as
586  * a touch event, mouse event, or axis event).
587  *
588  * @param event Indicates the pointer to the current UI input event.
589  * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list.
590  * @param historyIndex Indicates the index of the target historical event.
591  * @return Returns the ID of the corresponding touch point in the specified historical event.
592  * @since 12
593  */
594 int32_t OH_ArkUI_PointerEvent_GetHistoryPointerId(
595     const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex);
596 
597 /**
598  * @brief Obtains the X coordinate of a specific touch point in a historical event relative to the upper left corner
599  * of the current component from a directional input event (such as a touch event, mouse event, or axis event).
600  *
601  * @param event Indicates the pointer to the current UI input event.
602  * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list.
603  * @param historyIndex Indicates the index of the target historical event.
604  * @return Returns the X coordinate relative to the upper left corner of the current component;
605  * returns <b>0.0f</b> if any parameter error occurs.
606  * @since 12
607  */
608 float OH_ArkUI_PointerEvent_GetHistoryX(const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex);
609 
610 /**
611  * @brief Obtains the Y coordinate of a specific touch point in a historical event relative to the upper left corner
612  * of the current component from a directional input event (such as a touch event, mouse event, or axis event).
613  *
614  * @param event Indicates the pointer to the current UI input event.
615  * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list.
616  * @param historyIndex Indicates the index of the target historical event.
617  * @return Returns the Y coordinate relative to the upper left corner of the current component;
618  * returns <b>0.0f</b> if any parameter error occurs.
619  * @since 12
620  */
621 float OH_ArkUI_PointerEvent_GetHistoryY(const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex);
622 
623 /**
624  * @brief Obtains the X coordinate of a specific touch point in a historical event relative to the upper left corner
625  * of the current application window from a directional input event (such as a touch event, mouse event, or axis event).
626  *
627  * @param event Indicates the pointer to the current UI input event.
628  * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list.
629  * @param historyIndex Indicates the index of the target historical event.
630  * @return Returns the X coordinate relative to the upper left corner of the current application window;
631  * returns <b>0.0f</b> if any parameter error occurs.
632  * @since 12
633  */
634 float OH_ArkUI_PointerEvent_GetHistoryWindowX(
635     const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex);
636 
637 /**
638  * @brief Obtains the Y coordinate of a specific touch point in a historical event relative to the upper left corner
639  * of the current application window from a directional input event (such as a touch event, mouse event, or axis event).
640  *
641  * @param event Indicates the pointer to the current UI input event.
642  * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list.
643  * @param historyIndex Indicates the index of the target historical event.
644  * @return Returns the Y coordinate relative to the upper left corner of the current application window;
645  * returns <b>0.0f</b> if any parameter error occurs.
646  * @since 12
647  */
648 float OH_ArkUI_PointerEvent_GetHistoryWindowY(
649     const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex);
650 
651 /**
652  * @brief Obtains the X coordinate of a specific touch point in a historical event relative to the upper left corner
653  * of the current screen from a directional input event (such as a touch event, mouse event, or axis event).
654  *
655  * @param event Indicates the pointer to the current UI input event.
656  * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list.
657  * @param historyIndex Indicates the index of the target historical event.
658  * @return Returns the X coordinate relative to the upper left corner of the current screen;
659  * returns <b>0.0f</b> if any parameter error occurs.
660  * @since 12
661  */
662 float OH_ArkUI_PointerEvent_GetHistoryDisplayX(
663     const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex);
664 
665 /**
666  * @brief Obtains the Y coordinate of a specific touch point in a historical event relative to the upper left corner
667  * of the current screen from a directional input event (such as a touch event, mouse event, or axis event).
668  *
669  * @param event Indicates the pointer to the current UI input event.
670  * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list.
671  * @param historyIndex Indicates the index of the target historical event.
672  * @return Returns the Y coordinate relative to the upper left corner of the current screen;
673  * returns <b>0.0f</b> if any parameter error occurs.
674  * @since 12
675  */
676 float OH_ArkUI_PointerEvent_GetHistoryDisplayY(
677     const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex);
678 
679 /**
680  * @brief Obtains the pressure applied to the touchscreen in a specific historical event from a directional input event
681  * (for example, a touch event)..
682  *
683  * @param event Indicates the pointer to the current UI input event.
684  * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list.
685  * @param historyIndex Indicates the index of the target historical event.
686  * @return Returns the pressure applied to the touchscreen; returns <b>0.0f</b> if any parameter error occurs.
687  * @since 12
688  */
689 float OH_ArkUI_PointerEvent_GetHistoryPressure(
690     const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex);
691 
692 /**
693  * @brief Obtains the angle relative to the YZ plane in a specific historical event from a directional input event
694  * (for example, a touch event). The value range is [-90, 90]. A positive value indicates a rightward tilt.
695  *
696  * @param event Indicates the pointer to the current UI input event.
697  * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list.
698  * @param historyIndex Indicates the index of the target historical event.
699  * @return Returns the angle relative to the YZ plane.
700  * @since 12
701  */
702 float OH_ArkUI_PointerEvent_GetHistoryTiltX(
703     const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex);
704 
705 /**
706  * @brief Obtains the angle relative to the XZ plane in a specific historical event from a directional input event
707  * (for example, a touch event). The value range is [-90, 90]. A positive value indicates a downward tilt.
708  *
709  * @param event Indicates the pointer to the current UI input event.
710  * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list.
711  * @param historyIndex Indicates the index of the target historical event.
712  * @return Returns the angle relative to the XZ plane.
713  * @since 12
714  */
715 float OH_ArkUI_PointerEvent_GetHistoryTiltY(
716     const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex);
717 
718 /**
719  * @brief Obtains the width of the touch area in a specific historical event from a directional input event
720  * (for example, a touch event).
721  *
722  * @param event Indicates the pointer to the current UI input event.
723  * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list.
724  * @param historyIndex Indicates the index of the target historical event.
725  * @return Returns the width of the touch area.
726  * @since 12
727  */
728 float OH_ArkUI_PointerEvent_GetHistoryTouchAreaWidth(
729     const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex);
730 
731 /**
732  * @brief Obtains the height of the touch area in a specific historical event from a directional input event
733  * (for example, a touch event).
734  *
735  * @param event Indicates the pointer to the current UI input event.
736  * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list.
737  * @param historyIndex Indicates the index of the target historical event.
738  * @return Returns the height of the touch area.
739  * @since 12
740  */
741 float OH_ArkUI_PointerEvent_GetHistoryTouchAreaHeight(
742     const ArkUI_UIInputEvent* event, uint32_t pointerIndex, uint32_t historyIndex);
743 
744 /**
745  * @brief Obtains the value of the vertical scroll axis for this axis event.
746  *
747  * @param event Indicates the pointer to the UI input event.
748  * @return Returns the value of the vertical scroll axis of the current axis event;
749  * returns <b>0</b> if any parameter error occurs.
750  * @since 12
751  */
752 double OH_ArkUI_AxisEvent_GetVerticalAxisValue(const ArkUI_UIInputEvent* event);
753 
754 /**
755  * @brief Obtains the value of the horizontal scroll axis for this axis event.
756  *
757  * @param event Indicates the pointer to the UI input event.
758  * @return Returns the value of the horizontal scroll axis of the current axis event;
759  * returns <b>0</b> if any parameter error occurs.
760  * @since 12
761  */
762 double OH_ArkUI_AxisEvent_GetHorizontalAxisValue(const ArkUI_UIInputEvent* event);
763 
764 /**
765  * @brief Obtains the scale value of the pinch axis for this axis event.
766  *
767  * @param event Indicates the pointer to the UI input event.
768  * @return Returns the scale value of the pinch axis of the current axis event;
769  * returns <b>0</b> if any parameter error occurs.
770  * @since 12
771  */
772 double OH_ArkUI_AxisEvent_GetPinchAxisScaleValue(const ArkUI_UIInputEvent* event);
773 
774 /**
775  * @brief Obtains the action type of the current axis event.
776  *
777  * @param event Indicates the pointer to the current UI input event.
778  * @return Returns the action type of the current axis event.
779  * @since 15
780  */
781 int32_t OH_ArkUI_AxisEvent_GetAxisAction(const ArkUI_UIInputEvent* event);
782 
783 /**
784  * @brief Sets how the component behaves during hit testing.
785  *
786  * @param event Indicates the pointer to the current UI input event.
787  * @param mode Indicates how the component behaves during hit testing. The parameter type is {@link HitTestMode}.
788  * @return Returns the status code of the execution.
789  * @since 12
790  */
791 int32_t OH_ArkUI_PointerEvent_SetInterceptHitTestMode(const ArkUI_UIInputEvent* event, HitTestMode mode);
792 
793 /**
794  * @brief 获取鼠标事件的按键类型的值。
795  *
796  * @param event 表示指向当前UI输入事件的指针。
797  * @return 返回鼠标按键类型,1为左键,2为右键,3为中键,4为后退键,5为前进键。
798  * @since 12
799  */
800 int32_t OH_ArkUI_MouseEvent_GetMouseButton(const ArkUI_UIInputEvent* event);
801 
802 /**
803  * @brief 获取鼠标事件的鼠标动作类型的值。
804  *
805  * @param event 表示指向当前UI输入事件的指针。
806  * @return 返回鼠标动作类型,1表示按键按下,2表示按键松开,3表示鼠标移动。
807  * @since 12
808  */
809 int32_t OH_ArkUI_MouseEvent_GetMouseAction(const ArkUI_UIInputEvent* event);
810 
811 /**
812  * @brief Sets whether to prevent event bubbling.
813  *
814  * @param event Indicates the pointer to the current UI input event.
815  * @param stopPropagation Indicates whether the event is prevented from bubbling.
816  * @return Returns the status code of the execution. If 0 is returned, the setting is successful.
817  *         If 401 is returned, the execution fails.
818  *         The possible cause of the failure is that the event parameter is abnormal, such as a null pointer.
819  * @since 12
820  */
821 int32_t OH_ArkUI_PointerEvent_SetStopPropagation(const ArkUI_UIInputEvent* event, bool stopPropagation);
822 
823 /**
824  * @brief Obtains the ID of device that triggers a key event.
825  *
826  * @param event Pointer to an <b>ArkUI_UIInputEvent</b> object.
827  * @return Returns the device ID.
828  * @since 14
829  */
830 int32_t OH_ArkUI_UIInputEvent_GetDeviceId(const ArkUI_UIInputEvent* event);
831 
832 /**
833  * @brief Obtains the pressed status of modifier keys from a key event.
834  * The following modifier keys are supported: Ctrl, Alt, Shift, Fn. However, the <b>Fn</b> key on external keyboards
835  * is not supported.
836  *
837  * @param event Pointer to an <b>ArkUI_UIInputEvent</b> object.
838  * @param pressedKeyCodes Array of all keys that are pressed. You need to allocate the memory space.
839  * @param length Length of the passed pressedKeyCodes array (when used as an input parameter);
840  *               number of the keys pressed (when used as an output parameter).
841  * @return return Returns the result code.
842  *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
843  *         Returns {@link ARKUI_ERROR_CODE_BUFFER_SIZE_ERROR} if the giving buffer is not enough.
844  *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
845  * @since 14
846  */
847 int32_t OH_ArkUI_UIInputEvent_GetPressedKeys(
848     const ArkUI_UIInputEvent* event, int32_t* pressedKeyCodes, int32_t* length);
849 
850 /**
851  * @brief Obtains the axis value of a focus axis event.
852  *
853  * @param event Pointer to an <b>ArkUI_UIInputEvent</b> object.
854  * @param axis Axis type of the focus axis event.
855  * @return Returns the axis value of the focus axis event; returns <b>0.0</b> if any parameter error occurs.
856  * @since 15
857  */
858 double OH_ArkUI_FocusAxisEvent_GetAxisValue(const ArkUI_UIInputEvent* event, int32_t axis);
859 
860 /**
861  * @brief Sets whether to prevent a focus axis event from bubbling up.
862  *
863  * @param event Indicates the pointer to the current UI input event.
864  * @param stopPropagation Indicates whether to stop event propagation.
865  * @return Returns the result code.
866  *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
867  *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
868  * @since 15
869  */
870 
871 int32_t OH_ArkUI_FocusAxisEvent_SetStopPropagation(const ArkUI_UIInputEvent* event, bool stopPropagation);
872 
873 /**
874  * @brief Obtains the pressed time of a specific touch point.
875  *
876  * @param event Indicates the pointer to the current UI input event.
877  * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list.
878  * @return Returns the pressed time of a specific touch point; returns <b>0</b> if any parameter error occurs.
879  * @since 16
880  */
881 int64_t OH_ArkUI_PointerEvent_GetPressedTimeByIndex(const ArkUI_UIInputEvent* event, uint32_t pointerIndex);
882 
883 /**
884  * @brief Obtains the X axis offset relative to the previous reported mouse pointer position. When the mouse pointer is
885  * at the edge of the screen, the value may be less than the difference of the X coordinate reported twice.
886  *
887  * @param event Indicates the pointer to the current UI input event.
888  * @return Returns the X axis offset relative to the previous reported mouse pointer position;
889  * returns <b>0.0f</b> if any parameter error occurs.
890  * @since 16
891  */
892 float OH_ArkUI_MouseEvent_GetRawDeltaX(const ArkUI_UIInputEvent* event);
893 
894 /**
895  * @brief Obtains the Y axis offset relative to the previous reported mouse pointer position. When the mouse pointer is
896  * at the edge of the screen, the value may be less than the difference of the Y coordinate reported twice.
897  *
898  * @param event Indicates the pointer to the current UI input event.
899  * @return Returns the Y axis offset relative to the previous reported mouse pointer position;
900  * returns <b>0.0f</b> if any parameter error occurs.
901  * @since 16
902  */
903 float OH_ArkUI_MouseEvent_GetRawDeltaY(const ArkUI_UIInputEvent* event);
904 
905 /**
906  * @brief Obtains the pressed buttons from the mouse event.
907  *
908  * @param event Pointer to an <b>ArkUI_UIInputEvent</b> object.
909  * @param pressedButtons Indicates the list of the pressed buttons.You need to create a int array first.
910  * @param length Length of the passed pressedButtons array (when used as an input parameter);
911  *               number of the buttons pressed (when used as an output parameter).
912  * @return Returns the result code.
913  *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
914  *         Returns {@link ARKUI_ERROR_CODE_BUFFER_SIZE_ERROR} if the giving buffer is not enough.
915  * @since 16
916  */
917 int32_t OH_ArkUI_MouseEvent_GetPressedButtons(
918     const ArkUI_UIInputEvent* event, int32_t* pressedButtons, int32_t* length);
919 
920 /**
921  * @brief Obtains the screen ID on which the UI input event occurred.
922  *
923  * @param event Pointer to an <b>ArkUI_UIInputEvent</b> object.
924  * @return Returns the screen ID; returns <b>0</b> if any parameter error occurs.
925  * @since 16
926  */
927 int32_t OH_ArkUI_UIInputEvent_GetTargetDisplayId(const ArkUI_UIInputEvent* event);
928 
929 /**
930  * @brief Create cloned pointer event from the original pointer event.
931  *
932  * @param event Pointer to an <b>ArkUI_UIInputEvent</b> object.
933  * @param clonedEvent Pointer to an <b>ArkUI_UIInputEvent</b> pointer.
934  * @return Returns the result code.
935  *          Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
936  *          Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
937  * @since 15
938  */
939 
940 int32_t OH_ArkUI_PointerEvent_CreateClonedEvent(const ArkUI_UIInputEvent* event, ArkUI_UIInputEvent** clonedEvent);
941 
942 /**
943  * @brief Destroy the cloned pointer event.
944  *
945  * @param event Pointer to an <b>ArkUI_UIInputEvent</b> object.
946  * @return Returns the result code.
947  *          Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
948  *          Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
949  *          Returns {@link ARKUI_ERROR_CODE_NON_CLONED_POINTER_EVENT} if the event is not a
950  *          cloned pointer event.
951  * @since 15
952  */
953 int32_t OH_ArkUI_PointerEvent_DestroyClonedEvent(const ArkUI_UIInputEvent* event);
954 
955 /**
956  * @brief Set the position relative to the upper left corner of the current component from a cloned directional
957  * input event.
958  *
959  * @param event Pointer to an <b>ArkUI_UIInputEvent</b> object.
960  * @param x The X coordinate relative to the upper left corner of the current component, in px.
961  * @param y The Y coordinate relative to the upper left corner of the current component, in px.
962  * @return Returns the result code.
963  *          Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
964  *          Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
965  *          Returns {@link ARKUI_ERROR_CODE_NON_CLONED_POINTER_EVENT} if the event is not a
966  *          cloned pointer event.
967  * @since 15
968  */
969 int32_t OH_ArkUI_PointerEvent_SetClonedEventLocalPosition(const ArkUI_UIInputEvent* event, float x, float y);
970 
971 /**
972  * @brief Set the position of a specific touch point relative to the upper left corner of the current component
973  * from a cloned directional input event.
974  *
975  * @param event Pointer to an <b>ArkUI_UIInputEvent</b> object.
976  * @param x The X coordinate relative to the upper left corner of the current component, in px.
977  * @param y The Y coordinate relative to the upper left corner of the current component, in px.
978  * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list.
979  * @return Returns the result code.
980  *          Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
981  *          Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
982  *          Returns {@link ARKUI_ERROR_CODE_NON_CLONED_POINTER_EVENT} if the event is not a
983  *          cloned pointer event.
984  * @since 15
985  */
986 int32_t OH_ArkUI_PointerEvent_SetClonedEventLocalPositionByIndex(
987     const ArkUI_UIInputEvent* event, float x, float y, int32_t pointerIndex);
988 
989 /**
990  * @brief Set the action type of the cloned pointer event.
991  *
992  * @param event Pointer to an <b>ArkUI_UIInputEvent</b> object.
993  * @param actionType The action type of pointer event.
994  * @return Returns the result code.
995  *          Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
996  *          Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
997  *          Returns {@link ARKUI_ERROR_CODE_NON_CLONED_POINTER_EVENT} if the event is not a
998  *          cloned pointer event.
999  * @since 15
1000  */
1001 int32_t OH_ArkUI_PointerEvent_SetClonedEventActionType(const ArkUI_UIInputEvent* event, int32_t actionType);
1002 
1003 /**
1004  * @brief Set the ID of the touch point that triggers the current cloned pointer event.
1005  *
1006  * @param event Pointer to an <b>ArkUI_UIInputEvent</b> object.
1007  * @param fingerId The ID of the touch point that triggers the current pointer event.
1008  * @return Returns the result code.
1009  *          Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
1010  *          Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
1011  *          Returns {@link ARKUI_ERROR_CODE_NON_CLONED_POINTER_EVENT} if the event is not a
1012  *          cloned pointer event.
1013  * @since 15
1014  */
1015 int32_t OH_ArkUI_PointerEvent_SetClonedEventChangedFingerId(const ArkUI_UIInputEvent* event, int32_t fingerId);
1016 
1017 /**
1018  * @brief Set the ID of a touch point from a cloned directional input event.
1019  *
1020  * @param event Pointer to an <b>ArkUI_UIInputEvent</b> object.
1021  * @param fingerId The ID of the touch point.
1022  * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list.
1023  * @return Returns the result code.
1024  *          Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
1025  *          Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
1026  *          Returns {@link ARKUI_ERROR_CODE_NON_CLONED_POINTER_EVENT} if the event is not a
1027  *          cloned pointer event.
1028  * @since 15
1029  */
1030 int32_t OH_ArkUI_PointerEvent_SetClonedEventFingerIdByIndex(
1031     const ArkUI_UIInputEvent* event, int32_t fingerId, int32_t pointerIndex);
1032 
1033 /**
1034  * @brief Post a cloned event to a specific node.
1035  *
1036  * @param node Target node.
1037  * @param event Pointer to an <b>ArkUI_UIInputEvent</b> object.
1038  * @return Returns the result code.
1039  *          Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
1040  *          Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
1041  *          Returns {@link ARKUI_ERROR_CODE_NON_CLONED_POINTER_EVENT} if the event is not a
1042  *          cloned pointer event.
1043  *          Returns {@link ARKUI_ERROR_CODE_POST_CLONED_COMPONENT_STATUS_ABNORMAL }
1044  *          if the component status abnormal.
1045  *          Returns {@link ARKUI_ERROR_CODE_POST_CLONED_NO_COMPONENT_HIT_TO_RESPOND_TO_THE_EVENT }
1046  *          if no component hit to respond to the event.
1047  * @since 16
1048  */
1049 int32_t OH_ArkUI_PointerEvent_PostClonedEvent(ArkUI_NodeHandle node, const ArkUI_UIInputEvent* event);
1050 #ifdef __cplusplus
1051 };
1052 #endif
1053 
1054 #endif // _ARKUI_UI_INPUT_EVENT_H_
1055 /** @} */
1056