From 83644a76fbdc6872fc6322b9dee09c9f1f80b683 Mon Sep 17 00:00:00 2001 From: liyi0309 Date: Thu, 11 Apr 2024 21:10:58 +0800 Subject: [PATCH] add C-API attributes Signed-off-by: liyi0309 --- arkui/ace_engine/native/libace.ndk.json | 24 +++++++++++++++++++++ arkui/ace_engine/native/native_node.h | 28 +++++++++++++++++++++++++ arkui/ace_engine/native/native_type.h | 26 +++++++++++++++++++++++ 3 files changed, 78 insertions(+) diff --git a/arkui/ace_engine/native/libace.ndk.json b/arkui/ace_engine/native/libace.ndk.json index e1a222b7c..1a4c8d1b0 100644 --- a/arkui/ace_engine/native/libace.ndk.json +++ b/arkui/ace_engine/native/libace.ndk.json @@ -183,6 +183,30 @@ "first_introduced": "12", "name": "OH_ArkUI_PanGesture_GetOffsetY" }, + { + "first_introduced": "12", + "name": "OH_ArkUI_SwipeGesture_GetAngle" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_SwipeGesture_GetVelocity" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_RotationGesture_GetAngle" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_PinchGesture_GetScale" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_PinchGesture_GetCenterX" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_PinchGesture_GetCenterY" + }, { "first_introduced": "12", "name": "OH_NativeXComponent_SetNeedSoftKeyboard" diff --git a/arkui/ace_engine/native/native_node.h b/arkui/ace_engine/native/native_node.h index 12fa4b3ec..3c5f59829 100644 --- a/arkui/ace_engine/native/native_node.h +++ b/arkui/ace_engine/native/native_node.h @@ -5033,6 +5033,34 @@ typedef struct { */ int32_t (*removeNodeCustomEventReceiver)(ArkUI_NodeHandle node, void (*eventReceiver)(ArkUI_NodeCustomEvent* event)); + + /** + * @brief Saves custom data on the specified component. + * + * @param node Indicates the component on which the custom data will be saved. + * @param userData Indicates the custom data to be saved. + * @return Returns 0 if success. + * Returns 401 if a parameter exception occurs. + */ + int32_t (*setUserData)(ArkUI_NodeHandle node, void* userData); + + /** + * @brief Obtains the custom data saved on the specified component. + * + * @param node Indicates the target component. + * @return Returns the custom data. + */ + void* (*getUserData)(ArkUI_NodeHandle node); + + /** + * @brief Sets the unit for a component. + * + * @param node Indicates the component for which you want to set the unit. + * @param unit Indicates the unit, which is an enumerated value of {@link ArkUI_LengthMetricUnit}. + * The default value is ARKUI_LENGTH_METRIC_UNIT_DEFAULT. + * @return Returns 0 if the operation is successful; returns 401 if a parameter error occurs. + */ + int32_t (*setLengthMetricUnit)(ArkUI_NodeHandle node, ArkUI_LengthMetricUnit unit); } ArkUI_NativeNodeAPI_1; diff --git a/arkui/ace_engine/native/native_type.h b/arkui/ace_engine/native/native_type.h index 3a4c3647b..4de1baab7 100644 --- a/arkui/ace_engine/native/native_type.h +++ b/arkui/ace_engine/native/native_type.h @@ -1385,6 +1385,22 @@ typedef struct { float left; } ArkUI_Margin; +/** + * @brief Enumerates the component units. + * + * @since 12 + */ +typedef enum { + /** Default, which is fp for fonts and vp for non-fonts. */ + ARKUI_LENGTH_METRIC_UNIT_DEFAULT = -1, + /** px. */ + ARKUI_LENGTH_METRIC_UNIT_PX = 0, + /** vp. */ + ARKUI_LENGTH_METRIC_UNIT_VP, + /** fp. */ + ARKUI_LENGTH_METRIC_UNIT_FP +} ArkUI_LengthMetricUnit; + /** * @brief Creates a size constraint. * @@ -1650,6 +1666,16 @@ void OH_ArkUI_WaterFlowSectionOption_SetMargin(ArkUI_WaterFlowSectionOption* opt * @since 12 */ ArkUI_Margin OH_ArkUI_WaterFlowSectionOption_GetMargin(ArkUI_WaterFlowSectionOption* option, int32_t index); + +/** +* @brief Obtains the number of items in the water flow section that matches the specified index. +* +* @param option Indicates the pointer to a water flow section configuration. +* @param index Indicates the index of the target water flow section. +* @return Returns the number of items in the water flow section. +* @since 12 +*/ +int32_t OH_ArkUI_WaterFlowSectionOption_GetItemCount(ArkUI_WaterFlowSectionOption* option, int32_t index); #ifdef __cplusplus }; #endif -- Gitee