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