diff --git a/arkui/ace_engine/native/libace.ndk.json b/arkui/ace_engine/native/libace.ndk.json index e73a2ef176ab4f6087ce5684fdbcea4a4d7960f4..544b36e76154b8861710e42bc7d788b66c3e6440 100644 --- a/arkui/ace_engine/native/libace.ndk.json +++ b/arkui/ace_engine/native/libace.ndk.json @@ -2593,5 +2593,41 @@ { "first_introduced": "15", "name": "OH_ArkUI_NodeEvent_GetTextChangeEvent" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_PointerEvent_CreateClonedEvent" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_PointerEvent_DestroyClonedEvent" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_PointerEvent_SetClonedEventLocalPosition" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_PointerEvent_SetClonedEventLocalPositionByIndex" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_PointerEvent_SetClonedEventActionType" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_PointerEvent_SetClonedEventChangedFingerId" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_PointerEvent_SetClonedEventFingerIdByIndex" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_PointerEvent_PostClonedEvent" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_NodeUtils_GetPositionToParent" } ] \ No newline at end of file diff --git a/arkui/ace_engine/native/native_node.h b/arkui/ace_engine/native/native_node.h index 3db22940cdafa3ceb6910dd899f7e7ff65aa1e94..6d59b2edf20f47979b95f538265e6de842cb421d 100644 --- a/arkui/ace_engine/native/native_node.h +++ b/arkui/ace_engine/native/native_node.h @@ -8429,6 +8429,18 @@ int32_t OH_ArkUI_NodeUtils_SetCrossLanguageOption(ArkUI_NodeHandle node, ArkUI_C */ int32_t OH_ArkUI_NodeUtils_GetCrossLanguageOption(ArkUI_NodeHandle node, ArkUI_CrossLanguageOption* option); +/** + * @brief Obtains the offset of a specific node relative to its parent node. + * + * @param node Target node. + * @param globalOffset Offset of the target node relative to its parent node, in px. + * @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 15 + */ +int32_t OH_ArkUI_NodeUtils_GetPositionToParent(ArkUI_NodeHandle node, ArkUI_IntOffset* globalOffset); + #ifdef __cplusplus }; #endif diff --git a/arkui/ace_engine/native/native_type.h b/arkui/ace_engine/native/native_type.h index 9cb24710b12e91b1d7c69400ba8dcf38e3a56bfd..7ae754b98062bdb9149a6323e990006dc2c2f5f8 100644 --- a/arkui/ace_engine/native/native_type.h +++ b/arkui/ace_engine/native/native_type.h @@ -2014,6 +2014,21 @@ typedef enum { ARKUI_ERROR_CODE_NON_SCROLLABLE_CONTAINER = 180001, /** The buffer is not large enough. */ ARKUI_ERROR_CODE_BUFFER_SIZE_NOT_ENOUGH = 180002, + /** + * @error The event is not a clone event. + * @since 15 + */ + ARKUI_ERROR_CODE_NOT_CLONED_POINTER_EVENT = 180003, + /** + * @error The component status is abnormal. + * @since 15 + */ + ARKUI_ERROR_CODE_POST_CLONED_COMPONENT_STATUS_ABNORMAL = 180004, + /** + * @error No component hit to respond to the event. + * @since 15 + */ + ARKUI_ERROR_CODE_POST_CLONED_NO_COMPONENT_HIT_TO_RESPOND_TO_THE_EVENT = 180005, /** * @error invalid styled string. * @since 14 diff --git a/arkui/ace_engine/native/ui_input_event.h b/arkui/ace_engine/native/ui_input_event.h index 6731353b1489a1a5930b66c76f250ed2094356fb..6758e9d24cc55e6ba6ae5d36083d94dee82c9b22 100644 --- a/arkui/ace_engine/native/ui_input_event.h +++ b/arkui/ace_engine/native/ui_input_event.h @@ -38,6 +38,7 @@ #include +#include "native_type.h" #ifdef __cplusplus extern "C" { #endif @@ -770,6 +771,126 @@ int32_t OH_ArkUI_UIInputEvent_GetDeviceId(const ArkUI_UIInputEvent* event); int32_t OH_ArkUI_UIInputEvent_GetPressedKeys( const ArkUI_UIInputEvent* event, int32_t* pressedKeyCodes, int32_t* length); +/** + * @brief Creates a cloned event pointer based on an event pointer. + * + * @param event Pointer to an ArkUI_UIInputEvent object. + * @param clonedEvent Pointer to the cloned ArkUI_UIInputEvent object. + * @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 15 + */ +int32_t OH_ArkUI_PointerEvent_CreateClonedEvent(const ArkUI_UIInputEvent* event, ArkUI_UIInputEvent** clonedEvent); + +/** + * @brief Destroys a cloned event pointer. + * + * @param event Pointer to an ArkUI_UIInputEvent object. + * @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. + * Returns {@link ARKUI_ERROR_CODE_NON_CLONED_POINTER_EVENT} if the input event pointer is not a + * cloned event pointer. + * @since 15 + */ +int32_t OH_ArkUI_PointerEvent_DestroyClonedEvent(const ArkUI_UIInputEvent* event); + +/** + * @brief Sets the X and Y coordinates of a cloned event relative to the upper left corner of the current component. + * + * @param event Pointer to an ArkUI_UIInputEvent object. + * @param x X coordinate of the event relative to the upper left corner of the current component. + * @param y Y coordinate of the event relative to the upper left corner of the current component. + * @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. + * Returns {@link ARKUI_ERROR_CODE_NON_CLONED_POINTER_EVENT} if the input event pointer is not a + * cloned event pointer. + * @since 15 + */ +int32_t OH_ArkUI_PointerEvent_SetClonedEventLocalPosition(const ArkUI_UIInputEvent* event, float x, float y); + +/** + * @brief Sets the X and Y coordinates of a specific contact point of a cloned event relative to the upper left corner + * of the current component. + * + * @param event Pointer to an ArkUI_UIInputEvent object. + * @param x X coordinate of the event relative to the upper left corner of the current component. + * @param y Y coordinate of the event relative to the upper left corner of the current component. + * @param pointerIndex Index of the target touch point in the multi-touch data list. + * @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. + * Returns {@link ARKUI_ERROR_CODE_NON_CLONED_POINTER_EVENT} if the input event pointer is not a + * cloned event pointer. + * @since 15 + */ +int32_t OH_ArkUI_PointerEvent_SetClonedEventLocalPositionByIndex( + const ArkUI_UIInputEvent* event, float x, float y, int32_t pointerIndex); + +/** + * @brief Sets the action type of a cloned event. + * + * @param event Pointer to an ArkUI_UIInputEvent object. + * @param actionType Action type of the cloned event. + * @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. + * Returns {@link ARKUI_ERROR_CODE_NON_CLONED_POINTER_EVENT} if the input event pointer is not a + * cloned event pointer. + * @since 15 + */ +int32_t OH_ArkUI_PointerEvent_SetClonedEventActionType(const ArkUI_UIInputEvent* event, int32_t actionType); + +/** + * @brief Sets the touch point ID of a cloned pointer event. + * + * @param event Pointer to an ArkUI_UIInputEvent object. + * @param fingerId ID of the touch point that triggers the event. + * @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. + * Returns {@link ARKUI_ERROR_CODE_NON_CLONED_POINTER_EVENT} if the input event pointer is not a + * cloned event pointer. + * @since 15 + */ +int32_t OH_ArkUI_PointerEvent_SetClonedEventChangedFingerId(const ArkUI_UIInputEvent* event, int32_t fingerId); + +/** + * @brief Sets the touch point ID of a specific contact point of a cloned event. + * + * @param event Pointer to an ArkUI_UIInputEvent object. + * @param fingerId Touch point ID of the specific contact point. + * @param pointerIndex Index of the target touch point in the multi-touch data list. + * @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. + * Returns {@link ARKUI_ERROR_CODE_NON_CLONED_POINTER_EVENT} if the input event pointer is not a + * cloned event pointer. + * @since 15 + */ +int32_t OH_ArkUI_PointerEvent_SetClonedEventFingerIdByIndex( + const ArkUI_UIInputEvent* event, int32_t fingerId, int32_t pointerIndex); + +/** + * @brief Posts a cloned event to a specific node. + * + * @param node Target node. + * @param event Pointer to an ArkUI_UIInputEvent object. + * @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. + * Returns {@link ARKUI_ERROR_CODE_NON_CLONED_POINTER_EVENT} if the input event pointer is not a + * cloned event pointer. + * Returns {@link ARKUI_ERROR_CODE_POST_CLONED_COMPONENT_STATUS_ABNORMAL} + * if the component status abnormal. + * Returns {@link ARKUI_ERROR_CODE_POST_CLONED_NO_COMPONENT_HIT_TO_RESPOND_TO_THE_EVENT} + * if no component hit to response to the event. + * @since 15 + */ +int32_t OH_ArkUI_PointerEvent_PostClonedEvent(ArkUI_NodeHandle node, const ArkUI_UIInputEvent* event); + #ifdef __cplusplus }; #endif