123b3eb3cSopenharmony_ci/* 223b3eb3cSopenharmony_ci * Copyright (c) 2024 Huawei Device Co., Ltd. 323b3eb3cSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 423b3eb3cSopenharmony_ci * you may not use this file except in compliance with the License. 523b3eb3cSopenharmony_ci * You may obtain a copy of the License at 623b3eb3cSopenharmony_ci * 723b3eb3cSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 823b3eb3cSopenharmony_ci * 923b3eb3cSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1023b3eb3cSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1123b3eb3cSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1223b3eb3cSopenharmony_ci * See the License for the specific language governing permissions and 1323b3eb3cSopenharmony_ci * limitations under the License. 1423b3eb3cSopenharmony_ci */ 1523b3eb3cSopenharmony_ci 1623b3eb3cSopenharmony_ci/** 1723b3eb3cSopenharmony_ci * @addtogroup ArkUI_NativeModule 1823b3eb3cSopenharmony_ci * @{ 1923b3eb3cSopenharmony_ci * 2023b3eb3cSopenharmony_ci * @brief Defines APIs for ArkUI to register gesture callbacks on the native side. 2123b3eb3cSopenharmony_ci * 2223b3eb3cSopenharmony_ci * @since 12 2323b3eb3cSopenharmony_ci */ 2423b3eb3cSopenharmony_ci 2523b3eb3cSopenharmony_ci/** 2623b3eb3cSopenharmony_ci * @file native_gesture.h 2723b3eb3cSopenharmony_ci * 2823b3eb3cSopenharmony_ci * @brief Provides type definitions for <b>NativeGesture</b> APIs. 2923b3eb3cSopenharmony_ci * 3023b3eb3cSopenharmony_ci * @library libace_ndk.z.so 3123b3eb3cSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 3223b3eb3cSopenharmony_ci * @since 12 3323b3eb3cSopenharmony_ci */ 3423b3eb3cSopenharmony_ci 3523b3eb3cSopenharmony_ci#ifndef ARKUI_NATIVE_GESTTURE_H 3623b3eb3cSopenharmony_ci#define ARKUI_NATIVE_GESTTURE_H 3723b3eb3cSopenharmony_ci 3823b3eb3cSopenharmony_ci#include "ui_input_event.h" 3923b3eb3cSopenharmony_ci#include "native_type.h" 4023b3eb3cSopenharmony_ci 4123b3eb3cSopenharmony_ci#ifdef __cplusplus 4223b3eb3cSopenharmony_ciextern "C" { 4323b3eb3cSopenharmony_ci#endif 4423b3eb3cSopenharmony_ci 4523b3eb3cSopenharmony_ci/** 4623b3eb3cSopenharmony_ci * @brief Defines a gesture recognizer. 4723b3eb3cSopenharmony_ci * 4823b3eb3cSopenharmony_ci * @since 12 4923b3eb3cSopenharmony_ci */ 5023b3eb3cSopenharmony_citypedef struct ArkUI_GestureRecognizer ArkUI_GestureRecognizer; 5123b3eb3cSopenharmony_ci 5223b3eb3cSopenharmony_ci/** 5323b3eb3cSopenharmony_ci * @brief Defines the gesture interruption information. 5423b3eb3cSopenharmony_ci * 5523b3eb3cSopenharmony_ci * @since 12 5623b3eb3cSopenharmony_ci */ 5723b3eb3cSopenharmony_citypedef struct ArkUI_GestureInterruptInfo ArkUI_GestureInterruptInfo; 5823b3eb3cSopenharmony_ci 5923b3eb3cSopenharmony_ci/** 6023b3eb3cSopenharmony_ci * @brief Defines the gesture event. 6123b3eb3cSopenharmony_ci * 6223b3eb3cSopenharmony_ci * @since 12 6323b3eb3cSopenharmony_ci */ 6423b3eb3cSopenharmony_citypedef struct ArkUI_GestureEvent ArkUI_GestureEvent; 6523b3eb3cSopenharmony_ci 6623b3eb3cSopenharmony_ci/** 6723b3eb3cSopenharmony_ci * @brief Enumerates gesture event types. 6823b3eb3cSopenharmony_ci * 6923b3eb3cSopenharmony_ci * @since 12 7023b3eb3cSopenharmony_ci */ 7123b3eb3cSopenharmony_citypedef enum { 7223b3eb3cSopenharmony_ci /** Triggered. */ 7323b3eb3cSopenharmony_ci GESTURE_EVENT_ACTION_ACCEPT = 0x01, 7423b3eb3cSopenharmony_ci 7523b3eb3cSopenharmony_ci /** Updated. */ 7623b3eb3cSopenharmony_ci GESTURE_EVENT_ACTION_UPDATE = 0x02, 7723b3eb3cSopenharmony_ci 7823b3eb3cSopenharmony_ci /** Ended. */ 7923b3eb3cSopenharmony_ci GESTURE_EVENT_ACTION_END = 0x04, 8023b3eb3cSopenharmony_ci 8123b3eb3cSopenharmony_ci /** Canceled. */ 8223b3eb3cSopenharmony_ci GESTURE_EVENT_ACTION_CANCEL = 0x08, 8323b3eb3cSopenharmony_ci} ArkUI_GestureEventActionType; 8423b3eb3cSopenharmony_ci 8523b3eb3cSopenharmony_ci/** 8623b3eb3cSopenharmony_ci * @brief Defines a set of gesture event types. 8723b3eb3cSopenharmony_ci * 8823b3eb3cSopenharmony_ci * Example: ArkUI_GestureEventActionTypeMask actions = GESTURE_EVENT_ACTION_ACCEPT | GESTURE_EVENT_ACTION_UPDATE;\n 8923b3eb3cSopenharmony_ci * 9023b3eb3cSopenharmony_ci * @since 12 9123b3eb3cSopenharmony_ci */ 9223b3eb3cSopenharmony_citypedef uint32_t ArkUI_GestureEventActionTypeMask; 9323b3eb3cSopenharmony_ci 9423b3eb3cSopenharmony_ci/** 9523b3eb3cSopenharmony_ci * @brief Enumerates gesture event modes. 9623b3eb3cSopenharmony_ci * 9723b3eb3cSopenharmony_ci * @since 12 9823b3eb3cSopenharmony_ci */ 9923b3eb3cSopenharmony_citypedef enum { 10023b3eb3cSopenharmony_ci /** Normal. */ 10123b3eb3cSopenharmony_ci NORMAL = 0, 10223b3eb3cSopenharmony_ci 10323b3eb3cSopenharmony_ci /** High-priority. */ 10423b3eb3cSopenharmony_ci PRIORITY = 1, 10523b3eb3cSopenharmony_ci 10623b3eb3cSopenharmony_ci /** Parallel. */ 10723b3eb3cSopenharmony_ci PARALLEL = 2, 10823b3eb3cSopenharmony_ci} ArkUI_GesturePriority; 10923b3eb3cSopenharmony_ci 11023b3eb3cSopenharmony_ci/** 11123b3eb3cSopenharmony_ci * @brief Enumerates gesture group modes. 11223b3eb3cSopenharmony_ci * 11323b3eb3cSopenharmony_ci * @since 12 11423b3eb3cSopenharmony_ci */ 11523b3eb3cSopenharmony_citypedef enum { 11623b3eb3cSopenharmony_ci /* Sequential recognition. Gestures are recognized in the registration sequence until all gestures are recognized 11723b3eb3cSopenharmony_ci * successfully. Once one gesture fails to be recognized, all subsequent gestures fail to be recognized. 11823b3eb3cSopenharmony_ci * Only the last gesture in the gesture group can respond to the end event. */ 11923b3eb3cSopenharmony_ci SEQUENTIAL_GROUP = 0, 12023b3eb3cSopenharmony_ci 12123b3eb3cSopenharmony_ci /** Parallel recognition. Registered gestures are recognized concurrently until all gestures are recognized. 12223b3eb3cSopenharmony_ci * The recognition result of each gesture does not affect each other. */ 12323b3eb3cSopenharmony_ci PARALLEL_GROUP = 1, 12423b3eb3cSopenharmony_ci 12523b3eb3cSopenharmony_ci /** Exclusive recognition. Registered gestures are identified concurrently. 12623b3eb3cSopenharmony_ci * If one gesture is successfully recognized, gesture recognition ends. */ 12723b3eb3cSopenharmony_ci EXCLUSIVE_GROUP = 2, 12823b3eb3cSopenharmony_ci} ArkUI_GroupGestureMode; 12923b3eb3cSopenharmony_ci 13023b3eb3cSopenharmony_ci/** 13123b3eb3cSopenharmony_ci * @brief Enumerates gesture directions. 13223b3eb3cSopenharmony_ci * 13323b3eb3cSopenharmony_ci * @since 12 13423b3eb3cSopenharmony_ci */ 13523b3eb3cSopenharmony_citypedef enum { 13623b3eb3cSopenharmony_ci /** All directions. */ 13723b3eb3cSopenharmony_ci GESTURE_DIRECTION_ALL = 0b1111, 13823b3eb3cSopenharmony_ci 13923b3eb3cSopenharmony_ci /** Horizontal direction. */ 14023b3eb3cSopenharmony_ci GESTURE_DIRECTION_HORIZONTAL = 0b0011, 14123b3eb3cSopenharmony_ci 14223b3eb3cSopenharmony_ci /** Vertical direction. */ 14323b3eb3cSopenharmony_ci GESTURE_DIRECTION_VERTICAL = 0b1100, 14423b3eb3cSopenharmony_ci 14523b3eb3cSopenharmony_ci /** Leftward. */ 14623b3eb3cSopenharmony_ci GESTURE_DIRECTION_LEFT = 0b0001, 14723b3eb3cSopenharmony_ci 14823b3eb3cSopenharmony_ci /** Rightward. */ 14923b3eb3cSopenharmony_ci GESTURE_DIRECTION_RIGHT = 0b0010, 15023b3eb3cSopenharmony_ci 15123b3eb3cSopenharmony_ci /** Upward. */ 15223b3eb3cSopenharmony_ci GESTURE_DIRECTION_UP = 0b0100, 15323b3eb3cSopenharmony_ci 15423b3eb3cSopenharmony_ci /** Downward. */ 15523b3eb3cSopenharmony_ci GESTURE_DIRECTION_DOWN = 0b1000, 15623b3eb3cSopenharmony_ci 15723b3eb3cSopenharmony_ci /** None. */ 15823b3eb3cSopenharmony_ci GESTURE_DIRECTION_NONE = 0, 15923b3eb3cSopenharmony_ci} ArkUI_GestureDirection; 16023b3eb3cSopenharmony_ci 16123b3eb3cSopenharmony_ci/** 16223b3eb3cSopenharmony_ci * @brief Defines a set of gesture directions. 16323b3eb3cSopenharmony_ci * 16423b3eb3cSopenharmony_ci * Example: ArkUI_GestureDirectionMask directions = GESTURE_DIRECTION_LEFT | GESTURE_DIRECTION_RIGHT \n 16523b3eb3cSopenharmony_ci * This example indicates that the leftward and rightward directions are supported. \n 16623b3eb3cSopenharmony_ci * 16723b3eb3cSopenharmony_ci * @since 12 16823b3eb3cSopenharmony_ci */ 16923b3eb3cSopenharmony_citypedef uint32_t ArkUI_GestureDirectionMask; 17023b3eb3cSopenharmony_ci 17123b3eb3cSopenharmony_ci/** 17223b3eb3cSopenharmony_ci * @brief Enumerates gesture masking modes. 17323b3eb3cSopenharmony_ci * 17423b3eb3cSopenharmony_ci * @since 12 17523b3eb3cSopenharmony_ci */ 17623b3eb3cSopenharmony_citypedef enum { 17723b3eb3cSopenharmony_ci /** The gestures of child components are enabled and recognized based on the default gesture recognition sequence.*/ 17823b3eb3cSopenharmony_ci NORMAL_GESTURE_MASK = 0, 17923b3eb3cSopenharmony_ci 18023b3eb3cSopenharmony_ci /** The gestures of child components are disabled, including the built-in gestures. */ 18123b3eb3cSopenharmony_ci IGNORE_INTERNAL_GESTURE_MASK, 18223b3eb3cSopenharmony_ci} ArkUI_GestureMask; 18323b3eb3cSopenharmony_ci 18423b3eb3cSopenharmony_ci/** 18523b3eb3cSopenharmony_ci * @brief Enumerates gesture types. 18623b3eb3cSopenharmony_ci * 18723b3eb3cSopenharmony_ci * @since 12 18823b3eb3cSopenharmony_ci */ 18923b3eb3cSopenharmony_citypedef enum { 19023b3eb3cSopenharmony_ci /** Tap. */ 19123b3eb3cSopenharmony_ci TAP_GESTURE = 0, 19223b3eb3cSopenharmony_ci 19323b3eb3cSopenharmony_ci /** Long press. */ 19423b3eb3cSopenharmony_ci LONG_PRESS_GESTURE, 19523b3eb3cSopenharmony_ci 19623b3eb3cSopenharmony_ci /** Pan. */ 19723b3eb3cSopenharmony_ci PAN_GESTURE, 19823b3eb3cSopenharmony_ci 19923b3eb3cSopenharmony_ci /** Pinch. */ 20023b3eb3cSopenharmony_ci PINCH_GESTURE, 20123b3eb3cSopenharmony_ci 20223b3eb3cSopenharmony_ci /** Rotate. */ 20323b3eb3cSopenharmony_ci ROTATION_GESTURE, 20423b3eb3cSopenharmony_ci 20523b3eb3cSopenharmony_ci /** Swipe. */ 20623b3eb3cSopenharmony_ci SWIPE_GESTURE, 20723b3eb3cSopenharmony_ci 20823b3eb3cSopenharmony_ci /** A group of gestures. */ 20923b3eb3cSopenharmony_ci GROUP_GESTURE, 21023b3eb3cSopenharmony_ci} ArkUI_GestureRecognizerType; 21123b3eb3cSopenharmony_ci 21223b3eb3cSopenharmony_ci/** 21323b3eb3cSopenharmony_ci * @brief Enumerates gesture interruption results. 21423b3eb3cSopenharmony_ci * 21523b3eb3cSopenharmony_ci * @since 12 21623b3eb3cSopenharmony_ci */ 21723b3eb3cSopenharmony_citypedef enum { 21823b3eb3cSopenharmony_ci /** The gesture recognition process continues. */ 21923b3eb3cSopenharmony_ci GESTURE_INTERRUPT_RESULT_CONTINUE = 0, 22023b3eb3cSopenharmony_ci 22123b3eb3cSopenharmony_ci /** The gesture recognition process is paused. */ 22223b3eb3cSopenharmony_ci GESTURE_INTERRUPT_RESULT_REJECT, 22323b3eb3cSopenharmony_ci} ArkUI_GestureInterruptResult; 22423b3eb3cSopenharmony_ci 22523b3eb3cSopenharmony_ci/** 22623b3eb3cSopenharmony_ci * @brief Enumerates the gesture recognizer states. 22723b3eb3cSopenharmony_ci * 22823b3eb3cSopenharmony_ci * @since 12 22923b3eb3cSopenharmony_ci */ 23023b3eb3cSopenharmony_citypedef enum { 23123b3eb3cSopenharmony_ci /** Ready. */ 23223b3eb3cSopenharmony_ci ARKUI_GESTURE_RECOGNIZER_STATE_READY = 0, 23323b3eb3cSopenharmony_ci 23423b3eb3cSopenharmony_ci /** Detecting. */ 23523b3eb3cSopenharmony_ci ARKUI_GESTURE_RECOGNIZER_STATE_DETECTING = 1, 23623b3eb3cSopenharmony_ci 23723b3eb3cSopenharmony_ci /** Pending. */ 23823b3eb3cSopenharmony_ci ARKUI_GESTURE_RECOGNIZER_STATE_PENDING = 2, 23923b3eb3cSopenharmony_ci 24023b3eb3cSopenharmony_ci /** Blocked. */ 24123b3eb3cSopenharmony_ci ARKUI_GESTURE_RECOGNIZER_STATE_BLOCKED = 3, 24223b3eb3cSopenharmony_ci 24323b3eb3cSopenharmony_ci /** Successful. */ 24423b3eb3cSopenharmony_ci ARKUI_GESTURE_RECOGNIZER_STATE_SUCCESSFUL = 4, 24523b3eb3cSopenharmony_ci 24623b3eb3cSopenharmony_ci /** Failed. */ 24723b3eb3cSopenharmony_ci ARKUI_GESTURE_RECOGNIZER_STATE_FAILED = 5, 24823b3eb3cSopenharmony_ci} ArkUI_GestureRecognizerState; 24923b3eb3cSopenharmony_ci 25023b3eb3cSopenharmony_ci/** 25123b3eb3cSopenharmony_ci * @brief Defines the gesture recognizer handle. 25223b3eb3cSopenharmony_ci * 25323b3eb3cSopenharmony_ci * @since 12 25423b3eb3cSopenharmony_ci */ 25523b3eb3cSopenharmony_citypedef ArkUI_GestureRecognizer* ArkUI_GestureRecognizerHandle; 25623b3eb3cSopenharmony_ci 25723b3eb3cSopenharmony_ci/** 25823b3eb3cSopenharmony_ci * @brief Defines the gesture recognizer handle array. 25923b3eb3cSopenharmony_ci * 26023b3eb3cSopenharmony_ci * @since 12 26123b3eb3cSopenharmony_ci */ 26223b3eb3cSopenharmony_citypedef ArkUI_GestureRecognizerHandle* ArkUI_GestureRecognizerHandleArray; 26323b3eb3cSopenharmony_ci 26423b3eb3cSopenharmony_ci/** 26523b3eb3cSopenharmony_ci * @brief Defines a <b>GestureEventTargetInfo</b> object that provides information about a gesture event target. 26623b3eb3cSopenharmony_ci * 26723b3eb3cSopenharmony_ci * @since 12 26823b3eb3cSopenharmony_ci */ 26923b3eb3cSopenharmony_citypedef struct ArkUI_GestureEventTargetInfo ArkUI_GestureEventTargetInfo; 27023b3eb3cSopenharmony_ci 27123b3eb3cSopenharmony_ci/** 27223b3eb3cSopenharmony_ci * @brief Defines a parallel internal gesture event. 27323b3eb3cSopenharmony_ci * 27423b3eb3cSopenharmony_ci * @since 12 27523b3eb3cSopenharmony_ci */ 27623b3eb3cSopenharmony_citypedef struct ArkUI_ParallelInnerGestureEvent ArkUI_ParallelInnerGestureEvent; 27723b3eb3cSopenharmony_ci 27823b3eb3cSopenharmony_ci/** 27923b3eb3cSopenharmony_ci * @brief Defines a callback function for notifying gesture recognizer destruction. 28023b3eb3cSopenharmony_ci * @since 12 28123b3eb3cSopenharmony_ci */ 28223b3eb3cSopenharmony_citypedef void (*ArkUI_GestureRecognizerDisposeNotifyCallback)(ArkUI_GestureRecognizer* recognizer, void* userData); 28323b3eb3cSopenharmony_ci 28423b3eb3cSopenharmony_ci/** 28523b3eb3cSopenharmony_ci* @brief Checks whether a gesture is a built-in gesture of the component. 28623b3eb3cSopenharmony_ci* 28723b3eb3cSopenharmony_ci* @param event Indicates the pointer to the gesture interruption information. 28823b3eb3cSopenharmony_ci* @return Returns <b>true</b> if the gesture is a built-in gesture; returns <b>false</b> otherwise. 28923b3eb3cSopenharmony_ci 29023b3eb3cSopenharmony_ci* @since 12 29123b3eb3cSopenharmony_ci*/ 29223b3eb3cSopenharmony_cibool OH_ArkUI_GestureInterruptInfo_GetSystemFlag(const ArkUI_GestureInterruptInfo* event); 29323b3eb3cSopenharmony_ci 29423b3eb3cSopenharmony_ci/** 29523b3eb3cSopenharmony_ci* @brief Obtains the pointer to interrupted gesture recognizer. 29623b3eb3cSopenharmony_ci* 29723b3eb3cSopenharmony_ci* @param event Indicates the pointer to the gesture interruption information. 29823b3eb3cSopenharmony_ci* @return Returns the pointer to interrupted gesture recognizer. 29923b3eb3cSopenharmony_ci* @since 12 30023b3eb3cSopenharmony_ci*/ 30123b3eb3cSopenharmony_ciArkUI_GestureRecognizer* OH_ArkUI_GestureInterruptInfo_GetRecognizer(const ArkUI_GestureInterruptInfo* event); 30223b3eb3cSopenharmony_ci 30323b3eb3cSopenharmony_ci/** 30423b3eb3cSopenharmony_ci* @brief Obtains the pointer to the interrupted gesture event. 30523b3eb3cSopenharmony_ci* 30623b3eb3cSopenharmony_ci* @param event Indicates the pointer to the gesture interruption information. 30723b3eb3cSopenharmony_ci* @return Returns the pointer to the interrupted gesture event. 30823b3eb3cSopenharmony_ci* @since 12 30923b3eb3cSopenharmony_ci*/ 31023b3eb3cSopenharmony_ciArkUI_GestureEvent* OH_ArkUI_GestureInterruptInfo_GetGestureEvent(const ArkUI_GestureInterruptInfo* event); 31123b3eb3cSopenharmony_ci 31223b3eb3cSopenharmony_ci/** 31323b3eb3cSopenharmony_ci* @brief Obtains the type of the system gesture to trigger. 31423b3eb3cSopenharmony_ci* 31523b3eb3cSopenharmony_ci* @param event Indicates the pointer to the gesture interruption information. 31623b3eb3cSopenharmony_ci* @return Returns the type of the system gesture to trigger. If the gesture to trigger is not a system gesture, 31723b3eb3cSopenharmony_ci* <b>-1</b> is returned. 31823b3eb3cSopenharmony_ci* @since 12 31923b3eb3cSopenharmony_ci*/ 32023b3eb3cSopenharmony_ciint32_t OH_ArkUI_GestureInterruptInfo_GetSystemRecognizerType(const ArkUI_GestureInterruptInfo* event); 32123b3eb3cSopenharmony_ci 32223b3eb3cSopenharmony_ci/** 32323b3eb3cSopenharmony_ci* @brief Obtains the gesture event type. 32423b3eb3cSopenharmony_ci* 32523b3eb3cSopenharmony_ci* @param event Indicates the pointer to the gesture event. 32623b3eb3cSopenharmony_ci* @return Returns the gesture event type. 32723b3eb3cSopenharmony_ci* @since 12 32823b3eb3cSopenharmony_ci*/ 32923b3eb3cSopenharmony_ciArkUI_GestureEventActionType OH_ArkUI_GestureEvent_GetActionType(const ArkUI_GestureEvent* event); 33023b3eb3cSopenharmony_ci 33123b3eb3cSopenharmony_ci/** 33223b3eb3cSopenharmony_ci* @brief Obtains gesture input. 33323b3eb3cSopenharmony_ci* 33423b3eb3cSopenharmony_ci* @param event Indicates the pointer to the gesture event. 33523b3eb3cSopenharmony_ci* @return Returns the pointer to the input event of the gesture event. 33623b3eb3cSopenharmony_ci* @since 12 33723b3eb3cSopenharmony_ci*/ 33823b3eb3cSopenharmony_ciconst ArkUI_UIInputEvent* OH_ArkUI_GestureEvent_GetRawInputEvent(const ArkUI_GestureEvent* event); 33923b3eb3cSopenharmony_ci 34023b3eb3cSopenharmony_ci/** 34123b3eb3cSopenharmony_ci* @brief Obtains the number of times that a long press gesture is triggered periodically. 34223b3eb3cSopenharmony_ci* 34323b3eb3cSopenharmony_ci* @param event Indicates the pointer to the gesture event. 34423b3eb3cSopenharmony_ci* @return Returns the number of times that the long press gesture is triggered periodically. 34523b3eb3cSopenharmony_ci* @since 12 34623b3eb3cSopenharmony_ci*/ 34723b3eb3cSopenharmony_ciint32_t OH_ArkUI_LongPress_GetRepeatCount(const ArkUI_GestureEvent* event); 34823b3eb3cSopenharmony_ci 34923b3eb3cSopenharmony_ci/** 35023b3eb3cSopenharmony_ci* @brief Obtains the velocity of a pan gesture along the main axis. 35123b3eb3cSopenharmony_ci* 35223b3eb3cSopenharmony_ci* @param event Indicates the pointer to the gesture event. 35323b3eb3cSopenharmony_ci* @return Returns the velocity of the pan gesture along the main axis, in px/s. 35423b3eb3cSopenharmony_ci* The value is the square root of the sum of the squares of the velocity on the x-axis and y-axis. 35523b3eb3cSopenharmony_ci* @since 12 35623b3eb3cSopenharmony_ci*/ 35723b3eb3cSopenharmony_cifloat OH_ArkUI_PanGesture_GetVelocity(const ArkUI_GestureEvent* event); 35823b3eb3cSopenharmony_ci 35923b3eb3cSopenharmony_ci/** 36023b3eb3cSopenharmony_ci* @brief Obtains the velocity of a pan gesture along the x-axis. 36123b3eb3cSopenharmony_ci* 36223b3eb3cSopenharmony_ci* @param event Indicates the pointer to the gesture event. 36323b3eb3cSopenharmony_ci* @return Returns the velocity of the pan gesture along the x-axis, in px/s. 36423b3eb3cSopenharmony_ci* @since 12 36523b3eb3cSopenharmony_ci*/ 36623b3eb3cSopenharmony_cifloat OH_ArkUI_PanGesture_GetVelocityX(const ArkUI_GestureEvent* event); 36723b3eb3cSopenharmony_ci 36823b3eb3cSopenharmony_ci/** 36923b3eb3cSopenharmony_ci* @brief Obtains the velocity of a pan gesture along the y-axis. 37023b3eb3cSopenharmony_ci* 37123b3eb3cSopenharmony_ci* @param event Indicates the pointer to the gesture event. 37223b3eb3cSopenharmony_ci* @return Returns the velocity of the pan gesture along the y-axis, in px/s. 37323b3eb3cSopenharmony_ci* @since 12 37423b3eb3cSopenharmony_ci*/ 37523b3eb3cSopenharmony_cifloat OH_ArkUI_PanGesture_GetVelocityY(const ArkUI_GestureEvent* event); 37623b3eb3cSopenharmony_ci 37723b3eb3cSopenharmony_ci/** 37823b3eb3cSopenharmony_ci* @brief Obtains the relative offset of a pan gesture along the x-axis. 37923b3eb3cSopenharmony_ci* 38023b3eb3cSopenharmony_ci* @param event Indicates the pointer to the gesture event. 38123b3eb3cSopenharmony_ci* @return Returns the relative offset of the gesture along the x-axis, in px. 38223b3eb3cSopenharmony_ci* @since 12 38323b3eb3cSopenharmony_ci*/ 38423b3eb3cSopenharmony_cifloat OH_ArkUI_PanGesture_GetOffsetX(const ArkUI_GestureEvent* event); 38523b3eb3cSopenharmony_ci 38623b3eb3cSopenharmony_ci/** 38723b3eb3cSopenharmony_ci* @brief Obtains the relative offset of a pan gesture along the y-axis. 38823b3eb3cSopenharmony_ci* 38923b3eb3cSopenharmony_ci* @param event Indicates the pointer to the gesture event. 39023b3eb3cSopenharmony_ci* @return Returns the relative offset of the gesture along the y-axis, in px. 39123b3eb3cSopenharmony_ci* @since 12 39223b3eb3cSopenharmony_ci*/ 39323b3eb3cSopenharmony_cifloat OH_ArkUI_PanGesture_GetOffsetY(const ArkUI_GestureEvent* event); 39423b3eb3cSopenharmony_ci 39523b3eb3cSopenharmony_ci/** 39623b3eb3cSopenharmony_ci* @brief Obtains the angle information of the swipe gesture. 39723b3eb3cSopenharmony_ci* 39823b3eb3cSopenharmony_ci* After a swipe gesture is recognized, a line connecting the two fingers is identified as the initial line. 39923b3eb3cSopenharmony_ci* As the fingers swipe, the line between the fingers rotates. \n 40023b3eb3cSopenharmony_ci* Based on the coordinates of the initial line's and current line's end points, the arc tangent function is used to 40123b3eb3cSopenharmony_ci* calculate the respective included angle of the points relative to the horizontal direction \n 40223b3eb3cSopenharmony_ci* by using the following formula: Rotation angle = arctan2(cy2-cy1,cx2-cx1) - arctan2(y2-y1,x2-x1). \n 40323b3eb3cSopenharmony_ci* The initial line is used as the coordinate system. Values from 0 to 180 degrees represent clockwise rotation, 40423b3eb3cSopenharmony_ci* while values from –180 to 0 degrees represent counterclockwise rotation. \n 40523b3eb3cSopenharmony_ci* 40623b3eb3cSopenharmony_ci* @param event Indicates the pointer to the gesture event. 40723b3eb3cSopenharmony_ci* @return Returns the angle of the swipe gesture, which is the result obtained based on the aforementioned formula. 40823b3eb3cSopenharmony_ci* @since 12 40923b3eb3cSopenharmony_ci*/ 41023b3eb3cSopenharmony_cifloat OH_ArkUI_SwipeGesture_GetAngle(const ArkUI_GestureEvent* event); 41123b3eb3cSopenharmony_ci 41223b3eb3cSopenharmony_ci/** 41323b3eb3cSopenharmony_ci* @brief Obtains the average velocity of all fingers used in the swipe gesture. 41423b3eb3cSopenharmony_ci* 41523b3eb3cSopenharmony_ci* @param event Indicates the pointer to the gesture event. 41623b3eb3cSopenharmony_ci* @return Returns the average velocity of all fingers used in the swipe gesture, in px/s. 41723b3eb3cSopenharmony_ci* @since 12 41823b3eb3cSopenharmony_ci*/ 41923b3eb3cSopenharmony_cifloat OH_ArkUI_SwipeGesture_GetVelocity(const ArkUI_GestureEvent* event); 42023b3eb3cSopenharmony_ci 42123b3eb3cSopenharmony_ci/** 42223b3eb3cSopenharmony_ci* @brief Obtains the angle information of a rotation gesture. 42323b3eb3cSopenharmony_ci* 42423b3eb3cSopenharmony_ci* @param event Indicates the pointer to the gesture event. 42523b3eb3cSopenharmony_ci* @return Returns the rotation angle. 42623b3eb3cSopenharmony_ci* @since 12 42723b3eb3cSopenharmony_ci*/ 42823b3eb3cSopenharmony_cifloat OH_ArkUI_RotationGesture_GetAngle(const ArkUI_GestureEvent* event); 42923b3eb3cSopenharmony_ci 43023b3eb3cSopenharmony_ci/** 43123b3eb3cSopenharmony_ci* @brief Obtains the scale ratio of a pinch gesture. 43223b3eb3cSopenharmony_ci* 43323b3eb3cSopenharmony_ci* @param event Indicates the pointer to the gesture event. 43423b3eb3cSopenharmony_ci* @return Returns the scale ratio. 43523b3eb3cSopenharmony_ci* @since 12 43623b3eb3cSopenharmony_ci*/ 43723b3eb3cSopenharmony_cifloat OH_ArkUI_PinchGesture_GetScale(const ArkUI_GestureEvent* event); 43823b3eb3cSopenharmony_ci 43923b3eb3cSopenharmony_ci/** 44023b3eb3cSopenharmony_ci* @brief Obtains the X coordinate of the center of the pinch gesture, in vp, 44123b3eb3cSopenharmony_ci* relative to the upper left corner of the current component. 44223b3eb3cSopenharmony_ci* 44323b3eb3cSopenharmony_ci* @param event Indicates the pointer to the gesture event. 44423b3eb3cSopenharmony_ci* @return Returns the X coordinate of the center of the pinch gesture, in vp, 44523b3eb3cSopenharmony_ci* relative to the upper left corner of the current component. 44623b3eb3cSopenharmony_ci* @since 12 44723b3eb3cSopenharmony_ci*/ 44823b3eb3cSopenharmony_cifloat OH_ArkUI_PinchGesture_GetCenterX(const ArkUI_GestureEvent* event); 44923b3eb3cSopenharmony_ci 45023b3eb3cSopenharmony_ci/** 45123b3eb3cSopenharmony_ci* @brief Obtains the Y coordinate of the center of the pinch gesture, in vp, 45223b3eb3cSopenharmony_ci* relative to the upper left corner of the current component. 45323b3eb3cSopenharmony_ci* 45423b3eb3cSopenharmony_ci* @param event Indicates the pointer to the gesture event. 45523b3eb3cSopenharmony_ci* @return Returns the Y coordinate of the center of the pinch gesture, in vp, 45623b3eb3cSopenharmony_ci* relative to the upper left corner of the current component. 45723b3eb3cSopenharmony_ci* @since 12 45823b3eb3cSopenharmony_ci*/ 45923b3eb3cSopenharmony_cifloat OH_ArkUI_PinchGesture_GetCenterY(const ArkUI_GestureEvent* event); 46023b3eb3cSopenharmony_ci 46123b3eb3cSopenharmony_ci/** 46223b3eb3cSopenharmony_ci* @brief Obtains information about a gesture response chain. 46323b3eb3cSopenharmony_ci* 46423b3eb3cSopenharmony_ci* @param event Indicates the pointer to the gesture interruption information. 46523b3eb3cSopenharmony_ci* @param responseChain Indicates the pointer to an array of gesture recognizers on the response chain. 46623b3eb3cSopenharmony_ci* @param count Indicates the pointer to the number of gesture recognizers on the response chain. 46723b3eb3cSopenharmony_ci* @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if success. 46823b3eb3cSopenharmony_ci* Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs. 46923b3eb3cSopenharmony_ci* @since 12 47023b3eb3cSopenharmony_ci*/ 47123b3eb3cSopenharmony_ciint32_t OH_ArkUI_GetResponseRecognizersFromInterruptInfo(const ArkUI_GestureInterruptInfo* event, 47223b3eb3cSopenharmony_ci ArkUI_GestureRecognizerHandleArray* responseChain, int32_t* count); 47323b3eb3cSopenharmony_ci 47423b3eb3cSopenharmony_ci/** 47523b3eb3cSopenharmony_ci* @brief Sets the enabled state of a gesture recognizer. 47623b3eb3cSopenharmony_ci* 47723b3eb3cSopenharmony_ci* @param recognizer Indicates the pointer to a gesture recognizer. 47823b3eb3cSopenharmony_ci* @param enabled Indicates the enabled state. 47923b3eb3cSopenharmony_ci* @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if success. 48023b3eb3cSopenharmony_ci* Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs. 48123b3eb3cSopenharmony_ci* @since 12 48223b3eb3cSopenharmony_ci*/ 48323b3eb3cSopenharmony_ciint32_t OH_ArkUI_SetGestureRecognizerEnabled(ArkUI_GestureRecognizer* recognizer, bool enabled); 48423b3eb3cSopenharmony_ci 48523b3eb3cSopenharmony_ci/** 48623b3eb3cSopenharmony_ci* @brief Obtains the enabled state of a gesture recognizer. 48723b3eb3cSopenharmony_ci* 48823b3eb3cSopenharmony_ci* @param recognizer Indicates the pointer to a gesture recognizer. 48923b3eb3cSopenharmony_ci* @return Returns <b>true</b> if the gesture recognizer is enabled. 49023b3eb3cSopenharmony_ci* Returns <b>false</b> if the gesture recognizer is disabled. 49123b3eb3cSopenharmony_ci* @since 12 49223b3eb3cSopenharmony_ci*/ 49323b3eb3cSopenharmony_cibool OH_ArkUI_GetGestureRecognizerEnabled(ArkUI_GestureRecognizer* recognizer); 49423b3eb3cSopenharmony_ci 49523b3eb3cSopenharmony_ci/** 49623b3eb3cSopenharmony_ci* @brief Obtains the state of a gesture recognizer. 49723b3eb3cSopenharmony_ci* 49823b3eb3cSopenharmony_ci* @param recognizer Indicates the pointer to a gesture recognizer. 49923b3eb3cSopenharmony_ci* @param state Indicates the pointer to the state of the gesture recognizer. 50023b3eb3cSopenharmony_ci* @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if success. 50123b3eb3cSopenharmony_ci* Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs. 50223b3eb3cSopenharmony_ci* @since 12 50323b3eb3cSopenharmony_ci*/ 50423b3eb3cSopenharmony_ciint32_t OH_ArkUI_GetGestureRecognizerState(ArkUI_GestureRecognizer* recognizer, ArkUI_GestureRecognizerState* state); 50523b3eb3cSopenharmony_ci 50623b3eb3cSopenharmony_ci/** 50723b3eb3cSopenharmony_ci* @brief Obtains the information about a gesture event target. 50823b3eb3cSopenharmony_ci* 50923b3eb3cSopenharmony_ci* @param recognizer Indicates the pointer to a gesture recognizer. 51023b3eb3cSopenharmony_ci* @param info Indicates the information about a gesture event target. 51123b3eb3cSopenharmony_ci* @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if success. 51223b3eb3cSopenharmony_ci* Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs. 51323b3eb3cSopenharmony_ci* @since 12 51423b3eb3cSopenharmony_ci*/ 51523b3eb3cSopenharmony_ciint32_t OH_ArkUI_GetGestureEventTargetInfo(ArkUI_GestureRecognizer* recognizer, ArkUI_GestureEventTargetInfo** info); 51623b3eb3cSopenharmony_ci 51723b3eb3cSopenharmony_ci/** 51823b3eb3cSopenharmony_ci* @brief Obtains whether this scroll container is scrolled to the top. 51923b3eb3cSopenharmony_ci* 52023b3eb3cSopenharmony_ci* @param info Indicates the information about a gesture event target. 52123b3eb3cSopenharmony_ci* @param ret Indicates whether the scroll container is scrolled to the top. 52223b3eb3cSopenharmony_ci* @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if success. 52323b3eb3cSopenharmony_ci* Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs. 52423b3eb3cSopenharmony_ci* Returns {@link ARKUI_ERROR_CODE_NON_SCROLLABLE_CONTAINER} if the component is not a scroll container. 52523b3eb3cSopenharmony_ci* @since 12 52623b3eb3cSopenharmony_ci*/ 52723b3eb3cSopenharmony_ciint32_t OH_ArkUI_GestureEventTargetInfo_IsScrollBegin(ArkUI_GestureEventTargetInfo* info, bool* ret); 52823b3eb3cSopenharmony_ci 52923b3eb3cSopenharmony_ci/** 53023b3eb3cSopenharmony_ci* @brief Obtains whether this scroll container is scrolled to the bottom. 53123b3eb3cSopenharmony_ci* 53223b3eb3cSopenharmony_ci* @param info Indicates the information about a gesture event target. 53323b3eb3cSopenharmony_ci* @param ret Indicates whether the scroll container is scrolled to the bottom. 53423b3eb3cSopenharmony_ci* @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if success. 53523b3eb3cSopenharmony_ci* Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs. 53623b3eb3cSopenharmony_ci* Returns {@link ARKUI_ERROR_CODE_NON_SCROLLABLE_CONTAINER} if the component is not a scroll container. 53723b3eb3cSopenharmony_ci* @since 12 53823b3eb3cSopenharmony_ci*/ 53923b3eb3cSopenharmony_ciint32_t OH_ArkUI_GestureEventTargetInfo_IsScrollEnd(ArkUI_GestureEventTargetInfo* info, bool* ret); 54023b3eb3cSopenharmony_ci 54123b3eb3cSopenharmony_ci/** 54223b3eb3cSopenharmony_ci* @brief Obtains the direction of a pan gesture. 54323b3eb3cSopenharmony_ci* 54423b3eb3cSopenharmony_ci* @param recognizer Indicates the pointer to a gesture recognizer. 54523b3eb3cSopenharmony_ci* @param directionMask Indicates the pan direction. 54623b3eb3cSopenharmony_ci* @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if success. 54723b3eb3cSopenharmony_ci* Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs. 54823b3eb3cSopenharmony_ci* @since 12 54923b3eb3cSopenharmony_ci*/ 55023b3eb3cSopenharmony_ciint32_t OH_ArkUI_GetPanGestureDirectionMask(ArkUI_GestureRecognizer* recognizer, 55123b3eb3cSopenharmony_ci ArkUI_GestureDirectionMask* directionMask); 55223b3eb3cSopenharmony_ci 55323b3eb3cSopenharmony_ci/** 55423b3eb3cSopenharmony_ci* @brief Obtains whether a gesture is a built-in gesture. 55523b3eb3cSopenharmony_ci* 55623b3eb3cSopenharmony_ci* @param recognizer Indicates the pointer to a gesture recognizer. 55723b3eb3cSopenharmony_ci* @return Returns <b>true</b> if the gesture is a built-in gesture; returns <b>false</b> otherwise. 55823b3eb3cSopenharmony_ci* @since 12 55923b3eb3cSopenharmony_ci*/ 56023b3eb3cSopenharmony_cibool OH_ArkUI_IsBuiltInGesture(ArkUI_GestureRecognizer* recognizer); 56123b3eb3cSopenharmony_ci 56223b3eb3cSopenharmony_ci/** 56323b3eb3cSopenharmony_ci* @brief Obtains the tag of a gesture recognizer. 56423b3eb3cSopenharmony_ci* 56523b3eb3cSopenharmony_ci* @param recognizer Indicates the pointer to a gesture recognizer. 56623b3eb3cSopenharmony_ci* @param buffer Indicates the buffer. 56723b3eb3cSopenharmony_ci* @param bufferSize Indicates the buffer size. 56823b3eb3cSopenharmony_ci* @param result Indicates the length of the string to be written to the buffer. 56923b3eb3cSopenharmony_ci* @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if success. 57023b3eb3cSopenharmony_ci* Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs. 57123b3eb3cSopenharmony_ci* Returns {@link ARKUI_ERROR_CODE_BUFFER_SIZE_NOT_ENOUGH} if the buffer is not large enough. 57223b3eb3cSopenharmony_ci* @since 12 57323b3eb3cSopenharmony_ci*/ 57423b3eb3cSopenharmony_ciint32_t OH_ArkUI_GetGestureTag(ArkUI_GestureRecognizer* recognizer, char* buffer, int32_t bufferSize, int32_t* result); 57523b3eb3cSopenharmony_ci 57623b3eb3cSopenharmony_ci/** 57723b3eb3cSopenharmony_ci* @brief Obtains the ID of the component linked to a gesture recognizer. 57823b3eb3cSopenharmony_ci* 57923b3eb3cSopenharmony_ci* @param recognizer Indicates the pointer to a gesture recognizer. 58023b3eb3cSopenharmony_ci* @param nodeId Indicates the component ID. 58123b3eb3cSopenharmony_ci* @param size Indicates the buffer size. 58223b3eb3cSopenharmony_ci* @param result Indicates the length of the string to be written to the buffer. 58323b3eb3cSopenharmony_ci* @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if success. 58423b3eb3cSopenharmony_ci* Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs. 58523b3eb3cSopenharmony_ci* Returns {@link ARKUI_ERROR_CODE_BUFFER_SIZE_NOT_ENOUGH} if the buffer is not large enough. 58623b3eb3cSopenharmony_ci* @since 12 58723b3eb3cSopenharmony_ci*/ 58823b3eb3cSopenharmony_ciint32_t OH_ArkUI_GetGestureBindNodeId(ArkUI_GestureRecognizer* recognizer, char* nodeId, int32_t size, 58923b3eb3cSopenharmony_ci int32_t* result); 59023b3eb3cSopenharmony_ci 59123b3eb3cSopenharmony_ci/** 59223b3eb3cSopenharmony_ci* @brief Obtains whether a gesture recognizer is valid. 59323b3eb3cSopenharmony_ci* 59423b3eb3cSopenharmony_ci* @param recognizer Indicates the pointer to a gesture recognizer. 59523b3eb3cSopenharmony_ci* @return Returns <b>true</b> if the gesture recognizer is valid. 59623b3eb3cSopenharmony_ci* Returns <b>false</b> if the gesture recognizer is invalid. 59723b3eb3cSopenharmony_ci* @since 12 59823b3eb3cSopenharmony_ci*/ 59923b3eb3cSopenharmony_cibool OH_ArkUI_IsGestureRecognizerValid(ArkUI_GestureRecognizer* recognizer); 60023b3eb3cSopenharmony_ci 60123b3eb3cSopenharmony_ci/** 60223b3eb3cSopenharmony_ci* @brief Obtains custom data in the parallel internal gesture event. 60323b3eb3cSopenharmony_ci* 60423b3eb3cSopenharmony_ci* @param event Indicates the pointer to a parallel internal gesture event. 60523b3eb3cSopenharmony_ci* @return Returns the pointer to custom data. 60623b3eb3cSopenharmony_ci* @since 12 60723b3eb3cSopenharmony_ci*/ 60823b3eb3cSopenharmony_civoid* OH_ArkUI_ParallelInnerGestureEvent_GetUserData(ArkUI_ParallelInnerGestureEvent* event); 60923b3eb3cSopenharmony_ci 61023b3eb3cSopenharmony_ci/** 61123b3eb3cSopenharmony_ci* @brief Obtains the current gesture recognizer in a parallel internal gesture event. 61223b3eb3cSopenharmony_ci* 61323b3eb3cSopenharmony_ci* @param event Indicates the pointer to a parallel internal gesture event. 61423b3eb3cSopenharmony_ci* @return Returns the pointer to the current gesture recognizer. 61523b3eb3cSopenharmony_ci* @since 12 61623b3eb3cSopenharmony_ci*/ 61723b3eb3cSopenharmony_ciArkUI_GestureRecognizer* OH_ArkUI_ParallelInnerGestureEvent_GetCurrentRecognizer( 61823b3eb3cSopenharmony_ci ArkUI_ParallelInnerGestureEvent* event); 61923b3eb3cSopenharmony_ci 62023b3eb3cSopenharmony_ci/** 62123b3eb3cSopenharmony_ci* @brief Obtains the conflicting gesture recognizers in a parallel internal gesture event. 62223b3eb3cSopenharmony_ci* 62323b3eb3cSopenharmony_ci* @param event Indicates the pointer to a parallel internal gesture event. 62423b3eb3cSopenharmony_ci* @param array Indicates the pointer to the array of conflicting gesture recognizers. 62523b3eb3cSopenharmony_ci* @param size Indicates the size of the array of conflicting gesture recognizers. 62623b3eb3cSopenharmony_ci* @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if success. 62723b3eb3cSopenharmony_ci* Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs. 62823b3eb3cSopenharmony_ci* @since 12 62923b3eb3cSopenharmony_ci*/ 63023b3eb3cSopenharmony_ciint32_t OH_ArkUI_ParallelInnerGestureEvent_GetConflictRecognizers(ArkUI_ParallelInnerGestureEvent* event, 63123b3eb3cSopenharmony_ci ArkUI_GestureRecognizerHandleArray* array, int32_t* size); 63223b3eb3cSopenharmony_ci 63323b3eb3cSopenharmony_ci/** 63423b3eb3cSopenharmony_ci* @brief Sets a callback function for notifying gesture recognizer destruction. 63523b3eb3cSopenharmony_ci* 63623b3eb3cSopenharmony_ci* @param recognizer Indicates the pointer to a gesture recognizer. 63723b3eb3cSopenharmony_ci* @param callback Indicates the callback function for notifying gesture recognizer destruction. 63823b3eb3cSopenharmony_ci* @param userData Indicates the custom data. 63923b3eb3cSopenharmony_ci* @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if success. 64023b3eb3cSopenharmony_ci* Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs. 64123b3eb3cSopenharmony_ci*/ 64223b3eb3cSopenharmony_ciint32_t OH_ArkUI_SetArkUIGestureRecognizerDisposeNotify(ArkUI_GestureRecognizer* recognizer, 64323b3eb3cSopenharmony_ci ArkUI_GestureRecognizerDisposeNotifyCallback callback, void* userData); 64423b3eb3cSopenharmony_ci 64523b3eb3cSopenharmony_ciArkUI_NodeHandle OH_ArkUI_GestureEvent_GetNode(const ArkUI_GestureEvent* event); 64623b3eb3cSopenharmony_ci/** 64723b3eb3cSopenharmony_ci * @brief Defines the gesture APIs. 64823b3eb3cSopenharmony_ci * 64923b3eb3cSopenharmony_ci * @since 12 65023b3eb3cSopenharmony_ci */ 65123b3eb3cSopenharmony_citypedef struct { 65223b3eb3cSopenharmony_ci /** The struct version is 1. */ 65323b3eb3cSopenharmony_ci int32_t version; 65423b3eb3cSopenharmony_ci 65523b3eb3cSopenharmony_ci /** 65623b3eb3cSopenharmony_ci * @brief Creates a tap gesture. 65723b3eb3cSopenharmony_ci * 65823b3eb3cSopenharmony_ci * 1. This API is used to trigger a tap gesture with one, two, or more taps. \n 65923b3eb3cSopenharmony_ci * 2. If multi-tap is configured, the timeout interval between a lift and the next tap is 300 ms. \n 66023b3eb3cSopenharmony_ci * 3. If the distance between the last tapped position and the current tapped position exceeds 60 vp, 66123b3eb3cSopenharmony_ci * gesture recognition fails. \n 66223b3eb3cSopenharmony_ci * 4. If the value is greater than 1, the tap gesture will fail to be recognized when the number of fingers 66323b3eb3cSopenharmony_ci * touching the screen within 300 ms of the first finger touch is less than the required number, \n 66423b3eb3cSopenharmony_ci * or when the number of fingers lifted from the screen within 300 ms of the first finger's being lifted 66523b3eb3cSopenharmony_ci * is less than the required number. \n 66623b3eb3cSopenharmony_ci * 5. When the number of fingers touching the screen exceeds the set value, the gesture can be recognized. \n 66723b3eb3cSopenharmony_ci * 66823b3eb3cSopenharmony_ci * @param countNum Indicates the number of consecutive taps. If the value is less than 1 or is not set, 66923b3eb3cSopenharmony_ci * the default value <b>1</b> is used. 67023b3eb3cSopenharmony_ci * @param fingersNum Indicates the number of fingers required to trigger a tap. The value ranges 67123b3eb3cSopenharmony_ci * from 1 to 10. If the value is less than 1 or is not set, the default value <b>1</b> is used. 67223b3eb3cSopenharmony_ci * @return Returns the pointer to the created gesture. 67323b3eb3cSopenharmony_ci */ 67423b3eb3cSopenharmony_ci ArkUI_GestureRecognizer* (*createTapGesture)(int32_t countNum, int32_t fingersNum); 67523b3eb3cSopenharmony_ci 67623b3eb3cSopenharmony_ci /** 67723b3eb3cSopenharmony_ci * @brief Creates a long press gesture. 67823b3eb3cSopenharmony_ci * 67923b3eb3cSopenharmony_ci * 1. This API is used to trigger a long press gesture, which requires one or more fingers with a minimum 68023b3eb3cSopenharmony_ci * The value ranges 500 ms hold-down time. \n 68123b3eb3cSopenharmony_ci * 2. In components that support drag actions by default, such as <b><Text></b>, <b><TextInput></b>, 68223b3eb3cSopenharmony_ci * <b><TextArea></b>, <b><Hyperlink></b>, <b><Image></b>, and <b>RichEditor></b>, the long press gesture \n 68323b3eb3cSopenharmony_ci * may conflict with the drag action. If this occurs, they are handled as follows: \n 68423b3eb3cSopenharmony_ci * If the minimum duration of the long press gesture is less than 500 ms, the long press gesture receives 68523b3eb3cSopenharmony_ci * a higher response priority than the drag action. \n 68623b3eb3cSopenharmony_ci * If the minimum duration of the long press gesture is greater than or equal to 500 ms, 68723b3eb3cSopenharmony_ci * the drag action receives a higher response priority than the long press gesture. \n 68823b3eb3cSopenharmony_ci * 3. If a finger moves more than 15 px after being pressed, the gesture recognition fails. \n 68923b3eb3cSopenharmony_ci * 69023b3eb3cSopenharmony_ci * @param fingersNum Indicates the minimum number of fingers to trigger a long press gesture. 69123b3eb3cSopenharmony_ci * The value ranges from 1 to 10. 69223b3eb3cSopenharmony_ci * @param repeatResult Indicates whether to continuously trigger the event callback. 69323b3eb3cSopenharmony_ci * @param durationNum Indicates the minimum hold-down time, in ms. 69423b3eb3cSopenharmony_ci * If the value is less than or equal to 0, the default value <b>500</b> is used. 69523b3eb3cSopenharmony_ci * @return Returns the pointer to the created gesture. 69623b3eb3cSopenharmony_ci */ 69723b3eb3cSopenharmony_ci ArkUI_GestureRecognizer* (*createLongPressGesture)(int32_t fingersNum, bool repeatResult, int32_t durationNum); 69823b3eb3cSopenharmony_ci 69923b3eb3cSopenharmony_ci /** 70023b3eb3cSopenharmony_ci * @brief Creates a pan gesture. 70123b3eb3cSopenharmony_ci * 70223b3eb3cSopenharmony_ci * 1. This API is used to trigger a pan gesture when the movement distance of a finger on the screen exceeds 70323b3eb3cSopenharmony_ci * the minimum value. \n 70423b3eb3cSopenharmony_ci * 2. If a pan gesture and a tab swipe occur at the same time, set <b>distanceNum</b> to <b>1</b> 70523b3eb3cSopenharmony_ci * so that the gesture can be more easily recognized. \n 70623b3eb3cSopenharmony_ci * 70723b3eb3cSopenharmony_ci * @param fingersNum Indicates the minimum number of fingers to trigger a pan gesture. The value ranges from 1 to 10. 70823b3eb3cSopenharmony_ci * If the value is less than 1 or is not set, the default value <b>1</b> is used. 70923b3eb3cSopenharmony_ci * @param directions Indicates the pan direction. The value supports the AND (&) and OR (\|) operations. 71023b3eb3cSopenharmony_ci * @param distanceNum Indicates the minimum pan distance to trigger the gesture, in vp. If this parameter is 71123b3eb3cSopenharmony_ci * set to a value less than or equal to 0, the default value <b>5</b> is used. 71223b3eb3cSopenharmony_ci * @return Returns the pointer to the created gesture. 71323b3eb3cSopenharmony_ci */ 71423b3eb3cSopenharmony_ci ArkUI_GestureRecognizer* (*createPanGesture)( 71523b3eb3cSopenharmony_ci int32_t fingersNum, ArkUI_GestureDirectionMask directions, double distanceNum); 71623b3eb3cSopenharmony_ci 71723b3eb3cSopenharmony_ci /** 71823b3eb3cSopenharmony_ci * @brief Creates a pinch gesture. 71923b3eb3cSopenharmony_ci * 72023b3eb3cSopenharmony_ci * 1. This API is used to trigger a pinch gesture, which requires two to five fingers with a minimum 5 vp 72123b3eb3cSopenharmony_ci * distance between the fingers. \n 72223b3eb3cSopenharmony_ci * 2. While more fingers than the minimum number can be pressed to trigger the gesture, only the first 72323b3eb3cSopenharmony_ci * fingers of the minimum number participate in gesture calculation. \n 72423b3eb3cSopenharmony_ci * 72523b3eb3cSopenharmony_ci * @param fingersNum Indicates the minimum number of fingers to trigger a pinch. The value ranges from 2 to 5. 72623b3eb3cSopenharmony_ci * Default value: <b>2</b> 72723b3eb3cSopenharmony_ci * @param distanceNum Indicates the minimum recognition distance, in px. If this parameter is set to a value less 72823b3eb3cSopenharmony_ci * than or equal to 0, the default value <b>5</b> is used. 72923b3eb3cSopenharmony_ci * @return Returns the pointer to the created gesture. 73023b3eb3cSopenharmony_ci */ 73123b3eb3cSopenharmony_ci ArkUI_GestureRecognizer* (*createPinchGesture)(int32_t fingersNum, double distanceNum); 73223b3eb3cSopenharmony_ci 73323b3eb3cSopenharmony_ci /** 73423b3eb3cSopenharmony_ci * @brief Creates a rotation gesture. 73523b3eb3cSopenharmony_ci * 73623b3eb3cSopenharmony_ci * 1. This API is used to trigger a rotation gesture, which requires two to five fingers with a 73723b3eb3cSopenharmony_ci * minimum 1-degree rotation angle. \n 73823b3eb3cSopenharmony_ci * 2. While more fingers than the minimum number can be pressed to trigger the gesture, only the first 73923b3eb3cSopenharmony_ci * two fingers participate in gesture calculation. \n 74023b3eb3cSopenharmony_ci * 74123b3eb3cSopenharmony_ci * @param fingersNum Indicates the minimum number of fingers to trigger a rotation. The value ranges from 2 to 5. 74223b3eb3cSopenharmony_ci * Default value: <b>2</b> 74323b3eb3cSopenharmony_ci * @param angleNum Indicates the minimum degree that can trigger the rotation gesture. Default value: <b>1</b> 74423b3eb3cSopenharmony_ci * If this parameter is set to a value less than or equal to 0 or greater than 360, 74523b3eb3cSopenharmony_ci * the default value <b>1</b> is used. 74623b3eb3cSopenharmony_ci * @return Returns the pointer to the created gesture. 74723b3eb3cSopenharmony_ci */ 74823b3eb3cSopenharmony_ci ArkUI_GestureRecognizer* (*createRotationGesture)(int32_t fingersNum, double angleNum); 74923b3eb3cSopenharmony_ci 75023b3eb3cSopenharmony_ci /** 75123b3eb3cSopenharmony_ci * @brief Creates a swipe gesture. 75223b3eb3cSopenharmony_ci * 75323b3eb3cSopenharmony_ci * This API is used to implement a swipe gesture, which can be recognized when the swipe speed is 100 75423b3eb3cSopenharmony_ci * vp/s or higher. \n 75523b3eb3cSopenharmony_ci * 75623b3eb3cSopenharmony_ci * @param fingersNum Indicates the minimum number of fingers to trigger a swipe gesture. 75723b3eb3cSopenharmony_ci * The value ranges from 1 to 10. 75823b3eb3cSopenharmony_ci * @param directions Indicates the swipe direction. 75923b3eb3cSopenharmony_ci * @param speedNum Indicates the minimum speed of the swipe gesture, in px/s. 76023b3eb3cSopenharmony_ci * If this parameter is set to a value less than or equal to 0, the default value <b>100</b> is used. 76123b3eb3cSopenharmony_ci * @return Returns the pointer to the created gesture. 76223b3eb3cSopenharmony_ci */ 76323b3eb3cSopenharmony_ci ArkUI_GestureRecognizer* (*createSwipeGesture)( 76423b3eb3cSopenharmony_ci int32_t fingersNum, ArkUI_GestureDirectionMask directions, double speedNum); 76523b3eb3cSopenharmony_ci 76623b3eb3cSopenharmony_ci /** 76723b3eb3cSopenharmony_ci * @brief Creates a gesture group. 76823b3eb3cSopenharmony_ci * 76923b3eb3cSopenharmony_ci * @param gestureMode Indicates the gesture group mode. 77023b3eb3cSopenharmony_ci * @return Returns the pointer to the created gesture group. 77123b3eb3cSopenharmony_ci */ 77223b3eb3cSopenharmony_ci ArkUI_GestureRecognizer* (*createGroupGesture)(ArkUI_GroupGestureMode gestureMode); 77323b3eb3cSopenharmony_ci 77423b3eb3cSopenharmony_ci /** 77523b3eb3cSopenharmony_ci * @brief Disposes a gesture to release resources. 77623b3eb3cSopenharmony_ci * 77723b3eb3cSopenharmony_ci * @param recognizer Indicates the pointer to the gesture to dispose. 77823b3eb3cSopenharmony_ci */ 77923b3eb3cSopenharmony_ci void (*dispose)(ArkUI_GestureRecognizer* recognizer); 78023b3eb3cSopenharmony_ci 78123b3eb3cSopenharmony_ci /** 78223b3eb3cSopenharmony_ci * @brief Adds a gesture to a gesture group. 78323b3eb3cSopenharmony_ci * 78423b3eb3cSopenharmony_ci * @param group Indicates the pointer to the gesture group. 78523b3eb3cSopenharmony_ci * @param child Indicates the gesture to be added to the gesture group. 78623b3eb3cSopenharmony_ci * @return Returns <b>0</b> if success. 78723b3eb3cSopenharmony_ci * Returns <b>401</b> if a parameter exception occurs. Returns 401 if a parameter exception occurs. 78823b3eb3cSopenharmony_ci */ 78923b3eb3cSopenharmony_ci int32_t (*addChildGesture)(ArkUI_GestureRecognizer* group, ArkUI_GestureRecognizer* child); 79023b3eb3cSopenharmony_ci 79123b3eb3cSopenharmony_ci /** 79223b3eb3cSopenharmony_ci * @brief Removes a gesture to a gesture group. 79323b3eb3cSopenharmony_ci * 79423b3eb3cSopenharmony_ci * @param group Indicates the pointer to the gesture group. 79523b3eb3cSopenharmony_ci * @param child Indicates the gesture to be removed to the gesture group. 79623b3eb3cSopenharmony_ci * @return Returns <b>0</b> if success. 79723b3eb3cSopenharmony_ci * Returns <b>401</b> if a parameter exception occurs. 79823b3eb3cSopenharmony_ci */ 79923b3eb3cSopenharmony_ci int32_t (*removeChildGesture)(ArkUI_GestureRecognizer* group, ArkUI_GestureRecognizer* child); 80023b3eb3cSopenharmony_ci 80123b3eb3cSopenharmony_ci /** 80223b3eb3cSopenharmony_ci * @brief Registers a callback for gestures. 80323b3eb3cSopenharmony_ci * 80423b3eb3cSopenharmony_ci * @param recognizer Indicates the pointer to the gesture recognizer. 80523b3eb3cSopenharmony_ci * @param actionTypeMask Indicates the set of gesture event types. Multiple callbacks can be registered at once, 80623b3eb3cSopenharmony_ci * with the callback event types distinguished in the callbacks. 80723b3eb3cSopenharmony_ci * Example: actionTypeMask = GESTURE_EVENT_ACTION_ACCEPT | GESTURE_EVENT_ACTION_UPDATE; 80823b3eb3cSopenharmony_ci * @param extraParams Indicates the context passed in the <b>targetReceiver</b> callback. 80923b3eb3cSopenharmony_ci * @param targetReceiver Indicates the callback to register for processing the gesture event types. 81023b3eb3cSopenharmony_ci * <b>event</b> indicates the gesture callback data. 81123b3eb3cSopenharmony_ci * @return Returns <b>0</b> if success. 81223b3eb3cSopenharmony_ci * Returns <b>401</b> if a parameter exception occurs. 81323b3eb3cSopenharmony_ci */ 81423b3eb3cSopenharmony_ci int32_t (*setGestureEventTarget)( 81523b3eb3cSopenharmony_ci ArkUI_GestureRecognizer* recognizer, ArkUI_GestureEventActionTypeMask actionTypeMask, void* extraParams, 81623b3eb3cSopenharmony_ci void (*targetReceiver)(ArkUI_GestureEvent* event, void* extraParams)); 81723b3eb3cSopenharmony_ci 81823b3eb3cSopenharmony_ci /** 81923b3eb3cSopenharmony_ci * @brief Adds a gesture to a UI component. 82023b3eb3cSopenharmony_ci * 82123b3eb3cSopenharmony_ci * @param node Indicates the UI component to which you want to add the gesture. 82223b3eb3cSopenharmony_ci * @param recognizer Indicates the gesture to be added to the UI component. 82323b3eb3cSopenharmony_ci * @param mode Indicates the gesture event mode. Available options are <b>NORMAL_GESTURE</b>, 82423b3eb3cSopenharmony_ci * <b>PARALLEL_GESTURE</b>, and <b>PRIORITY_GESTURE</b>. 82523b3eb3cSopenharmony_ci * @param mask Indicates the gesture masking mode. 82623b3eb3cSopenharmony_ci * @return Returns <b>0</b> if success. 82723b3eb3cSopenharmony_ci * Returns <b>401</b> if a parameter exception occurs. 82823b3eb3cSopenharmony_ci */ 82923b3eb3cSopenharmony_ci int32_t (*addGestureToNode)( 83023b3eb3cSopenharmony_ci ArkUI_NodeHandle node, ArkUI_GestureRecognizer* recognizer, ArkUI_GesturePriority mode, ArkUI_GestureMask mask); 83123b3eb3cSopenharmony_ci 83223b3eb3cSopenharmony_ci /** 83323b3eb3cSopenharmony_ci * @brief Removes a gesture from a node. 83423b3eb3cSopenharmony_ci * 83523b3eb3cSopenharmony_ci * @param node Indicates the node from which you want to remove the gesture. 83623b3eb3cSopenharmony_ci * @param recognizer Indicates the gesture to be removed. 83723b3eb3cSopenharmony_ci * @return Returns <b>0</b> if success. 83823b3eb3cSopenharmony_ci * Returns <b>401</b> if a parameter exception occurs. 83923b3eb3cSopenharmony_ci */ 84023b3eb3cSopenharmony_ci int32_t (*removeGestureFromNode)(ArkUI_NodeHandle node, ArkUI_GestureRecognizer* recognizer); 84123b3eb3cSopenharmony_ci 84223b3eb3cSopenharmony_ci /** 84323b3eb3cSopenharmony_ci * @brief Sets a gesture interruption callback for a node. 84423b3eb3cSopenharmony_ci * 84523b3eb3cSopenharmony_ci * @param node Indicates the node for which you want to set a gesture interruption callback. 84623b3eb3cSopenharmony_ci * @param interrupter Indicates the gesture interruption callback to set. 84723b3eb3cSopenharmony_ci * <b>info</b> indicates the gesture interruption data. If <b>interrupter</b> returns 84823b3eb3cSopenharmony_ci * <b>GESTURE_INTERRUPT_RESULT_CONTINUE</b>, the gesture recognition process continues. If it returns 84923b3eb3cSopenharmony_ci * <b>GESTURE_INTERRUPT_RESULT_REJECT</b>, the gesture recognition process is paused. 85023b3eb3cSopenharmony_ci * @return Returns <b>0</b> if success. 85123b3eb3cSopenharmony_ci * Returns <b>401</b> if a parameter exception occurs. 85223b3eb3cSopenharmony_ci */ 85323b3eb3cSopenharmony_ci int32_t (*setGestureInterrupterToNode)( 85423b3eb3cSopenharmony_ci ArkUI_NodeHandle node, ArkUI_GestureInterruptResult (*interrupter)(ArkUI_GestureInterruptInfo* info)); 85523b3eb3cSopenharmony_ci 85623b3eb3cSopenharmony_ci /** 85723b3eb3cSopenharmony_ci * @brief Obtains the type of a gesture. 85823b3eb3cSopenharmony_ci * 85923b3eb3cSopenharmony_ci * @param recognizer Indicates the pointer to the gesture. 86023b3eb3cSopenharmony_ci * @return Returns the gesture type. 86123b3eb3cSopenharmony_ci */ 86223b3eb3cSopenharmony_ci ArkUI_GestureRecognizerType (*getGestureType)(ArkUI_GestureRecognizer* recognizer); 86323b3eb3cSopenharmony_ci 86423b3eb3cSopenharmony_ci /** 86523b3eb3cSopenharmony_ci * @brief Sets the callback function for a parallel internal gesture event. 86623b3eb3cSopenharmony_ci * 86723b3eb3cSopenharmony_ci * @param node Indicates the ArkUI node for which the callback of a parallel internal gesture event is to be set. 86823b3eb3cSopenharmony_ci * @param userData Indicates the custom data. 86923b3eb3cSopenharmony_ci * @param parallelInnerGesture Indicates the parallel internal gesture event. <b>event</b> returns the data of the 87023b3eb3cSopenharmony_ci * parallel internal gesture event; <b>parallelInnerGesture</b> returns the pointer to the gesture recognizer 87123b3eb3cSopenharmony_ci * that requires parallel recognition. 87223b3eb3cSopenharmony_ci * @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if success. 87323b3eb3cSopenharmony_ci * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs. 87423b3eb3cSopenharmony_ci */ 87523b3eb3cSopenharmony_ci int32_t (*setInnerGestureParallelTo)( 87623b3eb3cSopenharmony_ci ArkUI_NodeHandle node, void* userData, ArkUI_GestureRecognizer* (*parallelInnerGesture)( 87723b3eb3cSopenharmony_ci ArkUI_ParallelInnerGestureEvent* event)); 87823b3eb3cSopenharmony_ci 87923b3eb3cSopenharmony_ci /** 88023b3eb3cSopenharmony_ci * @brief Creates a tap gesture that is subject to distance restrictions. 88123b3eb3cSopenharmony_ci * 88223b3eb3cSopenharmony_ci * 1. This API is used to trigger a tap gesture with one, two, or more taps. \n 88323b3eb3cSopenharmony_ci * 2. If multi-tap is configured, the timeout interval between a lift and the next tap is 300 ms. \n 88423b3eb3cSopenharmony_ci * 3. If the distance between the last tapped position and the current tapped position exceeds 60 vp, 88523b3eb3cSopenharmony_ci * gesture recognition fails. \n 88623b3eb3cSopenharmony_ci * 4. If the value is greater than 1, the tap gesture will fail to be recognized when the number of fingers 88723b3eb3cSopenharmony_ci * touching the screen within 300 ms of the first finger touch is less than the required number, 88823b3eb3cSopenharmony_ci * or when the number of fingers lifted from the screen within 300 ms of the first finger's being lifted 88923b3eb3cSopenharmony_ci * is less than the required number. \n 89023b3eb3cSopenharmony_ci * 5. When the number of fingers touching the screen exceeds the set value, the gesture can be recognized. \n 89123b3eb3cSopenharmony_ci * 6. If the finger moves beyond the preset distance limit, gesture recognition fails. \n 89223b3eb3cSopenharmony_ci * 89323b3eb3cSopenharmony_ci * @param countNum Indicates the number of consecutive taps. If the value is less than 1 or is not set, the default 89423b3eb3cSopenharmony_ci * value <b>1</b> is used. 89523b3eb3cSopenharmony_ci * @param fingersNum Indicates the number of fingers required to trigger a tap. The value ranges from 1 to 10. 89623b3eb3cSopenharmony_ci * If the value is less than 1 or is not set, the default value <b>1</b> is used. 89723b3eb3cSopenharmony_ci * @param distanceThreshold Indicates the allowed moving distance of a finger. 89823b3eb3cSopenharmony_ci * The unit of this parameter is px. 89923b3eb3cSopenharmony_ci * If the value is less than 0, it will be converted to the default value of infinity. 90023b3eb3cSopenharmony_ci * @return Returns the pointer to the created gesture. 90123b3eb3cSopenharmony_ci */ 90223b3eb3cSopenharmony_ci ArkUI_GestureRecognizer* (*createTapGestureWithDistanceThreshold)( 90323b3eb3cSopenharmony_ci int32_t countNum, int32_t fingersNum, double distanceThreshold); 90423b3eb3cSopenharmony_ci} ArkUI_NativeGestureAPI_1; 90523b3eb3cSopenharmony_ci 90623b3eb3cSopenharmony_ci#ifdef __cplusplus 90723b3eb3cSopenharmony_ci}; 90823b3eb3cSopenharmony_ci#endif 90923b3eb3cSopenharmony_ci 91023b3eb3cSopenharmony_ci#endif // ARKUI_NATIVE_GESTTURE_H 91123b3eb3cSopenharmony_ci/** @} */