native_dialog.h
Overview
Declares a set of custom dialog box APIs of ArkUI on the native side.
File to include: <arkui/native_dialog.h>
Library: libace_ndk.z.so
System capability: SystemCapability.ArkUI.ArkUI.Full
Since: 12
Related module: ArkUI_NativeModule
Sample: NativeDialogSample
Summary
Structs
| Name | typedef Keyword | Description |
|---|---|---|
| ArkUI_NativeDialogAPI_1 | ArkUI_NativeDialogAPI_1 | Provides a collection of native-side custom dialog box APIs provided by ArkUI. |
| ArkUI_NativeDialogAPI_2 | ArkUI_NativeDialogAPI_2 | Provides a collection of native-side custom dialog box APIs provided by ArkUI. |
| ArkUI_NativeDialogAPI_3 | ArkUI_NativeDialogAPI_3 | Provides a collection of native-side custom dialog box APIs provided by ArkUI. |
| ArkUI_DialogDismissEvent | ArkUI_DialogDismissEvent | Defines a struct for a dialog box dismiss event. |
| ArkUI_CustomDialogOptions | ArkUI_CustomDialogOptions | Defines a struct for custom dialog box options. |
Enums
| Name | typedef Keyword | Description |
|---|---|---|
| ArkUI_DismissReason | ArkUI_DismissReason | Enumerates the actions for triggering closure of the dialog box. |
| ArkUI_LevelMode | ArkUI_LevelMode | Enumerates the display level modes of the dialog box. |
| ArkUI_ImmersiveMode | ArkUI_ImmersiveMode | Enumerates the display areas of the embedded dialog box overlay. |
| ArkUI_DialogState | ArkUI_DialogState | Enumerates the dialog box status. |
Functions
Enum Description
ArkUI_DismissReason
enum ArkUI_DismissReason
Description
Enumerates the actions for triggering closure of the dialog box.
Since: 12
| Value | Description |
|---|---|
| DIALOG_DISMISS_BACK_PRESS = 0 | Touching the Back button, swiping left or right on the screen, or pressing the Esc key. |
| DIALOG_DISMISS_TOUCH_OUTSIDE = 1 | Touching the mask. |
| DIALOG_DISMISS_CLOSE_BUTTON = 2 | Touching the Close button. |
| DIALOG_DISMISS_SLIDE_DOWN = 3 | Sliding down. |
ArkUI_LevelMode
enum ArkUI_LevelMode
Description
Enumerates the display level modes of the dialog box.
Since: 15
| Value | Description |
|---|---|
| ARKUI_LEVEL_MODE_OVERLAY = 0 | The dialog box is displayed above all other application content. |
| ARKUI_LEVEL_MODE_EMBEDDED = 1 | The dialog box is embedded within the application's page content. |
ArkUI_ImmersiveMode
enum ArkUI_ImmersiveMode
Description
Enumerates the display areas of the embedded dialog box overlay.
Since: 15
| Value | Description |
|---|---|
| ARKUI_IMMERSIVE_MODE_DEFAULT = 0 | The dialog box overlay follows the layout constraints of its parent node. |
| ARKUI_IMMERSIVE_MODE_EXTEND = 1 | The dialog box overlay can extend to cover the status bar and navigation bar for a more immersive look. |
ArkUI_DialogState
enum ArkUI_DialogState
Description
Enumerates the dialog box status.
Since: 20
| Value | Description |
|---|---|
| DIALOG_UNINITIALIZED = 0 | State before the controller is bound to the dialog box. |
| DIALOG_INITIALIZED = 1 | State after the controller is bound to the dialog box. |
| DIALOG_APPEARING = 2 | State during the dialog box appearance animation. |
| DIALOG_APPEARED = 3 | State after the dialog display appearance ends. |
| DIALOG_DISAPPEARING = 4 | State during the dialog box disappearance animation. |
| DIALOG_DISAPPEARED = 5 | State after the dialog box disappearance animation ends. |
Function Description
ArkUI_OnWillDismissEvent()
typedef bool (*ArkUI_OnWillDismissEvent)(int32_t reason)
Description
Defines a pointer to the callback invoked when the dialog box is closed.
Since: 12
Parameters
| Name | Description |
|---|---|
| reason | Reason for dialog box dismissal. |
Return value
| Type | Description |
|---|---|
| bool | Any return value indicates that the dialog box will not be closed. |
OH_ArkUI_DialogDismissEvent_SetShouldBlockDismiss()
void OH_ArkUI_DialogDismissEvent_SetShouldBlockDismiss(ArkUI_DialogDismissEvent* event, bool shouldBlockDismiss)
Description
Sets whether to block the system behavior of dismissing a dialog box.
Since: 12
Parameters
| Name | Description |
|---|---|
| ArkUI_DialogDismissEvent* event | Pointer to a dialog box dismiss event object. |
| bool shouldBlockDismiss | Whether to block the system behavior of dismissing the dialog box. The value true means to block the system behavior, and false means the opposite. |
OH_ArkUI_DialogDismissEvent_GetUserData()
void* OH_ArkUI_DialogDismissEvent_GetUserData(ArkUI_DialogDismissEvent* event)
Description
Obtains the pointer to user data in a dialog box dismiss event object.
Since: 12
Parameters
| Name | Description |
|---|---|
| ArkUI_DialogDismissEvent* event | Pointer to a dialog box dismiss event object. |
Returns
| Type | Description |
|---|---|
| void* | Pointer to user data. |
OH_ArkUI_DialogDismissEvent_GetDismissReason()
int32_t OH_ArkUI_DialogDismissEvent_GetDismissReason(ArkUI_DialogDismissEvent* event)
Description
Obtains the dismissal reason from a dialog box dismiss event object.
Since: 12
Parameters
| Name | Description |
|---|---|
| ArkUI_DialogDismissEvent* event | Pointer to a dialog box dismiss event object. |
Returns
| Type | Description |
|---|---|
| int32_t | Dismissal reason, or -1 if an exception occurs. DIALOG_DISMISS_BACK_PRESS: touching the Back button, swiping left or right on the screen, or pressing the Esc key. DIALOG_DISMISS_TOUCH_OUTSIDE: touching the mask. DIALOG_DISMISS_CLOSE_BUTTON: touching the close button. DIALOG_DISMISS_SLIDE_DOWN: swiping down. |
OH_ArkUI_CustomDialog_OpenDialog()
int32_t OH_ArkUI_CustomDialog_OpenDialog(ArkUI_CustomDialogOptions* options, void (*callback)(int32_t dialogId))
Description
Displays a custom dialog box.
Since: 19
Parameters
| Name | Description |
|---|---|
| ArkUI_CustomDialogOptions* options | Dialog box parameters. |
| void (*callback)(int32_t dialogId) | Callback invoked when the dialog box is displayed. The parameter is the dialog box ID. |
Returns
| Type | Description |
|---|---|
| int32_t | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_CustomDialog_UpdateDialog()
int32_t OH_ArkUI_CustomDialog_UpdateDialog(ArkUI_CustomDialogOptions* options, void (*callback)(int32_t dialogId))
Description
Updates a custom dialog box.
Since: 19
Parameters
| Name | Description |
|---|---|
| ArkUI_CustomDialogOptions* options | Dialog box parameters. |
| void (*callback)(int32_t dialogId) | Callback invoked when the dialog box is updated. The parameter is the dialog box ID. |
Returns
| Type | Description |
|---|---|
| int32_t | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_CustomDialog_CloseDialog()
int32_t OH_ArkUI_CustomDialog_CloseDialog(int32_t dialogId)
Description
Closes a custom dialog box.
Since: 19
Parameters
| Name | Description |
|---|---|
| int32_t dialogId | ID of the dialog box to close. |
Returns
| Type | Description |
|---|---|
| int32_t | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_CustomDialog_CreateOptions()
ArkUI_CustomDialogOptions* OH_ArkUI_CustomDialog_CreateOptions(ArkUI_NodeHandle content)
Description
Creates custom dialog box options.
Since: 19
Parameters
| Name | Description |
|---|---|
| ArkUI_NodeHandle content | Content of the custom dialog box. |
Returns
| Type | Description |
|---|---|
| ArkUI_CustomDialogOptions* | Pointer to the custom dialog box configuration. |
OH_ArkUI_CustomDialog_DisposeOptions()
void OH_ArkUI_CustomDialog_DisposeOptions(ArkUI_CustomDialogOptions* options)
Description
Disposes of the custom dialog box options.
Since: 19
Parameters
| Name | Description |
|---|---|
| ArkUI_CustomDialogOptions* options | Pointer to the custom dialog box configuration. |
OH_ArkUI_CustomDialog_SetLevelMode()
int32_t OH_ArkUI_CustomDialog_SetLevelMode(ArkUI_CustomDialogOptions* options, ArkUI_LevelMode levelMode)
Description
Sets the display level of the dialog box.
NOTE
This API must be called before the OH_ArkUI_CustomDialog_OpenDialog API is invoked.
Since: 19
Parameters
| Name | Description |
|---|---|
| ArkUI_CustomDialogOptions* options | Pointer to the custom dialog box options. |
| ArkUI_LevelMode levelMode | Display level to set, specified by an enumerated value of ArkUI_LevelMode. |
Returns
| Type | Description |
|---|---|
| int32_t | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_CustomDialog_SetLevelUniqueId()
int32_t OH_ArkUI_CustomDialog_SetLevelUniqueId(ArkUI_CustomDialogOptions* options, int32_t uniqueId)
Description
Sets the ID of the node under the dialog box's display level.
NOTE
This API must be called before the OH_ArkUI_CustomDialog_OpenDialog API is invoked.
Since: 19
Parameters
| Name | Description |
|---|---|
| ArkUI_CustomDialogOptions* options | Pointer to the custom dialog box options. |
| int32_t uniqueId | ID of the node under the dialog box's display level. The dialog box will be displayed on the same page as this node. |
Returns
| Type | Description |
|---|---|
| int32_t | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_CustomDialog_SetImmersiveMode()
int32_t OH_ArkUI_CustomDialog_SetImmersiveMode(ArkUI_CustomDialogOptions* options, ArkUI_ImmersiveMode immersiveMode)
Description
Sets the display area of the embedded dialog box overlay.
Since: 19
Parameters
| Name | Description |
|---|---|
| ArkUI_CustomDialogOptions* options | Pointer to the custom dialog box options. |
| ArkUI_ImmersiveMode immersiveMode | Display area, specified by an enumerated value of ArkUI_ImmersiveMode. |
Returns
| Type | Description |
|---|---|
| int32_t | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_CustomDialog_SetBackgroundColor()
int32_t OH_ArkUI_CustomDialog_SetBackgroundColor(ArkUI_CustomDialogOptions* options, uint32_t backgroundColor)
Description
Sets the background color of a dialog box.
Since: 19
Parameters
| Name | Description |
|---|---|
| ArkUI_CustomDialogOptions* options | Dialog box parameters. |
| uint32_t backgroundColor | Background color of the dialog box, in 0xARGB format. |
Returns
| Type | Description |
|---|---|
| int32_t | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_CustomDialog_SetCornerRadius()
int32_t OH_ArkUI_CustomDialog_SetCornerRadius(ArkUI_CustomDialogOptions* options, float topLeft, float topRight, float bottomLeft, float bottomRight)
Description
Sets the corner radius for a custom dialog box.
Since: 19
Parameters
| Name | Description |
|---|---|
| ArkUI_CustomDialogOptions* options | Dialog box parameters. |
| float topLeft | Radius of the upper left corner of the dialog box, in vp. Default value: 32 vp since API version 12; 24 vp in API version 11 and earlier versions. |
| float topRight | Radius of the upper right corner of the dialog box, in vp. Default value: 32 vp since API version 12; 24 vp in API version 11 and earlier versions. |
| float bottomLeft | Radius of the lower left corner of the dialog box, in vp. Default value: 32 vp since API version 12; 24 vp in API version 11 and earlier versions. |
| float bottomRight | Radius of the lower right corner of the dialog box, in vp. Default value: 32 vp since API version 12; 24 vp in API version 11 and earlier versions. |
Returns
| Type | Description |
|---|---|
| int32_t | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_CustomDialog_SetBorderWidth()
int32_t OH_ArkUI_CustomDialog_SetBorderWidth(ArkUI_CustomDialogOptions* options, float top, float right, float bottom, float left, ArkUI_LengthMetricUnit unit)
Description
Sets the border width of a dialog box.
Since: 19
Parameters
| Name | Description |
|---|---|
| ArkUI_CustomDialogOptions* options | Dialog box parameters. |
| float top | Width of the top border of the dialog box. |
| float right | Width of the right border of the dialog box. |
| float bottom | Width of the bottom border of the dialog box. |
| float left | Width of the left border of the dialog box. |
| ArkUI_LengthMetricUnit unit | Unit of the width. The default value is vp. |
Returns
| Type | Description |
|---|---|
| int32_t | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_CustomDialog_SetBorderColor()
int32_t OH_ArkUI_CustomDialog_SetBorderColor(ArkUI_CustomDialogOptions* options, uint32_t top, uint32_t right, uint32_t bottom, uint32_t left)
Description
Sets the border color of the dialog box.
Since: 19
Parameters
| Name | Description |
|---|---|
| ArkUI_CustomDialogOptions* options | Dialog box parameters. |
| uint32_t top | Color of the top border of the dialog box, in 0xARGB format. |
| uint32_t right | Color of the right border of the dialog box, in 0xARGB format. |
| uint32_t bottom | Color of the bottom border of the dialog box, in 0xARGB format. |
| uint32_t left | Color of the left border of the dialog box, in 0xARGB format. |
Returns
| Type | Description |
|---|---|
| int32_t | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_CustomDialog_SetBorderStyle()
int32_t OH_ArkUI_CustomDialog_SetBorderStyle(ArkUI_CustomDialogOptions* options, int32_t top, int32_t right, int32_t bottom, int32_t left)
Description
Sets the border style of a dialog box.
Since: 19
Parameters
| Name | Description |
|---|---|
| ArkUI_CustomDialogOptions* options | Dialog box parameters. |
| int32_t top | Style of the top border of the dialog box. The parameter type is ArkUI_BorderStyle. The default value is ARKUI_BORDER_STYLE_SOLID. |
| int32_t right | Style of the right border of the dialog box. The parameter type is ArkUI_BorderStyle. The default value is ARKUI_BORDER_STYLE_SOLID. |
| int32_t bottom | Style of the bottom border of the dialog box. The parameter type is ArkUI_BorderStyle. The default value is ARKUI_BORDER_STYLE_SOLID. |
| int32_t left | Style of the left border of the dialog box. The parameter type is ArkUI_BorderStyle. The default value is ARKUI_BORDER_STYLE_SOLID. |
Returns
| Type | Description |
|---|---|
| int32_t | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_CustomDialog_SetWidth()
int32_t OH_ArkUI_CustomDialog_SetWidth(ArkUI_CustomDialogOptions* options, float width, ArkUI_LengthMetricUnit unit)
Description
Sets the width of the dialog box background.
Since: 19
Parameters
| Name | Description |
|---|---|
| ArkUI_CustomDialogOptions* options | Dialog box parameters. |
| float width | Width of the dialog box background. |
| ArkUI_LengthMetricUnit unit | Unit of the width. The default value is vp. |
Returns
| Type | Description |
|---|---|
| int32_t | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_CustomDialog_SetHeight()
int32_t OH_ArkUI_CustomDialog_SetHeight(ArkUI_CustomDialogOptions* options, float height, ArkUI_LengthMetricUnit unit)
Description
Sets the height of the dialog box background.
Since: 19
Parameters
| Name | Description |
|---|---|
| ArkUI_CustomDialogOptions* options | Dialog box parameters. |
| float height | Height of the dialog box background. |
| ArkUI_LengthMetricUnit unit | Unit of the height. The default value is vp. |
Returns
| Type | Description |
|---|---|
| int32_t | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_CustomDialog_SetShadow()
int32_t OH_ArkUI_CustomDialog_SetShadow(ArkUI_CustomDialogOptions* options, ArkUI_ShadowStyle shadow)
Description
Sets the shadow of the dialog box background.
Since: 19
Parameters
| Name | Description |
|---|---|
| ArkUI_CustomDialogOptions* options | Dialog box parameters. |
| ArkUI_ShadowStyle shadow | Shadow style of the background, specified by an enumerated value. |
Returns
| Type | Description |
|---|---|
| int32_t | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_CustomDialog_SetCustomShadow()
int32_t OH_ArkUI_CustomDialog_SetCustomShadow(ArkUI_CustomDialogOptions* options, const ArkUI_AttributeItem* customShadow)
Description
Sets the shadow of the dialog box background.
Since: 19
Parameters
| Name | Description |
|---|---|
| ArkUI_CustomDialogOptions* options | Dialog box parameters. |
| const ArkUI_AttributeItem* customShadow | Custom shadow parameters. The format is consistent with the NODE_CUSTOM_SHADOW property in ArkUI_NodeAttributeType. |
Returns
| Type | Description |
|---|---|
| int32_t | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_CustomDialog_SetBackgroundBlurStyle()
int32_t OH_ArkUI_CustomDialog_SetBackgroundBlurStyle(ArkUI_CustomDialogOptions* options, ArkUI_BlurStyle blurStyle)
Description
Sets the background blur style of the dialog box.
Since: 19
Parameters
| Name | Description |
|---|---|
| ArkUI_CustomDialogOptions* options | Dialog box parameters. |
| ArkUI_BlurStyle blurStyle | Background blur style, specified by an enumerated value. |
Returns
| Type | Description |
|---|---|
| int32_t | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_CustomDialog_SetAlignment()
int32_t OH_ArkUI_CustomDialog_SetAlignment(ArkUI_CustomDialogOptions* options, int32_t alignment, float offsetX, float offsetY)
Description
Sets the alignment mode of a dialog box.
Since: 19
Parameters
| Name | Description |
|---|---|
| ArkUI_CustomDialogOptions* options | Dialog box parameters. |
| int32_t alignment | Alignment mode of the dialog box. The parameter type is ArkUI_Alignment. |
| float offsetX | Horizontal offset of the dialog box. The value is a floating point number, in vp. |
| float offsetY | Vertical offset of the dialog box. The value is a floating point number, in vp. |
Returns
| Type | Description |
|---|---|
| int32_t | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_CustomDialog_SetModalMode()
int32_t OH_ArkUI_CustomDialog_SetModalMode(ArkUI_CustomDialogOptions* options, bool isModal)
Description
Sets the modal mode for a custom dialog box.
Since: 19
Parameters
| Name | Description |
|---|---|
| ArkUI_CustomDialogOptions* options | Dialog box parameters. |
| bool 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, and false means the opposite. Default value: false. |
Returns
| Type | Description |
|---|---|
| int32_t | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_CustomDialog_SetAutoCancel()
int32_t OH_ArkUI_CustomDialog_SetAutoCancel(ArkUI_CustomDialogOptions* options, bool autoCancel)
Description
Specifies whether to allow users to touch the mask to dismiss the custom dialog box.
Since: 19
Parameters
| Name | Description |
|---|---|
| ArkUI_CustomDialogOptions* options | Dialog box parameters. |
| bool autoCancel | 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. Default value: true |
Returns
| Type | Description |
|---|---|
| int32_t | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_CustomDialog_SetSubwindowMode()
int32_t OH_ArkUI_CustomDialog_SetSubwindowMode(ArkUI_CustomDialogOptions* options, bool showInSubwindow)
Description
Sets whether to display the dialog box in a subwindow.
Since: 19
Parameters
| Name | Description |
|---|---|
| ArkUI_CustomDialogOptions* options | Dialog box parameters. |
| bool showInSubwindow | Whether to show the dialog box in a subwindow when the dialog box needs to be displayed outside the main window. If the value is true, the dialog box can be displayed in an independent subwindow outside the main window. If the value is false, the dialog box is displayed within the application, not in an independent subwindow. Default value: false. |
Returns
| Type | Description |
|---|---|
| int32_t | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_CustomDialog_SetMask()
int32_t OH_ArkUI_CustomDialog_SetMask(ArkUI_CustomDialogOptions* options, uint32_t maskColor, const ArkUI_Rect* maskRect)
Description
Sets the mask for a custom dialog box.
Since: 19
Parameters
| Name | Description |
|---|---|
| ArkUI_CustomDialogOptions* options | Dialog box parameters. |
| uint32_t maskColor | Mask color, in 0xargb format. |
| const ArkUI_Rect* 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 ArkUI_Rect. |
Returns
| Type | Description |
|---|---|
| int32_t | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_CustomDialog_SetKeyboardAvoidMode()
int32_t OH_ArkUI_CustomDialog_SetKeyboardAvoidMode(ArkUI_CustomDialogOptions* options, ArkUI_KeyboardAvoidMode keyboardAvoidMode)
Description
Sets the keyboard avoidance mode of a dialog box.
Since: 19
Parameters
| Name | Description |
|---|---|
| ArkUI_CustomDialogOptions* options | Dialog box parameters. |
| ArkUI_KeyboardAvoidMode keyboardAvoidMode | Keyboard avoidance mode, specified by an enumerated value. |
Returns
| Type | Description |
|---|---|
| int32_t | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_CustomDialog_SetHoverModeEnabled()
int32_t OH_ArkUI_CustomDialog_SetHoverModeEnabled(ArkUI_CustomDialogOptions* options, bool enabled)
Description
Sets whether to enable the hover mode for a dialog box.
Since: 19
Parameters
| Name | Description |
|---|---|
| ArkUI_CustomDialogOptions* options | Dialog box parameters. |
| bool enabled | Whether to respond when the device is in semi-folded mode. The default value is false. The value true means to respond when the device is in semi-folded mode, and false means the opposite. |
Returns
| Type | Description |
|---|---|
| int32_t | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_CustomDialog_SetHoverModeArea()
int32_t OH_ArkUI_CustomDialog_SetHoverModeArea(ArkUI_CustomDialogOptions* options, ArkUI_HoverModeAreaType hoverModeAreaType)
Description
Sets the default display area of a dialog box in hover mode.
Since: 19
Parameters
| Name | Description |
|---|---|
| ArkUI_CustomDialogOptions* options | Dialog box parameters. |
| ArkUI_HoverModeAreaType hoverModeAreaType | Display area in hover mode, specified by an enumerated value. |
Returns
| Type | Description |
|---|---|
| int32_t | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_CustomDialog_RegisterOnWillDismissCallback()
int32_t OH_ArkUI_CustomDialog_RegisterOnWillDismissCallback(ArkUI_CustomDialogOptions* options, void* userData, void (*callback)(ArkUI_DialogDismissEvent* event))
Description
Registers a callback for the dismissal event of a custom dialog box.
Since: 19
Parameters
| Name | Description |
|---|---|
| ArkUI_CustomDialogOptions* options | Dialog box parameters. |
| void* userData | Pointer to user data. |
| void (*callback)(ArkUI_DialogDismissEvent* event) | Callback for the dismissal event of the custom dialog box. - event: input parameter of the callback, which captures the reason for dismissal. |
Returns
| Type | Description |
|---|---|
| int32_t | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_CustomDialog_RegisterOnWillAppearCallback()
int32_t OH_ArkUI_CustomDialog_RegisterOnWillAppearCallback(ArkUI_CustomDialogOptions* options, void* userData, void (*callback)(void* userData))
Description
Registers a callback to be invoked when the specified custom dialog box is about to appear.
Since: 19
Parameters
| Name | Description |
|---|---|
| ArkUI_CustomDialogOptions* options | Dialog box parameters. |
| void* userData | Pointer to user data. |
| void (*callback)(void* userData) | Event callback before the dialog box appearance animation. |
Returns
| Type | Description |
|---|---|
| int32_t | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_CustomDialog_RegisterOnDidAppearCallback()
int32_t OH_ArkUI_CustomDialog_RegisterOnDidAppearCallback(ArkUI_CustomDialogOptions* options, void* userData, void (*callback)(void* userData))
Description
Registers a callback to be invoked when the specified custom dialog box appears.
Since: 19
Parameters
| Name | Description |
|---|---|
| ArkUI_CustomDialogOptions* options | Dialog box parameters. |
| void* userData | Pointer to user data. |
| void (*callback)(void* userData) | Event callback after the dialog box appears. |
Returns
| Type | Description |
|---|---|
| int32_t | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_CustomDialog_RegisterOnWillDisappearCallback()
int32_t OH_ArkUI_CustomDialog_RegisterOnWillDisappearCallback(ArkUI_CustomDialogOptions* options, void* userData, void (*callback)(void* userData))
Description
Registers a callback to be invoked when the specified custom dialog box is about to disappear.
Since: 19
Parameters
| Name | Description |
|---|---|
| ArkUI_CustomDialogOptions* options | Dialog box parameters. |
| void* userData | Pointer to user data. |
| void (*callback)(void* userData) | Event callback before the dialog box disappearance animation. |
Returns
| Type | Description |
|---|---|
| int32_t | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_CustomDialog_RegisterOnDidDisappearCallback()
int32_t OH_ArkUI_CustomDialog_RegisterOnDidDisappearCallback(ArkUI_CustomDialogOptions* options, void* userData, void (*callback)(void* userData))
Description
Registers a callback to be invoked when the specified custom dialog box disappears.
Since: 19
Parameters
| Name | Description |
|---|---|
| ArkUI_CustomDialogOptions* options | Dialog box parameters. |
| void* userData | Pointer to user data. |
| void (*callback)(void* userData) | Event callback when the dialog box disappears. |
Returns
| Type | Description |
|---|---|
| int32_t | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_CustomDialog_GetState()
int32_t OH_ArkUI_CustomDialog_GetState(ArkUI_NativeDialogHandle handle, ArkUI_DialogState* state)
Description
Obtains the state of a dialog box.
Since: 20
Parameters
| Name | Description |
|---|---|
| ArkUI_NativeDialogHandle handle | Pointer to the custom dialog box controller. |
| ArkUI_DialogState* state | Enumerates states of the custom dialog box. |
Returns
| Type | Description |
|---|---|
| int32_t | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_CustomDialog_SetBackgroundBlurStyleOptions()
int32_t OH_ArkUI_CustomDialog_SetBackgroundBlurStyleOptions(ArkUI_CustomDialogOptions* options, const ArkUI_AttributeItem* backgroundBlurStyleOptions)
Description
Sets the background blur effect for a dialog box.
Since: 19
Parameters
| Name | Description |
|---|---|
| ArkUI_CustomDialogOptions* options | Dialog box parameters. |
| const ArkUI_AttributeItem* backgroundBlurStyleOptions | Background blur effect for the dialog box. The format of the ArkUI_AttributeItem parameter is as follows: .value[0].i32: color mode, specified by an enumerated value of ArkUI_ColorMode. .value[1]?.i32: adaptive color mode, specified by an enumerated value of ArkUI_AdaptiveColor. .value[2]?.f32: blur degree. The value range is [0.0, 1.0]. If the value is out of the valid range, the boundary value is used. .value[3]?.u32: brightness of black in the grayscale blur. The value range is [0, 127]. If the value is out of the valid range, 0 is used. .value[4]?.u32: darkening degree of white in the grayscale blur. The value range is [0, 127]. If the value is out of the valid range, 0 is used. .value[5]?.i32: blur activation policy, specified by an enumerated value of ArkUI_BlurStyleActivePolicy. .value[6]?.u32: background color, in 0xARGB format, of the components within the window after the window loses focus (in which case, the blur effect on the components within the window is removed). |
Returns
| Type | Description |
|---|---|
| int32_t | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_CustomDialog_SetBackgroundEffect()
int32_t OH_ArkUI_CustomDialog_SetBackgroundEffect(ArkUI_CustomDialogOptions* options, const ArkUI_AttributeItem* backgroundEffect)
Description
Sets the background effect parameters for a dialog box.
Since: 19
Parameters
| Name | Description |
|---|---|
| ArkUI_CustomDialogOptions* options | Dialog box parameters. |
| const ArkUI_AttributeItem* backgroundEffect | Background effect of the dialog box. The format of the ArkUI_AttributeItem parameter is as follows: .value[0].f32: blur radius, in vp. .value[1]?.f32: saturation. .value[2]?.f32: brightness. .value[3]?.u32: color, in 0xARGB format. .value[4]?.i32: adaptive color mode, specified by an enumerated value of ArkUI_AdaptiveColor. .value[5]?.u32: brightness of black in the grayscale blur. The value range is [0, 127]. If the value is out of the valid range, 0 is used. .value[6]?.u32: darkening degree of white in the grayscale blur. The value range is [0, 127]. If the value is out of the valid range, 0 is used. .value[7]?.i32: blur activation policy, specified by an enumerated value of ArkUI_BlurStyleActivePolicy. .value[8]?.u32: background color, in 0xARGB format, of the components within the window after the window loses focus (in which case, the blur effect on the components within the window is removed). |
Returns
| Type | Description |
|---|---|
| int32_t | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
你可能感兴趣的鸿蒙文章
openharmony 鸿蒙 arkts-apis-uicontext-contextmenucontroller
openharmony 鸿蒙 errorcode-canvas
openharmony 鸿蒙 capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent
openharmony 鸿蒙 errorcode-bindSheet
openharmony 鸿蒙 js-apis-arkui-uiExtension-sys
openharmony 鸿蒙 capi-arkui-accessibility-arkui-accessibilityeventinfo
openharmony 鸿蒙 capi-arkui-rendernodeutils
openharmony 鸿蒙 js-apis-arkui-node
openharmony 鸿蒙 capi-native-node-h
openharmony 鸿蒙 capi-arkui-nativemodule-arkui-listitemswipeactionitem