diff --git a/arkui/ace_engine/native/native_node.h b/arkui/ace_engine/native/native_node.h index c1fc53bc0d8c21572799d1f3fa1c97b1c3033203..9c037d25725d75cff4a95b53604db3d0242c3211 100644 --- a/arkui/ace_engine/native/native_node.h +++ b/arkui/ace_engine/native/native_node.h @@ -3271,6 +3271,27 @@ typedef enum { */ NODE_SCROLL_ENABLE_PAGING, + /** + * @brief Scroll to the next or previous page. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].i32 Indicates whether to scroll to next page. Value 1 indicates scroll to next page and value 0 + * indicates scroll to previous page. \n + * .value[1]?.i32 Indicates whether to enable animation. Value 1 indicates enable and 0 indicates disable. \n + * + */ + NODE_SCROLL_PAGE, + + /** + * @brief Scroll a specified distance. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].f32:Horizontal scrolling distance in vp; \n + * .value[1].f32: Vertical scrolling distance in vp; \n + * + */ + NODE_SCROLL_BY, + /** * @brief Defines the direction in which the list items are arranged. This attribute can be set, reset, and * obtained as required through APIs. @@ -3329,6 +3350,22 @@ typedef enum { */ NODE_LIST_CACHED_COUNT, + /** + * @brief Scroll to the specified index. + * + * When activating the smooth animation, all items passed through will be loaded and layout calculated, which can + * lead to performance issues when loading a large number of items.\n + * \n + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].i32:The index value of the target element to be slid to in the current container.\n + * .value[1]?.i32:Set whether there is an action when sliding to the index value of a list item in the list, where + * 1 indicates an action and 0 indicates no action. Default value: 0。\n + * .value[2]?.i32:Specify the alignment of the sliding element with the current container,The parameter type is + * {@link ArkUI_ScrollAlignment}, default value is ARKUI_SCROLL_ALIGNMENT_START. \n + * + */ + NODE_LIST_SCROLL_TO_INDEX, + /** * @brief Defines whether to enable loop playback for the swiper. * This attribute can be set, reset, and obtained as required through APIs. @@ -3532,6 +3569,30 @@ typedef enum { */ NODE_SWIPER_CACHED_COUNT, + /** + * @brief Set the nested scrolling mode for the Swiper component and parent component. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].i32:Nested scrolling patterns for Swiper components and parent components. The parameter type is + * {@link ArkUI_SwiperNestedScrollMode} \n + * The default value is ARKUI_SWIPER_NESTED_SRCOLL_SELF_ONLY \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32:Nested scrolling patterns for Swiper components and parent components. The parameter type is + * {@link ArkUI_SwiperNestedScrollMode} \n + */ + NODE_SWIPER_NESTED_SCROLL, + + /** + * @brief Set the switcher component to flip to the specified page. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].i32:Specify the index value of the page in Swiper.\n + * .value[1]?.i32:Set whether there is an animation effect when flipping to the specified page. 1 indicates active + * effect, 0 indicates no active effect, default value is 0。\n + */ + NODE_SWIPER_SWIPE_TO_INDEX, + /** * @brief Defines the header of the list item group. * This attribute can be set, reset, and obtained as required through APIs. @@ -3786,6 +3847,22 @@ typedef enum { * .value[0].i32: number of cached items in the water flowadapter. \n */ NODE_WATER_FLOW_CACHED_COUNT, + + /** + * @brief Scroll to the specified index. + * + * When activating the smooth animation, all items passed through will be loaded and layout calculated, which can + * lead to performance issues when loading a large number of items.\n + * \n + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].i32:The index value of the target element to be slid to in the current container.\n + * .value[1]?.i32:Set whether there is an action when sliding to the index value of a list item in the list, where + * 1 indicates an action and 0 indicates no action. Default value is 0。\n + * .value[2]?.i32:Specify the alignment of the sliding element with the current container,The parameter type is + * {@link ArkUI_ScrollAlignment}. Default value is ARKUI_SCROLL_ALIGNMENT_START。\n + * + */ + NODE_WATER_FLOW_SCROLL_TO_INDEX, } ArkUI_NodeAttributeType; #define MAX_COMPONENT_EVENT_ARG_NUM 12 @@ -4223,6 +4300,44 @@ typedef enum { * needs to scroll based on the real-world situation and return the result in this parameter. \n */ NODE_SCROLL_EVENT_ON_SCROLL_FRAME_BEGIN, + + /** + * @brief Define the enumeration value of the pre sliding trigger event for the scrolling container component. + * + * The conditions that trigger this event: \n + * 1. When the scrolling component triggers scrolling, it supports input settings such as keyboard and mouse + * operations that trigger scrolling.\n + * 2. Called through the rolling controller API interface.\n + * 3. Cross boundary rebound.\n + * When an event callback occurs, the union type in the event parameter {@ link ArkUI_NodeEvent} object is + * {@link ArkUI_NodeComponentEvent}. \n + * {@link ArkUI_NodeComponentEvent} contains three parameters: \n + * ArkUI_NodeComponentEvent.data[0].f32: The offset for each frame of scrolling is positive when scrolling to + * the left and negative when scrolling to the right, measured in vp. \n + * ArkUI_NodeComponentEvent.data[1].f32: The offset of each frame scrolling, with a positive offset when + * scrolling up and a negative offset when scrolling down, measured in vp. \n + * ArkUI_NodeComponentEvent.data[2].i32: Current sliding state, parameter type is {@link ArkUI_ScrollState}.\n + */ + NODE_SCROLL_EVENT_ON_WILL_SCROLL, + /** + * @brief Define the event enumeration value triggered when sliding a scrolling container component. + * + * The conditions that trigger this event: \n + * 1. When the scrolling component triggers scrolling, it supports input settings such as keyboard and mouse + * operations that trigger scrolling.\n + * 2. Called through the rolling controller API interface.\n + * 3. Cross boundary rebound.\n + * When an event callback occurs, the union type in the event parameter {@ link ArkUI_NodeEvent} object is + * {@link ArkUI_NodeComponentEvent}. \n + * {@link ArkUI_NodeComponentEvent} contains three parameters: \n + * ArkUI_NodeComponentEvent.data[0].f32: The offset for each frame of scrolling is positive when scrolling to + * the left and negative when scrolling to the right, measured in vp. \n + * ArkUI_NodeComponentEvent.data[1].f32: The offset of each frame scrolling, with a positive offset when + * scrolling up and a negative offset when scrolling down, measured in vp. \n + * ArkUI_NodeComponentEvent.data[2].i32: Current sliding state, parameter typeis {@link ArkUI_ScrollState}. \n + */ + NODE_SCROLL_EVENT_ON_DID_SCROLL, + /** * @brief Defines the event triggered when scrolling starts in the ARKUI_NODE_SCROLL component. * diff --git a/arkui/ace_engine/native/native_type.h b/arkui/ace_engine/native/native_type.h index f9038b369ee7f11944078096fa65b4cd2fb75d06..128158a4ae787d7da8f77859f66b17233c6b4afb 100644 --- a/arkui/ace_engine/native/native_type.h +++ b/arkui/ace_engine/native/native_type.h @@ -647,6 +647,19 @@ typedef enum { ARKUI_SWIPER_ARROW_SHOW_ON_HOVER, } ArkUI_SwiperArrow; +/** + * @brief Nested scrolling mode for Swiper components and parent components. + * + * @since 12 + */ +typedef enum { + /** Swiper only scrolls on its own and is not linked to its parent component. */ + ARKUI_SWIPER_NESTED_SRCOLL_SELF_ONLY = 0, + /** The Swiper itself scrolls first, and the parent component scrolls after it reaches the edge. After the parent + * component scrolls to the edge, if the parent component has an edge effect, the parent component triggers the edge + * effect; otherwise, the Swiper triggers the edge effect. */ + ARKUI_SWIPER_NESTED_SRCOLL_SELF_FIRST, +} ArkUI_SwiperNestedScrollMode; /** * @brief Enumerates the accessibility modes. @@ -736,6 +749,40 @@ typedef enum { ARKUI_SCROLL_EDGE_END, } ArkUI_ScrollEdge; +/** + * @brief Alignment when scrolling to specific items. + * + * @since 12 + */ +typedef enum { + /** Align the head. Align the head of the specified item with the head of the container.*/ + ARKUI_SCROLL_ALIGNMENT_START = 0, + /** Center alignment. Align the axis direction of the specified item to the center of the container.*/ + ARKUI_SCROLL_ALIGNMENT_CENTER, + /** Tail alignment. Align the tail of the specified item with the tail of the container.*/ + ARKUI_SCROLL_ALIGNMENT_END, + /** Automatic alignment. If the specified item is completely in the display area, no adjustments will be made. + * Otherwise, according to the principle of the shortest sliding distance, align the head or tail of the specified + * item with the container, so that the specified item is completely in the display area.*/ + ARKUI_SCROLL_ALIGNMENT_AUTO, +} ArkUI_ScrollAlignment; + +/** + * @brief Define the current scrolling state. + * + * @since 12 + */ +typedef enum { + /** Idle state. Trigger when using the method provided by the controller to control scrolling, and trigger when + * dragging the scroll bar to scroll.*/ + ARKUI_SCROLL_STATE_IDLE = 0, + /** Scroll state. Triggered when dragging the container with fingers to scroll.*/ + ARKUI_SCROLL_STATE_SCROLL, + /** Inertial rolling state. Triggered when inertia rolling and bouncing back to the edge are performed after + * releasing the hand quickly.*/ + ARKUI_SCROLL_STATE_FLING, +} ArkUI_ScrollState; + /** * @brief Enumerates the types of the slider in the block direction. *