From 7ea5ac96f80739553c4243d601362f854659c31a Mon Sep 17 00:00:00 2001 From: lexiaoyao2 Date: Mon, 10 Mar 2025 15:23:13 +0800 Subject: [PATCH] add a new picker container Signed-off-by: lexiaoyao2 Change-Id: I9f7ddf17f328b4e35e0aacc317beaef949b0ac9c --- arkui/ace_engine/native/native_node.h | 122 ++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) diff --git a/arkui/ace_engine/native/native_node.h b/arkui/ace_engine/native/native_node.h index c246d755f..f38a58fea 100644 --- a/arkui/ace_engine/native/native_node.h +++ b/arkui/ace_engine/native/native_node.h @@ -133,6 +133,8 @@ typedef enum { ARKUI_NODE_GRID_ITEM, /** Custom span. */ ARKUI_NODE_CUSTOM_SPAN, + /** Picker container. */ + ARKUI_NODE_PICKER = 1016, } ArkUI_NodeType; /** @@ -6260,6 +6262,102 @@ typedef enum { * @since 18 */ NODE_CALENDAR_PICKER_MARK_TODAY = 16007, + /** + * @brief Defines the index of the default selected item in the data selection range of the picker. + * 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].u32: index. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].u32: index. \n + * + */ + NODE_PICKER_OPTION_SELECTED_INDEX = MAX_NODE_SCOPE_NUM * ARKUI_NODE_PICKER, + /** + * @brief Defines whether haptic feedback. + * 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].i32: whether to feedback. The value true means to feedback, and + * false means the opposite.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * value[0].i32: whether to feedback.\n + * + * @since 20 + */ + NODE_PICKER_ENABLE_HAPTIC_FEEDBACK = 1016001, + /** + * @brief Defines whether to support scroll looping for the picker. + * 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].i32: whether to support scroll looping. The value true means to support scroll looping, and + * false means the opposite.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * value[0].i32: The value 1 means to support scroll looping, and 0 means the opposite. \n + * + * @since 20 + */ + NODE_PICKER_CAN_LOOP = 1016002, + /** + * @brief Defines the font color, font size, and font weight for the selected item in the picker. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .string: array of five parameters of the string type, separated by semicolons (;).\n + * Parameter 1: font color, in #ARGB format.\n + * Parameter 2: font size, in fp. The value is a number.\n + * Parameter 3: font weight. Available options are ("bold", "normal", "bolder", "lighter", "medium", "regular").\n. + * Parameter 4: fonts, separated by commas (,).\n + * Parameter 5: font style. Available options are ("normal", "italic").\n + * Example: "#ff182431;14;normal;Arial,HarmonyOS Sans;normal". \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .string: array of five parameters of the string type, separated by semicolons (;).\n + * Parameter 1: font color, in #ARGB format.\n + * Parameter 2: font size, in fp. The value is a number.\n + * Parameter 3: font weight. Available options are ("bold", "normal", "bolder", "lighter", "medium", "regular").\n. + * Parameter 4: fonts, separated by commas (,).\n + * Parameter 5: font style. Available options are ("normal", "italic").\n + * Example: "#ff182431;14;normal;Arial,HarmonyOS Sans;normal". \n + * + */ + NODE_PICKER_SELECTED_TEXT_STYLE = 1016003, + /** + * @brief Sets the type and parameters of the selection indicator. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} Format: \n + *.value[0].u32: selection indicator type, 0-divider,1-background; \n + *.value[1].f32: divider width; \n + *.value[2].u32: divider color, type 0xargb; \n + *.value[3].f32: the distance between the divider and the beginning of the side of the picker, unit vp; \n + *.value[4].f32: the distance between the divider and the end of the side of the picker (unit: vp). \n + * value[5].u32: background color, in 0xARGB format, for example, 0xFF1122FF. \n + * 1: .value[6].f32: radius of the four corners. \n + * 2: .value[6].f32: radius of the upper left corner. \n + * .value[7].f32: radius of the upper right corner. \n + * .value[8].f32: radius of the lower left corner. \n + * .value[9].f32: radius of the lower right corner. \n + * \n + * Attribute fetch method return value {@link ArkUI_AttributeItem} format: \n + *.value[0].u32: selection indicator type, 0-divider,1-background; \n + *.value[1].f32: divider width; \n + *.value[2].u32: divider color, type 0xargb; \n + *.value[3].f32: the distance between the divider and the beginning of the side of the picker, unit vp; \n + *.value[4].f32: the distance between the divider and the end of the side of the picker (unit: vp). \n + * value[5].u32: background color, in 0xARGB format, for example, 0xFF1122FF. \n + * 1: .value[6].f32: radius of the four corners. \n + * 2: .value[6].f32: radius of the upper left corner. \n + * .value[7].f32: radius of the upper right corner. \n + * .value[8].f32: radius of the lower left corner. \n + * .value[9].f32: radius of the lower right corner. \n + * + */ + NODE_PICKER_SELECTION_INDICATOR = 1016004, } ArkUI_NodeAttributeType; #define MAX_COMPONENT_EVENT_ARG_NUM 12 @@ -7647,6 +7745,30 @@ typedef enum { * the end position of the currently displayed waterfall. \n */ NODE_WATER_FLOW_ON_SCROLL_INDEX, + /** + * @brief Defines the event triggered when an item is selected in the ARKUI_NODE_PICKER component. + * + \n + * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is + * {@link ArkUI_NodeComponentEvent}. \n + * {@link ArkUI_NodeComponentEvent} contains one parameter:\n + * ArkUI_NodeComponentEvent.data[0...11].i32: value of the selected item. \n + * + * @since 20 + */ + NODE_PICKER_EVENT_ON_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_PICKER, + /** + * @brief Defines the event triggered when an item is selected and scrolling has stopped in the + * ARKUI_NODE_PICKER component. + * + * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is + * {@link ArkUI_NodeComponentEvent}. \n + * {@link ArkUI_NodeComponentEvent} contains one parameter:\n + * ArkUI_NodeComponentEvent.data[0...11].i32: value of the selected item. \n + * + * @since 20 + */ + NODE_PICKER_EVENT_ON_SCROLL_STOP = 1016001, } ArkUI_NodeEventType; /** -- Gitee