diff --git a/arkui/ace_engine/native/libace.ndk.json b/arkui/ace_engine/native/libace.ndk.json index 9f3177a0d..d964b6c9e 100644 --- a/arkui/ace_engine/native/libace.ndk.json +++ b/arkui/ace_engine/native/libace.ndk.json @@ -6518,6 +6518,34 @@ "first_introduced": "24", "name": "OH_ArkUI_TextLayoutManager_GetCharacterRangeForGlyphRange" }, + { + "first_introduced": "26.0.0", + "name": "OH_ArkUI_NodeEvent_GetGestureCollectInterceptInfo" + }, + { + "first_introduced": "26.0.0", + "name": "OH_ArkUI_GestureCollectInterceptInfo_GetResponseRecognizers" + }, + { + "first_introduced": "26.0.0", + "name": "OH_ArkUI_GestureCollectInterceptInfo_GetTouchRecognizers" + }, + { + "first_introduced": "26.0.0", + "name": "OH_ArkUI_GestureCollectInterceptInfo_SetGestureCollectIntervention" + }, + { + "first_introduced": "26.0.0", + "name": "OH_ArkUI_TouchRecognizer_IsHostBelongsTo" + }, + { + "first_introduced": "26.0.0", + "name": "OH_ArkUI_GestureRecognizer_IsHostBelongsTo" + }, + { + "first_introduced": "26.0.0", + "name": "OH_ArkUI_GetGestureBindNodeUniqueId" + }, { "first_introduced": "24", "name": "OH_ArkUI_FontWeightConfigs_Create" diff --git a/arkui/ace_engine/native/native_gesture.h b/arkui/ace_engine/native/native_gesture.h index 6000ca581..5a6979feb 100644 --- a/arkui/ace_engine/native/native_gesture.h +++ b/arkui/ace_engine/native/native_gesture.h @@ -225,6 +225,51 @@ typedef enum { DRAG_DROP, } ArkUI_GestureRecognizerType; +/** + * @brief Defines the intervention types for gesture and event collection. + * + * @since 26.0.0 + */ +typedef enum { + /** + * @brief Continues the normal gesture and event collection process. No intervention is performed. + * @since 26.0.0 + */ + OH_ARKUI_GESTURE_COLLECT_INTERVENTION_CONTINUE = 0, + + /** + * @brief Discards all pending low-priority gestures and events. \n + * The gestures of the left sibling component and ancestor nodes (parent nodes and above) are discarded. \n + * Only the gestures already collected on the current node and higher-priority nodes are retained. + * @since 26.0.0 + */ + OH_ARKUI_GESTURE_COLLECT_INTERVENTION_DISCARD_LOWER = 1, + + /** + * @brief Discards all collected high-priority gestures and events. \n + * The gestures of the right sibling component and the current node are discarded. \n + * Continues processing the collection flow for lower-priority gestures (left sibling and ancestor nodes). + * @since 26.0.0 + */ + OH_ARKUI_GESTURE_COLLECT_INTERVENTION_DISCARD_HIGHER = 2, + + /** + * @brief Discards the gestures and events of the current node. \n + * The gestures and events of the current node are excluded from the gesture tree. \n + * The gestures of the sibling components (left and right) and the ancestor node are still collected. + * @since 26.0.0 + */ + OH_ARKUI_GESTURE_COLLECT_INTERVENTION_DISCARD_SELF = 3, + + /** + * @brief Discards the gestures and events to be collected from the left sibling component. \n + * The gestures and events of the current node and the right sibling component are retained. \n + * Continues the collection flow for the parent and ancestor nodes. + * @since 26.0.0 + */ + OH_ARKUI_GESTURE_COLLECT_INTERVENTION_DISCARD_LOWER_PRIORITY_SIBLINGS = 4, +} OH_ArkUI_GestureCollectIntervention; + /** * @brief Enumerates gesture interruption results. * @@ -1251,6 +1296,77 @@ void* OH_ArkUI_GestureInterrupter_GetUserData(ArkUI_GestureInterruptInfo* event) */ ArkUI_ErrorCode OH_ArkUI_PreventGestureRecognizerBegin(ArkUI_GestureRecognizer* recognizer); +/** + * @brief Obtains the gesture recognizer from the gesture collection interception information. + * + * @param info Pointer to the gesture collection interception information. + * @param array Pointer to the gesture recognizer array. + * @param size Size of the gesture recognizer array. + * @return 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 26.0.0 + */ +ArkUI_ErrorCode OH_ArkUI_GestureCollectInterceptInfo_GetResponseRecognizers( + const ArkUI_GestureCollectInterceptInfo* info, ArkUI_GestureRecognizerHandleArray* array, int32_t* size); + +/** + * @brief Obtains the handle to touch recognizer from the gesture collection interception information. + * + * @param info Pointer to the gesture collection interception information. + * @param recognizers Pointer to the array of handles to touch recognizers. + * @param size Size of the recognizers array. + * @return 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 26.0.0 + */ +ArkUI_ErrorCode OH_ArkUI_GestureCollectInterceptInfo_GetTouchRecognizers(const ArkUI_GestureCollectInterceptInfo* info, + ArkUI_TouchRecognizerHandleArray* recognizers, int32_t* size); + +/** + * @brief Sets the gesture collection intervention mode. + * @param info Pointer to the gesture collection interception information. + * @param intervention Gesture collection intervention mode, which is of + * type {@link OH_ArkUI_GestureCollectIntervention}. + * @return 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 26.0.0 +*/ +ArkUI_ErrorCode OH_ArkUI_GestureCollectInterceptInfo_SetGestureCollectIntervention( + ArkUI_GestureCollectInterceptInfo* info, OH_ArkUI_GestureCollectIntervention intervention); + +/** + * @brief Obtains the unique ID of the component linked to a gesture recognizer. + * + * @param recognizer Pointer to the gesture recognizer. + * @param uniqueId Unique ID of the component linked to a gesture recognizer. + * @return 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 26.0.0 + */ +ArkUI_ErrorCode OH_ArkUI_GetGestureBindNodeUniqueId(const ArkUI_GestureRecognizer* recognizer, int32_t* uniqueId); + +/** + * @brief Checks whether the node linked to the gesture is a child node of the passed component. + * + * @param recognizer Handle to the touch recognizer. + * @param uniqueId Unique ID of the component. + * @return Returns true if the node linked to the gesture is a child node of the passed component. + * Returns false otherwise. + * @since 26.0.0 + */ +bool OH_ArkUI_TouchRecognizer_IsHostBelongsTo(const ArkUI_TouchRecognizerHandle recognizer, int32_t uniqueId); + +/** + * @brief Checks whether the node linked to the gesture is a child node of the passed component. + * + * @param recognizer Pointer to the gesture recognizer. + * @param uniqueId Unique ID of the component. + * @return Returns true if the node linked to the gesture is a child node of the passed component. + * Returns false otherwise. + * @since 26.0.0 + */ +bool OH_ArkUI_GestureRecognizer_IsHostBelongsTo(const ArkUI_GestureRecognizer* recognizer, int32_t uniqueId); + #ifdef __cplusplus }; #endif diff --git a/arkui/ace_engine/native/native_node.h b/arkui/ace_engine/native/native_node.h index 22dc17a5d..c4c190367 100644 --- a/arkui/ace_engine/native/native_node.h +++ b/arkui/ace_engine/native/native_node.h @@ -9484,6 +9484,17 @@ typedef enum { */ NODE_ON_NEED_SOFTKEYBOARD = 36, + /** + * @brief This callback is invoked when the events and gestures on this node and + * higher-priority nodes are collected. \n + * This callback is used to intervene in the collection result of events and gestures. \n + * + * When the event callback occurs, the {@link ArkUI_GestureCollectInterceptInfo} object can be obtained from the + * {@link ArkUI_NodeEvent} object. \n + * @since 26.0.0 + */ + NODE_ON_GESTURE_COLLECT_INTERCEPT = 37, + /** * @brief Triggers onDetectResultUpdate callback * when the text is set to TextDataDetectorConfig and recognized successfully. @@ -13245,6 +13256,18 @@ int32_t OH_ArkUI_Swiper_ShowNext(ArkUI_NodeHandle node); int32_t OH_ArkUI_NativeModule_GetPageRootNodeHandleByContext( ArkUI_ContextHandle context, ArkUI_NodeHandle* rootNode); +/** + * @brief Obtains the ArkUI_GestureCollectInterceptInfo object from a specified ArkUI_NodeEvent object. + * + * @param nodeEvent Pointer to the ArkUI_NodeEvent object. + * @return Returns the pointer to the ArkUI_GestureCollectInterceptInfo object. + * It is valid only during callback and does not need to be released. + * Returns null if the input parameter is invalid or the + * information is not gesture collection interception information. + * @since 26.0.0 + */ +ArkUI_GestureCollectInterceptInfo* OH_ArkUI_NodeEvent_GetGestureCollectInterceptInfo(ArkUI_NodeEvent* nodeEvent); + #ifdef __cplusplus }; #endif diff --git a/arkui/ace_engine/native/native_type.h b/arkui/ace_engine/native/native_type.h index 867c9b134..fe15462e6 100644 --- a/arkui/ace_engine/native/native_type.h +++ b/arkui/ace_engine/native/native_type.h @@ -94,6 +94,13 @@ typedef struct ArkUI_Node* ArkUI_NodeHandle; */ typedef struct ArkUI_NativeDialog* ArkUI_NativeDialogHandle; +/** + * @brief Defines information about gesture collection interception. + * + * @since 26.0.0 + */ +typedef struct ArkUI_GestureCollectInterceptInfo ArkUI_GestureCollectInterceptInfo; + /** * @brief Defines the return value structure for the onGetIrregularSizeByIndex callback * in Grid layout options.