openharmony 鸿蒙 capi-native-dialog-h

2026-08-25 浏览 (1)

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

Nametypedef KeywordDescription
ArkUI_NativeDialogAPI_1ArkUI_NativeDialogAPI_1Provides a collection of native-side custom dialog box APIs provided by ArkUI.
ArkUI_NativeDialogAPI_2ArkUI_NativeDialogAPI_2Provides a collection of native-side custom dialog box APIs provided by ArkUI.
ArkUI_NativeDialogAPI_3ArkUI_NativeDialogAPI_3Provides a collection of native-side custom dialog box APIs provided by ArkUI.
ArkUI_DialogDismissEventArkUI_DialogDismissEventDefines a struct for a dialog box dismiss event.
ArkUI_CustomDialogOptionsArkUI_CustomDialogOptionsDefines a struct for custom dialog box options.

Enums

Nametypedef KeywordDescription
ArkUI_DismissReasonArkUI_DismissReasonEnumerates the actions for triggering closure of the dialog box.
ArkUI_LevelModeArkUI_LevelModeEnumerates the display level modes of the dialog box.
ArkUI_ImmersiveModeArkUI_ImmersiveModeEnumerates the display areas of the embedded dialog box overlay.
ArkUI_DialogStateArkUI_DialogStateEnumerates the dialog box status.

Functions

Nametypedef KeywordDescription
typedef bool (*ArkUI_OnWillDismissEvent)(int32_t reason)ArkUI_OnWillDismissEventDefines a pointer to the callback invoked when the dialog box is closed.
void OH_ArkUI_DialogDismissEvent_SetShouldBlockDismiss(ArkUI_DialogDismissEvent* event, bool shouldBlockDismiss)-Sets whether to block the system behavior of dismissing a dialog box.
void* OH_ArkUI_DialogDismissEvent_GetUserData(ArkUI_DialogDismissEvent* event)-Obtains the pointer to user data in a dialog box dismiss event object.
int32_t OH_ArkUI_DialogDismissEvent_GetDismissReason(ArkUI_DialogDismissEvent* event)-Obtains the dismissal reason from a dialog box dismiss event object.
int32_t OH_ArkUI_CustomDialog_OpenDialog(ArkUI_CustomDialogOptions* options, void (*callback)(int32_t dialogId))-Displays a custom dialog box.
int32_t OH_ArkUI_CustomDialog_UpdateDialog(ArkUI_CustomDialogOptions* options, void (*callback)(int32_t dialogId))-Updates a custom dialog box.
int32_t OH_ArkUI_CustomDialog_CloseDialog(int32_t dialogId)-Closes a custom dialog box.
ArkUI_CustomDialogOptions* OH_ArkUI_CustomDialog_CreateOptions(ArkUI_NodeHandle content)-Creates options for a custom dialog.
void OH_ArkUI_CustomDialog_DisposeOptions(ArkUI_CustomDialogOptions* options)-Disposes of the custom dialog box options.
int32_t OH_ArkUI_CustomDialog_SetLevelMode(ArkUI_CustomDialogOptions* options, ArkUI_LevelMode levelMode)-Sets the display level of the dialog box.
int32_t OH_ArkUI_CustomDialog_SetLevelUniqueId(ArkUI_CustomDialogOptions* options, int32_t uniqueId)-Sets the ID of the node under the dialog box's display level.
int32_t OH_ArkUI_CustomDialog_SetImmersiveMode(ArkUI_CustomDialogOptions* options, ArkUI_ImmersiveMode immersiveMode)-Sets the display area of the embedded dialog box overlay.
int32_t OH_ArkUI_CustomDialog_SetBackgroundColor(ArkUI_CustomDialogOptions* options, uint32_t backgroundColor)-Sets the background color of a dialog box.
int32_t OH_ArkUI_CustomDialog_SetCornerRadius(ArkUI_CustomDialogOptions* options, float topLeft, float topRight, float bottomLeft, float bottomRight)-Sets the corner radius for a custom dialog box.
int32_t OH_ArkUI_CustomDialog_SetBorderWidth(ArkUI_CustomDialogOptions* options, float top, float right, float bottom, float left, ArkUI_LengthMetricUnit unit)-Sets the border width of a dialog box.
int32_t OH_ArkUI_CustomDialog_SetBorderColor(ArkUI_CustomDialogOptions* options, uint32_t top, uint32_t right, uint32_t bottom, uint32_t left)-Sets the border color of the dialog box.
int32_t OH_ArkUI_CustomDialog_SetBorderStyle(ArkUI_CustomDialogOptions* options, int32_t top, int32_t right, int32_t bottom, int32_t left)-Sets the border style of a dialog box.
int32_t OH_ArkUI_CustomDialog_SetWidth(ArkUI_CustomDialogOptions* options, float width, ArkUI_LengthMetricUnit unit)-Sets the width of the dialog box background.
int32_t OH_ArkUI_CustomDialog_SetHeight(ArkUI_CustomDialogOptions* options, float height, ArkUI_LengthMetricUnit unit)-Sets the height of the dialog box background.
int32_t OH_ArkUI_CustomDialog_SetShadow(ArkUI_CustomDialogOptions* options, ArkUI_ShadowStyle shadow)-Sets the shadow of the dialog box background.
int32_t OH_ArkUI_CustomDialog_SetCustomShadow(ArkUI_CustomDialogOptions* options, const ArkUI_AttributeItem* customShadow)-Sets the shadow of the dialog box background.
int32_t OH_ArkUI_CustomDialog_SetBackgroundBlurStyle(ArkUI_CustomDialogOptions* options, ArkUI_BlurStyle blurStyle)-Sets the background blur style of the dialog box.
int32_t OH_ArkUI_CustomDialog_SetAlignment(ArkUI_CustomDialogOptions* options, int32_t alignment, float offsetX, float offsetY)-Sets the alignment mode of a dialog box.
int32_t OH_ArkUI_CustomDialog_SetModalMode(ArkUI_CustomDialogOptions* options, bool isModal)-Sets the modal mode for a custom dialog box.
int32_t OH_ArkUI_CustomDialog_SetAutoCancel(ArkUI_CustomDialogOptions* options, bool autoCancel)-Specifies whether to allow users to touch the mask to dismiss the custom dialog box.
int32_t OH_ArkUI_CustomDialog_SetSubwindowMode(ArkUI_CustomDialogOptions* options, bool showInSubwindow)-Sets whether to display the dialog box in a subwindow.
int32_t OH_ArkUI_CustomDialog_SetMask(ArkUI_CustomDialogOptions* options, uint32_t maskColor, const ArkUI_Rect* maskRect)-Sets the mask for a custom dialog box.
int32_t OH_ArkUI_CustomDialog_SetKeyboardAvoidMode(ArkUI_CustomDialogOptions* options, ArkUI_KeyboardAvoidMode keyboardAvoidMode)-Sets the keyboard avoidance mode of a dialog box.
int32_t OH_ArkUI_CustomDialog_SetHoverModeEnabled(ArkUI_CustomDialogOptions* options, bool enabled)-Sets whether to enable the hover mode for a dialog box.
int32_t OH_ArkUI_CustomDialog_SetHoverModeArea(ArkUI_CustomDialogOptions* options, ArkUI_HoverModeAreaType hoverModeAreaType)-Sets the default display area of a dialog box in hover mode.
int32_t OH_ArkUI_CustomDialog_RegisterOnWillDismissCallback(ArkUI_CustomDialogOptions* options, void* userData, void (*callback)(ArkUI_DialogDismissEvent* event))-Registers a callback for the dismissal event of a custom dialog box.
int32_t OH_ArkUI_CustomDialog_RegisterOnWillAppearCallback(ArkUI_CustomDialogOptions* options, void* userData, void (*callback)(void* userData))-Registers a callback to be invoked when the specified custom dialog box is about to appear.
int32_t OH_ArkUI_CustomDialog_RegisterOnDidAppearCallback(ArkUI_CustomDialogOptions* options, void* userData, void (*callback)(void* userData))-Registers a callback to be invoked when the specified custom dialog box appears.
int32_t OH_ArkUI_CustomDialog_RegisterOnWillDisappearCallback(ArkUI_CustomDialogOptions* options, void* userData, void (*callback)(void* userData))-Registers a callback to be invoked when the specified custom dialog box is about to disappear.
int32_t OH_ArkUI_CustomDialog_RegisterOnDidDisappearCallback(ArkUI_CustomDialogOptions* options, void* userData, void (*callback)(void* userData))-Registers a callback to be invoked when the specified custom dialog box disappears.
int32_t OH_ArkUI_CustomDialog_GetState(ArkUI_NativeDialogHandle handle, ArkUI_DialogState* state)-Obtains the state of a dialog box.
int32_t OH_ArkUI_CustomDialog_SetBackgroundBlurStyleOptions(ArkUI_CustomDialogOptions* options, const ArkUI_AttributeItem* backgroundBlurStyleOptions)-Sets the background blur effect for a dialog box.
int32_t OH_ArkUI_CustomDialog_SetBackgroundEffect(ArkUI_CustomDialogOptions* options, const ArkUI_AttributeItem* backgroundEffect)-Sets the background effect parameters for a dialog box.

Enum Description

ArkUI_DismissReason

enum ArkUI_DismissReason

Description

Enumerates the actions for triggering closure of the dialog box.

Since: 12

ValueDescription
DIALOG_DISMISS_BACK_PRESS = 0Touching the Back button, swiping left or right on the screen, or pressing the Esc key.
DIALOG_DISMISS_TOUCH_OUTSIDE = 1Touching the mask.
DIALOG_DISMISS_CLOSE_BUTTON = 2Touching the Close button.
DIALOG_DISMISS_SLIDE_DOWN = 3Sliding down.

ArkUI_LevelMode

enum ArkUI_LevelMode

Description

Enumerates the display level modes of the dialog box.

Since: 15

ValueDescription
ARKUI_LEVEL_MODE_OVERLAY = 0The dialog box is displayed above all other application content.
ARKUI_LEVEL_MODE_EMBEDDED = 1The 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

ValueDescription
ARKUI_IMMERSIVE_MODE_DEFAULT = 0The dialog box overlay follows the layout constraints of its parent node.
ARKUI_IMMERSIVE_MODE_EXTEND = 1The 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

ValueDescription
DIALOG_UNINITIALIZED = 0State before the controller is bound to the dialog box.
DIALOG_INITIALIZED = 1State after the controller is bound to the dialog box.
DIALOG_APPEARING = 2State during the dialog box appearance animation.
DIALOG_APPEARED = 3State after the dialog display appearance ends.
DIALOG_DISAPPEARING = 4State during the dialog box disappearance animation.
DIALOG_DISAPPEARED = 5State 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

NameDescription
reasonReason for dialog box dismissal.

Return value

TypeDescription
boolAny 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

NameDescription
ArkUI_DialogDismissEvent* eventPointer to a dialog box dismiss event object.
bool shouldBlockDismissWhether 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

NameDescription
ArkUI_DialogDismissEvent* eventPointer to a dialog box dismiss event object.

Returns

TypeDescription
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

NameDescription
ArkUI_DialogDismissEvent* eventPointer to a dialog box dismiss event object.

Returns

TypeDescription
int32_tDismissal 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

NameDescription
ArkUI_CustomDialogOptions* optionsDialog box parameters.
void (*callback)(int32_t dialogId)Callback invoked when the dialog box is displayed. The parameter is the dialog box ID.

Returns

TypeDescription
int32_tResult 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

NameDescription
ArkUI_CustomDialogOptions* optionsDialog box parameters.
void (*callback)(int32_t dialogId)Callback invoked when the dialog box is updated. The parameter is the dialog box ID.

Returns

TypeDescription
int32_tResult 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

NameDescription
int32_t dialogIdID of the dialog box to close.

Returns

TypeDescription
int32_tResult 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

NameDescription
ArkUI_NodeHandle contentContent of the custom dialog box.

Returns

TypeDescription
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

NameDescription
ArkUI_CustomDialogOptions* optionsPointer 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

NameDescription
ArkUI_CustomDialogOptions* optionsPointer to the custom dialog box options.
ArkUI_LevelMode levelModeDisplay level to set, specified by an enumerated value of ArkUI_LevelMode.

Returns

TypeDescription
int32_tResult 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

NameDescription
ArkUI_CustomDialogOptions* optionsPointer to the custom dialog box options.
int32_t uniqueIdID of the node under the dialog box's display level. The dialog box will be displayed on the same page as this node.

Returns

TypeDescription
int32_tResult 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

NameDescription
ArkUI_CustomDialogOptions* optionsPointer to the custom dialog box options.
ArkUI_ImmersiveMode immersiveModeDisplay area, specified by an enumerated value of ArkUI_ImmersiveMode.

Returns

TypeDescription
int32_tResult 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

NameDescription
ArkUI_CustomDialogOptions* optionsDialog box parameters.
uint32_t backgroundColorBackground color of the dialog box, in 0xARGB format.

Returns

TypeDescription
int32_tResult 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

NameDescription
ArkUI_CustomDialogOptions* optionsDialog box parameters.
float topLeftRadius 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 topRightRadius 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 bottomLeftRadius 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 bottomRightRadius 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

TypeDescription
int32_tResult 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

NameDescription
ArkUI_CustomDialogOptions* optionsDialog box parameters.
float topWidth of the top border of the dialog box.
float rightWidth of the right border of the dialog box.
float bottomWidth of the bottom border of the dialog box.
float leftWidth of the left border of the dialog box.
ArkUI_LengthMetricUnit unitUnit of the width. The default value is vp.

Returns

TypeDescription
int32_tResult 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

NameDescription
ArkUI_CustomDialogOptions* optionsDialog box parameters.
uint32_t topColor of the top border of the dialog box, in 0xARGB format.
uint32_t rightColor of the right border of the dialog box, in 0xARGB format.
uint32_t bottomColor of the bottom border of the dialog box, in 0xARGB format.
uint32_t leftColor of the left border of the dialog box, in 0xARGB format.

Returns

TypeDescription
int32_tResult 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

NameDescription
ArkUI_CustomDialogOptions* optionsDialog box parameters.
int32_t topStyle of the top border of the dialog box. The parameter type is ArkUI_BorderStyle. The default value is ARKUI_BORDER_STYLE_SOLID.
int32_t rightStyle of the right border of the dialog box. The parameter type is ArkUI_BorderStyle. The default value is ARKUI_BORDER_STYLE_SOLID.
int32_t bottomStyle of the bottom border of the dialog box. The parameter type is ArkUI_BorderStyle. The default value is ARKUI_BORDER_STYLE_SOLID.
int32_t leftStyle of the left border of the dialog box. The parameter type is ArkUI_BorderStyle. The default value is ARKUI_BORDER_STYLE_SOLID.

Returns

TypeDescription
int32_tResult 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

NameDescription
ArkUI_CustomDialogOptions* optionsDialog box parameters.
float widthWidth of the dialog box background.
ArkUI_LengthMetricUnit unitUnit of the width. The default value is vp.

Returns

TypeDescription
int32_tResult 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

NameDescription
ArkUI_CustomDialogOptions* optionsDialog box parameters.
float heightHeight of the dialog box background.
ArkUI_LengthMetricUnit unitUnit of the height. The default value is vp.

Returns

TypeDescription
int32_tResult 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

NameDescription
ArkUI_CustomDialogOptions* optionsDialog box parameters.
ArkUI_ShadowStyle shadowShadow style of the background, specified by an enumerated value.

Returns

TypeDescription
int32_tResult 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

NameDescription
ArkUI_CustomDialogOptions* optionsDialog box parameters.
const ArkUI_AttributeItem* customShadowCustom shadow parameters. The format is consistent with the NODE_CUSTOM_SHADOW property in ArkUI_NodeAttributeType.

Returns

TypeDescription
int32_tResult 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

NameDescription
ArkUI_CustomDialogOptions* optionsDialog box parameters.
ArkUI_BlurStyle blurStyleBackground blur style, specified by an enumerated value.

Returns

TypeDescription
int32_tResult 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

NameDescription
ArkUI_CustomDialogOptions* optionsDialog box parameters.
int32_t alignmentAlignment mode of the dialog box. The parameter type is ArkUI_Alignment.
float offsetXHorizontal offset of the dialog box. The value is a floating point number, in vp.
float offsetYVertical offset of the dialog box. The value is a floating point number, in vp.

Returns

TypeDescription
int32_tResult 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

NameDescription
ArkUI_CustomDialogOptions* optionsDialog box parameters.
bool isModalWhether 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

TypeDescription
int32_tResult 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

NameDescription
ArkUI_CustomDialogOptions* optionsDialog box parameters.
bool autoCancelWhether 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

TypeDescription
int32_tResult 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

NameDescription
ArkUI_CustomDialogOptions* optionsDialog box parameters.
bool showInSubwindowWhether 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

TypeDescription
int32_tResult 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

NameDescription
ArkUI_CustomDialogOptions* optionsDialog box parameters.
uint32_t maskColorMask color, in 0xargb format.
const ArkUI_Rect* maskRectPointer 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

TypeDescription
int32_tResult 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

NameDescription
ArkUI_CustomDialogOptions* optionsDialog box parameters.
ArkUI_KeyboardAvoidMode keyboardAvoidModeKeyboard avoidance mode, specified by an enumerated value.

Returns

TypeDescription
int32_tResult 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

NameDescription
ArkUI_CustomDialogOptions* optionsDialog box parameters.
bool enabledWhether 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

TypeDescription
int32_tResult 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

NameDescription
ArkUI_CustomDialogOptions* optionsDialog box parameters.
ArkUI_HoverModeAreaType hoverModeAreaTypeDisplay area in hover mode, specified by an enumerated value.

Returns

TypeDescription
int32_tResult 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

NameDescription
ArkUI_CustomDialogOptions* optionsDialog box parameters.
void* userDataPointer 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

TypeDescription
int32_tResult 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

NameDescription
ArkUI_CustomDialogOptions* optionsDialog box parameters.
void* userDataPointer to user data.
void (*callback)(void* userData)Event callback before the dialog box appearance animation.

Returns

TypeDescription
int32_tResult 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

NameDescription
ArkUI_CustomDialogOptions* optionsDialog box parameters.
void* userDataPointer to user data.
void (*callback)(void* userData)Event callback after the dialog box appears.

Returns

TypeDescription
int32_tResult 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

NameDescription
ArkUI_CustomDialogOptions* optionsDialog box parameters.
void* userDataPointer to user data.
void (*callback)(void* userData)Event callback before the dialog box disappearance animation.

Returns

TypeDescription
int32_tResult 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

NameDescription
ArkUI_CustomDialogOptions* optionsDialog box parameters.
void* userDataPointer to user data.
void (*callback)(void* userData)Event callback when the dialog box disappears.

Returns

TypeDescription
int32_tResult 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

NameDescription
ArkUI_NativeDialogHandle handlePointer to the custom dialog box controller.
ArkUI_DialogState* stateEnumerates states of the custom dialog box.

Returns

TypeDescription
int32_tResult 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

NameDescription
ArkUI_CustomDialogOptions* optionsDialog box parameters.
const ArkUI_AttributeItem* backgroundBlurStyleOptionsBackground 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

TypeDescription
int32_tResult 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

NameDescription
ArkUI_CustomDialogOptions* optionsDialog box parameters.
const ArkUI_AttributeItem* backgroundEffectBackground 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

TypeDescription
int32_tResult 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

  • 所属分类: 后端技术
  • 本文标签: 鸿蒙 软件
  • 版权声明: 本文链接 https://seaxiang.com/blog/3986UtsK