• 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_NativeModule
18  * @{
19  *
20  * @brief Defines APIs for ArkUI to register gesture callbacks on the native side.
21  *
22  * @since 12
23  */
24 
25 /**
26  * @file native_gesture.h
27  *
28  * @brief Provides type definitions for <b>NativeGesture</b> APIs.
29  *
30  * @library libace_ndk.z.so
31  * @syscap SystemCapability.ArkUI.ArkUI.Full
32  * @kit ArkUI
33  * @since 12
34  */
35 
36 #ifndef ARKUI_NATIVE_GESTTURE_H
37 #define ARKUI_NATIVE_GESTTURE_H
38 
39 #include "ui_input_event.h"
40 #include "native_type.h"
41 #include <stdbool.h>
42 
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46 
47 /**
48  * @brief Defines a gesture recognizer.
49  *
50  * @since 12
51  */
52 typedef struct ArkUI_GestureRecognizer ArkUI_GestureRecognizer;
53 
54 /**
55  * @brief Defines the gesture interruption information.
56  *
57  * @since 12
58  */
59 typedef struct ArkUI_GestureInterruptInfo ArkUI_GestureInterruptInfo;
60 
61 /**
62  * @brief Defines the gesture event.
63  *
64  * @since 12
65  */
66 typedef struct ArkUI_GestureEvent ArkUI_GestureEvent;
67 
68 /**
69  * @brief Enumerates gesture event types.
70  *
71  * @since 12
72  */
73 typedef enum {
74     /** Triggered. */
75     GESTURE_EVENT_ACTION_ACCEPT = 0x01,
76 
77     /** Updated. */
78     GESTURE_EVENT_ACTION_UPDATE = 0x02,
79 
80     /** Ended. */
81     GESTURE_EVENT_ACTION_END = 0x04,
82 
83     /** Canceled. */
84     GESTURE_EVENT_ACTION_CANCEL = 0x08,
85 } ArkUI_GestureEventActionType;
86 
87 /**
88  * @brief Defines a set of gesture event types.
89  *
90  * Example: ArkUI_GestureEventActionTypeMask actions = GESTURE_EVENT_ACTION_ACCEPT | GESTURE_EVENT_ACTION_UPDATE;\n
91  *
92  * @since 12
93  */
94 typedef uint32_t ArkUI_GestureEventActionTypeMask;
95 
96 /**
97  * @brief Enumerates gesture event modes.
98  *
99  * @since 12
100  */
101 typedef enum {
102     /** Normal. */
103     NORMAL = 0,
104 
105     /** High-priority. */
106     PRIORITY = 1,
107 
108     /** Parallel. */
109     PARALLEL = 2,
110 } ArkUI_GesturePriority;
111 
112 /**
113  * @brief Enumerates gesture group modes.
114  *
115  * @since 12
116  */
117 typedef enum {
118     /** Sequential recognition. Gestures are recognized in the registration sequence until all gestures are recognized
119      * successfully. Once one gesture fails to be recognized, all subsequent gestures fail to be recognized.
120      * Only the last gesture in the gesture group can respond to the end event. */
121     SEQUENTIAL_GROUP = 0,
122 
123     /** Parallel recognition. Registered gestures are recognized concurrently until all gestures are recognized.
124       * The recognition result of each gesture does not affect each other. */
125     PARALLEL_GROUP = 1,
126 
127     /** Exclusive recognition. Registered gestures are identified concurrently.
128       * If one gesture is successfully recognized, gesture recognition ends. */
129     EXCLUSIVE_GROUP = 2,
130 } ArkUI_GroupGestureMode;
131 
132 /**
133  * @brief Enumerates gesture directions.
134  *
135  * @since 12
136  */
137 typedef enum {
138     /** All directions. */
139     GESTURE_DIRECTION_ALL = 0b1111,
140 
141     /** Horizontal direction. */
142     GESTURE_DIRECTION_HORIZONTAL = 0b0011,
143 
144     /** Vertical direction. */
145     GESTURE_DIRECTION_VERTICAL = 0b1100,
146 
147     /** Leftward. */
148     GESTURE_DIRECTION_LEFT = 0b0001,
149 
150     /** Rightward. */
151     GESTURE_DIRECTION_RIGHT = 0b0010,
152 
153     /** Upward. */
154     GESTURE_DIRECTION_UP = 0b0100,
155 
156     /** Downward. */
157     GESTURE_DIRECTION_DOWN = 0b1000,
158 
159     /** None. */
160     GESTURE_DIRECTION_NONE = 0,
161 } ArkUI_GestureDirection;
162 
163 /**
164  * @brief Defines a set of gesture directions.
165  *
166  * Example: ArkUI_GestureDirectionMask directions = GESTURE_DIRECTION_LEFT | GESTURE_DIRECTION_RIGHT \n
167  * This example indicates that the leftward and rightward directions are supported. \n
168  *
169  * @since 12
170  */
171 typedef uint32_t ArkUI_GestureDirectionMask;
172 
173 /**
174  * @brief Enumerates gesture masking modes.
175  *
176  * @since 12
177  */
178 typedef enum {
179     /** The gestures of child components are enabled and recognized based on the default gesture recognition sequence.*/
180     NORMAL_GESTURE_MASK = 0,
181 
182     /** The gestures of child components are disabled, including the built-in gestures. */
183     IGNORE_INTERNAL_GESTURE_MASK,
184 } ArkUI_GestureMask;
185 
186 /**
187  * @brief Enumerates gesture types.
188  *
189  * @since 12
190  */
191 typedef enum {
192     /** Tap. */
193     TAP_GESTURE = 0,
194 
195     /** Long press. */
196     LONG_PRESS_GESTURE,
197 
198     /** Pan. */
199     PAN_GESTURE,
200 
201     /** Pinch. */
202     PINCH_GESTURE,
203 
204     /** Rotate. */
205     ROTATION_GESTURE,
206 
207     /** Swipe. */
208     SWIPE_GESTURE,
209 
210     /** A group of gestures. */
211     GROUP_GESTURE,
212 
213     /**
214      * The click gesture registed through onClick.
215      *
216      * @since 20
217      */
218     CLICK_GESTURE,
219 
220     /**
221      * Drag gesture used for drag and drop.
222      *
223      * @since 20
224      */
225     DRAG_DROP,
226 } ArkUI_GestureRecognizerType;
227 
228 /**
229  * @brief Enumerates gesture interruption results.
230  *
231  * @since 12
232  */
233 typedef enum {
234     /** The gesture recognition process continues. */
235     GESTURE_INTERRUPT_RESULT_CONTINUE = 0,
236 
237     /** The gesture recognition process is paused. */
238     GESTURE_INTERRUPT_RESULT_REJECT,
239 } ArkUI_GestureInterruptResult;
240 
241 /**
242  * @brief Enumerates the gesture recognizer states.
243  *
244  * @since 12
245  */
246 typedef enum {
247     /** Ready. */
248     ARKUI_GESTURE_RECOGNIZER_STATE_READY = 0,
249 
250     /** Detecting. */
251     ARKUI_GESTURE_RECOGNIZER_STATE_DETECTING = 1,
252 
253     /** Pending. */
254     ARKUI_GESTURE_RECOGNIZER_STATE_PENDING = 2,
255 
256     /** Blocked. */
257     ARKUI_GESTURE_RECOGNIZER_STATE_BLOCKED = 3,
258 
259     /** Successful. */
260     ARKUI_GESTURE_RECOGNIZER_STATE_SUCCESSFUL = 4,
261 
262     /** Failed. */
263     ARKUI_GESTURE_RECOGNIZER_STATE_FAILED = 5,
264 } ArkUI_GestureRecognizerState;
265 
266 /**
267  * @brief Defines the gesture recognizer handle.
268  *
269  * @since 12
270  */
271 typedef ArkUI_GestureRecognizer* ArkUI_GestureRecognizerHandle;
272 
273 /**
274  * @brief Defines the gesture recognizer handle array.
275  *
276  * @since 12
277  */
278 typedef ArkUI_GestureRecognizerHandle* ArkUI_GestureRecognizerHandleArray;
279 
280 /**
281  * @brief Defines a <b>GestureEventTargetInfo</b> object that provides information about a gesture event target.
282  *
283  * @since 12
284  */
285 typedef struct ArkUI_GestureEventTargetInfo ArkUI_GestureEventTargetInfo;
286 
287 /**
288  * @brief Defines a parallel internal gesture event.
289  *
290  * @since 12
291  */
292 typedef struct ArkUI_ParallelInnerGestureEvent ArkUI_ParallelInnerGestureEvent;
293 
294 /**
295  * @brief Defines a touch recognizer.
296  *
297  * @since 15
298  */
299 typedef struct ArkUI_TouchRecognizer ArkUI_TouchRecognizer;
300 
301 /**
302  * @brief Defines a touch recognizer handle.
303  *
304  * @since 15
305  */
306 typedef ArkUI_TouchRecognizer* ArkUI_TouchRecognizerHandle;
307 
308 /**
309  * @brief Defines an array of touch recognizer handle.
310  *
311  * @since 15
312  */
313 typedef ArkUI_TouchRecognizerHandle* ArkUI_TouchRecognizerHandleArray;
314 
315 /**
316  * @brief Defines a callback function for notifying gesture recognizer destruction.
317  *
318  * @param recognizer Indicates the pointer to a gesture recognizer.
319  * @param userData Indicates the custom data.
320  * @since 12
321  */
322 typedef void (*ArkUI_GestureRecognizerDisposeNotifyCallback)(ArkUI_GestureRecognizer* recognizer, void* userData);
323 
324 /**
325 * @brief Checks whether a gesture is a built-in gesture of the component.
326 *
327 * @param event Indicates the pointer to the gesture interruption information.
328 * @return Returns <b>true</b> if the gesture is a built-in gesture; returns <b>false</b> otherwise.
329 
330 * @since 12
331 */
332 bool OH_ArkUI_GestureInterruptInfo_GetSystemFlag(const ArkUI_GestureInterruptInfo* event);
333 
334 /**
335 * @brief Obtains the pointer to interrupted gesture recognizer.
336 *
337 * @param event Indicates the pointer to the gesture interruption information.
338 * @return Returns the pointer to interrupted gesture recognizer.
339 * @since 12
340 */
341 ArkUI_GestureRecognizer* OH_ArkUI_GestureInterruptInfo_GetRecognizer(const ArkUI_GestureInterruptInfo* event);
342 
343 /**
344 * @brief Obtains the pointer to the interrupted gesture event.
345 *
346 * @param event Indicates the pointer to the gesture interruption information.
347 * @return Returns the pointer to the interrupted gesture event.
348 * @since 12
349 */
350 ArkUI_GestureEvent* OH_ArkUI_GestureInterruptInfo_GetGestureEvent(const ArkUI_GestureInterruptInfo* event);
351 
352 /**
353 * @brief Obtains the type of the system gesture to trigger.
354 *
355 * @param event Indicates the pointer to the gesture interruption information.
356 * @return Returns the type of the system gesture to trigger. If the gesture to trigger is not a system gesture,
357 *         <b>-1</b> is returned.
358 * @since 12
359 */
360 int32_t OH_ArkUI_GestureInterruptInfo_GetSystemRecognizerType(const ArkUI_GestureInterruptInfo* event);
361 
362 /**
363 * @brief Get the touch recognizer handles from the gesture interrupt info.
364 *
365 * @param info Indicates the pointer to a gesture interrupt info.
366 * @param recognizers Indicates the pointer to an array of touch recognizer handles.
367 * @param size Indicates the size of recognizers.
368 * @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if success.
369 *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs.
370 * @since 15
371 */
372 int32_t OH_ArkUI_GestureInterruptInfo_GetTouchRecognizers(const ArkUI_GestureInterruptInfo* info,
373     ArkUI_TouchRecognizerHandleArray* recognizers, int32_t* size);
374 
375 /**
376 * @brief Get component object of the specific touch recognizer.
377 *
378 * @param recognizer Indicates the pointer to the TouchRecognizer.
379 * @return Get component object of the specific touch recognizer.
380 * @since 15
381 */
382 ArkUI_NodeHandle OH_ArkUI_TouchRecognizer_GetNodeHandle(const ArkUI_TouchRecognizerHandle recognizer);
383 
384 /**
385 * @brief Send touch-cancel event to the touch recognizer in a gesture interruption callback.
386 *
387 * @param recognizer Indicates the touch recognizer handle.
388 * @param info Indicates the pointer to a gesture interrupt info.
389 * @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if success.
390 *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs.
391 * @since 15
392 */
393 int32_t OH_ArkUI_TouchRecognizer_CancelTouch(ArkUI_TouchRecognizerHandle recognizer, ArkUI_GestureInterruptInfo* info);
394 
395 /**
396 * @brief Obtains the gesture event type.
397 *
398 * @param event Indicates the pointer to the gesture event.
399 * @return Returns the gesture event type.
400 * @since 12
401 */
402 ArkUI_GestureEventActionType OH_ArkUI_GestureEvent_GetActionType(const ArkUI_GestureEvent* event);
403 
404 /**
405 * @brief Obtains gesture input.
406 *
407 * @param event Indicates the pointer to the gesture event.
408 * @return Returns the pointer to the input event of the gesture event.
409 * @since 12
410 */
411 const ArkUI_UIInputEvent* OH_ArkUI_GestureEvent_GetRawInputEvent(const ArkUI_GestureEvent* event);
412 
413 /**
414 * @brief Obtains the number of times that a long press gesture is triggered periodically.
415 *
416 * @param event Indicates the pointer to the gesture event.
417 * @return Returns the number of times that the long press gesture is triggered periodically.
418 * @since 12
419 */
420 int32_t OH_ArkUI_LongPress_GetRepeatCount(const ArkUI_GestureEvent* event);
421 
422 /**
423 * @brief Obtains the velocity of a pan gesture along the main axis.
424 *
425 * @param event Indicates the pointer to the gesture event.
426 * @return Returns the velocity of the pan gesture along the main axis, in px/s.
427 *         The value is the square root of the sum of the squares of the velocity on the x-axis and y-axis.
428 * @since 12
429 */
430 float OH_ArkUI_PanGesture_GetVelocity(const ArkUI_GestureEvent* event);
431 
432 /**
433 * @brief Obtains the velocity of a pan gesture along the x-axis.
434 *
435 * @param event Indicates the pointer to the gesture event.
436 * @return Returns the velocity of the pan gesture along the x-axis, in px/s.
437 * @since 12
438 */
439 float OH_ArkUI_PanGesture_GetVelocityX(const ArkUI_GestureEvent* event);
440 
441 /**
442 * @brief Obtains the velocity of a pan gesture along the y-axis.
443 *
444 * @param event Indicates the pointer to the gesture event.
445 * @return Returns the velocity of the pan gesture along the y-axis, in px/s.
446 * @since 12
447 */
448 float OH_ArkUI_PanGesture_GetVelocityY(const ArkUI_GestureEvent* event);
449 
450 /**
451 * @brief Obtains the relative offset of a pan gesture along the x-axis.
452 *
453 * @param event Indicates the pointer to the gesture event.
454 * @return Returns the relative offset of the gesture along the x-axis, in px.
455 * @since 12
456 */
457 float OH_ArkUI_PanGesture_GetOffsetX(const ArkUI_GestureEvent* event);
458 
459 /**
460 * @brief Obtains the relative offset of a pan gesture along the y-axis.
461 *
462 * @param event Indicates the pointer to the gesture event.
463 * @return Returns the relative offset of the gesture along the y-axis, in px.
464 * @since 12
465 */
466 float OH_ArkUI_PanGesture_GetOffsetY(const ArkUI_GestureEvent* event);
467 
468 /**
469 * @brief Obtains the angle information of the swipe gesture.
470 *
471 * After a swipe gesture is recognized, a line connecting the two fingers is identified as the initial line.
472 * As the fingers swipe, the line between the fingers rotates. \n
473 * Based on the coordinates of the initial line's and current line's end points, the arc tangent function is used to
474 * calculate the respective included angle of the points relative to the horizontal direction \n
475 * by using the following formula: Rotation angle = arctan2(cy2-cy1,cx2-cx1) - arctan2(y2-y1,x2-x1). \n
476 * The initial line is used as the coordinate system. Values from 0 to 180 degrees represent clockwise rotation,
477 * while values from –180 to 0 degrees represent counterclockwise rotation. \n
478 *
479 * @param event Indicates the pointer to the gesture event.
480 * @return Returns the angle of the swipe gesture, which is the result obtained based on the aforementioned formula.
481 * @since 12
482 */
483 float OH_ArkUI_SwipeGesture_GetAngle(const ArkUI_GestureEvent* event);
484 
485 /**
486 * @brief Obtains the average velocity of all fingers used in the swipe gesture.
487 *
488 * @param event Indicates the pointer to the gesture event.
489 * @return Returns the average velocity of all fingers used in the swipe gesture, in px/s.
490 * @since 12
491 */
492 float OH_ArkUI_SwipeGesture_GetVelocity(const ArkUI_GestureEvent* event);
493 
494 /**
495 * @brief Obtains the angle information of a rotation gesture.
496 *
497 * @param event Indicates the pointer to the gesture event.
498 * @return Returns the rotation angle.
499 * @since 12
500 */
501 float OH_ArkUI_RotationGesture_GetAngle(const ArkUI_GestureEvent* event);
502 
503 /**
504 * @brief Obtains the scale ratio of a pinch gesture.
505 *
506 * @param event Indicates the pointer to the gesture event.
507 * @return Returns the scale ratio.
508 * @since 12
509 */
510 float OH_ArkUI_PinchGesture_GetScale(const ArkUI_GestureEvent* event);
511 
512 /**
513 * @brief Obtains the X coordinate of the center of the pinch gesture, in vp,
514 * relative to the upper left corner of the current component.
515 *
516 * @param event Indicates the pointer to the gesture event.
517 * @return Returns the X coordinate of the center of the pinch gesture, in vp,
518 * relative to the upper left corner of the current component.
519 * @since 12
520 */
521 float OH_ArkUI_PinchGesture_GetCenterX(const ArkUI_GestureEvent* event);
522 
523 /**
524 * @brief Obtains the Y coordinate of the center of the pinch gesture, in vp,
525 * relative to the upper left corner of the current component.
526 *
527 * @param event Indicates the pointer to the gesture event.
528 * @return Returns the Y coordinate of the center of the pinch gesture, in vp,
529 * relative to the upper left corner of the current component.
530 * @since 12
531 */
532 float OH_ArkUI_PinchGesture_GetCenterY(const ArkUI_GestureEvent* event);
533 
534 /**
535 * @brief Get the ARKUI component bound to the gesture.
536 *
537 * @param event gesture event.
538 * @return ARKUI component bound to the gesture.If Null is returned, it means event is an invalid value.
539 * @since 12
540 */
541 ArkUI_NodeHandle OH_ArkUI_GestureEvent_GetNode(const ArkUI_GestureEvent* event);
542 
543 /**
544 * @brief Obtains information about a gesture response chain.
545 *
546 * @param event Indicates the pointer to the gesture interruption information.
547 * @param responseChain Indicates the pointer to an array of gesture recognizers on the response chain.
548 * @param count Indicates the pointer to the number of gesture recognizers on the response chain.
549 * @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if success.
550 *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs.
551 * @since 12
552 */
553 int32_t OH_ArkUI_GetResponseRecognizersFromInterruptInfo(const ArkUI_GestureInterruptInfo* event,
554     ArkUI_GestureRecognizerHandleArray* responseChain, int32_t* count);
555 
556 /**
557 * @brief Sets the enabled state of a gesture recognizer.
558 *
559 * @param recognizer Indicates the pointer to a gesture recognizer.
560 * @param enabled Indicates the enabled state.
561 * @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if success.
562 *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs.
563 * @since 12
564 */
565 int32_t OH_ArkUI_SetGestureRecognizerEnabled(ArkUI_GestureRecognizer* recognizer, bool enabled);
566 
567 /**
568 * @brief Sets whether to enable strict finger count checking. If this feature is enabled and the actual number of touch
569 *        fingers does not match the set number, the gesture recognition fails.
570 *
571 * @param recognizer Indicates the pointer to a gesture recognizer.
572 * @param limitFingerCount Indicates whether to enable strict finger count checking.
573 * @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if success.
574 *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
575 * @since 15
576 */
577 int32_t OH_ArkUI_SetGestureRecognizerLimitFingerCount(ArkUI_GestureRecognizer* recognizer, bool limitFingerCount);
578 
579 /**
580 * @brief Obtains the enabled state of a gesture recognizer.
581 *
582 * @param recognizer Indicates the pointer to a gesture recognizer.
583 * @return Returns <b>true</b> if the gesture recognizer is enabled.
584 *         Returns <b>false</b> if the gesture recognizer is disabled.
585 * @since 12
586 */
587 bool OH_ArkUI_GetGestureRecognizerEnabled(ArkUI_GestureRecognizer* recognizer);
588 
589 /**
590 * @brief Obtains the state of a gesture recognizer.
591 *
592 * @param recognizer Indicates the pointer to a gesture recognizer.
593 * @param state Indicates the pointer to the state of the gesture recognizer.
594 * @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if success.
595 *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs.
596 * @since 12
597 */
598 int32_t OH_ArkUI_GetGestureRecognizerState(ArkUI_GestureRecognizer* recognizer, ArkUI_GestureRecognizerState* state);
599 
600 /**
601 * @brief Obtains the information about a gesture event target.
602 *
603 * @param recognizer Indicates the pointer to a gesture recognizer.
604 * @param info Indicates the information about a gesture event target.
605 * @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if success.
606 *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs.
607 * @since 12
608 */
609 int32_t OH_ArkUI_GetGestureEventTargetInfo(ArkUI_GestureRecognizer* recognizer, ArkUI_GestureEventTargetInfo** info);
610 
611 /**
612 * @brief Obtains whether this scroll container is scrolled to the top.
613 *
614 * @param info Indicates the information about a gesture event target.
615 * @param ret Indicates whether the scroll container is scrolled to the top.
616 * @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if success.
617 *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs.
618 *         Returns {@link ARKUI_ERROR_CODE_NON_SCROLLABLE_CONTAINER} if the component is not a scroll container.
619 * @since 12
620 */
621 int32_t OH_ArkUI_GestureEventTargetInfo_IsScrollBegin(ArkUI_GestureEventTargetInfo* info, bool* ret);
622 
623 /**
624 * @brief Obtains whether this scroll container is scrolled to the bottom.
625 *
626 * @param info Indicates the information about a gesture event target.
627 * @param ret Indicates whether the scroll container is scrolled to the bottom.
628 * @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if success.
629 *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs.
630 *         Returns {@link ARKUI_ERROR_CODE_NON_SCROLLABLE_CONTAINER} if the component is not a scroll container.
631 * @since 12
632 */
633 int32_t OH_ArkUI_GestureEventTargetInfo_IsScrollEnd(ArkUI_GestureEventTargetInfo* info, bool* ret);
634 
635 /**
636 * @brief Obtains the direction of a pan gesture.
637 *
638 * @param recognizer Indicates the pointer to a gesture recognizer.
639 * @param directionMask Indicates the pan direction.
640 * @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if success.
641 *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs.
642 * @since 12
643 */
644 int32_t OH_ArkUI_GetPanGestureDirectionMask(ArkUI_GestureRecognizer* recognizer,
645     ArkUI_GestureDirectionMask* directionMask);
646 
647 /**
648 * @brief Obtains whether a gesture is a built-in gesture.
649 *
650 * @param recognizer Indicates the pointer to a gesture recognizer.
651 * @return Returns <b>true</b> if the gesture is a built-in gesture; returns <b>false</b> otherwise.
652 * @since 12
653 */
654 bool OH_ArkUI_IsBuiltInGesture(ArkUI_GestureRecognizer* recognizer);
655 
656 /**
657 * @brief Obtains the tag of a gesture recognizer.
658 *
659 * @param recognizer Indicates the pointer to a gesture recognizer.
660 * @param buffer Indicates the buffer.
661 * @param bufferSize Indicates the buffer size.
662 * @param result Indicates the length of the string to be written to the buffer.
663 * @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if success.
664 *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs.
665 *         Returns {@link ARKUI_ERROR_CODE_BUFFER_SIZE_NOT_ENOUGH} if the buffer is not large enough.
666 * @since 12
667 */
668 int32_t OH_ArkUI_GetGestureTag(ArkUI_GestureRecognizer* recognizer, char* buffer, int32_t bufferSize, int32_t* result);
669 
670 /**
671 * @brief Obtains the ID of the component linked to a gesture recognizer.
672 *
673 * @param recognizer Indicates the pointer to a gesture recognizer.
674 * @param nodeId Indicates the component ID.
675 * @param size Indicates the buffer size.
676 * @param result Indicates the length of the string to be written to the buffer.
677 * @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if success.
678 *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs.
679 *         Returns {@link ARKUI_ERROR_CODE_BUFFER_SIZE_NOT_ENOUGH} if the buffer is not large enough.
680 * @since 12
681 */
682 int32_t OH_ArkUI_GetGestureBindNodeId(ArkUI_GestureRecognizer* recognizer, char* nodeId, int32_t size,
683     int32_t* result);
684 
685 /**
686 * @brief Obtains whether a gesture recognizer is valid.
687 *
688 * @param recognizer Indicates the pointer to a gesture recognizer.
689 * @return Returns <b>true</b> if the gesture recognizer is valid.
690 *         Returns <b>false</b> if the gesture recognizer is invalid.
691 * @since 12
692 */
693 bool OH_ArkUI_IsGestureRecognizerValid(ArkUI_GestureRecognizer* recognizer);
694 
695 /**
696 * @brief Obtains custom data in the parallel internal gesture event.
697 *
698 * @param event Indicates the pointer to a parallel internal gesture event.
699 * @return Returns the pointer to custom data.
700 * @since 12
701 */
702 void* OH_ArkUI_ParallelInnerGestureEvent_GetUserData(ArkUI_ParallelInnerGestureEvent* event);
703 
704 /**
705 * @brief Obtains the current gesture recognizer in a parallel internal gesture event.
706 *
707 * @param event Indicates the pointer to a parallel internal gesture event.
708 * @return Returns the pointer to the current gesture recognizer.
709 * @since 12
710 */
711 ArkUI_GestureRecognizer* OH_ArkUI_ParallelInnerGestureEvent_GetCurrentRecognizer(
712     ArkUI_ParallelInnerGestureEvent* event);
713 
714 /**
715 * @brief Obtains the conflicting gesture recognizers in a parallel internal gesture event.
716 *
717 * @param event Indicates the pointer to a parallel internal gesture event.
718 * @param array Indicates the pointer to the array of conflicting gesture recognizers.
719 * @param size Indicates the size of the array of conflicting gesture recognizers.
720 * @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if success.
721 *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs.
722 * @since 12
723 */
724 int32_t OH_ArkUI_ParallelInnerGestureEvent_GetConflictRecognizers(ArkUI_ParallelInnerGestureEvent* event,
725     ArkUI_GestureRecognizerHandleArray* array, int32_t* size);
726 
727 /**
728 * @brief Sets a callback function for notifying gesture recognizer destruction.
729 *
730 * @param recognizer Indicates the pointer to a gesture recognizer.
731 * @param callback Indicates the callback function for notifying gesture recognizer destruction.
732 * @param userData Indicates the custom data.
733 * @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if success.
734 *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs.
735 * @since 12
736 */
737 int32_t OH_ArkUI_SetArkUIGestureRecognizerDisposeNotify(ArkUI_GestureRecognizer* recognizer,
738     ArkUI_GestureRecognizerDisposeNotifyCallback callback, void* userData);
739 
740 /**
741 * @brief Obtains the swipe direction of a gesture recognizer.
742 *
743 * @param recognizer Pointer to a gesture recognizer.
744 * @param directMask Swipe direction of the gesture recognizer.
745 * @return Returns the result code.
746 *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
747 *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
748 * @since 18
749 */
750 int32_t OH_ArkUI_GetGestureParam_DirectMask(
751     ArkUI_GestureRecognizer* recognizer, ArkUI_GestureDirectionMask* directMask);
752 
753 /**
754 * @brief Obtains the number of fingers used by a gesture recognizer.
755 *
756 * @param recognizer Pointer to a gesture recognizer.
757 * @param finger Number of fingers used by the gesture recognizer.
758 * @return Returns the result code.
759 *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
760 *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
761 * @since 18
762 */
763 int32_t OH_ArkUI_GetGestureParam_FingerCount(ArkUI_GestureRecognizer* recognizer, int* finger);
764 
765 /**
766 * @brief Checks whether a gesture recognizer has a finger count limit.
767 *
768 * @param recognizer Pointer to a gesture recognizer.
769 * @param isLimited Whether the gesture recognizer has a finger count limit.
770 * @return Returns the result code.
771 *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
772 *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
773 * @since 18
774 */
775 int32_t OH_ArkUI_GetGestureParam_limitFingerCount(ArkUI_GestureRecognizer* recognizer, bool* isLimited);
776 
777 /**
778 * @brief Checks whether a gesture recognizer supports repeated event callbacks.
779 *
780 * @param recognizer Pointer to a gesture recognizer.
781 * @param isRepeat Whether the gesture recognizer supports repeated event callbacks.
782 * @return Returns the result code.
783 *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
784 *         Returns {@link ARKUI_ERROR_CODE_RECOGNIZER_TYPE_NOT_SUPPORTED} if the gesture recognizer type is not
785 * supported.
786 * @since 18
787 */
788 int32_t OH_ArkUI_GetGestureParam_repeat(ArkUI_GestureRecognizer* recognizer, bool* isRepeat);
789 
790 /**
791 * @brief Obtains the allowed movement distance range for a gesture recognizer.
792 *
793 * @param recognizer Pointer to a gesture recognizer.
794 * @param distance Allowed movement distance range of the gesture recognizer.
795 * @return Returns the result code.
796 *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
797 *         Returns {@link ARKUI_ERROR_CODE_RECOGNIZER_TYPE_NOT_SUPPORTED} if the gesture recognizer type is not
798 * supported.
799 * @since 18
800 */
801 int32_t OH_ArkUI_GetGestureParam_distance(ArkUI_GestureRecognizer* recognizer, double* distance);
802 
803 /**
804 * @brief Obtains the minimum swipe speed recognized by a gesture recognizer.
805 *
806 * @param recognizer Pointer to a gesture recognizer.
807 * @param speed Minimum swipe speed recognized by a gesture recognizer.
808 * @return Returns the result code.
809 *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
810 *         Returns {@link ARKUI_ERROR_CODE_RECOGNIZER_TYPE_NOT_SUPPORTED} if the gesture recognizer type is not
811 * supported.
812 * @since 18
813 */
814 int32_t OH_ArkUI_GetGestureParam_speed(ArkUI_GestureRecognizer* recognizer, double* speed);
815 
816 /**
817 * @brief Obtains the minimum duration required to trigger a long press by a gesture recognizer.
818 *
819 * @param recognizer Pointer to a gesture recognizer.
820 * @param duration Minimum duration for a long press.
821 * @return Returns the result code.
822 *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
823 *         Returns {@link ARKUI_ERROR_CODE_RECOGNIZER_TYPE_NOT_SUPPORTED} if the gesture recognizer type is not
824 * supported.
825 * @since 18
826 */
827 int32_t OH_ArkUI_GetGestureParam_duration(ArkUI_GestureRecognizer* recognizer, int* duration);
828 
829 /**
830 * @brief Obtains the minimum angle change required for a rotation gesture to be recognized by a gesture recognizer.
831 *
832 * @param recognizer Pointer to a gesture recognizer.
833 * @param angle Minimum angle change.
834 * @return Returns the result code.
835 *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
836 *         Returns {@link ARKUI_ERROR_CODE_RECOGNIZER_TYPE_NOT_SUPPORTED} if the gesture recognizer type is not
837 * supported.
838 * @since 18
839 */
840 int32_t OH_ArkUI_GetGestureParam_angle(ArkUI_GestureRecognizer* recognizer, double* angle);
841 
842 /**
843 * @brief Obtains the movement threshold for gestures to be recognized by a gesture recognizer.
844 *
845 * @param recognizer Pointer to a gesture recognizer.
846 * @param distanceThresHold Movement threshold.
847 * @return Returns the result code.
848 *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
849 *         Returns {@link ARKUI_ERROR_CODE_RECOGNIZER_TYPE_NOT_SUPPORTED} if the gesture recognizer type is not
850 * supported.
851 * @since 18
852 */
853 int32_t OH_ArkUI_GetGestureParam_distanceThreshold(ArkUI_GestureRecognizer* recognizer, double* distanceThreshold);
854 
855 /**
856 * @brief Sets the minimum movement distance thresholds for gestures to be recognized by a gesture recognizer.
857 *
858 * @param recognizer Indicates the pointer to a gesture recognizer.
859 * @param size Size of the array of minimum movement distance thresholds.
860 * @param toolTypeArray Pointer to the array of tool types for which thresholds are set.
861 * @param distanceArray Pointer to the array of minimum movement distances, in px.
862 * @return Returns the result code.
863 *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
864 *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
865 *         Returns {@link ARKUI_ERROR_CODE_RECOGNIZER_TYPE_NOT_SUPPORTED} if the gesture recognizer type is
866 *                 not supported.
867 * @since 19
868 */
869 ArkUI_ErrorCode OH_ArkUI_PanGesture_SetDistanceMap(
870     ArkUI_GestureRecognizer* recognizer, int size, int* toolTypeArray, double* distanceArray);
871 
872 /**
873 * @brief Obtains the movement threshold for gestures to be recognized by a gesture recognizer for a specific tool type.
874 *
875 * @param recognizer Indicates the pointer to a gesture recognizer.
876 * @param toolType Tool type for which you want to obtain the threshold.
877 * @param distance Gesture movement threshold of the gesture recognizer, in px.
878 * @return Returns the result code.
879 *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
880 *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs.
881 *         Returns {@link ARKUI_ERROR_CODE_RECOGNIZER_TYPE_NOT_SUPPORTED} if the gesture recognizer type is
882 *                 not supported.
883 * @since 19
884 */
885 ArkUI_ErrorCode OH_ArkUI_PanGesture_GetDistanceByToolType(
886     ArkUI_GestureRecognizer* recognizer, int toolType, double* distance);
887 
888 /**
889  * @brief Registers a callback that is executed after all gesture recognizers are collected.
890  * When the user begins touching the screen, the system performs hit testing and collects gesture recognizers
891  * based on the touch location. Subsequently, before processing any move events, the component can use this API
892  * to determine the gesture recognizers that will participate in and compete for recognition.
893  *
894  * @param node Handle to the node on which the callback is to be set.
895  * @param userData Custom data.
896  * @param touchTestDone Callback for completion of gesture recognizer collection.
897  *                      - event: Basic information of the gesture.
898  *                      - recognizers: Array of gesture recognizers.
899  *                      - count: Number of gesture recognizers.
900  * @return Result code.
901  *         {@link ARKUI_ERROR_CODE_NO_ERROR}: The operation is successful.
902  *         {@link ARKUI_ERROR_CODE_PARAM_INVALID}: A parameter error occurs.
903  * @since 20
904  */
905 ArkUI_ErrorCode OH_ArkUI_SetTouchTestDoneCallback(
906     ArkUI_NodeHandle node,
907     void* userData,
908     void (*touchTestDone)(
909         ArkUI_GestureEvent* event,
910         ArkUI_GestureRecognizerHandleArray recognizers,
911         int32_t count,
912         void* userData
913     )
914 );
915 
916 /**
917  * @brief Defines the gesture APIs.
918  *
919  * @since 12
920  */
921 typedef struct {
922     /** The struct version is 1. */
923     int32_t version;
924 
925     /**
926     * @brief Creates a tap gesture.
927     *
928     *        1. This API is used to trigger a tap gesture with one, two, or more taps. \n
929     *        2. If multi-tap is configured, the timeout interval between a lift and the next tap is 300 ms. \n
930     *        3. If the distance between the last tapped position and the current tapped position exceeds 60 vp,
931     *           gesture recognition fails. \n
932     *        4. If the value is greater than 1, the tap gesture will fail to be recognized when the number of fingers
933     *           touching the screen within 300 ms of the first finger touch is less than the required number, \n
934     *           or when the number of fingers lifted from the screen within 300 ms of the first finger's being lifted
935     *           is less than the required number. \n
936     *        5. When the number of fingers touching the screen exceeds the set value, the gesture can be recognized. \n
937     *
938     * @param countNum Indicates the number of consecutive taps. If the value is less than 1 or is not set,
939     *        the default value <b>1</b> is used.
940     * @param fingersNum Indicates the number of fingers required to trigger a tap. The value ranges
941     *        from 1 to 10. If the value is less than 1 or is not set, the default value <b>1</b> is used.
942     * @return Returns the pointer to the created gesture.
943     */
944     ArkUI_GestureRecognizer* (*createTapGesture)(int32_t countNum, int32_t fingersNum);
945 
946     /**
947     * @brief Creates a long press gesture.
948     *
949     *        1. This API is used to trigger a long press gesture, which requires one or more fingers with a minimum
950     *           The value ranges 500 ms hold-down time. \n
951     *        2. In components that support drag actions by default, such as <b><Text></b>, <b><TextInput></b>,
952     *           <b><TextArea></b>, <b><Hyperlink></b>, <b><Image></b>, and <b>RichEditor></b>, the long press gesture \n
953     *           may conflict with the drag action. If this occurs, they are handled as follows: \n
954     *           If the minimum duration of the long press gesture is less than 500 ms, the long press gesture receives
955     *           a higher response priority than the drag action. \n
956     *           If the minimum duration of the long press gesture is greater than or equal to 500 ms,
957     *           the drag action receives a higher response priority than the long press gesture. \n
958     *        3. If a finger moves more than 15 px after being pressed, the gesture recognition fails. \n
959     *
960     * @param fingersNum Indicates the minimum number of fingers to trigger a long press gesture.
961     *        The value ranges from 1 to 10.
962     * @param repeatResult Indicates whether to continuously trigger the event callback.
963     * @param durationNum Indicates the minimum hold-down time, in ms.
964     *        If the value is less than or equal to 0, the default value <b>500</b> is used.
965     * @return Returns the pointer to the created gesture.
966     */
967     ArkUI_GestureRecognizer* (*createLongPressGesture)(int32_t fingersNum, bool repeatResult, int32_t durationNum);
968 
969     /**
970     * @brief Creates a pan gesture.
971     *
972     *        1. This API is used to trigger a pan gesture when the movement distance of a finger on the screen exceeds
973     *           the minimum value. \n
974     *        2. If a pan gesture and a tab swipe occur at the same time, set <b>distanceNum</b> to <b>1</b>
975     *           so that the gesture can be more easily recognized. \n
976     *
977     * @param fingersNum Indicates the minimum number of fingers to trigger a pan gesture. The value ranges from 1 to 10.
978     *        If the value is less than 1 or is not set, the default value <b>1</b> is used.
979     * @param directions Indicates the pan direction. The value supports the AND (&amp;) and OR (\|) operations.
980     * @param distanceNum Indicates the minimum pan distance to trigger the gesture, in vp. If this parameter is
981     *        set to a value less than or equal to 0, the default value <b>5</b> is used.
982     * @return Returns the pointer to the created gesture.
983     */
984     ArkUI_GestureRecognizer* (*createPanGesture)(
985         int32_t fingersNum, ArkUI_GestureDirectionMask directions, double distanceNum);
986 
987     /**
988     * @brief Creates a pinch gesture.
989     *
990     *        1. This API is used to trigger a pinch gesture, which requires two to five fingers with a minimum 5 vp
991     *           distance between the fingers. \n
992     *        2. While more fingers than the minimum number can be pressed to trigger the gesture, only the first
993     *           fingers of the minimum number participate in gesture calculation. \n
994     *
995     * @param fingersNum Indicates the minimum number of fingers to trigger a pinch. The value ranges from 2 to 5.
996     *        Default value: <b>2</b>
997     * @param distanceNum Indicates the minimum recognition distance, in px. If this parameter is set to a value less
998     *        than or equal to 0, the default value <b>5</b> is used.
999     * @return Returns the pointer to the created gesture.
1000     */
1001     ArkUI_GestureRecognizer* (*createPinchGesture)(int32_t fingersNum, double distanceNum);
1002 
1003     /**
1004     * @brief Creates a rotation gesture.
1005     *
1006     *        1. This API is used to trigger a rotation gesture, which requires two to five fingers with a
1007     *           minimum 1-degree rotation angle. \n
1008     *        2. While more fingers than the minimum number can be pressed to trigger the gesture, only the first
1009     *           two fingers participate in gesture calculation. \n
1010     *
1011     * @param fingersNum Indicates the minimum number of fingers to trigger a rotation. The value ranges from 2 to 5.
1012     *        Default value: <b>2</b>
1013     * @param angleNum Indicates the minimum degree that can trigger the rotation gesture. Default value: <b>1</b>
1014     *        If this parameter is set to a value less than or equal to 0 or greater than 360,
1015     *        the default value <b>1</b> is used.
1016     * @return Returns the pointer to the created gesture.
1017     */
1018     ArkUI_GestureRecognizer* (*createRotationGesture)(int32_t fingersNum, double angleNum);
1019 
1020     /**
1021     * @brief Creates a swipe gesture.
1022     *
1023     *        This API is used to implement a swipe gesture, which can be recognized when the swipe speed is 100
1024     *        vp/s or higher. \n
1025     *
1026     * @param fingersNum Indicates the minimum number of fingers to trigger a swipe gesture.
1027     *        The value ranges from 1 to 10.
1028     * @param directions Indicates the swipe direction.
1029     * @param speedNum Indicates the minimum speed of the swipe gesture, in px/s.
1030     *        If this parameter is set to a value less than or equal to 0, the default value <b>100</b> is used.
1031     * @return Returns the pointer to the created gesture.
1032     */
1033     ArkUI_GestureRecognizer* (*createSwipeGesture)(
1034         int32_t fingersNum, ArkUI_GestureDirectionMask directions, double speedNum);
1035 
1036     /**
1037     * @brief Creates a gesture group.
1038     *
1039     * @param gestureMode Indicates the gesture group mode.
1040     * @return Returns the pointer to the created gesture group.
1041     */
1042     ArkUI_GestureRecognizer* (*createGroupGesture)(ArkUI_GroupGestureMode gestureMode);
1043 
1044     /**
1045     * @brief Disposes a gesture to release resources.
1046     *
1047     * @param recognizer Indicates the pointer to the gesture to dispose.
1048     */
1049     void (*dispose)(ArkUI_GestureRecognizer* recognizer);
1050 
1051     /**
1052     * @brief Adds a gesture to a gesture group.
1053     *
1054     * @param group Indicates the pointer to the gesture group.
1055     * @param child Indicates the gesture to be added to the gesture group.
1056     * @return Returns <b>0</b> if success.
1057     *         Returns <b>401</b> if a parameter exception occurs. Returns 401 if a parameter exception occurs.
1058     */
1059     int32_t (*addChildGesture)(ArkUI_GestureRecognizer* group, ArkUI_GestureRecognizer* child);
1060 
1061     /**
1062     * @brief Removes a gesture to a gesture group.
1063     *
1064     * @param group Indicates the pointer to the gesture group.
1065     * @param child Indicates the gesture to be removed to the gesture group.
1066     * @return Returns <b>0</b> if success.
1067     *         Returns <b>401</b> if a parameter exception occurs.
1068     */
1069     int32_t (*removeChildGesture)(ArkUI_GestureRecognizer* group, ArkUI_GestureRecognizer* child);
1070 
1071     /**
1072     * @brief Registers a callback for gestures.
1073     *
1074     * @param recognizer Indicates the pointer to the gesture recognizer.
1075     * @param actionTypeMask Indicates the set of gesture event types. Multiple callbacks can be registered at once,
1076     *        with the callback event types distinguished in the callbacks.
1077     *        Example: actionTypeMask = GESTURE_EVENT_ACTION_ACCEPT | GESTURE_EVENT_ACTION_UPDATE;
1078     * @param extraParams Indicates the context passed in the <b>targetReceiver</b> callback.
1079     * @param targetReceiver Indicates the callback to register for processing the gesture event types.
1080     *        <b>event</b> indicates the gesture callback data.
1081     * @return Returns <b>0</b> if success.
1082     *         Returns <b>401</b> if a parameter exception occurs.
1083     */
1084     int32_t (*setGestureEventTarget)(
1085         ArkUI_GestureRecognizer* recognizer, ArkUI_GestureEventActionTypeMask actionTypeMask, void* extraParams,
1086         void (*targetReceiver)(ArkUI_GestureEvent* event, void* extraParams));
1087 
1088     /**
1089     * @brief Adds a gesture to a UI component.
1090     *
1091     * @param node Indicates the UI component to which you want to add the gesture.
1092     * @param recognizer Indicates the gesture to be added to the UI component.
1093     * @param mode Indicates the gesture event mode. Available options are <b>NORMAL_GESTURE</b>,
1094     *        <b>PARALLEL_GESTURE</b>, and <b>PRIORITY_GESTURE</b>.
1095     * @param mask Indicates the gesture masking mode.
1096     * @return Returns <b>0</b> if success.
1097     *         Returns <b>401</b> if a parameter exception occurs.
1098     */
1099     int32_t (*addGestureToNode)(
1100         ArkUI_NodeHandle node, ArkUI_GestureRecognizer* recognizer, ArkUI_GesturePriority mode, ArkUI_GestureMask mask);
1101 
1102     /**
1103     * @brief Removes a gesture from a node.
1104     *
1105     * @param node Indicates the node from which you want to remove the gesture.
1106     * @param recognizer Indicates the gesture to be removed.
1107     * @return Returns <b>0</b> if success.
1108     * Returns <b>401</b> if a parameter exception occurs.
1109     */
1110     int32_t (*removeGestureFromNode)(ArkUI_NodeHandle node, ArkUI_GestureRecognizer* recognizer);
1111 
1112     /**
1113     * @brief Sets a gesture interruption callback for a node.
1114     *
1115     * @param node Indicates the node for which you want to set a gesture interruption callback.
1116     * @param interrupter Indicates the gesture interruption callback to set.
1117     *        <b>info</b> indicates the gesture interruption data. If <b>interrupter</b> returns
1118     *        <b>GESTURE_INTERRUPT_RESULT_CONTINUE</b>, the gesture recognition process continues. If it returns
1119     *        <b>GESTURE_INTERRUPT_RESULT_REJECT</b>, the gesture recognition process is paused.
1120     * @return Returns <b>0</b> if success.
1121     * Returns <b>401</b> if a parameter exception occurs.
1122     */
1123     int32_t (*setGestureInterrupterToNode)(
1124         ArkUI_NodeHandle node, ArkUI_GestureInterruptResult (*interrupter)(ArkUI_GestureInterruptInfo* info));
1125 
1126     /**
1127     * @brief Obtains the type of a gesture.
1128     *
1129     * @param recognizer Indicates the pointer to the gesture.
1130     * @return Returns the gesture type.
1131     */
1132     ArkUI_GestureRecognizerType (*getGestureType)(ArkUI_GestureRecognizer* recognizer);
1133 
1134     /**
1135     * @brief Sets the callback function for a parallel internal gesture event.
1136     *
1137     * @param node Indicates the ArkUI node for which the callback of a parallel internal gesture event is to be set.
1138     * @param userData Indicates the custom data.
1139     * @param parallelInnerGesture Indicates the parallel internal gesture event. <b>event</b> returns the data of the
1140     *        parallel internal gesture event; <b>parallelInnerGesture</b> returns the pointer to the gesture recognizer
1141     *        that requires parallel recognition.
1142     * @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if success.
1143     *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs.
1144     */
1145     int32_t (*setInnerGestureParallelTo)(
1146         ArkUI_NodeHandle node, void* userData, ArkUI_GestureRecognizer* (*parallelInnerGesture)(
1147             ArkUI_ParallelInnerGestureEvent* event));
1148 
1149     /**
1150     * @brief Creates a tap gesture that is subject to distance restrictions.
1151     *
1152     *        1. This API is used to trigger a tap gesture with one, two, or more taps. \n
1153     *        2. If multi-tap is configured, the timeout interval between a lift and the next tap is 300 ms. \n
1154     *        3. If the distance between the last tapped position and the current tapped position exceeds 60 vp,
1155     *           gesture recognition fails. \n
1156     *        4. If the value is greater than 1, the tap gesture will fail to be recognized when the number of fingers
1157     *           touching the screen within 300 ms of the first finger touch is less than the required number,
1158     *           or when the number of fingers lifted from the screen within 300 ms of the first finger's being lifted
1159     *           is less than the required number. \n
1160     *        5. When the number of fingers touching the screen exceeds the set value, the gesture can be recognized. \n
1161     *        6. If the finger moves beyond the preset distance limit, gesture recognition fails. \n
1162     *
1163     * @param countNum Indicates the number of consecutive taps. If the value is less than 1 or is not set, the default
1164     *        value <b>1</b> is used.
1165     * @param fingersNum Indicates the number of fingers required to trigger a tap. The value ranges from 1 to 10.
1166     *        If the value is less than 1 or is not set, the default value <b>1</b> is used.
1167     * @param distanceThreshold Indicates the allowed moving distance of a finger.
1168     *        If the value is less than 0 or is not set, it will be converted to the default value of infinity.
1169     * @return Returns the pointer to the created gesture.
1170     */
1171     ArkUI_GestureRecognizer* (*createTapGestureWithDistanceThreshold)(
1172         int32_t countNum, int32_t fingersNum, double distanceThreshold);
1173 } ArkUI_NativeGestureAPI_1;
1174 
1175 /**
1176  * @brief Defines the gesture APIs.
1177  *
1178  * @since 18
1179  */
1180 typedef struct {
1181     /**
1182      * @brief Pointer to the <b>ArkUI_NativeGestureAPI_1</b> struct.
1183      */
1184     ArkUI_NativeGestureAPI_1* gestureApi1;
1185 
1186     /**
1187     * @brief Sets the callback for gesture interruption events.
1188     *
1189     * @param node Node for which you want to set a gesture interruption callback.
1190     * @param userData Custom data.
1191     * @param interrupter Gesture interruption callback to set. <b>info</b> indicates the gesture interruption data.
1192     * If <b>interrupter</b> returns <b>GESTURE_INTERRUPT_RESULT_CONTINUE</b>, the gesture recognition process proceeds
1193     * properly. If it returns <b>GESTURE_INTERRUPT_RESULT_REJECT</b>, the gesture recognition process is paused.
1194     * @return Returns <b>0</b> if success.
1195     *         Returns <b>401</b> if a parameter error occurs.
1196     */
1197     int32_t (*setGestureInterrupterToNode)(ArkUI_NodeHandle node, void* userData,
1198         ArkUI_GestureInterruptResult (*interrupter)(ArkUI_GestureInterruptInfo* info));
1199 } ArkUI_NativeGestureAPI_2;
1200 
1201 /**
1202 * @brief Obtains the custom data from a gesture interruption event.
1203 *
1204 * @param event Pointer to the gesture interruption information.
1205 * @return Returns the pointer to the custom data.
1206 * @since 18
1207 */
1208 void* OH_ArkUI_GestureInterrupter_GetUserData(ArkUI_GestureInterruptInfo* event);
1209 
1210 /**
1211  * @brief Prevents a gesture recognizer from participating in the current gesture recognition before all fingers are
1212  * lifted.
1213  * If the system has already determined the result of the gesture recognizer (regardless of success or failure),
1214  * calling this API will be ineffective.
1215  *
1216  * @param recognizer Pointer to a gesture recognizer.
1217  * @return Result code.
1218  *         {@link ARKUI_ERROR_CODE_NO_ERROR}: The operation is successful.
1219  *         {@link ARKUI_ERROR_CODE_PARAM_INVALID}: A parameter error occurs.
1220  * @since 20
1221  */
1222 ArkUI_ErrorCode OH_ArkUI_PreventGestureRecognizerBegin(ArkUI_GestureRecognizer* recognizer);
1223 
1224 #ifdef __cplusplus
1225 };
1226 #endif
1227 
1228 #endif // ARKUI_NATIVE_GESTTURE_H
1229 /** @} */
1230