From 0ef8cb55e5a556bfa803682113c46a1dd7512d1a Mon Sep 17 00:00:00 2001 From: hct95 Date: Fri, 29 Nov 2024 11:40:01 +0800 Subject: [PATCH] add new gestureInfo capi Signed-off-by: hct95 --- arkui/ace_engine/native/native_gesture.h | 114 +++++++++++++++++++++++ arkui/ace_engine/native/native_type.h | 5 + 2 files changed, 119 insertions(+) diff --git a/arkui/ace_engine/native/native_gesture.h b/arkui/ace_engine/native/native_gesture.h index 42b37aa9c..e39f2bba9 100644 --- a/arkui/ace_engine/native/native_gesture.h +++ b/arkui/ace_engine/native/native_gesture.h @@ -599,6 +599,120 @@ int32_t OH_ArkUI_GetGestureTag(ArkUI_GestureRecognizer* recognizer, char* buffer int32_t OH_ArkUI_GetGestureBindNodeId(ArkUI_GestureRecognizer* recognizer, char* nodeId, int32_t size, int32_t* result); +/** +* @brief Obtains the direction of a gesture recognizer. +* +* @param recognizer Indicates the pointer to a gesture recognizer. +* @param directionMask Indicates the gesture recognizer direction. +* @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if success. +* Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs. +* Returns {@link ARKUI_ERROR_CODE_GESTURE_NOT_CONTAIN_THIS_PARAMETER} if the recognizer is not contain this +* params. +* @since 16 +*/ +int32_t OH_ArkUI_GetGestureParam_DirectionMask(ArkUI_GestureRecognizer* recognizer, + ArkUI_GestureDirectionMask* directionMask); + +/** +* @brief Obtains the finger count of a gesture recognizer. +* +* @param recognizer Indicates the pointer to a gesture recognizer. +* @param finger Indicates the gesture recognizer's finger count. +* @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if success. +* Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs. +* @since 16 +*/ +int32_t OH_ArkUI_GetGestureParam_FingerCount(ArkUI_GestureRecognizer *recognizer, int32_t* finger); + +/** +* @brief Obtains the fingerCountLimit of a gesture recognizer. +* +* @param recognizer Indicates the pointer to a gesture recognizer. +* @param isFingerCountLimit Indicates the gesture recognizer's fingerCountLimit. +* @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if success. +* Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs. +* @since 16 +*/ +int32_t OH_ArkUI_GetGestureParam_FingerCountLimit(ArkUI_GestureRecognizer* recognizer, bool* isFingerCountLimit); + +/** +* @brief Obtains the repeat state of a gesture recognizer. +* +* @param recognizer Indicates the pointer to a gesture recognizer. +* @param isRepeat Indicates the gesture recognizer's repeat state. +* @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if success. +* Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs. +* Returns {@link ARKUI_ERROR_CODE_GESTURE_NOT_CONTAIN_THIS_PARAMETER} if the recognizer is not contain this +* params. +* @since 16 +*/ +int32_t OH_ArkUI_GetGestureParam_Repeat(ArkUI_GestureRecognizer* recognizer, bool* isRepeat); + +/** +* @brief Obtains the distance of a gesture recognizer. +* +* @param recognizer Indicates the pointer to a gesture recognizer. +* @param distance Indicates the gesture recognizer's distance. +* @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if success. +* Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs. +* Returns {@link ARKUI_ERROR_CODE_GESTURE_NOT_CONTAIN_THIS_PARAMETER} if the recognizer is not contain this +* params. +* @since 16 +*/ +int32_t OH_ArkUI_GetGestureParam_Distance(ArkUI_GestureRecognizer* recognizer, double* distance); + +/** +* @brief Obtains the velocityThreshold of a gesture recognizer. +* +* @param recognizer Indicates the pointer to a gesture recognizer. +* @param velocityThreshold Indicates the gesture recognizer's velocityThreshold. +* @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if success. +* Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs. +* Returns {@link ARKUI_ERROR_CODE_GESTURE_NOT_CONTAIN_THIS_PARAMETER} if the recognizer is not contain this +* params. +* @since 16 +*/ +int32_t OH_ArkUI_GetGestureParam_VelocityThreshold(ArkUI_GestureRecognizer* recognizer, double* velocityThreshold); + +/** +* @brief Obtains the duration of a gesture recognizer. +* +* @param recognizer Indicates the pointer to a gesture recognizer. +* @param duration Indicates the gesture recognizer's duration. +* @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if success. +* Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs. +* Returns {@link ARKUI_ERROR_CODE_GESTURE_NOT_CONTAIN_THIS_PARAMETER} if the recognizer is not contain this +* params. +* @since 16 +*/ +int32_t OH_ArkUI_GetGestureParam_Duration(ArkUI_GestureRecognizer* recognizer, int32_t* duration); + +/** +* @brief Obtains the angle of a gesture recognizer. +* +* @param recognizer Indicates the pointer to a gesture recognizer. +* @param angle Indicates the gesture recognizer's angle. +* @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if success. +* Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs. +* Returns {@link ARKUI_ERROR_CODE_GESTURE_NOT_CONTAIN_THIS_PARAMETER} if the recognizer is not contain this +* params. +* @since 16 +*/ +int32_t OH_ArkUI_GetGestureParam_Angle(ArkUI_GestureRecognizer* recognizer, double* angle); + +/** +* @brief Obtains the distanceThreshold of a gesture recognizer. +* +* @param recognizer Indicates the pointer to a gesture recognizer. +* @param distanceThreshold Indicates the gesture recognizer's distanceThreshold. +* @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if success. +* Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs. +* Returns {@link ARKUI_ERROR_CODE_GESTURE_NOT_CONTAIN_THIS_PARAMETER} if the recognizer is not contain this +* params. +* @since 16 +*/ +int32_t OH_ArkUI_GetGestureParam_DistanceThreshold(ArkUI_GestureRecognizer* recognizer, double* distanceThreshold); + /** * @brief Obtains whether a gesture recognizer is valid. * diff --git a/arkui/ace_engine/native/native_type.h b/arkui/ace_engine/native/native_type.h index ca825e62b..0246e0f03 100644 --- a/arkui/ace_engine/native/native_type.h +++ b/arkui/ace_engine/native/native_type.h @@ -1937,6 +1937,11 @@ typedef enum { * @since 14 */ ARKUI_ERROR_CODE_INVALID_STYLED_STRING = 180101, + /** + * The gesture not contain this parameter. + * @since 16 + */ + ARKUI_ERROR_CODE_GESTURE_NOT_CONTAIN_THIS_PARAMETER = 180102, } ArkUI_ErrorCode; /** -- Gitee