From a19a19f3f9062c8ac98397b8f55c7fb98f179e3a Mon Sep 17 00:00:00 2001 From: mlyuestc Date: Tue, 18 Feb 2025 15:22:05 +0000 Subject: [PATCH] add new interface Signed-off-by: mlyuestc Change-Id: Ia7db2f4cbaf463de6ab2e8ee1aa140f7a828c5f8 --- arkui/ace_engine/native/libace.ndk.json | 36 +++++++ arkui/ace_engine/native/native_node.h | 12 +++ arkui/ace_engine/native/native_type.h | 15 +++ arkui/ace_engine/native/ui_input_event.h | 121 +++++++++++++++++++++++ 4 files changed, 184 insertions(+) diff --git a/arkui/ace_engine/native/libace.ndk.json b/arkui/ace_engine/native/libace.ndk.json index fdcb2e86f..1e1b9c36b 100644 --- a/arkui/ace_engine/native/libace.ndk.json +++ b/arkui/ace_engine/native/libace.ndk.json @@ -2569,5 +2569,41 @@ { "first_introduced": "15", "name": "OH_ArkUI_AccessibilityProviderRegisterCallbackWithInstance" + }, + { + "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 355b71fb1..08a452533 100644 --- a/arkui/ace_engine/native/native_node.h +++ b/arkui/ace_engine/native/native_node.h @@ -8308,6 +8308,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 a3380b35d..af9bc0f9f 100644 --- a/arkui/ace_engine/native/native_type.h +++ b/arkui/ace_engine/native/native_type.h @@ -1986,6 +1986,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 85a377f12..874d10c7b 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 @@ -743,6 +744,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 -- Gitee