17777dab0Sopenharmony_ci/* 27777dab0Sopenharmony_ci * Copyright (c) 2024 Huawei Device Co., Ltd. 37777dab0Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 47777dab0Sopenharmony_ci * you may not use this file except in compliance with the License. 57777dab0Sopenharmony_ci * You may obtain a copy of the License at 67777dab0Sopenharmony_ci * 77777dab0Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 87777dab0Sopenharmony_ci * 97777dab0Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 107777dab0Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 117777dab0Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 127777dab0Sopenharmony_ci * See the License for the specific language governing permissions and 137777dab0Sopenharmony_ci * limitations under the License. 147777dab0Sopenharmony_ci */ 157777dab0Sopenharmony_ci 167777dab0Sopenharmony_ci/** 177777dab0Sopenharmony_ci * @addtogroup ArkUI_NativeModule 187777dab0Sopenharmony_ci * @{ 197777dab0Sopenharmony_ci * 207777dab0Sopenharmony_ci * @brief Defines APIs for ArkUI to register gesture callbacks on the native side. 217777dab0Sopenharmony_ci * 227777dab0Sopenharmony_ci * @since 12 237777dab0Sopenharmony_ci */ 247777dab0Sopenharmony_ci 257777dab0Sopenharmony_ci/** 267777dab0Sopenharmony_ci * @file native_gesture.h 277777dab0Sopenharmony_ci * 287777dab0Sopenharmony_ci * @brief Provides type definitions for <b>NativeGesture</b> APIs. 297777dab0Sopenharmony_ci * 307777dab0Sopenharmony_ci * @library libace_ndk.z.so 317777dab0Sopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 327777dab0Sopenharmony_ci * @kit ArkUI 337777dab0Sopenharmony_ci * @since 12 347777dab0Sopenharmony_ci */ 357777dab0Sopenharmony_ci 367777dab0Sopenharmony_ci#ifndef ARKUI_NATIVE_GESTTURE_H 377777dab0Sopenharmony_ci#define ARKUI_NATIVE_GESTTURE_H 387777dab0Sopenharmony_ci 397777dab0Sopenharmony_ci#include "ui_input_event.h" 407777dab0Sopenharmony_ci#include "native_type.h" 417777dab0Sopenharmony_ci#include <stdbool.h> 427777dab0Sopenharmony_ci 437777dab0Sopenharmony_ci#ifdef __cplusplus 447777dab0Sopenharmony_ciextern "C" { 457777dab0Sopenharmony_ci#endif 467777dab0Sopenharmony_ci 477777dab0Sopenharmony_ci/** 487777dab0Sopenharmony_ci * @brief Defines a gesture recognizer. 497777dab0Sopenharmony_ci * 507777dab0Sopenharmony_ci * @since 12 517777dab0Sopenharmony_ci */ 527777dab0Sopenharmony_citypedef struct ArkUI_GestureRecognizer ArkUI_GestureRecognizer; 537777dab0Sopenharmony_ci 547777dab0Sopenharmony_ci/** 557777dab0Sopenharmony_ci * @brief Defines the gesture interruption information. 567777dab0Sopenharmony_ci * 577777dab0Sopenharmony_ci * @since 12 587777dab0Sopenharmony_ci */ 597777dab0Sopenharmony_citypedef struct ArkUI_GestureInterruptInfo ArkUI_GestureInterruptInfo; 607777dab0Sopenharmony_ci 617777dab0Sopenharmony_ci/** 627777dab0Sopenharmony_ci * @brief Defines the gesture event. 637777dab0Sopenharmony_ci * 647777dab0Sopenharmony_ci * @since 12 657777dab0Sopenharmony_ci */ 667777dab0Sopenharmony_citypedef struct ArkUI_GestureEvent ArkUI_GestureEvent; 677777dab0Sopenharmony_ci 687777dab0Sopenharmony_ci/** 697777dab0Sopenharmony_ci * @brief Enumerates gesture event types. 707777dab0Sopenharmony_ci * 717777dab0Sopenharmony_ci * @since 12 727777dab0Sopenharmony_ci */ 737777dab0Sopenharmony_citypedef enum { 747777dab0Sopenharmony_ci /** Triggered. */ 757777dab0Sopenharmony_ci GESTURE_EVENT_ACTION_ACCEPT = 0x01, 767777dab0Sopenharmony_ci 777777dab0Sopenharmony_ci /** Updated. */ 787777dab0Sopenharmony_ci GESTURE_EVENT_ACTION_UPDATE = 0x02, 797777dab0Sopenharmony_ci 807777dab0Sopenharmony_ci /** Ended. */ 817777dab0Sopenharmony_ci GESTURE_EVENT_ACTION_END = 0x04, 827777dab0Sopenharmony_ci 837777dab0Sopenharmony_ci /** Canceled. */ 847777dab0Sopenharmony_ci GESTURE_EVENT_ACTION_CANCEL = 0x08, 857777dab0Sopenharmony_ci} ArkUI_GestureEventActionType; 867777dab0Sopenharmony_ci 877777dab0Sopenharmony_ci/** 887777dab0Sopenharmony_ci * @brief Defines a set of gesture event types. 897777dab0Sopenharmony_ci * 907777dab0Sopenharmony_ci * Example: ArkUI_GestureEventActionTypeMask actions = GESTURE_EVENT_ACTION_ACCEPT | GESTURE_EVENT_ACTION_UPDATE;\n 917777dab0Sopenharmony_ci * 927777dab0Sopenharmony_ci * @since 12 937777dab0Sopenharmony_ci */ 947777dab0Sopenharmony_citypedef uint32_t ArkUI_GestureEventActionTypeMask; 957777dab0Sopenharmony_ci 967777dab0Sopenharmony_ci/** 977777dab0Sopenharmony_ci * @brief Enumerates gesture event modes. 987777dab0Sopenharmony_ci * 997777dab0Sopenharmony_ci * @since 12 1007777dab0Sopenharmony_ci */ 1017777dab0Sopenharmony_citypedef enum { 1027777dab0Sopenharmony_ci /** Normal. */ 1037777dab0Sopenharmony_ci NORMAL = 0, 1047777dab0Sopenharmony_ci 1057777dab0Sopenharmony_ci /** High-priority. */ 1067777dab0Sopenharmony_ci PRIORITY = 1, 1077777dab0Sopenharmony_ci 1087777dab0Sopenharmony_ci /** Parallel. */ 1097777dab0Sopenharmony_ci PARALLEL = 2, 1107777dab0Sopenharmony_ci} ArkUI_GesturePriority; 1117777dab0Sopenharmony_ci 1127777dab0Sopenharmony_ci/** 1137777dab0Sopenharmony_ci * @brief Enumerates gesture group modes. 1147777dab0Sopenharmony_ci * 1157777dab0Sopenharmony_ci * @since 12 1167777dab0Sopenharmony_ci */ 1177777dab0Sopenharmony_citypedef enum { 1187777dab0Sopenharmony_ci /* Sequential recognition. Gestures are recognized in the registration sequence until all gestures are recognized 1197777dab0Sopenharmony_ci * successfully. Once one gesture fails to be recognized, all subsequent gestures fail to be recognized. 1207777dab0Sopenharmony_ci * Only the last gesture in the gesture group can respond to the end event. */ 1217777dab0Sopenharmony_ci SEQUENTIAL_GROUP = 0, 1227777dab0Sopenharmony_ci 1237777dab0Sopenharmony_ci /** Parallel recognition. Registered gestures are recognized concurrently until all gestures are recognized. 1247777dab0Sopenharmony_ci * The recognition result of each gesture does not affect each other. */ 1257777dab0Sopenharmony_ci PARALLEL_GROUP = 1, 1267777dab0Sopenharmony_ci 1277777dab0Sopenharmony_ci /** Exclusive recognition. Registered gestures are identified concurrently. 1287777dab0Sopenharmony_ci * If one gesture is successfully recognized, gesture recognition ends. */ 1297777dab0Sopenharmony_ci EXCLUSIVE_GROUP = 2, 1307777dab0Sopenharmony_ci} ArkUI_GroupGestureMode; 1317777dab0Sopenharmony_ci 1327777dab0Sopenharmony_ci/** 1337777dab0Sopenharmony_ci * @brief Enumerates gesture directions. 1347777dab0Sopenharmony_ci * 1357777dab0Sopenharmony_ci * @since 12 1367777dab0Sopenharmony_ci */ 1377777dab0Sopenharmony_citypedef enum { 1387777dab0Sopenharmony_ci /** All directions. */ 1397777dab0Sopenharmony_ci GESTURE_DIRECTION_ALL = 0b1111, 1407777dab0Sopenharmony_ci 1417777dab0Sopenharmony_ci /** Horizontal direction. */ 1427777dab0Sopenharmony_ci GESTURE_DIRECTION_HORIZONTAL = 0b0011, 1437777dab0Sopenharmony_ci 1447777dab0Sopenharmony_ci /** Vertical direction. */ 1457777dab0Sopenharmony_ci GESTURE_DIRECTION_VERTICAL = 0b1100, 1467777dab0Sopenharmony_ci 1477777dab0Sopenharmony_ci /** Leftward. */ 1487777dab0Sopenharmony_ci GESTURE_DIRECTION_LEFT = 0b0001, 1497777dab0Sopenharmony_ci 1507777dab0Sopenharmony_ci /** Rightward. */ 1517777dab0Sopenharmony_ci GESTURE_DIRECTION_RIGHT = 0b0010, 1527777dab0Sopenharmony_ci 1537777dab0Sopenharmony_ci /** Upward. */ 1547777dab0Sopenharmony_ci GESTURE_DIRECTION_UP = 0b0100, 1557777dab0Sopenharmony_ci 1567777dab0Sopenharmony_ci /** Downward. */ 1577777dab0Sopenharmony_ci GESTURE_DIRECTION_DOWN = 0b1000, 1587777dab0Sopenharmony_ci 1597777dab0Sopenharmony_ci /** None. */ 1607777dab0Sopenharmony_ci GESTURE_DIRECTION_NONE = 0, 1617777dab0Sopenharmony_ci} ArkUI_GestureDirection; 1627777dab0Sopenharmony_ci 1637777dab0Sopenharmony_ci/** 1647777dab0Sopenharmony_ci * @brief Defines a set of gesture directions. 1657777dab0Sopenharmony_ci * 1667777dab0Sopenharmony_ci * Example: ArkUI_GestureDirectionMask directions = GESTURE_DIRECTION_LEFT | GESTURE_DIRECTION_RIGHT \n 1677777dab0Sopenharmony_ci * This example indicates that the leftward and rightward directions are supported. \n 1687777dab0Sopenharmony_ci * 1697777dab0Sopenharmony_ci * @since 12 1707777dab0Sopenharmony_ci */ 1717777dab0Sopenharmony_citypedef uint32_t ArkUI_GestureDirectionMask; 1727777dab0Sopenharmony_ci 1737777dab0Sopenharmony_ci/** 1747777dab0Sopenharmony_ci * @brief Enumerates gesture masking modes. 1757777dab0Sopenharmony_ci * 1767777dab0Sopenharmony_ci * @since 12 1777777dab0Sopenharmony_ci */ 1787777dab0Sopenharmony_citypedef enum { 1797777dab0Sopenharmony_ci /** The gestures of child components are enabled and recognized based on the default gesture recognition sequence.*/ 1807777dab0Sopenharmony_ci NORMAL_GESTURE_MASK = 0, 1817777dab0Sopenharmony_ci 1827777dab0Sopenharmony_ci /** The gestures of child components are disabled, including the built-in gestures. */ 1837777dab0Sopenharmony_ci IGNORE_INTERNAL_GESTURE_MASK, 1847777dab0Sopenharmony_ci} ArkUI_GestureMask; 1857777dab0Sopenharmony_ci 1867777dab0Sopenharmony_ci/** 1877777dab0Sopenharmony_ci * @brief Enumerates gesture types. 1887777dab0Sopenharmony_ci * 1897777dab0Sopenharmony_ci * @since 12 1907777dab0Sopenharmony_ci */ 1917777dab0Sopenharmony_citypedef enum { 1927777dab0Sopenharmony_ci /** Tap. */ 1937777dab0Sopenharmony_ci TAP_GESTURE = 0, 1947777dab0Sopenharmony_ci 1957777dab0Sopenharmony_ci /** Long press. */ 1967777dab0Sopenharmony_ci LONG_PRESS_GESTURE, 1977777dab0Sopenharmony_ci 1987777dab0Sopenharmony_ci /** Pan. */ 1997777dab0Sopenharmony_ci PAN_GESTURE, 2007777dab0Sopenharmony_ci 2017777dab0Sopenharmony_ci /** Pinch. */ 2027777dab0Sopenharmony_ci PINCH_GESTURE, 2037777dab0Sopenharmony_ci 2047777dab0Sopenharmony_ci /** Rotate. */ 2057777dab0Sopenharmony_ci ROTATION_GESTURE, 2067777dab0Sopenharmony_ci 2077777dab0Sopenharmony_ci /** Swipe. */ 2087777dab0Sopenharmony_ci SWIPE_GESTURE, 2097777dab0Sopenharmony_ci 2107777dab0Sopenharmony_ci /** A group of gestures. */ 2117777dab0Sopenharmony_ci GROUP_GESTURE, 2127777dab0Sopenharmony_ci} ArkUI_GestureRecognizerType; 2137777dab0Sopenharmony_ci 2147777dab0Sopenharmony_ci/** 2157777dab0Sopenharmony_ci * @brief Enumerates gesture interruption results. 2167777dab0Sopenharmony_ci * 2177777dab0Sopenharmony_ci * @since 12 2187777dab0Sopenharmony_ci */ 2197777dab0Sopenharmony_citypedef enum { 2207777dab0Sopenharmony_ci /** The gesture recognition process continues. */ 2217777dab0Sopenharmony_ci GESTURE_INTERRUPT_RESULT_CONTINUE = 0, 2227777dab0Sopenharmony_ci 2237777dab0Sopenharmony_ci /** The gesture recognition process is paused. */ 2247777dab0Sopenharmony_ci GESTURE_INTERRUPT_RESULT_REJECT, 2257777dab0Sopenharmony_ci} ArkUI_GestureInterruptResult; 2267777dab0Sopenharmony_ci 2277777dab0Sopenharmony_ci/** 2287777dab0Sopenharmony_ci * @brief Enumerates the gesture recognizer states. 2297777dab0Sopenharmony_ci * 2307777dab0Sopenharmony_ci * @since 12 2317777dab0Sopenharmony_ci */ 2327777dab0Sopenharmony_citypedef enum { 2337777dab0Sopenharmony_ci /** Ready. */ 2347777dab0Sopenharmony_ci ARKUI_GESTURE_RECOGNIZER_STATE_READY = 0, 2357777dab0Sopenharmony_ci 2367777dab0Sopenharmony_ci /** Detecting. */ 2377777dab0Sopenharmony_ci ARKUI_GESTURE_RECOGNIZER_STATE_DETECTING = 1, 2387777dab0Sopenharmony_ci 2397777dab0Sopenharmony_ci /** Pending. */ 2407777dab0Sopenharmony_ci ARKUI_GESTURE_RECOGNIZER_STATE_PENDING = 2, 2417777dab0Sopenharmony_ci 2427777dab0Sopenharmony_ci /** Blocked. */ 2437777dab0Sopenharmony_ci ARKUI_GESTURE_RECOGNIZER_STATE_BLOCKED = 3, 2447777dab0Sopenharmony_ci 2457777dab0Sopenharmony_ci /** Successful. */ 2467777dab0Sopenharmony_ci ARKUI_GESTURE_RECOGNIZER_STATE_SUCCESSFUL = 4, 2477777dab0Sopenharmony_ci 2487777dab0Sopenharmony_ci /** Failed. */ 2497777dab0Sopenharmony_ci ARKUI_GESTURE_RECOGNIZER_STATE_FAILED = 5, 2507777dab0Sopenharmony_ci} ArkUI_GestureRecognizerState; 2517777dab0Sopenharmony_ci 2527777dab0Sopenharmony_ci/** 2537777dab0Sopenharmony_ci * @brief Defines the gesture recognizer handle. 2547777dab0Sopenharmony_ci * 2557777dab0Sopenharmony_ci * @since 12 2567777dab0Sopenharmony_ci */ 2577777dab0Sopenharmony_citypedef ArkUI_GestureRecognizer* ArkUI_GestureRecognizerHandle; 2587777dab0Sopenharmony_ci 2597777dab0Sopenharmony_ci/** 2607777dab0Sopenharmony_ci * @brief Defines the gesture recognizer handle array. 2617777dab0Sopenharmony_ci * 2627777dab0Sopenharmony_ci * @since 12 2637777dab0Sopenharmony_ci */ 2647777dab0Sopenharmony_citypedef ArkUI_GestureRecognizerHandle* ArkUI_GestureRecognizerHandleArray; 2657777dab0Sopenharmony_ci 2667777dab0Sopenharmony_ci/** 2677777dab0Sopenharmony_ci * @brief Defines a <b>GestureEventTargetInfo</b> object that provides information about a gesture event target. 2687777dab0Sopenharmony_ci * 2697777dab0Sopenharmony_ci * @since 12 2707777dab0Sopenharmony_ci */ 2717777dab0Sopenharmony_citypedef struct ArkUI_GestureEventTargetInfo ArkUI_GestureEventTargetInfo; 2727777dab0Sopenharmony_ci 2737777dab0Sopenharmony_ci/** 2747777dab0Sopenharmony_ci * @brief Defines a parallel internal gesture event. 2757777dab0Sopenharmony_ci * 2767777dab0Sopenharmony_ci * @since 12 2777777dab0Sopenharmony_ci */ 2787777dab0Sopenharmony_citypedef struct ArkUI_ParallelInnerGestureEvent ArkUI_ParallelInnerGestureEvent; 2797777dab0Sopenharmony_ci 2807777dab0Sopenharmony_ci/** 2817777dab0Sopenharmony_ci * @brief Defines a callback function for notifying gesture recognizer destruction. 2827777dab0Sopenharmony_ci * @since 12 2837777dab0Sopenharmony_ci */ 2847777dab0Sopenharmony_citypedef void (*ArkUI_GestureRecognizerDisposeNotifyCallback)(ArkUI_GestureRecognizer* recognizer, void* userData); 2857777dab0Sopenharmony_ci 2867777dab0Sopenharmony_ci/** 2877777dab0Sopenharmony_ci* @brief Checks whether a gesture is a built-in gesture of the component. 2887777dab0Sopenharmony_ci* 2897777dab0Sopenharmony_ci* @param event Indicates the pointer to the gesture interruption information. 2907777dab0Sopenharmony_ci* @return Returns <b>true</b> if the gesture is a built-in gesture; returns <b>false</b> otherwise. 2917777dab0Sopenharmony_ci 2927777dab0Sopenharmony_ci* @since 12 2937777dab0Sopenharmony_ci*/ 2947777dab0Sopenharmony_cibool OH_ArkUI_GestureInterruptInfo_GetSystemFlag(const ArkUI_GestureInterruptInfo* event); 2957777dab0Sopenharmony_ci 2967777dab0Sopenharmony_ci/** 2977777dab0Sopenharmony_ci* @brief Obtains the pointer to interrupted gesture recognizer. 2987777dab0Sopenharmony_ci* 2997777dab0Sopenharmony_ci* @param event Indicates the pointer to the gesture interruption information. 3007777dab0Sopenharmony_ci* @return Returns the pointer to interrupted gesture recognizer. 3017777dab0Sopenharmony_ci* @since 12 3027777dab0Sopenharmony_ci*/ 3037777dab0Sopenharmony_ciArkUI_GestureRecognizer* OH_ArkUI_GestureInterruptInfo_GetRecognizer(const ArkUI_GestureInterruptInfo* event); 3047777dab0Sopenharmony_ci 3057777dab0Sopenharmony_ci/** 3067777dab0Sopenharmony_ci* @brief Obtains the pointer to the interrupted gesture event. 3077777dab0Sopenharmony_ci* 3087777dab0Sopenharmony_ci* @param event Indicates the pointer to the gesture interruption information. 3097777dab0Sopenharmony_ci* @return Returns the pointer to the interrupted gesture event. 3107777dab0Sopenharmony_ci* @since 12 3117777dab0Sopenharmony_ci*/ 3127777dab0Sopenharmony_ciArkUI_GestureEvent* OH_ArkUI_GestureInterruptInfo_GetGestureEvent(const ArkUI_GestureInterruptInfo* event); 3137777dab0Sopenharmony_ci 3147777dab0Sopenharmony_ci/** 3157777dab0Sopenharmony_ci* @brief Obtains the type of the system gesture to trigger. 3167777dab0Sopenharmony_ci* 3177777dab0Sopenharmony_ci* @param event Indicates the pointer to the gesture interruption information. 3187777dab0Sopenharmony_ci* @return Returns the type of the system gesture to trigger. If the gesture to trigger is not a system gesture, 3197777dab0Sopenharmony_ci* <b>-1</b> is returned. 3207777dab0Sopenharmony_ci* @since 12 3217777dab0Sopenharmony_ci*/ 3227777dab0Sopenharmony_ciint32_t OH_ArkUI_GestureInterruptInfo_GetSystemRecognizerType(const ArkUI_GestureInterruptInfo* event); 3237777dab0Sopenharmony_ci 3247777dab0Sopenharmony_ci/** 3257777dab0Sopenharmony_ci* @brief Obtains the gesture event type. 3267777dab0Sopenharmony_ci* 3277777dab0Sopenharmony_ci* @param event Indicates the pointer to the gesture event. 3287777dab0Sopenharmony_ci* @return Returns the gesture event type. 3297777dab0Sopenharmony_ci* @since 12 3307777dab0Sopenharmony_ci*/ 3317777dab0Sopenharmony_ciArkUI_GestureEventActionType OH_ArkUI_GestureEvent_GetActionType(const ArkUI_GestureEvent* event); 3327777dab0Sopenharmony_ci 3337777dab0Sopenharmony_ci/** 3347777dab0Sopenharmony_ci* @brief Obtains gesture input. 3357777dab0Sopenharmony_ci* 3367777dab0Sopenharmony_ci* @param event Indicates the pointer to the gesture event. 3377777dab0Sopenharmony_ci* @return Returns the pointer to the input event of the gesture event. 3387777dab0Sopenharmony_ci* @since 12 3397777dab0Sopenharmony_ci*/ 3407777dab0Sopenharmony_ciconst ArkUI_UIInputEvent* OH_ArkUI_GestureEvent_GetRawInputEvent(const ArkUI_GestureEvent* event); 3417777dab0Sopenharmony_ci 3427777dab0Sopenharmony_ci/** 3437777dab0Sopenharmony_ci* @brief Obtains the number of times that a long press gesture is triggered periodically. 3447777dab0Sopenharmony_ci* 3457777dab0Sopenharmony_ci* @param event Indicates the pointer to the gesture event. 3467777dab0Sopenharmony_ci* @return Returns the number of times that the long press gesture is triggered periodically. 3477777dab0Sopenharmony_ci* @since 12 3487777dab0Sopenharmony_ci*/ 3497777dab0Sopenharmony_ciint32_t OH_ArkUI_LongPress_GetRepeatCount(const ArkUI_GestureEvent* event); 3507777dab0Sopenharmony_ci 3517777dab0Sopenharmony_ci/** 3527777dab0Sopenharmony_ci* @brief Obtains the velocity of a pan gesture along the main axis. 3537777dab0Sopenharmony_ci* 3547777dab0Sopenharmony_ci* @param event Indicates the pointer to the gesture event. 3557777dab0Sopenharmony_ci* @return Returns the velocity of the pan gesture along the main axis, in px/s. 3567777dab0Sopenharmony_ci* The value is the square root of the sum of the squares of the velocity on the x-axis and y-axis. 3577777dab0Sopenharmony_ci* @since 12 3587777dab0Sopenharmony_ci*/ 3597777dab0Sopenharmony_cifloat OH_ArkUI_PanGesture_GetVelocity(const ArkUI_GestureEvent* event); 3607777dab0Sopenharmony_ci 3617777dab0Sopenharmony_ci/** 3627777dab0Sopenharmony_ci* @brief Obtains the velocity of a pan gesture along the x-axis. 3637777dab0Sopenharmony_ci* 3647777dab0Sopenharmony_ci* @param event Indicates the pointer to the gesture event. 3657777dab0Sopenharmony_ci* @return Returns the velocity of the pan gesture along the x-axis, in px/s. 3667777dab0Sopenharmony_ci* @since 12 3677777dab0Sopenharmony_ci*/ 3687777dab0Sopenharmony_cifloat OH_ArkUI_PanGesture_GetVelocityX(const ArkUI_GestureEvent* event); 3697777dab0Sopenharmony_ci 3707777dab0Sopenharmony_ci/** 3717777dab0Sopenharmony_ci* @brief Obtains the velocity of a pan gesture along the y-axis. 3727777dab0Sopenharmony_ci* 3737777dab0Sopenharmony_ci* @param event Indicates the pointer to the gesture event. 3747777dab0Sopenharmony_ci* @return Returns the velocity of the pan gesture along the y-axis, in px/s. 3757777dab0Sopenharmony_ci* @since 12 3767777dab0Sopenharmony_ci*/ 3777777dab0Sopenharmony_cifloat OH_ArkUI_PanGesture_GetVelocityY(const ArkUI_GestureEvent* event); 3787777dab0Sopenharmony_ci 3797777dab0Sopenharmony_ci/** 3807777dab0Sopenharmony_ci* @brief Obtains the relative offset of a pan gesture along the x-axis. 3817777dab0Sopenharmony_ci* 3827777dab0Sopenharmony_ci* @param event Indicates the pointer to the gesture event. 3837777dab0Sopenharmony_ci* @return Returns the relative offset of the gesture along the x-axis, in px. 3847777dab0Sopenharmony_ci* @since 12 3857777dab0Sopenharmony_ci*/ 3867777dab0Sopenharmony_cifloat OH_ArkUI_PanGesture_GetOffsetX(const ArkUI_GestureEvent* event); 3877777dab0Sopenharmony_ci 3887777dab0Sopenharmony_ci/** 3897777dab0Sopenharmony_ci* @brief Obtains the relative offset of a pan gesture along the y-axis. 3907777dab0Sopenharmony_ci* 3917777dab0Sopenharmony_ci* @param event Indicates the pointer to the gesture event. 3927777dab0Sopenharmony_ci* @return Returns the relative offset of the gesture along the y-axis, in px. 3937777dab0Sopenharmony_ci* @since 12 3947777dab0Sopenharmony_ci*/ 3957777dab0Sopenharmony_cifloat OH_ArkUI_PanGesture_GetOffsetY(const ArkUI_GestureEvent* event); 3967777dab0Sopenharmony_ci 3977777dab0Sopenharmony_ci/** 3987777dab0Sopenharmony_ci* @brief Obtains the angle information of the swipe gesture. 3997777dab0Sopenharmony_ci* 4007777dab0Sopenharmony_ci* After a swipe gesture is recognized, a line connecting the two fingers is identified as the initial line. 4017777dab0Sopenharmony_ci* As the fingers swipe, the line between the fingers rotates. \n 4027777dab0Sopenharmony_ci* Based on the coordinates of the initial line's and current line's end points, the arc tangent function is used to 4037777dab0Sopenharmony_ci* calculate the respective included angle of the points relative to the horizontal direction \n 4047777dab0Sopenharmony_ci* by using the following formula: Rotation angle = arctan2(cy2-cy1,cx2-cx1) - arctan2(y2-y1,x2-x1). \n 4057777dab0Sopenharmony_ci* The initial line is used as the coordinate system. Values from 0 to 180 degrees represent clockwise rotation, 4067777dab0Sopenharmony_ci* while values from –180 to 0 degrees represent counterclockwise rotation. \n 4077777dab0Sopenharmony_ci* 4087777dab0Sopenharmony_ci* @param event Indicates the pointer to the gesture event. 4097777dab0Sopenharmony_ci* @return Returns the angle of the swipe gesture, which is the result obtained based on the aforementioned formula. 4107777dab0Sopenharmony_ci* @since 12 4117777dab0Sopenharmony_ci*/ 4127777dab0Sopenharmony_cifloat OH_ArkUI_SwipeGesture_GetAngle(const ArkUI_GestureEvent* event); 4137777dab0Sopenharmony_ci 4147777dab0Sopenharmony_ci/** 4157777dab0Sopenharmony_ci* @brief Obtains the average velocity of all fingers used in the swipe gesture. 4167777dab0Sopenharmony_ci* 4177777dab0Sopenharmony_ci* @param event Indicates the pointer to the gesture event. 4187777dab0Sopenharmony_ci* @return Returns the average velocity of all fingers used in the swipe gesture, in px/s. 4197777dab0Sopenharmony_ci* @since 12 4207777dab0Sopenharmony_ci*/ 4217777dab0Sopenharmony_cifloat OH_ArkUI_SwipeGesture_GetVelocity(const ArkUI_GestureEvent* event); 4227777dab0Sopenharmony_ci 4237777dab0Sopenharmony_ci/** 4247777dab0Sopenharmony_ci* @brief Obtains the angle information of a rotation gesture. 4257777dab0Sopenharmony_ci* 4267777dab0Sopenharmony_ci* @param event Indicates the pointer to the gesture event. 4277777dab0Sopenharmony_ci* @return Returns the rotation angle. 4287777dab0Sopenharmony_ci* @since 12 4297777dab0Sopenharmony_ci*/ 4307777dab0Sopenharmony_cifloat OH_ArkUI_RotationGesture_GetAngle(const ArkUI_GestureEvent* event); 4317777dab0Sopenharmony_ci 4327777dab0Sopenharmony_ci/** 4337777dab0Sopenharmony_ci* @brief Obtains the scale ratio of a pinch gesture. 4347777dab0Sopenharmony_ci* 4357777dab0Sopenharmony_ci* @param event Indicates the pointer to the gesture event. 4367777dab0Sopenharmony_ci* @return Returns the scale ratio. 4377777dab0Sopenharmony_ci* @since 12 4387777dab0Sopenharmony_ci*/ 4397777dab0Sopenharmony_cifloat OH_ArkUI_PinchGesture_GetScale(const ArkUI_GestureEvent* event); 4407777dab0Sopenharmony_ci 4417777dab0Sopenharmony_ci/** 4427777dab0Sopenharmony_ci* @brief Obtains the X coordinate of the center of the pinch gesture, in vp, 4437777dab0Sopenharmony_ci* relative to the upper left corner of the current component. 4447777dab0Sopenharmony_ci* 4457777dab0Sopenharmony_ci* @param event Indicates the pointer to the gesture event. 4467777dab0Sopenharmony_ci* @return Returns the X coordinate of the center of the pinch gesture, in vp, 4477777dab0Sopenharmony_ci* relative to the upper left corner of the current component. 4487777dab0Sopenharmony_ci* @since 12 4497777dab0Sopenharmony_ci*/ 4507777dab0Sopenharmony_cifloat OH_ArkUI_PinchGesture_GetCenterX(const ArkUI_GestureEvent* event); 4517777dab0Sopenharmony_ci 4527777dab0Sopenharmony_ci/** 4537777dab0Sopenharmony_ci* @brief Obtains the Y coordinate of the center of the pinch gesture, in vp, 4547777dab0Sopenharmony_ci* relative to the upper left corner of the current component. 4557777dab0Sopenharmony_ci* 4567777dab0Sopenharmony_ci* @param event Indicates the pointer to the gesture event. 4577777dab0Sopenharmony_ci* @return Returns the Y coordinate of the center of the pinch gesture, in vp, 4587777dab0Sopenharmony_ci* relative to the upper left corner of the current component. 4597777dab0Sopenharmony_ci* @since 12 4607777dab0Sopenharmony_ci*/ 4617777dab0Sopenharmony_cifloat OH_ArkUI_PinchGesture_GetCenterY(const ArkUI_GestureEvent* event); 4627777dab0Sopenharmony_ci 4637777dab0Sopenharmony_ci/** 4647777dab0Sopenharmony_ci* @brief Get the ARKUI component bound to the gesture. 4657777dab0Sopenharmony_ci* 4667777dab0Sopenharmony_ci* @param event gesture event. 4677777dab0Sopenharmony_ci* @return ARKUI component bound to the gesture.If Null is returned, it means event is an invalid value. 4687777dab0Sopenharmony_ci* @since 12 4697777dab0Sopenharmony_ci*/ 4707777dab0Sopenharmony_ciArkUI_NodeHandle OH_ArkUI_GestureEvent_GetNode(const ArkUI_GestureEvent* event); 4717777dab0Sopenharmony_ci 4727777dab0Sopenharmony_ci/** 4737777dab0Sopenharmony_ci* @brief Obtains information about a gesture response chain. 4747777dab0Sopenharmony_ci* 4757777dab0Sopenharmony_ci* @param event Indicates the pointer to the gesture interruption information. 4767777dab0Sopenharmony_ci* @param responseChain Indicates the pointer to an array of gesture recognizers on the response chain. 4777777dab0Sopenharmony_ci* @param count Indicates the pointer to the number of gesture recognizers on the response chain. 4787777dab0Sopenharmony_ci* @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if success. 4797777dab0Sopenharmony_ci* Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs. 4807777dab0Sopenharmony_ci* @since 12 4817777dab0Sopenharmony_ci*/ 4827777dab0Sopenharmony_ciint32_t OH_ArkUI_GetResponseRecognizersFromInterruptInfo(const ArkUI_GestureInterruptInfo* event, 4837777dab0Sopenharmony_ci ArkUI_GestureRecognizerHandleArray* responseChain, int32_t* count); 4847777dab0Sopenharmony_ci 4857777dab0Sopenharmony_ci/** 4867777dab0Sopenharmony_ci* @brief Sets the enabled state of a gesture recognizer. 4877777dab0Sopenharmony_ci* 4887777dab0Sopenharmony_ci* @param recognizer Indicates the pointer to a gesture recognizer. 4897777dab0Sopenharmony_ci* @param enabled Indicates the enabled state. 4907777dab0Sopenharmony_ci* @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if success. 4917777dab0Sopenharmony_ci* Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs. 4927777dab0Sopenharmony_ci* @since 12 4937777dab0Sopenharmony_ci*/ 4947777dab0Sopenharmony_ciint32_t OH_ArkUI_SetGestureRecognizerEnabled(ArkUI_GestureRecognizer* recognizer, bool enabled); 4957777dab0Sopenharmony_ci 4967777dab0Sopenharmony_ci/** 4977777dab0Sopenharmony_ci* @brief Obtains the enabled state of a gesture recognizer. 4987777dab0Sopenharmony_ci* 4997777dab0Sopenharmony_ci* @param recognizer Indicates the pointer to a gesture recognizer. 5007777dab0Sopenharmony_ci* @return Returns <b>true</b> if the gesture recognizer is enabled. 5017777dab0Sopenharmony_ci* Returns <b>false</b> if the gesture recognizer is disabled. 5027777dab0Sopenharmony_ci* @since 12 5037777dab0Sopenharmony_ci*/ 5047777dab0Sopenharmony_cibool OH_ArkUI_GetGestureRecognizerEnabled(ArkUI_GestureRecognizer* recognizer); 5057777dab0Sopenharmony_ci 5067777dab0Sopenharmony_ci/** 5077777dab0Sopenharmony_ci* @brief Obtains the state of a gesture recognizer. 5087777dab0Sopenharmony_ci* 5097777dab0Sopenharmony_ci* @param recognizer Indicates the pointer to a gesture recognizer. 5107777dab0Sopenharmony_ci* @param state Indicates the pointer to the state of the gesture recognizer. 5117777dab0Sopenharmony_ci* @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if success. 5127777dab0Sopenharmony_ci* Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs. 5137777dab0Sopenharmony_ci* @since 12 5147777dab0Sopenharmony_ci*/ 5157777dab0Sopenharmony_ciint32_t OH_ArkUI_GetGestureRecognizerState(ArkUI_GestureRecognizer* recognizer, ArkUI_GestureRecognizerState* state); 5167777dab0Sopenharmony_ci 5177777dab0Sopenharmony_ci/** 5187777dab0Sopenharmony_ci* @brief Obtains the information about a gesture event target. 5197777dab0Sopenharmony_ci* 5207777dab0Sopenharmony_ci* @param recognizer Indicates the pointer to a gesture recognizer. 5217777dab0Sopenharmony_ci* @param info Indicates the information about a gesture event target. 5227777dab0Sopenharmony_ci* @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if success. 5237777dab0Sopenharmony_ci* Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs. 5247777dab0Sopenharmony_ci* @since 12 5257777dab0Sopenharmony_ci*/ 5267777dab0Sopenharmony_ciint32_t OH_ArkUI_GetGestureEventTargetInfo(ArkUI_GestureRecognizer* recognizer, ArkUI_GestureEventTargetInfo** info); 5277777dab0Sopenharmony_ci 5287777dab0Sopenharmony_ci/** 5297777dab0Sopenharmony_ci* @brief Obtains whether this scroll container is scrolled to the top. 5307777dab0Sopenharmony_ci* 5317777dab0Sopenharmony_ci* @param info Indicates the information about a gesture event target. 5327777dab0Sopenharmony_ci* @param ret Indicates whether the scroll container is scrolled to the top. 5337777dab0Sopenharmony_ci* @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if success. 5347777dab0Sopenharmony_ci* Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs. 5357777dab0Sopenharmony_ci* Returns {@link ARKUI_ERROR_CODE_NON_SCROLLABLE_CONTAINER} if the component is not a scroll container. 5367777dab0Sopenharmony_ci* @since 12 5377777dab0Sopenharmony_ci*/ 5387777dab0Sopenharmony_ciint32_t OH_ArkUI_GestureEventTargetInfo_IsScrollBegin(ArkUI_GestureEventTargetInfo* info, bool* ret); 5397777dab0Sopenharmony_ci 5407777dab0Sopenharmony_ci/** 5417777dab0Sopenharmony_ci* @brief Obtains whether this scroll container is scrolled to the bottom. 5427777dab0Sopenharmony_ci* 5437777dab0Sopenharmony_ci* @param info Indicates the information about a gesture event target. 5447777dab0Sopenharmony_ci* @param ret Indicates whether the scroll container is scrolled to the bottom. 5457777dab0Sopenharmony_ci* @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if success. 5467777dab0Sopenharmony_ci* Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs. 5477777dab0Sopenharmony_ci* Returns {@link ARKUI_ERROR_CODE_NON_SCROLLABLE_CONTAINER} if the component is not a scroll container. 5487777dab0Sopenharmony_ci* @since 12 5497777dab0Sopenharmony_ci*/ 5507777dab0Sopenharmony_ciint32_t OH_ArkUI_GestureEventTargetInfo_IsScrollEnd(ArkUI_GestureEventTargetInfo* info, bool* ret); 5517777dab0Sopenharmony_ci 5527777dab0Sopenharmony_ci/** 5537777dab0Sopenharmony_ci* @brief Obtains the direction of a pan gesture. 5547777dab0Sopenharmony_ci* 5557777dab0Sopenharmony_ci* @param recognizer Indicates the pointer to a gesture recognizer. 5567777dab0Sopenharmony_ci* @param directionMask Indicates the pan direction. 5577777dab0Sopenharmony_ci* @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if success. 5587777dab0Sopenharmony_ci* Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs. 5597777dab0Sopenharmony_ci* @since 12 5607777dab0Sopenharmony_ci*/ 5617777dab0Sopenharmony_ciint32_t OH_ArkUI_GetPanGestureDirectionMask(ArkUI_GestureRecognizer* recognizer, 5627777dab0Sopenharmony_ci ArkUI_GestureDirectionMask* directionMask); 5637777dab0Sopenharmony_ci 5647777dab0Sopenharmony_ci/** 5657777dab0Sopenharmony_ci* @brief Obtains whether a gesture is a built-in gesture. 5667777dab0Sopenharmony_ci* 5677777dab0Sopenharmony_ci* @param recognizer Indicates the pointer to a gesture recognizer. 5687777dab0Sopenharmony_ci* @return Returns <b>true</b> if the gesture is a built-in gesture; returns <b>false</b> otherwise. 5697777dab0Sopenharmony_ci* @since 12 5707777dab0Sopenharmony_ci*/ 5717777dab0Sopenharmony_cibool OH_ArkUI_IsBuiltInGesture(ArkUI_GestureRecognizer* recognizer); 5727777dab0Sopenharmony_ci 5737777dab0Sopenharmony_ci/** 5747777dab0Sopenharmony_ci* @brief Obtains the tag of a gesture recognizer. 5757777dab0Sopenharmony_ci* 5767777dab0Sopenharmony_ci* @param recognizer Indicates the pointer to a gesture recognizer. 5777777dab0Sopenharmony_ci* @param buffer Indicates the buffer. 5787777dab0Sopenharmony_ci* @param bufferSize Indicates the buffer size. 5797777dab0Sopenharmony_ci* @param result Indicates the length of the string to be written to the buffer. 5807777dab0Sopenharmony_ci* @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if success. 5817777dab0Sopenharmony_ci* Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs. 5827777dab0Sopenharmony_ci* Returns {@link ARKUI_ERROR_CODE_BUFFER_SIZE_NOT_ENOUGH} if the buffer is not large enough. 5837777dab0Sopenharmony_ci* @since 12 5847777dab0Sopenharmony_ci*/ 5857777dab0Sopenharmony_ciint32_t OH_ArkUI_GetGestureTag(ArkUI_GestureRecognizer* recognizer, char* buffer, int32_t bufferSize, int32_t* result); 5867777dab0Sopenharmony_ci 5877777dab0Sopenharmony_ci/** 5887777dab0Sopenharmony_ci* @brief Obtains the ID of the component linked to a gesture recognizer. 5897777dab0Sopenharmony_ci* 5907777dab0Sopenharmony_ci* @param recognizer Indicates the pointer to a gesture recognizer. 5917777dab0Sopenharmony_ci* @param nodeId Indicates the component ID. 5927777dab0Sopenharmony_ci* @param size Indicates the buffer size. 5937777dab0Sopenharmony_ci* @param result Indicates the length of the string to be written to the buffer. 5947777dab0Sopenharmony_ci* @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if success. 5957777dab0Sopenharmony_ci* Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs. 5967777dab0Sopenharmony_ci* Returns {@link ARKUI_ERROR_CODE_BUFFER_SIZE_NOT_ENOUGH} if the buffer is not large enough. 5977777dab0Sopenharmony_ci* @since 12 5987777dab0Sopenharmony_ci*/ 5997777dab0Sopenharmony_ciint32_t OH_ArkUI_GetGestureBindNodeId(ArkUI_GestureRecognizer* recognizer, char* nodeId, int32_t size, 6007777dab0Sopenharmony_ci int32_t* result); 6017777dab0Sopenharmony_ci 6027777dab0Sopenharmony_ci/** 6037777dab0Sopenharmony_ci* @brief Obtains whether a gesture recognizer is valid. 6047777dab0Sopenharmony_ci* 6057777dab0Sopenharmony_ci* @param recognizer Indicates the pointer to a gesture recognizer. 6067777dab0Sopenharmony_ci* @return Returns <b>true</b> if the gesture recognizer is valid. 6077777dab0Sopenharmony_ci* Returns <b>false</b> if the gesture recognizer is invalid. 6087777dab0Sopenharmony_ci* @since 12 6097777dab0Sopenharmony_ci*/ 6107777dab0Sopenharmony_cibool OH_ArkUI_IsGestureRecognizerValid(ArkUI_GestureRecognizer* recognizer); 6117777dab0Sopenharmony_ci 6127777dab0Sopenharmony_ci/** 6137777dab0Sopenharmony_ci* @brief Obtains custom data in the parallel internal gesture event. 6147777dab0Sopenharmony_ci* 6157777dab0Sopenharmony_ci* @param event Indicates the pointer to a parallel internal gesture event. 6167777dab0Sopenharmony_ci* @return Returns the pointer to custom data. 6177777dab0Sopenharmony_ci* @since 12 6187777dab0Sopenharmony_ci*/ 6197777dab0Sopenharmony_civoid* OH_ArkUI_ParallelInnerGestureEvent_GetUserData(ArkUI_ParallelInnerGestureEvent* event); 6207777dab0Sopenharmony_ci 6217777dab0Sopenharmony_ci/** 6227777dab0Sopenharmony_ci* @brief Obtains the current gesture recognizer in a parallel internal gesture event. 6237777dab0Sopenharmony_ci* 6247777dab0Sopenharmony_ci* @param event Indicates the pointer to a parallel internal gesture event. 6257777dab0Sopenharmony_ci* @return Returns the pointer to the current gesture recognizer. 6267777dab0Sopenharmony_ci* @since 12 6277777dab0Sopenharmony_ci*/ 6287777dab0Sopenharmony_ciArkUI_GestureRecognizer* OH_ArkUI_ParallelInnerGestureEvent_GetCurrentRecognizer( 6297777dab0Sopenharmony_ci ArkUI_ParallelInnerGestureEvent* event); 6307777dab0Sopenharmony_ci 6317777dab0Sopenharmony_ci/** 6327777dab0Sopenharmony_ci* @brief Obtains the conflicting gesture recognizers in a parallel internal gesture event. 6337777dab0Sopenharmony_ci* 6347777dab0Sopenharmony_ci* @param event Indicates the pointer to a parallel internal gesture event. 6357777dab0Sopenharmony_ci* @param array Indicates the pointer to the array of conflicting gesture recognizers. 6367777dab0Sopenharmony_ci* @param size Indicates the size of the array of conflicting gesture recognizers. 6377777dab0Sopenharmony_ci* @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if success. 6387777dab0Sopenharmony_ci* Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs. 6397777dab0Sopenharmony_ci* @since 12 6407777dab0Sopenharmony_ci*/ 6417777dab0Sopenharmony_ciint32_t OH_ArkUI_ParallelInnerGestureEvent_GetConflictRecognizers(ArkUI_ParallelInnerGestureEvent* event, 6427777dab0Sopenharmony_ci ArkUI_GestureRecognizerHandleArray* array, int32_t* size); 6437777dab0Sopenharmony_ci 6447777dab0Sopenharmony_ci/** 6457777dab0Sopenharmony_ci* @brief Sets a callback function for notifying gesture recognizer destruction. 6467777dab0Sopenharmony_ci* 6477777dab0Sopenharmony_ci* @param recognizer Indicates the pointer to a gesture recognizer. 6487777dab0Sopenharmony_ci* @param callback Indicates the callback function for notifying gesture recognizer destruction. 6497777dab0Sopenharmony_ci* @param userData Indicates the custom data. 6507777dab0Sopenharmony_ci* @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if success. 6517777dab0Sopenharmony_ci* Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs. 6527777dab0Sopenharmony_ci*/ 6537777dab0Sopenharmony_ciint32_t OH_ArkUI_SetArkUIGestureRecognizerDisposeNotify(ArkUI_GestureRecognizer* recognizer, 6547777dab0Sopenharmony_ci ArkUI_GestureRecognizerDisposeNotifyCallback callback, void* userData); 6557777dab0Sopenharmony_ci 6567777dab0Sopenharmony_ci/** 6577777dab0Sopenharmony_ci * @brief Defines the gesture APIs. 6587777dab0Sopenharmony_ci * 6597777dab0Sopenharmony_ci * @since 12 6607777dab0Sopenharmony_ci */ 6617777dab0Sopenharmony_citypedef struct { 6627777dab0Sopenharmony_ci /** The struct version is 1. */ 6637777dab0Sopenharmony_ci int32_t version; 6647777dab0Sopenharmony_ci 6657777dab0Sopenharmony_ci /** 6667777dab0Sopenharmony_ci * @brief Creates a tap gesture. 6677777dab0Sopenharmony_ci * 6687777dab0Sopenharmony_ci * 1. This API is used to trigger a tap gesture with one, two, or more taps. \n 6697777dab0Sopenharmony_ci * 2. If multi-tap is configured, the timeout interval between a lift and the next tap is 300 ms. \n 6707777dab0Sopenharmony_ci * 3. If the distance between the last tapped position and the current tapped position exceeds 60 vp, 6717777dab0Sopenharmony_ci * gesture recognition fails. \n 6727777dab0Sopenharmony_ci * 4. If the value is greater than 1, the tap gesture will fail to be recognized when the number of fingers 6737777dab0Sopenharmony_ci * touching the screen within 300 ms of the first finger touch is less than the required number, \n 6747777dab0Sopenharmony_ci * or when the number of fingers lifted from the screen within 300 ms of the first finger's being lifted 6757777dab0Sopenharmony_ci * is less than the required number. \n 6767777dab0Sopenharmony_ci * 5. When the number of fingers touching the screen exceeds the set value, the gesture can be recognized. \n 6777777dab0Sopenharmony_ci * 6787777dab0Sopenharmony_ci * @param countNum Indicates the number of consecutive taps. If the value is less than 1 or is not set, 6797777dab0Sopenharmony_ci * the default value <b>1</b> is used. 6807777dab0Sopenharmony_ci * @param fingersNum Indicates the number of fingers required to trigger a tap. The value ranges 6817777dab0Sopenharmony_ci * from 1 to 10. If the value is less than 1 or is not set, the default value <b>1</b> is used. 6827777dab0Sopenharmony_ci * @return Returns the pointer to the created gesture. 6837777dab0Sopenharmony_ci */ 6847777dab0Sopenharmony_ci ArkUI_GestureRecognizer* (*createTapGesture)(int32_t countNum, int32_t fingersNum); 6857777dab0Sopenharmony_ci 6867777dab0Sopenharmony_ci /** 6877777dab0Sopenharmony_ci * @brief Creates a long press gesture. 6887777dab0Sopenharmony_ci * 6897777dab0Sopenharmony_ci * 1. This API is used to trigger a long press gesture, which requires one or more fingers with a minimum 6907777dab0Sopenharmony_ci * The value ranges 500 ms hold-down time. \n 6917777dab0Sopenharmony_ci * 2. In components that support drag actions by default, such as <b><Text></b>, <b><TextInput></b>, 6927777dab0Sopenharmony_ci * <b><TextArea></b>, <b><Hyperlink></b>, <b><Image></b>, and <b>RichEditor></b>, the long press gesture \n 6937777dab0Sopenharmony_ci * may conflict with the drag action. If this occurs, they are handled as follows: \n 6947777dab0Sopenharmony_ci * If the minimum duration of the long press gesture is less than 500 ms, the long press gesture receives 6957777dab0Sopenharmony_ci * a higher response priority than the drag action. \n 6967777dab0Sopenharmony_ci * If the minimum duration of the long press gesture is greater than or equal to 500 ms, 6977777dab0Sopenharmony_ci * the drag action receives a higher response priority than the long press gesture. \n 6987777dab0Sopenharmony_ci * 3. If a finger moves more than 15 px after being pressed, the gesture recognition fails. \n 6997777dab0Sopenharmony_ci * 7007777dab0Sopenharmony_ci * @param fingersNum Indicates the minimum number of fingers to trigger a long press gesture. 7017777dab0Sopenharmony_ci * The value ranges from 1 to 10. 7027777dab0Sopenharmony_ci * @param repeatResult Indicates whether to continuously trigger the event callback. 7037777dab0Sopenharmony_ci * @param durationNum Indicates the minimum hold-down time, in ms. 7047777dab0Sopenharmony_ci * If the value is less than or equal to 0, the default value <b>500</b> is used. 7057777dab0Sopenharmony_ci * @return Returns the pointer to the created gesture. 7067777dab0Sopenharmony_ci */ 7077777dab0Sopenharmony_ci ArkUI_GestureRecognizer* (*createLongPressGesture)(int32_t fingersNum, bool repeatResult, int32_t durationNum); 7087777dab0Sopenharmony_ci 7097777dab0Sopenharmony_ci /** 7107777dab0Sopenharmony_ci * @brief Creates a pan gesture. 7117777dab0Sopenharmony_ci * 7127777dab0Sopenharmony_ci * 1. This API is used to trigger a pan gesture when the movement distance of a finger on the screen exceeds 7137777dab0Sopenharmony_ci * the minimum value. \n 7147777dab0Sopenharmony_ci * 2. If a pan gesture and a tab swipe occur at the same time, set <b>distanceNum</b> to <b>1</b> 7157777dab0Sopenharmony_ci * so that the gesture can be more easily recognized. \n 7167777dab0Sopenharmony_ci * 7177777dab0Sopenharmony_ci * @param fingersNum Indicates the minimum number of fingers to trigger a pan gesture. The value ranges from 1 to 10. 7187777dab0Sopenharmony_ci * If the value is less than 1 or is not set, the default value <b>1</b> is used. 7197777dab0Sopenharmony_ci * @param directions Indicates the pan direction. The value supports the AND (&) and OR (\|) operations. 7207777dab0Sopenharmony_ci * @param distanceNum Indicates the minimum pan distance to trigger the gesture, in vp. If this parameter is 7217777dab0Sopenharmony_ci * set to a value less than or equal to 0, the default value <b>5</b> is used. 7227777dab0Sopenharmony_ci * @return Returns the pointer to the created gesture. 7237777dab0Sopenharmony_ci */ 7247777dab0Sopenharmony_ci ArkUI_GestureRecognizer* (*createPanGesture)( 7257777dab0Sopenharmony_ci int32_t fingersNum, ArkUI_GestureDirectionMask directions, double distanceNum); 7267777dab0Sopenharmony_ci 7277777dab0Sopenharmony_ci /** 7287777dab0Sopenharmony_ci * @brief Creates a pinch gesture. 7297777dab0Sopenharmony_ci * 7307777dab0Sopenharmony_ci * 1. This API is used to trigger a pinch gesture, which requires two to five fingers with a minimum 5 vp 7317777dab0Sopenharmony_ci * distance between the fingers. \n 7327777dab0Sopenharmony_ci * 2. While more fingers than the minimum number can be pressed to trigger the gesture, only the first 7337777dab0Sopenharmony_ci * fingers of the minimum number participate in gesture calculation. \n 7347777dab0Sopenharmony_ci * 7357777dab0Sopenharmony_ci * @param fingersNum Indicates the minimum number of fingers to trigger a pinch. The value ranges from 2 to 5. 7367777dab0Sopenharmony_ci * Default value: <b>2</b> 7377777dab0Sopenharmony_ci * @param distanceNum Indicates the minimum recognition distance, in px. If this parameter is set to a value less 7387777dab0Sopenharmony_ci * than or equal to 0, the default value <b>5</b> is used. 7397777dab0Sopenharmony_ci * @return Returns the pointer to the created gesture. 7407777dab0Sopenharmony_ci */ 7417777dab0Sopenharmony_ci ArkUI_GestureRecognizer* (*createPinchGesture)(int32_t fingersNum, double distanceNum); 7427777dab0Sopenharmony_ci 7437777dab0Sopenharmony_ci /** 7447777dab0Sopenharmony_ci * @brief Creates a rotation gesture. 7457777dab0Sopenharmony_ci * 7467777dab0Sopenharmony_ci * 1. This API is used to trigger a rotation gesture, which requires two to five fingers with a 7477777dab0Sopenharmony_ci * minimum 1-degree rotation angle. \n 7487777dab0Sopenharmony_ci * 2. While more fingers than the minimum number can be pressed to trigger the gesture, only the first 7497777dab0Sopenharmony_ci * two fingers participate in gesture calculation. \n 7507777dab0Sopenharmony_ci * 7517777dab0Sopenharmony_ci * @param fingersNum Indicates the minimum number of fingers to trigger a rotation. The value ranges from 2 to 5. 7527777dab0Sopenharmony_ci * Default value: <b>2</b> 7537777dab0Sopenharmony_ci * @param angleNum Indicates the minimum degree that can trigger the rotation gesture. Default value: <b>1</b> 7547777dab0Sopenharmony_ci * If this parameter is set to a value less than or equal to 0 or greater than 360, 7557777dab0Sopenharmony_ci * the default value <b>1</b> is used. 7567777dab0Sopenharmony_ci * @return Returns the pointer to the created gesture. 7577777dab0Sopenharmony_ci */ 7587777dab0Sopenharmony_ci ArkUI_GestureRecognizer* (*createRotationGesture)(int32_t fingersNum, double angleNum); 7597777dab0Sopenharmony_ci 7607777dab0Sopenharmony_ci /** 7617777dab0Sopenharmony_ci * @brief Creates a swipe gesture. 7627777dab0Sopenharmony_ci * 7637777dab0Sopenharmony_ci * This API is used to implement a swipe gesture, which can be recognized when the swipe speed is 100 7647777dab0Sopenharmony_ci * vp/s or higher. \n 7657777dab0Sopenharmony_ci * 7667777dab0Sopenharmony_ci * @param fingersNum Indicates the minimum number of fingers to trigger a swipe gesture. 7677777dab0Sopenharmony_ci * The value ranges from 1 to 10. 7687777dab0Sopenharmony_ci * @param directions Indicates the swipe direction. 7697777dab0Sopenharmony_ci * @param speedNum Indicates the minimum speed of the swipe gesture, in px/s. 7707777dab0Sopenharmony_ci * If this parameter is set to a value less than or equal to 0, the default value <b>100</b> is used. 7717777dab0Sopenharmony_ci * @return Returns the pointer to the created gesture. 7727777dab0Sopenharmony_ci */ 7737777dab0Sopenharmony_ci ArkUI_GestureRecognizer* (*createSwipeGesture)( 7747777dab0Sopenharmony_ci int32_t fingersNum, ArkUI_GestureDirectionMask directions, double speedNum); 7757777dab0Sopenharmony_ci 7767777dab0Sopenharmony_ci /** 7777777dab0Sopenharmony_ci * @brief Creates a gesture group. 7787777dab0Sopenharmony_ci * 7797777dab0Sopenharmony_ci * @param gestureMode Indicates the gesture group mode. 7807777dab0Sopenharmony_ci * @return Returns the pointer to the created gesture group. 7817777dab0Sopenharmony_ci */ 7827777dab0Sopenharmony_ci ArkUI_GestureRecognizer* (*createGroupGesture)(ArkUI_GroupGestureMode gestureMode); 7837777dab0Sopenharmony_ci 7847777dab0Sopenharmony_ci /** 7857777dab0Sopenharmony_ci * @brief Disposes a gesture to release resources. 7867777dab0Sopenharmony_ci * 7877777dab0Sopenharmony_ci * @param recognizer Indicates the pointer to the gesture to dispose. 7887777dab0Sopenharmony_ci */ 7897777dab0Sopenharmony_ci void (*dispose)(ArkUI_GestureRecognizer* recognizer); 7907777dab0Sopenharmony_ci 7917777dab0Sopenharmony_ci /** 7927777dab0Sopenharmony_ci * @brief Adds a gesture to a gesture group. 7937777dab0Sopenharmony_ci * 7947777dab0Sopenharmony_ci * @param group Indicates the pointer to the gesture group. 7957777dab0Sopenharmony_ci * @param child Indicates the gesture to be added to the gesture group. 7967777dab0Sopenharmony_ci * @return Returns <b>0</b> if success. 7977777dab0Sopenharmony_ci * Returns <b>401</b> if a parameter exception occurs. Returns 401 if a parameter exception occurs. 7987777dab0Sopenharmony_ci */ 7997777dab0Sopenharmony_ci int32_t (*addChildGesture)(ArkUI_GestureRecognizer* group, ArkUI_GestureRecognizer* child); 8007777dab0Sopenharmony_ci 8017777dab0Sopenharmony_ci /** 8027777dab0Sopenharmony_ci * @brief Removes a gesture to a gesture group. 8037777dab0Sopenharmony_ci * 8047777dab0Sopenharmony_ci * @param group Indicates the pointer to the gesture group. 8057777dab0Sopenharmony_ci * @param child Indicates the gesture to be removed to the gesture group. 8067777dab0Sopenharmony_ci * @return Returns <b>0</b> if success. 8077777dab0Sopenharmony_ci * Returns <b>401</b> if a parameter exception occurs. 8087777dab0Sopenharmony_ci */ 8097777dab0Sopenharmony_ci int32_t (*removeChildGesture)(ArkUI_GestureRecognizer* group, ArkUI_GestureRecognizer* child); 8107777dab0Sopenharmony_ci 8117777dab0Sopenharmony_ci /** 8127777dab0Sopenharmony_ci * @brief Registers a callback for gestures. 8137777dab0Sopenharmony_ci * 8147777dab0Sopenharmony_ci * @param recognizer Indicates the pointer to the gesture recognizer. 8157777dab0Sopenharmony_ci * @param actionTypeMask Indicates the set of gesture event types. Multiple callbacks can be registered at once, 8167777dab0Sopenharmony_ci * with the callback event types distinguished in the callbacks. 8177777dab0Sopenharmony_ci * Example: actionTypeMask = GESTURE_EVENT_ACTION_ACCEPT | GESTURE_EVENT_ACTION_UPDATE; 8187777dab0Sopenharmony_ci * @param extraParams Indicates the context passed in the <b>targetReceiver</b> callback. 8197777dab0Sopenharmony_ci * @param targetReceiver Indicates the callback to register for processing the gesture event types. 8207777dab0Sopenharmony_ci * <b>event</b> indicates the gesture callback data. 8217777dab0Sopenharmony_ci * @return Returns <b>0</b> if success. 8227777dab0Sopenharmony_ci * Returns <b>401</b> if a parameter exception occurs. 8237777dab0Sopenharmony_ci */ 8247777dab0Sopenharmony_ci int32_t (*setGestureEventTarget)( 8257777dab0Sopenharmony_ci ArkUI_GestureRecognizer* recognizer, ArkUI_GestureEventActionTypeMask actionTypeMask, void* extraParams, 8267777dab0Sopenharmony_ci void (*targetReceiver)(ArkUI_GestureEvent* event, void* extraParams)); 8277777dab0Sopenharmony_ci 8287777dab0Sopenharmony_ci /** 8297777dab0Sopenharmony_ci * @brief Adds a gesture to a UI component. 8307777dab0Sopenharmony_ci * 8317777dab0Sopenharmony_ci * @param node Indicates the UI component to which you want to add the gesture. 8327777dab0Sopenharmony_ci * @param recognizer Indicates the gesture to be added to the UI component. 8337777dab0Sopenharmony_ci * @param mode Indicates the gesture event mode. Available options are <b>NORMAL_GESTURE</b>, 8347777dab0Sopenharmony_ci * <b>PARALLEL_GESTURE</b>, and <b>PRIORITY_GESTURE</b>. 8357777dab0Sopenharmony_ci * @param mask Indicates the gesture masking mode. 8367777dab0Sopenharmony_ci * @return Returns <b>0</b> if success. 8377777dab0Sopenharmony_ci * Returns <b>401</b> if a parameter exception occurs. 8387777dab0Sopenharmony_ci */ 8397777dab0Sopenharmony_ci int32_t (*addGestureToNode)( 8407777dab0Sopenharmony_ci ArkUI_NodeHandle node, ArkUI_GestureRecognizer* recognizer, ArkUI_GesturePriority mode, ArkUI_GestureMask mask); 8417777dab0Sopenharmony_ci 8427777dab0Sopenharmony_ci /** 8437777dab0Sopenharmony_ci * @brief Removes a gesture from a node. 8447777dab0Sopenharmony_ci * 8457777dab0Sopenharmony_ci * @param node Indicates the node from which you want to remove the gesture. 8467777dab0Sopenharmony_ci * @param recognizer Indicates the gesture to be removed. 8477777dab0Sopenharmony_ci * @return Returns <b>0</b> if success. 8487777dab0Sopenharmony_ci * Returns <b>401</b> if a parameter exception occurs. 8497777dab0Sopenharmony_ci */ 8507777dab0Sopenharmony_ci int32_t (*removeGestureFromNode)(ArkUI_NodeHandle node, ArkUI_GestureRecognizer* recognizer); 8517777dab0Sopenharmony_ci 8527777dab0Sopenharmony_ci /** 8537777dab0Sopenharmony_ci * @brief Sets a gesture interruption callback for a node. 8547777dab0Sopenharmony_ci * 8557777dab0Sopenharmony_ci * @param node Indicates the node for which you want to set a gesture interruption callback. 8567777dab0Sopenharmony_ci * @param interrupter Indicates the gesture interruption callback to set. 8577777dab0Sopenharmony_ci * <b>info</b> indicates the gesture interruption data. If <b>interrupter</b> returns 8587777dab0Sopenharmony_ci * <b>GESTURE_INTERRUPT_RESULT_CONTINUE</b>, the gesture recognition process continues. If it returns 8597777dab0Sopenharmony_ci * <b>GESTURE_INTERRUPT_RESULT_REJECT</b>, the gesture recognition process is paused. 8607777dab0Sopenharmony_ci * @return Returns <b>0</b> if success. 8617777dab0Sopenharmony_ci * Returns <b>401</b> if a parameter exception occurs. 8627777dab0Sopenharmony_ci */ 8637777dab0Sopenharmony_ci int32_t (*setGestureInterrupterToNode)( 8647777dab0Sopenharmony_ci ArkUI_NodeHandle node, ArkUI_GestureInterruptResult (*interrupter)(ArkUI_GestureInterruptInfo* info)); 8657777dab0Sopenharmony_ci 8667777dab0Sopenharmony_ci /** 8677777dab0Sopenharmony_ci * @brief Obtains the type of a gesture. 8687777dab0Sopenharmony_ci * 8697777dab0Sopenharmony_ci * @param recognizer Indicates the pointer to the gesture. 8707777dab0Sopenharmony_ci * @return Returns the gesture type. 8717777dab0Sopenharmony_ci */ 8727777dab0Sopenharmony_ci ArkUI_GestureRecognizerType (*getGestureType)(ArkUI_GestureRecognizer* recognizer); 8737777dab0Sopenharmony_ci 8747777dab0Sopenharmony_ci /** 8757777dab0Sopenharmony_ci * @brief Sets the callback function for a parallel internal gesture event. 8767777dab0Sopenharmony_ci * 8777777dab0Sopenharmony_ci * @param node Indicates the ArkUI node for which the callback of a parallel internal gesture event is to be set. 8787777dab0Sopenharmony_ci * @param userData Indicates the custom data. 8797777dab0Sopenharmony_ci * @param parallelInnerGesture Indicates the parallel internal gesture event. <b>event</b> returns the data of the 8807777dab0Sopenharmony_ci * parallel internal gesture event; <b>parallelInnerGesture</b> returns the pointer to the gesture recognizer 8817777dab0Sopenharmony_ci * that requires parallel recognition. 8827777dab0Sopenharmony_ci * @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if success. 8837777dab0Sopenharmony_ci * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs. 8847777dab0Sopenharmony_ci */ 8857777dab0Sopenharmony_ci int32_t (*setInnerGestureParallelTo)( 8867777dab0Sopenharmony_ci ArkUI_NodeHandle node, void* userData, ArkUI_GestureRecognizer* (*parallelInnerGesture)( 8877777dab0Sopenharmony_ci ArkUI_ParallelInnerGestureEvent* event)); 8887777dab0Sopenharmony_ci 8897777dab0Sopenharmony_ci /** 8907777dab0Sopenharmony_ci * @brief Creates a tap gesture that is subject to distance restrictions. 8917777dab0Sopenharmony_ci * 8927777dab0Sopenharmony_ci * 1. This API is used to trigger a tap gesture with one, two, or more taps. \n 8937777dab0Sopenharmony_ci * 2. If multi-tap is configured, the timeout interval between a lift and the next tap is 300 ms. \n 8947777dab0Sopenharmony_ci * 3. If the distance between the last tapped position and the current tapped position exceeds 60 vp, 8957777dab0Sopenharmony_ci * gesture recognition fails. \n 8967777dab0Sopenharmony_ci * 4. If the value is greater than 1, the tap gesture will fail to be recognized when the number of fingers 8977777dab0Sopenharmony_ci * touching the screen within 300 ms of the first finger touch is less than the required number, 8987777dab0Sopenharmony_ci * or when the number of fingers lifted from the screen within 300 ms of the first finger's being lifted 8997777dab0Sopenharmony_ci * is less than the required number. \n 9007777dab0Sopenharmony_ci * 5. When the number of fingers touching the screen exceeds the set value, the gesture can be recognized. \n 9017777dab0Sopenharmony_ci * 6. If the finger moves beyond the preset distance limit, gesture recognition fails. \n 9027777dab0Sopenharmony_ci * 9037777dab0Sopenharmony_ci * @param countNum Indicates the number of consecutive taps. If the value is less than 1 or is not set, the default 9047777dab0Sopenharmony_ci * value <b>1</b> is used. 9057777dab0Sopenharmony_ci * @param fingersNum Indicates the number of fingers required to trigger a tap. The value ranges from 1 to 10. 9067777dab0Sopenharmony_ci * If the value is less than 1 or is not set, the default value <b>1</b> is used. 9077777dab0Sopenharmony_ci * @param distanceThreshold Indicates the allowed moving distance of a finger. 9087777dab0Sopenharmony_ci * If the value is less than 0 or is not set, it will be converted to the default value of infinity. 9097777dab0Sopenharmony_ci * @return Returns the pointer to the created gesture. 9107777dab0Sopenharmony_ci */ 9117777dab0Sopenharmony_ci ArkUI_GestureRecognizer* (*createTapGestureWithDistanceThreshold)( 9127777dab0Sopenharmony_ci int32_t countNum, int32_t fingersNum, double distanceThreshold); 9137777dab0Sopenharmony_ci} ArkUI_NativeGestureAPI_1; 9147777dab0Sopenharmony_ci 9157777dab0Sopenharmony_ci#ifdef __cplusplus 9167777dab0Sopenharmony_ci}; 9177777dab0Sopenharmony_ci#endif 9187777dab0Sopenharmony_ci 9197777dab0Sopenharmony_ci#endif // ARKUI_NATIVE_GESTTURE_H 9207777dab0Sopenharmony_ci/** @} */ 921