diff --git a/arkui/ace_engine/native/libace.ndk.json b/arkui/ace_engine/native/libace.ndk.json index d75a5bc6bfed48956cc1aefd439b8bbd99e93420..b0acf00b2fde0ca0d01582b2e9259b84e90559fc 100644 --- a/arkui/ace_engine/native/libace.ndk.json +++ b/arkui/ace_engine/native/libace.ndk.json @@ -4070,5 +4070,49 @@ { "first_introduced": "21", "name": "OH_ArkUI_NativeModule_UnregisterCommonEvent" + }, + { + "first_introduced": "21", + "name": "OH_ArkUI_PositionEdges_Create" + }, + { + "first_introduced": "21", + "name": "OH_ArkUI_PositionEdges_Copy" + }, + { + "first_introduced": "21", + "name": "OH_ArkUI_PositionEdges_Dispose" + }, + { + "first_introduced": "21", + "name": "OH_ArkUI_PositionEdges_SetTop" + }, + { + "first_introduced": "21", + "name": "OH_ArkUI_PositionEdges_GetTop" + }, + { + "first_introduced": "21", + "name": "OH_ArkUI_PositionEdges_SetLeft" + }, + { + "first_introduced": "21", + "name": "OH_ArkUI_PositionEdges_GetLeft" + }, + { + "first_introduced": "21", + "name": "OH_ArkUI_PositionEdges_SetBottom" + }, + { + "first_introduced": "21", + "name": "OH_ArkUI_PositionEdges_GetBottom" + }, + { + "first_introduced": "21", + "name": "OH_ArkUI_PositionEdges_SetRight" + }, + { + "first_introduced": "21", + "name": "OH_ArkUI_PositionEdges_GetRight" } ] \ 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 788f80454702a862b8e02b42a73ade278b7afe3e..04a4f7d089a58c7fb1c576001f0c8992a261b3fc 100644 --- a/arkui/ace_engine/native/native_node.h +++ b/arkui/ace_engine/native/native_node.h @@ -1999,6 +1999,53 @@ typedef enum { */ NODE_ROTATE_ANGLE = 104, + /** + * @brief Defines the width attribute with param type LayoutPolicy, which can be set, reset, and obtained + * as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].i32: the LayoutPolicy that the width of the component follows.\n + * The parameter type is {@link ArkUI_LayoutPolicy}. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: the LayoutPolicy that the width of the component follows.\n + * The parameter type is {@link ArkUI_LayoutPolicy}. \n + * + * @since 21 + */ + NODE_WIDTH_LAYOUTPOLICY = 105, + + /** + * @brief Defines the height attribute with param type LayoutPolicy, which can be set, reset, and obtained + * as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].i32: the LayoutPolicy that the height of the component follows.\n + * The parameter type is {@link ArkUI_LayoutPolicy}. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: the LayoutPolicy that the height of the component follows.\n + * The parameter type is {@link ArkUI_LayoutPolicy}. \n + * + * @since 21 + */ + NODE_HEIGHT_LAYOUTPOLICY = 106, + + /** + * @brief Defines the position attribute in param type Edges, which specifies the position of the component + * by the distance relative to the parent container's four edges. This attribute can be set, reset, and obtained as + * required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .object indicates struct of edges for position. The parameter type is {@link ArkUI_PositionEdges}. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .object indicates struct of edges for position. The parameter type is {@link ArkUI_PositionEdges}. \n + * + * @since 21 + */ + NODE_POSITION_EDGES = 107, + /** * @brief Defines the text content attribute, which can be set, reset, and obtained as required through APIs. * diff --git a/arkui/ace_engine/native/native_type.h b/arkui/ace_engine/native/native_type.h index f7b72cc37d01d1e2fdf67c70598a42194058fb72..25626e7d1e55564fd2e95e73297879c25e942bcf 100644 --- a/arkui/ace_engine/native/native_type.h +++ b/arkui/ace_engine/native/native_type.h @@ -256,6 +256,13 @@ typedef struct AbilityBase_Want AbilityBase_Want; */ typedef struct ArkUI_EmbeddedComponentOption ArkUI_EmbeddedComponentOption; +/** + * @brief Define the Edges describing the position of a component by distances to the container's four edges. + * + * @since 21 + */ +typedef struct ArkUI_PositionEdges ArkUI_PositionEdges; + /** * @brief Defines the event callback type. * @@ -2818,6 +2825,23 @@ typedef enum { ARKUI_CORNER_DIRECTION_BOTTOM_RIGHT, } ArkUI_CornerDirection; +/** + * @brief Enumerates the LayoutPolicy. + * + * @since 21 + */ +typedef enum { + /** The component fills its parent, which means its size is as large as its parent */ + ARKUI_LAYOUTPOLICY_MATCHPARENT = 0, + /** + * The component fills its content, which means its size is as large as its children but it is constrained + * by its parent. + */ + ARKUI_LAYOUTPOLICY_WRAPCONTENT, + /** The component fills its content which means its size is as large as its children. */ + ARKUI_LAYOUTPOLICY_FIXATIDEALSIZE, +} ArkUI_LayoutPolicy; + /** * @brief Defines parameter used by the system font style callback event. * @@ -5394,6 +5418,115 @@ void OH_ArkUI_EmbeddedComponentOption_SetOnError( */ void OH_ArkUI_EmbeddedComponentOption_SetOnTerminated( ArkUI_EmbeddedComponentOption* option, void (*callback)(int32_t code, AbilityBase_Want* want)); + +/** + * @brief Create an edge object for position attribute. + * + * @return A pointer to the edge object. + * @since 21 + */ +ArkUI_PositionEdges* OH_ArkUI_PositionEdges_Create(); + +/** + * @brief Creates a deep copy of an edge object for position attribute. + * + * @param edges A pointer to an edge object. + * @return A pointer to the new edge object. + * @since 21 + */ +ArkUI_PositionEdges* OH_ArkUI_PositionEdges_Copy(const ArkUI_PositionEdges* edges); + +/** + * @brief Dispose an edge object for position attribute. + * + * @param edges Pointer to the edge object to be disposed. + * @since 21 + */ +void OH_ArkUI_PositionEdges_Dispose(ArkUI_PositionEdges* edges); + +/** + * @brief Sets the top edge of an edge object for position attribute. + * + * @param edges Pointer to the edge object. + * @param value The distance of top edge to the corresponding edge of parent container, in vp. + * @since 21 + */ +void OH_ArkUI_PositionEdges_SetTop(ArkUI_PositionEdges* edges, float value); + +/** + * @brief Gets the top edge of an edge object for position attribute. + * + * @param edges Pointer to the edge object. + * @param value The distance of top edge to the corresponding edge of parent container, in vp. + * @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 the parameter is invalid. + * @since 21 + */ +int32_t OH_ArkUI_PositionEdges_GetTop(ArkUI_PositionEdges* edges, float* value); + +/** + * @brief Sets the left edge of an edge object for position attribute. + * + * @param edges Pointer to the edge object. + * @param value The distance of left edge to the corresponding edge of parent container, in vp. + * @since 21 + */ +void OH_ArkUI_PositionEdges_SetLeft(ArkUI_PositionEdges* edges, float value); + +/** + * @brief Gets the left edge of an edge object for position attribute. + * + * @param edges Pointer to the edge object. + * @param value The distance of left edge to the corresponding edge of parent container, in vp. + * @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 the parameter is invalid. + * @since 21 + */ +int32_t OH_ArkUI_PositionEdges_GetLeft(ArkUI_PositionEdges* edges, float* value); + +/** + * @brief Sets the bottom edge of an edge object for position attribute. + * + * @param edges Pointer to the edge object. + * @param value The distance of bottom edge to the corresponding edge of parent container, in vp. + * @since 21 + */ +void OH_ArkUI_PositionEdges_SetBottom(ArkUI_PositionEdges* edges, float value); + +/** + * @brief Gets the bottom edge of an edge object for position attribute. + * + * @param edges Pointer to the edge object. + * @param value The distance of bottom edge to the corresponding edge of parent container, in vp. + * @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 the parameter is invalid. + * @since 21 + */ +int32_t OH_ArkUI_PositionEdges_GetBottom(ArkUI_PositionEdges* edges, float* value); + +/** + * @brief Sets the right edge of an edge object for position attribute. + * + * @param edges Pointer to the edge object. + * @param value The distance of right edge to the corresponding edge of parent container, in vp. + * @since 21 + */ +void OH_ArkUI_PositionEdges_SetRight(ArkUI_PositionEdges* edges, float value); + +/** + * @brief Gets the right edge of an edge object for position attribute. + * + * @param edges Pointer to the edge object. + * @param value The distance of right edge to the corresponding edge of parent container, in vp. + * @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 the parameter is invalid. + * @since 21 + */ +int32_t OH_ArkUI_PositionEdges_GetRight(ArkUI_PositionEdges* edges, float* value); #ifdef __cplusplus }; #endif