From 5b9b546a30a8ce5586c24ac01ad428a779dc2510 Mon Sep 17 00:00:00 2001 From: zhanghang Date: Wed, 26 Feb 2025 17:20:05 +0800 Subject: [PATCH] textpicker Signed-off-by: zhanghang --- arkui/ace_engine/native/libace.ndk.json | 156 +++++++ arkui/ace_engine/native/native_dialog.h | 574 ++++++++++++++++++++++++ arkui/ace_engine/native/native_type.h | 92 ++++ 3 files changed, 822 insertions(+) diff --git a/arkui/ace_engine/native/libace.ndk.json b/arkui/ace_engine/native/libace.ndk.json index d809c13cb..d97416bca 100644 --- a/arkui/ace_engine/native/libace.ndk.json +++ b/arkui/ace_engine/native/libace.ndk.json @@ -3066,5 +3066,161 @@ { "first_introduced": "15", "name": "OH_ArkUI_NodeUtils_GetPositionToParent" + }, + { + "first_introduced": "16", + "name": "OH_ArkUI_CustomDialog_CreateOptions" + }, + { + "first_introduced": "16", + "name": "OH_ArkUI_CustomDialog_DisposeOptions" + }, + { + "first_introduced": "16", + "name": "OH_ArkUI_CustomDialog_SetLevelMode" + }, + { + "first_introduced": "16", + "name": "OH_ArkUI_CustomDialog_SetLevelUniqueId" + }, + { + "first_introduced": "16", + "name": "OH_ArkUI_CustomDialog_SetImmersiveMode" + }, + { + "first_introduced": "16", + "name": "OH_ArkUI_CustomDialog_OpenDialog" + }, + { + "first_introduced": "16", + "name": "OH_ArkUI_CustomDialog_UpdateDialog" + }, + { + "first_introduced": "16", + "name": "OH_ArkUI_CustomDialog_CloseDialog" + }, + { + "first_introduced": "16", + "name": "OH_ArkUI_CustomDialog_SetBackgroundColor" + }, + { + "first_introduced": "16", + "name": "OH_ArkUI_CustomDialog_SetCornerRadius" + }, + { + "first_introduced": "16", + "name": "OH_ArkUI_CustomDialog_SetBorderWidth" + }, + { + "first_introduced": "16", + "name": "OH_ArkUI_CustomDialog_SetBorderColor" + }, + { + "first_introduced": "16", + "name": "OH_ArkUI_CustomDialog_SetBorderStyle" + }, + { + "first_introduced": "16", + "name": "OH_ArkUI_CustomDialog_SetWidth" + }, + { + "first_introduced": "16", + "name": "OH_ArkUI_CustomDialog_SetHeight" + }, + { + "first_introduced": "16", + "name": "OH_ArkUI_CustomDialog_SetShadow" + }, + { + "first_introduced": "16", + "name": "OH_ArkUI_CustomDialog_SetCustomShadow" + }, + { + "first_introduced": "16", + "name": "OH_ArkUI_CustomDialog_SetBackgroundBlurStyle" + }, + { + "first_introduced": "16", + "name": "OH_ArkUI_CustomDialog_SetAlignment" + }, + { + "first_introduced": "16", + "name": "OH_ArkUI_CustomDialog_SetModalMode" + }, + { + "first_introduced": "16", + "name": "OH_ArkUI_CustomDialog_SetAutoCancel" + }, + { + "first_introduced": "16", + "name": "OH_ArkUI_CustomDialog_SetSubwindowMode " + }, + { + "first_introduced": "16", + "name": "OH_ArkUI_CustomDialog_SetMask" + }, + { + "first_introduced": "16", + "name": "OH_ArkUI_CustomDialog_SetKeyboardAvoidMode " + }, + { + "first_introduced": "16", + "name": "OH_ArkUI_CustomDialog_SetEnableHoverMode" + }, + { + "first_introduced": "16", + "name": "OH_ArkUI_CustomDialog_SetHoverModeArea" + }, + { + "first_introduced": "16", + "name": "OH_ArkUI_CustomDialog_RegisterOnWillDismissCalllback" + }, + { + "first_introduced": "16", + "name": "OH_ArkUI_CustomDialog_RegisterOnWillAppearCallback" + }, + { + "first_introduced": "16", + "name": "OH_ArkUI_CustomDialog_RegisterOnDidAppearCallback" + }, + { + "first_introduced": "16", + "name": "OH_ArkUI_CustomDialog_RegisterOnWillDisappearCallback" + }, + { + "first_introduced": "16", + "name": "OH_ArkUI_CustomDialog_RegisterOnDidDisappearCallback" + }, + { + "first_introduced": "16", + "name": "OH_ArkUI_TextPickerRangeContentArray_Create" + }, + { + "first_introduced": "16", + "name": "OH_ArkUI_TextPickerRangeContentArray_SetIconAtIndex" + }, + { + "first_introduced": "16", + "name": "OH_ArkUI_TextPickerRangeContentArray_SetTextAtIndex" + }, + { + "first_introduced": "16", + "name": "OH_ArkUI_TextPickerRangeContentArray_Destroy" + }, + { + "first_introduced": "16", + "name": "OH_ArkUI_TextCascadePickerRangeContentArray_Create" + }, + { + "first_introduced": "16", + "name": "OH_ArkUI_TextCascadePickerRangeContentArray_SetTextAtIndex" + }, + { + "first_introduced": "16", + "name": "OH_ArkUI_TextCascadePickerRangeContentArray_SetChildAtIndex" + }, + { + "first_introduced": "16", + "name": "OH_ArkUI_TextCascadePickerRangeContentArray_Destroy" } ] \ No newline at end of file diff --git a/arkui/ace_engine/native/native_dialog.h b/arkui/ace_engine/native/native_dialog.h index f609945e5..b792df48f 100644 --- a/arkui/ace_engine/native/native_dialog.h +++ b/arkui/ace_engine/native/native_dialog.h @@ -39,6 +39,7 @@ #include #include "native_type.h" +#include "native_node.h" #ifdef __cplusplus extern "C" { @@ -98,6 +99,13 @@ typedef bool (*ArkUI_OnWillDismissEvent)(int32_t reason); */ typedef struct ArkUI_DialogDismissEvent ArkUI_DialogDismissEvent; +/** + * @brief Defines a struct for the content object of a custom dialog box. + * + * @since 16 + */ +typedef struct ArkUI_CustomDialogOptions ArkUI_CustomDialogOptions; + /** * @brief Provides the custom dialog box APIs for the native side. * @@ -464,6 +472,164 @@ typedef struct { */ int32_t (*registerOnDidDisappear)( ArkUI_NativeDialogHandle handle, void* userData, void (*callback)(void* userData)); + + /** + * @brief Sets the border width of the dialog box. + * + * @note This method must be called before the show method. + * @param handle Pointer to the dialog box controller. + * @param top Width of the top border. + * @param right Width of the right border. + * @param bottom Width of the bottom border. + * @param left Width of the left border. + * @param unit Unit of the width. The default value is vp. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occur.. + * @since 16 + */ + int32_t (*setBorderWidth)( + ArkUI_NativeDialogHandle handle, float top, float right, float bottom, float left, ArkUI_LengthMetricUnit unit); + + /** + * @brief Sets the border color of the dialog box. + * + * @note This method must be called before the show method. + * @param handle Pointer to the dialog box controller. + * @param top Color of the top border. + * @param right Color of the right border. + * @param bottom Color of the bottom border. + * @param left Color of the left border. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occur.. + * @since 16 + */ + int32_t (*setBorderColor)( + ArkUI_NativeDialogHandle handle, uint32_t top, uint32_t right, uint32_t bottom, uint32_t left); + + /** + * @brief Sets the border style of the dialog box. + * + * @note This method must be called before the show method. + * @param handle Pointer to the dialog box controller. + * @param top Style of the top border. + * @param right Style of the right border. + * @param bottom Style of the bottom border. + * @param left Style of the left border. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occur.. + * @since 16 + */ + int32_t (*setBorderStyle)( + ArkUI_NativeDialogHandle handle, int32_t top, int32_t right, int32_t bottom, int32_t left); + + /** + * @brief Sets the width of the dialog box background. + * + * @note This method must be called before the show method. + * @param handle Pointer to the dialog box controller. + * @param width Width of the background. + * @param unit Unit of the width. The default value is vp. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occur.. + * @since 16 + */ + int32_t (*setWidth)(ArkUI_NativeDialogHandle handle, float width, ArkUI_LengthMetricUnit unit); + + /** + * @brief Sets the height of the dialog box background. + * + * @note This method must be called before the show method. + * @param handle Pointer to the dialog box controller. + * @param height Height of the background. + * @param unit Unit of the height. The default value is vp. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occur.. + * @since 16 + */ + int32_t (*setHeight)(ArkUI_NativeDialogHandle handle, float height, ArkUI_LengthMetricUnit unit); + + /** + * @brief Sets the shadow of the dialog box background. + * + * @note This method must be called before the show method. + * @param handle Pointer to the dialog box controller. + * @param shadow Shadow style of the background, specified by an enumerated value. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occur.. + * @since 16 + */ + int32_t (*setShadow)(ArkUI_NativeDialogHandle handle, ArkUI_ShadowStyle shadow); + + /** + * @brief Sets the custom shadow of the dialog box background. + * + * @note This method must be called before the show method. + * @param handle Pointer to the dialog box controller. + * @param customShadow Custom shadow parameter. The format is the same as that of the NODE_SHADOW property. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occur.. + * @since 16 + */ + int32_t (*setCustomShadow)(ArkUI_NativeDialogHandle handle, const ArkUI_AttributeItem* customShadow); + + /** + * @brief Sets the background blur style of the dialog box. + * + * @note This method must be called before the show method. + * @param handle Pointer to the dialog box controller. + * @param blurStyle Background blur style, specified by an enumerated value. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occur.. + * @since 16 + */ + int32_t (*setBackgroundBlurStyle)(ArkUI_NativeDialogHandle handle, ArkUI_BlurStyle blurStyle); + + /** + * @brief Sets the keyboard avoidance mode of the dialog box. + * + * @note This method must be called before the show method. + * @param handle Pointer to the dialog box controller. + * @param keyboardAvoidMode Keyboard avoidance mode, specified by an enumerated value. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occur.. + * @since 16 + */ + int32_t (*setKeyboardAvoidMode)(ArkUI_NativeDialogHandle handle, ArkUI_KeyboardAvoidMode keyboardAvoidMode); + + /** + * @brief Sets whether to enable the hover mode for the dialog box. + * + * @note This method must be called before the show method. + * @param handle Pointer to the dialog box controller. + * @param enableHoverMode Whether to enable the hover mode. The default value is false. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occur.. + * @since 16 + */ + int32_t (*enableHoverMode)(ArkUI_NativeDialogHandle handle, bool enableHoverMode); + + /** + * @brief Set the default display area of the dialog box in hover mode. + * + * @note This method must be called before the show method. + * @param handle Pointer to the dialog box controller. + * @param hoverModeAreaType Display area in hover mode, specified by an enumerated value. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occur. + * @since 16 + */ + int32_t (*setHoverModeArea)(ArkUI_NativeDialogHandle handle, ArkUI_HoverModeAreaType hoverModeAreaType); } ArkUI_NativeDialogAPI_3; /** @@ -501,6 +667,414 @@ void* OH_ArkUI_DialogDismissEvent_GetUserData(ArkUI_DialogDismissEvent* event); */ int32_t OH_ArkUI_DialogDismissEvent_GetDismissReason(ArkUI_DialogDismissEvent* event); +/** + * @brief Displays a custom dialog box. + * + * @param options Dialog box parameters. + * @param callback Callback to be invoked when the custom dialog box displays. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 16 + */ +int32_t OH_ArkUI_CustomDialog_OpenDialog(ArkUI_CustomDialogOptions* options, void (*callback)(int32_t dialogId)); + +/** + * @brief Updates a custom dialog box. + * + * @param options Dialog box parameters. + * @param callback Callback to be invoked when the custom dialog box updates. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 16 + */ +int32_t OH_ArkUI_CustomDialog_UpdateDialog(ArkUI_CustomDialogOptions* options, void (*callback)(int32_t dialogId)); + +/** + * @brief Closes a custom dialog box. + * + * @param dialogId Dialog id. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 16 + */ +int32_t OH_ArkUI_CustomDialog_CloseDialog(int32_t dialogId); + +/** + * @brief Creates custom dialog box options. + * + * @param content Content of the custom dialog box. + * @return Returns the pointer to the custom dialog box options. + * @since 16 + */ +ArkUI_CustomDialogOptions* OH_ArkUI_CustomDialog_CreateOptions(ArkUI_NodeHandle content); + +/** + * @brief Destroys the custom dialog box options. + * + * @param options The pointer to the custom dialog box options. + * @since 16 + */ +void OH_ArkUI_CustomDialog_DisposeOptions(ArkUI_CustomDialogOptions* options); + +/** + * @brief Sets the level mode for a custom dialog box. + * + * @note This method must be called before the OH_ArkUI_CustomDialog_OpenDialog method. + * @param options Indicates the pointer to the custom dialog options. + * @param levelMode Indicates the level mode. The parameter type is {@link ArkUI_LevelMode}. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 16 + */ +int32_t OH_ArkUI_CustomDialog_SetLevelMode(ArkUI_CustomDialogOptions* options, ArkUI_LevelMode levelMode); + +/** + * @brief Sets the level uniqueId for a custom dialog box. + * + * @param options Indicates the pointer to the custom dialog options. + * @param uniqueId Indicates the unique id of any nodes in router or navigation pages. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 16 + */ +int32_t OH_ArkUI_CustomDialog_SetLevelUniqueId(ArkUI_CustomDialogOptions* options, int32_t uniqueId); + +/** + * @brief Sets the immersive mode for a custom dialog box. + * + * @note This method must be called before the OH_ArkUI_CustomDialog_OpenDialog method. + * @param options Indicates the pointer to the custom dialog options. + * @param immersiveMode Indicates the immersive mode. The parameter type is {@link ArkUI_ImmersiveMode}. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 16 + */ +int32_t OH_ArkUI_CustomDialog_SetImmersiveMode(ArkUI_CustomDialogOptions* options, ArkUI_ImmersiveMode immersiveMode); + +/** + * @brief Sets the background color of the dialog box. + * + * @param options Dialog box parameters. + * @param backgroundColor Background color of the dialog box. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 16 + */ +int32_t OH_ArkUI_CustomDialog_SetBackgroundColor(ArkUI_CustomDialogOptions* options, uint32_t backgroundColor); + +/** + * @brief Sets the corner radius for a custom dialog box. + * + * @param options Dialog box parameters. + * @param topLeft Corner radius of the upper left corner. + * @param topRight Corner radius of the upper right corner. + * @param bottomLeft Corner radius of the lower left corner. + * @param bottomRight Corner radius of the lower right corner. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 16 + */ +int32_t OH_ArkuI_CustomDialog_SetCornerRadius( + ArkUI_CustomDialogOptions* options, float topLeft, float topRight, float bottomLeft, float bottomRight); + +/** + * @brief Sets the border width of the dialog box. + * + * @param options Dialog box parameters. + * @param top Width of the top border. + * @param right Width of the right border. + * @param bottom Width of the bottom border. + * @param left Width of the left op border. + * @param unit Unit of the width. The default value is vp. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 16 + */ +int32_t OH_ArkUI_CustomDialog_SetBorderWidth( + ArkUI_CustomDialogOptions* options, float top, float right, float bottom, float left, ArkUI_LengthMetricUnit unit); + +/** + * @brief Sets the border color of the dialog box. + * + * @param options Dialog box parameters. + * @param top Color of the top border. + * @param right Color of the right border. + * @param bottom Color of the bottom border. + * @param left Color of the left border. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 16 + */ +int32_t OH_ArkUI_CustomDialog_SetBorderColor( + ArkUI_CustomDialogOptions* options, uint32_t top, uint32_t right, uint32_t bottom, uint32_t left); + +/** + * @brief Sets the border style of the dialog box. + * + * @param options Dialog box parameters. + * @param top Style of the top border. + * @param right Style of the right border. + * @param bottom Style of the bottom border. + * @param left Style of the left border. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 16 + */ +int32_t OH_ArkUI_CustomDialog_SetBorderStyle( + ArkUI_CustomDialogOptions* options, int32_t top, int32_t right, int32_t bottom, int32_t left); + +/** + * @brief Sets the width of the dialog box background. + * + * @param options Dialog box parameters. + * @param width Width of the background. + * @param unit Unit of the width. The default value is vp. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 16 + */ +int32_t OH_ArkUI_CustomDialog_SetWidth(ArkUI_CustomDialogOptions* options, float width, ArkUI_LengthMetricUnit unit); + +/** + * @brief Sets the height of the dialog box background. + * + * @param options Dialog box parameters. + * @param height Height of the background. + * @param unit Unit of the height. The default value is vp. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 16 + */ +int32_t OH_ArkUI_CustomDialog_SetHeight(ArkUI_CustomDialogOptions* options, float height, ArkUI_LengthMetricUnit unit); + +/** + * @brief Sets the shadow of the dialog box background. + * + * @param options Dialog box parameters. + * @param shadow Shadow style of the background, specified by an enumerated value. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 16 + */ +int32_t OH_ArkUI_CustomDialog_SetShadow(ArkUI_CustomDialogOptions* options, ArkUI_ShadowStyle shadow); + +/** + * @brief Sets the custom shadow of the dialog box background. + * + * @param options Dialog box parameters. + * @param customShadow Custom shadow parameter. The format is the same as that of the NODE_SHADOW property. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 16 + */ +int32_t OH_ArkUI_CustomDialog_SetCustomShadow( + ArkUI_CustomDialogOptions* options, const ArkUI_AttributeItem* customShadow); + +/** + * @brief Sets the background blur style of the dialog box. + * + * @param options Dialog box parameters. + * @param blurStyle Background blur style, specified by an enumerated value. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 16 + */ +int32_t OH_ArkUI_CustomDialog_SetBackgroundBlurStyle(ArkUI_CustomDialogOptions* options, ArkUI_BlurStyle blurStyle); + +/** + * @brief Sets the alignment mode of the dialog box. + * + * @param options Dialog box parameters. + * @param alignment Alignment mode of the dialog box. The parameter type is {@link ArkUI_Alignment}. + * @param offsetX Indicates the horizontal offset of the custom dialog box. The value is a floating point number. + * @param offsetY Indicates the vertical offset of the custom dialog box. The value is a floating point number. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 16 + */ +int32_t OH_ArkUI_CustomDialog_SetAlignment( + ArkUI_CustomDialogOptions* options, int32_t alignment, float offsetX, float offsetY); + +/** + * @brief Sets the modal mode for a custom dialog box. + * + * @param options Dialog box parameters. + * @param isModal Whether the dialog box is a modal. A modal dialog box has a mask applied, + * while a non-modal dialog box does not. The value true means that the dialog box is a modal. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 16 + */ +int32_t OH_ArkUI_CustomDialog_SetModalMode(ArkUI_CustomDialogOptions* options, bool isModal); + +/** + * @brief Specifies whether to allow users to touch the mask to dismiss the custom dialog box. + * + * @param options Dialog box parameters. + * @param autoCancel Specifies whether to allow users to touch the mask to dismiss the dialog box. + * The value true means to allow users to do so, and false means the opposite. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 16 + */ +int32_t OH_ArkUI_CustomDialog_SetAutoCancel(ArkUI_CustomDialogOptions* options, bool autoCancel); + +/** + * @brief Sets whether to display the dialog box in a subwindow. + * + * @param options Dialog box parameters. + * @param isShowInSubwindow Whether to display the dialog box in a subwindow when it is not in the main window. + * The default value is false, meaning the dialog box is displayed within the application, not in a + * separate subwindow. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 16 + */ +int32_t OH_ArkUI_CustomDialog_SetSubwindowMode(ArkUI_CustomDialogOptions* options, bool isShowInSubwindow); + +/** + * @brief Sets the mask for a custom dialog box. + * + * @param options Dialog box parameters. + * @param maskColor Mask color, in 0xargb format. + * @param maskRect Pointer to the mask area. Events outside the mask area are transparently transmitted, + * and events within the mask area are not. The parameter type is {@link ArkUI_Rect}. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 16 + */ +int32_t OH_ArkUI_CustomDialog_SetMask( + ArkUI_CustomDialogOptions* options, uint32_t maskColor, const ArkUI_Rect* maskRect); + +/** + * @brief Sets the keyboard avoidance mode of the dialog box. + * + * @param options Dialog box parameters. + * @param keyboardAvoidMode Keyboard avoidance mode, specified by an enumerated value. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 16 + */ +int32_t OH_ArkUI_CustomDialog_SetKeyboardAvoidMode( + ArkUI_CustomDialogOptions* options, ArkUI_KeyboardAvoidMode keyboardAvoidMode); + +/** + * @brief Sets whether to enable the hover mode for the dialog box. + * + * @param options Dialog box parameters. + * @param enableHoverMode Whether to enable the hover mode. The default value is false. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 16 + */ +int32_t OH_ArkUI_CustomDialog_SetEnableHoverMode(ArkUI_CustomDialogOptions* options, bool enableHoverMode); + +/** + * @brief Set the default display area of the dialog box in hover mode. + * + * @param options Dialog box parameters. + * @param hoverModeAreaType Display area in hover mode, specified by an enumerated value. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 16 + */ +int32_t OH_ArkUI_CustomDialog_SetHoverModeArea( + ArkUI_CustomDialogOptions* options, ArkUI_HoverModeAreaType hoverModeAreaType); + +/** + * @brief Registers a callback for the dismissal event of the custom dialog box. + * + * @param options Dialog box parameters. + * @param userData Pointer to the user-defined data. + * @param callback Callback for the dismissal event of the custom dialog box. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 16 + */ +int32_t OH_ArkUI_CustomDialog_RegisterOnWillDismissCalllback( + ArkUI_CustomDialogOptions* options, void* userData, void (*callback)(ArkUI_DialogDismissEvent* event)); + +/** + * @brief Registers a callback to be invoked when the custom dialog box is about to appear. + * + * @param options Dialog box parameters. + * @param userData Pointer to the user-defined data. + * @param callback Callback to be invoked when the dialog box is about to appear. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 16 + */ +int32_t OH_ArkUI_CustomDialog_RegisterOnWillAppearCallback( + ArkUI_CustomDialogOptions* options, void* userData, void (*callback)(void* userData)); + +/** + * @brief Registers a callback to be invoked when the custom dialog box appears. + * + * @param options Dialog box parameters. + * @param userData Pointer to the user-defined data. + * @param callback Callback to be invoked when the custom dialog box appears. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 16 + */ +int32_t OH_ArkUI_CustomDialog_RegisterOnDidAppearCallback( + ArkUI_CustomDialogOptions* options, void* userData, void (*callback)(void* userData)); + +/** + * @brief Registers a callback to be invoked when the custom dialog box is about to disappear. + * + * @param options Dialog box parameters. + * @param userData Pointer to the user-defined data. + * @param callback Callback to be invoked when the dialog box is about to disappear. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 16 + */ +int32_t OH_ArkUI_CustomDialog_RegisterOnWillDisappearCallback( + ArkUI_CustomDialogOptions* options, void* userData, void (*callback)(void* userData)); + +/** + * @brief Registers a callback to be invoked when the custom dialog box disappears. + * + * @param options Dialog box parameters. + * @param userData Pointer to the user-defined data. + * @param callback Callback to be invoked when the custom dialog box disappears. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 16 + */ +int32_t OH_ArkUI_CustomDialog_RegisterOnDidDisappearCallback( + ArkUI_CustomDialogOptions* options, void* userData, void (*callback)(void* userData)); + #ifdef __cplusplus }; #endif diff --git a/arkui/ace_engine/native/native_type.h b/arkui/ace_engine/native/native_type.h index 140f85f11..107190aa9 100644 --- a/arkui/ace_engine/native/native_type.h +++ b/arkui/ace_engine/native/native_type.h @@ -2579,6 +2579,20 @@ typedef struct ArkUI_SystemFontStyleEvent ArkUI_SystemFontStyleEvent; */ typedef struct ArkUI_SnapshotOptions ArkUI_SnapshotOptions; +/** + * @brief TextPicker single column selector, supports mixing text and images. + * + * @since 16 + */ +typedef struct ArkUI_TextPickerRangeContentArray ArkUI_TextPickerRangeContentArray; + + /** + * @brief TextPicker multi column selector, supports mixing text and images. + * + * @since 16 + */ +typedef struct ArkUI_TextCascadePickerRangeContentArray ArkUI_TextCascadePickerRangeContentArray; + /** * @brief Creates a size constraint. * @@ -5010,6 +5024,84 @@ int32_t OH_ArkUI_VisibleAreaEventOptions_GetRatios(ArkUI_VisibleAreaEventOptions * @since 16 */ int32_t OH_ArkUI_VisibleAreaEventOptions_GetExpectedUpdateInterval(ArkUI_VisibleAreaEventOptions* option); + +/** + *@brief Creates a TextPickerRangeContent instance. + * + *@param length The length of the picker array. + *@return Returns a TextPickerRangeContent instance. + *@since 16 + */ +ArkUI_TextPickerRangeContentArray* OH_ArkUI_TextPickerRangeContentArray_Create(int32_t length); + +/** + *@brief Sets the icon of items in a text picker ranges. + * + *@param handle The TextPickerRangeContent instance for obtaining information. + *@param icon Icon address. + *@param index The index position of the value to be obtained. + *@since 16 + */ +void OH_ArkUI_TextPickerRangeContentArray_SetIconAtIndex( + ArkUI_TextPickerRangeContentArray* handle, char* icon, int32_t index); + +/** + *@brief Sets the text of items in a text picker ranges. + * + *@param handle The TextPickerRangeContent instance for obtaining information. + *@param text Text content. + *@param index The index position of the value to be obtained. + *@since 16 + */ +void OH_ArkUI_TextPickerRangeContentArray_SetTextAtIndex( + ArkUI_TextPickerRangeContentArray* handle, char* text, int32_t index); + +/** + *@brief Destroys the TextPickerRangeContent instance. + * + *@param handle The TextPickerRangeContent instance for obtaining information. + *@since 16 + */ +void OH_ArkUI_TextPickerRangeContentArray_Destroy(ArkUI_TextPickerRangeContentArray* handle); + +/** + *@brief Creates a TextCascadePickerRangeContent instance. + * + *@param length The length of the picker arry. + *@return Returns a TextCascadePickerRangeContent instance. + *@since 16 + */ +ArkUI_TextCascadePickerRangeContentArray* OH_ArkUI_TextCascadePickerRangeContentArray_Create(int32_t length); + +/** + *@brief Sets the text of items in a multi text picker ranges. + * + *@param handle The TextCascadePickerRangeContent instance for obtaining information. + *@param text text content. + *@param index The index position of the value to be obtained. + *@since 16 + */ +void OH_ArkUI_TextCascadePickerRangeContentArray_SetTextAtIndex( + ArkUI_TextCascadePickerRangeContentArray* handle, char* text, int32_t index); + +/** + *@brief Sets the child info of items in a multi text picker ranges. + * + *@param handle The TextCascadePickerRangeContent instance for obtaining information. + *@param child The child instance. + *@param index The index position of the value to be obtained. + *@since 16 + */ +void OH_ArkUI_TextCascadePickerRangeContentArray_SetChildAtIndex( + ArkUI_TextCascadePickerRangeContentArray* handle, ArkUI_TextCascadePickerRangeContentArray* child, int32_t index); + +/** + *@brief Destroys the TextCascadePickerRangeContent instance. + * + *@param handle The TextCascadePickerRangeContent instance for obtaining information. + *@since 16 + */ +void OH_ArkUI_TextCascadePickerRangeContentArray_Destroy(ArkUI_TextCascadePickerRangeContentArray* handle); #ifdef __cplusplus }; #endif -- Gitee