From 9a8838ee9dad0abe0a8222c961da85457d9fb61a Mon Sep 17 00:00:00 2001 From: zhouchaobo Date: Sun, 26 Jan 2025 17:27:49 +0800 Subject: [PATCH] Gesture recognizer get capi add Signed-off-by: zhouchaobo --- arkui/ace_engine/native/libace.ndk.json | 36 ++++++++ arkui/ace_engine/native/native_gesture.h | 108 +++++++++++++++++++++++ arkui/ace_engine/native/native_type.h | 2 + 3 files changed, 146 insertions(+) diff --git a/arkui/ace_engine/native/libace.ndk.json b/arkui/ace_engine/native/libace.ndk.json index 93b14a1c3..10d4b14a9 100644 --- a/arkui/ace_engine/native/libace.ndk.json +++ b/arkui/ace_engine/native/libace.ndk.json @@ -2574,5 +2574,41 @@ { "first_introduced": "16", "name": "OH_ArkUI_UnregisterDrawCallbackOnNodeHandle" + }, + { + "first_introduced": "16", + "name": "OH_ArkUI_GetGestureParm_FingerCount" + }, + { + "first_introduced": "16", + "name": "OH_ArkUI_GetGestureParm_limitFingerCount" + }, + { + "first_introduced": "16", + "name": "OH_ArkUI_GetGestureParm_repeat" + }, + { + "first_introduced": "16", + "name": "OH_ArkUI_GetGestureParm_distance" + }, + { + "first_introduced": "16", + "name": "OH_ArkUI_GetGestureParm_speed" + }, + { + "first_introduced": "16", + "name": "OH_ArkUI_GetGestureParm_duration" + }, + { + "first_introduced": "16", + "name": "OH_ArkUI_GetGestureParm_angle" + }, + { + "first_introduced": "16", + "name": "OH_ArkUI_GetGestureParm_disThresHold" + }, + { + "first_introduced": "16", + "name": "OH_ArkUI_GetGestureParm_DirectMask" } ] \ No newline at end of file diff --git a/arkui/ace_engine/native/native_gesture.h b/arkui/ace_engine/native/native_gesture.h index 4551c782c..e0026ab4e 100644 --- a/arkui/ace_engine/native/native_gesture.h +++ b/arkui/ace_engine/native/native_gesture.h @@ -654,6 +654,114 @@ int32_t OH_ArkUI_ParallelInnerGestureEvent_GetConflictRecognizers(ArkUI_Parallel int32_t OH_ArkUI_SetArkUIGestureRecognizerDisposeNotify(ArkUI_GestureRecognizer* recognizer, ArkUI_GestureRecognizerDisposeNotifyCallback callback, void* userData); +/** +* @brief Obtains the swipe direction of a gesture recognizer. +* +* @param recognizer Pointer to a gesture recognizer. +* @param dictMask Swipe direction of the gesture recognizer. +* @return Returns the result code. +* Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. +* Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. +* @since 16 +*/ +int32_t OH_ArkUI_GetGestureParm_DirectMask(ArkUI_GestureRecognizer* recognizer, ArkUI_GestureDirectionMask* dictMask); + +/** +* @brief Obtains the number of fingers used by a gesture recognizer. +* +* @param recognizer Pointer to a gesture recognizer. +* @param finger Number of fingers used by the gesture recognizer. +* @return Returns the result code. +* Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. +* Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. +* @since 16 +*/ +int32_t OH_ArkUI_GetGestureParm_FingerCount(ArkUI_GestureRecognizer* recognizer, int* finger); + +/** +* @brief Checks whether a gesture recognizer has a finger count limit. +* +* @param recognizer Pointer to a gesture recognizer. +* @param isLimited Whether the gesture recognizer has a finger count limit. +* @return Returns the result code. +* Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. +* Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. +* @since 16 +*/ +int32_t OH_ArkUI_GetGestureParm_limitFingerCount(ArkUI_GestureRecognizer* recognizer, bool* isLimited); + +/** +* @brief Checks whether a gesture recognizer supports repeated event callbacks. +* +* @param recognizer Pointer to a gesture recognizer. +* @param isRepeat Whether the gesture recognizer supports repeated event callbacks. +* @return Returns the result code. +* Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. +* Returns {@link ARKUI_ERROR_CODE_RECOGNIZER_TYPE_NOT_SUPPORT} if the gesture recognizer type is not supported. +* @since 16 +*/ +int32_t OH_ArkUI_GetGestureParm_repeat(ArkUI_GestureRecognizer* recognizer, bool* isRepeat); + +/** +* @brief Obtains the allowed movement distance range for a gesture recognizer. +* +* @param recognizer Pointer to a gesture recognizer. +* @param distance Allowed movement distance range of the gesture recognizer. +* @return Returns the result code. +* Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. +* Returns {@link ARKUI_ERROR_CODE_RECOGNIZER_TYPE_NOT_SUPPORT} if the gesture recognizer type is not supported. +* @since 16 +*/ +int32_t OH_ArkUI_GetGestureParm_distance(ArkUI_GestureRecognizer* recognizer, double* distance); + +/** +* @brief Obtains the minimum swipe speed recognized by a gesture recognizer. +* +* @param recognizer Pointer to a gesture recognizer. +* @param speed Minimum swipe speed recognized by a gesture recognizer. +* @return Returns the result code. +* Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. +* Returns {@link ARKUI_ERROR_CODE_RECOGNIZER_TYPE_NOT_SUPPORT} if the gesture recognizer type is not supported. +* @since 16 +*/ +int32_t OH_ArkUI_GetGestureParm_speed(ArkUI_GestureRecognizer* recognizer, double* speed); + +/** +* @brief Obtains the minimum duration required to trigger a long press by a gesture recognizer. +* +* @param recognizer Pointer to a gesture recognizer. +* @param duration Minimum duration for a long press. +* @return Returns the result code. +* Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. +* Returns {@link ARKUI_ERROR_CODE_RECOGNIZER_TYPE_NOT_SUPPORT} if the gesture recognizer type is not supported. +* @since 16 +*/ +int32_t OH_ArkUI_GetGestureParm_duration(ArkUI_GestureRecognizer* recognizer, int* duration); + +/** +* @brief Obtains the minimum angle change required for a rotation gesture to be recognized by a gesture recognizer. +* +* @param recognizer Pointer to a gesture recognizer. +* @param angle Minimum angle change. +* @return Returns the result code. +* Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. +* Returns {@link ARKUI_ERROR_CODE_RECOGNIZER_TYPE_NOT_SUPPORT} if the gesture recognizer type is not supported. +* @since 16 +*/ +int32_t OH_ArkUI_GetGestureParm_angle(ArkUI_GestureRecognizer* recognizer, double* angle); + +/** +* @brief Obtains the movement threshold for gestures to be recognized by a gesture recognizer. +* +* @param recognizer Pointer to a gesture recognizer. +* @param disThresHold Movement threshold. +* @return Returns the result code. +* Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. +* Returns {@link ARKUI_ERROR_CODE_RECOGNIZER_TYPE_NOT_SUPPORT} if the gesture recognizer type is not supported. +* @since 16 +*/ +int32_t OH_ArkUI_GetGestureParm_disThresHold(ArkUI_GestureRecognizer* recognizer, double* disThresHold); + /** * @brief Defines the gesture APIs. * diff --git a/arkui/ace_engine/native/native_type.h b/arkui/ace_engine/native/native_type.h index 05352dd08..e4b662c41 100644 --- a/arkui/ace_engine/native/native_type.h +++ b/arkui/ace_engine/native/native_type.h @@ -1998,6 +1998,8 @@ typedef enum { * @since 16 */ ARKUI_ERROR_CODE_CALLBACK_INVALID = 190002, + /** The gesture recognizer type is not supported. */ + ARKUI_ERROR_CODE_RECOGNIZER_TYPE_NOT_SUPPORT = 180102, } ArkUI_ErrorCode; /** -- Gitee