From 8ad4343e767abf69da5f57a30607da5e80cea6dc Mon Sep 17 00:00:00 2001 From: yyuanche Date: Tue, 21 May 2024 10:40:56 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90NDK=E3=80=916toD=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=20Signed-off-by:=20yyuanche=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- arkui/ace_engine/native/libace.ndk.json | 52 +++++++++ arkui/ace_engine/native/native_node.h | 143 +++++++++++++++++++++++ arkui/ace_engine/native/native_type.h | 97 +++++++++++++++ arkui/ace_engine/native/ui_input_event.h | 14 ++- 4 files changed, 305 insertions(+), 1 deletion(-) diff --git a/arkui/ace_engine/native/libace.ndk.json b/arkui/ace_engine/native/libace.ndk.json index b5f15e435..60a7b3b03 100644 --- a/arkui/ace_engine/native/libace.ndk.json +++ b/arkui/ace_engine/native/libace.ndk.json @@ -643,6 +643,10 @@ "first_introduced": "12", "name": "OH_ArkUI_WaterFlowSectionOption_RegisterGetItemMainSizeCallbackByIndex" }, + { + "first_introduced": "12", + "name": "OH_ArkUI_WaterFlowSectionOption_RegisterGetItemMainSizeCallbackByIndexWithUserData" + }, { "first_introduced": "12", "name": "OH_ArkUI_AnimateOption_Create" @@ -1158,5 +1162,53 @@ { "first_introduced": "12", "name": "OH_ArkUI_ListItemSwipeActionOption_SetOnOffsetChange" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_PointerEvent_SetStopPropagation" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_NodeUtils_GetLayoutSize" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_NodeUtils_GetLayoutPosition" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_NodeUtils_GetLayoutPositionInWindow" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_NodeUtils_GetLayoutPositionInScreen" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_NodeUtils_GetPositionWithTranslateInWindow" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_NodeUtils_GetPositionWithTranslateInScreen" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_ListChildrenMainSizeOption_Create" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_ListChildrenMainSizeOption_Dispose" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_ListChildrenMainSizeOption_SetDefaultMainSize" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_ListChildrenMainSizeOption_GetDefaultMainSize" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_ListChildrenMainSizeOption_Splice" } ] \ 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 5df060447..dc7db7973 100644 --- a/arkui/ace_engine/native/native_node.h +++ b/arkui/ace_engine/native/native_node.h @@ -1617,6 +1617,43 @@ typedef enum { */ NODE_FOCUS_ON_TOUCH, + /** + * @brief Defines the border width attribute, which can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * 1: .value[0].f32: width of the four borders, in percentage. \n + * 2: .value[0].f32: width of the top border, in percentage. \n + * .value[1].f32: width of the right border, in percentage. \n + * .value[2].f32: width of the bottom border, in percentage. \n + * .value[3].f32: width of the right border, in percentage. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: width of the top border, in percentage. \n + * .value[1].f32: width of the right border, in percentage. \n + * .value[2].f32: width of the bottom border, in percentage. \n + * .value[3].f32: width of the right border, in percentage. \n + * + */ + NODE_BORDER_WIDTH_PERCENT = 85, + /** + * @brief Defines the border corner radius attribute, which can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * 1: .value[0].f32: radius of the four corners, in percentage. \n + * 2: .value[0].f32: radius of the upper left corner, in percentage. \n + * .value[1].f32: radius of the upper right corner, in percentage. \n + * .value[2].f32: radius of the lower left corner, in percentage. \n + * .value[3].f32: radius of the lower right corner, in percentage. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: radius of the upper left corner, in percentage. \n + * .value[1].f32: radius of the upper right corner, in percentage. \n + * .value[2].f32: radius of the lower left corner, in percentage. \n + * .value[3].f32: radius of the lower right corner, in percentage. \n + * + */ + NODE_BORDER_RADIUS_PERCENT = 86, + /** * @brief Defines the text content attribute, which can be set, reset, and obtained as required through APIs. * @@ -4233,6 +4270,17 @@ typedef enum { */ NODE_LIST_ALIGN_LIST_ITEM, + /** + * @brief Set the default spindle size for the List subcomponent. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .object: The parameter format is {@ ArkUI-ListChildrenMainSize} \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .object: The parameter format is {@ ArkUI-ListChildrenMainSize} \n + */ + NODE_LIST_CHILDREN_MAIN_SIZE = 1003007, + /** * @brief Defines whether to enable loop playback for the swiper. * This attribute can be set, reset, and obtained as required through APIs. @@ -4554,6 +4602,17 @@ typedef enum { */ NODE_LIST_ITEM_GROUP_SET_DIVIDER, + /** + * @brief Set the default spindle size for the ListItem Group subcomponent. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .object: The parameter format is {@ ArkUI-ListChildrenMainSize} \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .object: The parameter format is {@ ArkUI-ListChildrenMainSize} \n + */ + NODE_LIST_ITEM_GROUP_CHILDREN_MAIN_SIZE = 1005003, + /** * @brief Defines the horizontal alignment mode of child components in the column. * This attribute can be set, reset, and obtained as required through APIs. @@ -4660,6 +4719,18 @@ typedef enum { * */ NODE_REFRESH_CONTENT, + /** + * @brief Set the pull-down hand coefficient. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].f32:Pull-down hand coefficient, valid value between 0 and 1. + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32:Pull-down hand coefficient, valid value between 0 and 1. + * + */ + NODE_REFRESH_PULL_DOWN_RATIO = 1009002, /** * @brief Defines the main axis direction of the component layout. @@ -6738,6 +6809,78 @@ int32_t OH_ArkUI_NodeContent_RemoveNode(ArkUI_NodeContentHandle content, ArkUI_N */ int32_t OH_ArkUI_NodeContent_InsertNode(ArkUI_NodeContentHandle content, ArkUI_NodeHandle node, int32_t position); +/** + * @brief Get the size of the component layout area. + * The layout area size does not include graphic variation attributes such as scaling. + * + * @param node ArkUI_NodeHandle pointer. + * @param size The drawing area size of the component handle, in px. + * @return Returns 0 if success. + * Returns 401 if a parameter exception occurs. + * @since 12 + */ +int32_t OH_ArkUI_NodeUtils_GetLayoutSize(ArkUI_NodeHandle node, ArkUI_IntSize* size); + +/** + * @brief Obtain the position of the component layout area relative to the parent component. + * The relative position of the layout area does not include graphic variation attributes, such as translation. + * + * @param node ArkUI_NodeHandle pointer. + * @param localOffset The offset value of the component handle relative to the parent component, in px. + * @return Returns 0 if success. + * Returns 401 if a parameter exception occurs. + * @since 12 + */ +int32_t OH_ArkUI_NodeUtils_GetLayoutPosition(ArkUI_NodeHandle node, ArkUI_IntOffset* localOffset); + +/** + * @brief Obtain the position of the component layout area relative to the window. + * The relative position of the layout area does not include graphic variation attributes, such as translation. + * + * @param node ArkUI_NodeHandle pointer. + * @param globalOffset The offset value of the component handle relative to the window, in px. + * @return Returns 0 if success. + * Returns 401 if a parameter exception occurs. + * @since 12 + */ +int32_t OH_ArkUI_NodeUtils_GetLayoutPositionInWindow(ArkUI_NodeHandle node, ArkUI_IntOffset* globalOffset); + +/** + * @brief Obtain the position of the component layout area relative to the screen. + * The relative position of the layout area does not include graphic variation attributes, such as translation. + * + * @param node ArkUI_NodeHandle pointer. + * @param screenOffset The offset value of the component handle relative to the screen, in px. + * @return Returns 0 if success. + * Returns 401 if a parameter exception occurs. + * @since 12 + */ +int32_t OH_ArkUI_NodeUtils_GetLayoutPositionInScreen(ArkUI_NodeHandle node, ArkUI_IntOffset* screenOffset); + +/** + * @brief Obtain the position of the component in the window, including the properties of graphic translation changes. + * + * @param node ArkUI_NodeHandle pointer. + * @param translateOffset The cumulative offset value of the component handle itself, + * parent components, and ancestor nodes, in px. + * @return Returns 0 if success. + * Returns 401 if a parameter exception occurs. + * @since 12 + */ +int32_t OH_ArkUI_NodeUtils_GetPositionWithTranslateInWindow(ArkUI_NodeHandle node, ArkUI_IntOffset* translateOffset); + +/** + * @brief Obtain the position of the component on the screen, including the attributes of graphic translation changes. + * + * @param node ArkUI_NodeHandle pointer. + * @param translateOffset The cumulative offset value of the component handle itself, + * parent components, and ancestor nodes, in px. + * @return Returns 0 if success. + * Returns 401 if a parameter exception occurs. + * @since 12 + */ +int32_t OH_ArkUI_NodeUtils_GetPositionWithTranslateInScreen(ArkUI_NodeHandle node, ArkUI_IntOffset* translateOffset); + #ifdef __cplusplus }; #endif diff --git a/arkui/ace_engine/native/native_type.h b/arkui/ace_engine/native/native_type.h index 381ea6d42..9782351bb 100644 --- a/arkui/ace_engine/native/native_type.h +++ b/arkui/ace_engine/native/native_type.h @@ -155,6 +155,13 @@ typedef struct ArkUI_GuidelineOption ArkUI_GuidelineOption; */ typedef struct ArkUI_BarrierOption ArkUI_BarrierOption; +/** + * @brief Define the ChildrenMainSize class information for a List. + * + * @since 12 +*/ +typedef struct ArkUI_ListChildrenMainSize ArkUI_ListChildrenMainSize; + /** * @brief Defines the event callback type. * @@ -2033,6 +2040,20 @@ int32_t OH_ArkUI_WaterFlowSectionOption_GetItemCount(ArkUI_WaterFlowSectionOptio void OH_ArkUI_WaterFlowSectionOption_RegisterGetItemMainSizeCallbackByIndex(ArkUI_WaterFlowSectionOption* option, int32_t index, float(*callback)(int32_t itemIndex)); +/** +* @brief The FlowItem grouping configuration information getsthe spindle size of +* the specified Item based on flowItemIndex. +* +* @param option Indicates the pointer to a water flow section configuration. +* @param index Indicates the index of the target water flow section. +* @param userData FlowItem Custom data. +* @param callback Gets the spindle size of the specified Item based on index. +* @since 12 +*/ +void OH_ArkUI_WaterFlowSectionOption_RegisterGetItemMainSizeCallbackByIndexWithUserData( + ArkUI_WaterFlowSectionOption* option, int32_t index, void* userData, + float (*callback)(int32_t itemIndex, void* userData)); + /** * @brief Sets the number of columns (in a vertical layout) or rows (in a horizontal layout) of a water flow. * @@ -2912,6 +2933,82 @@ int32_t OH_ArkUI_ListItemSwipeActionOption_GetEdgeEffect(ArkUI_ListItemSwipeActi void OH_ArkUI_ListItemSwipeActionOption_SetOnOffsetChange(ArkUI_ListItemSwipeActionOption* option, void (*callback)(float offset)); +/** + * @brief Create configuration items for the ListChildrenMainSize interface settings. + * + * @return ListChildrenMainSize configuration item instance. + * @since 12 +*/ +ArkUI_ListChildrenMainSize* OH_ArkUI_ListChildrenMainSizeOption_Create(); + +/** +* @brief Destroy the ListChildrenMainSize instance. +* +* @param option The ListChildrenMainSize instance to be destroyed. +* @since 12 +*/ +void OH_ArkUI_ListChildrenMainSizeOption_Dispose(ArkUI_ListChildrenMainSize* option); + +/** + * @brief Set the default size of ChildrenMainSizeOption for the List component. + * + * @param option ListChildrenMainSize instance. + * @param defaultMainSize The default size of the ListItem under the List, measured in vp. + * @since 12 +*/ +void OH_ArkUI_ListChildrenMainSizeOption_SetDefaultMainSize(ArkUI_ListChildrenMainSize* option, float defaultMainSize); + +/** + * @brief Get the default size of ChildrenMainSizeOption for the List component. + * + * @param option ListChildrenMainSize instance. + * @return The default size of the ListItem under the List is 0, measured in vp. + * When the option is a null pointer, it returns 401. + * @since 12 +*/ +float OH_ArkUI_ListChildrenMainSizeOption_GetDefaultMainSize(ArkUI_ListChildrenMainSize* option); + +/** + * @brief Reset the array size of ChildrenMainSizeOption for the List component. + * + * @param option ListChildrenMainSize instance. + * @param totalSize Array size. + * @since 12 +*/ +void OH_ArkUI_ListChildrenMainSizeOption_Resize(ArkUI_ListChildrenMainSize option, int32_t totalSize); + +/** + * @brief Resize the ChildrenMainSizeOption array operation on the List component. + * + * @param option ListChildrenMainSize instance. + * @param index To modify the starting position of the MainSize array. + * @param deleteCount The number of MainSize arrays to be deleted starting from index. + * @param addCount The number of MainSize arrays to be added starting from index. + * @return 0 represents success. If the function parameter is abnormal, return 401. + * @since 12 +*/ +int32_t OH_ArkUI_ListChildrenMainSizeOption_Splice(ArkUI_ListChildrenMainSize* option, int32_t index, int32_t deleteCount, int32_t addCount); + +/** + * @brief Update the value of the ChildrenMainSizeOption array in the List component. + * + * @param option ListChildrenMainSize instance. + * @param index To modify the starting position of the MainSize array. + * @param mainSize 实际修改的值。 + * @return 0 represents success. If the function parameter is abnormal, return 401. + * @since 12 +*/ +int32_t OH_ArkUI_ListChildrenMainSizeOption_UpdateSize(ArkUI_ListChildrenMainSize* option, int32_t index, float mainSize); + +/** + * @brief Get the value of the ChildrenMainSizeOption array for the List component. + * + * @param option ListChildrenMainSize instance. + * @param index The index position of the value to be obtained. + * @return The value of the specific position of the array. If the function parameter is abnormal, return 401. + * @since 12 +*/ +float OH_ArkUI_ListChildrenMainSizeOption_GetMainSize(ArkUI_ListChildrenMainSize* option, int32_t index) #ifdef __cplusplus }; #endif diff --git a/arkui/ace_engine/native/ui_input_event.h b/arkui/ace_engine/native/ui_input_event.h index 05890e33e..05af248bb 100644 --- a/arkui/ace_engine/native/ui_input_event.h +++ b/arkui/ace_engine/native/ui_input_event.h @@ -672,7 +672,7 @@ int32_t OH_ArkUI_PointerEvent_SetInterceptHitTestMode(const ArkUI_UIInputEvent* * * @param event Represents a pointer to the current UI input event. * @return Return to the mouse button type, where 1 is the left button, 2 is the right button, - * 4 is the middle button, 8 is the back button, and 16 is the forward button. + * 3 is the middle button, 4 is the back button, and 5 is the forward button. * @since 12 */ int32_t OH_ArkUI_MouseEvent_GetMouseButton(const ArkUI_UIInputEvent* event); @@ -687,6 +687,18 @@ int32_t OH_ArkUI_MouseEvent_GetMouseButton(const ArkUI_UIInputEvent* event); */ int32_t OH_ArkUI_MouseEvent_GetMouseAction(const ArkUI_UIInputEvent* event); +/** + * @brief Sets whether to prevent event bubbling. + * + * @param event Indicates the pointer to the current UI input event. + * @param stopPropagation Indicates whether the event is prevented from bubbling. + * @return Returns the status code of the execution. If 0 is returned, the setting is successful. + * If 401 is returned, the execution fails. + * The possible cause of the failure is that the event parameter is abnormal, such as a null pointer. + * @since 12 + */ +int32_t OH_ArkUI_PointerEvent_SetStopPropagation(const ArkUI_UIInputEvent* event, bool stopPropagation); + #ifdef __cplusplus }; #endif -- Gitee