ArkUI_NativeDialogAPI_3

typedef struct {...} ArkUI_NativeDialogAPI_3

Overview

Provides a collection of native-side custom dialog box APIs provided by ArkUI.

Since: 19

Related module: ArkUI_NativeModule

Header file: native_dialog.h

Summary

Member Variables

Name Description
ArkUI_NativeDialogAPI_1 nativeDialogAPI1 Collection of native-side custom dialog box APIs provided by ArkUI, covering the scope of ArkUI_NativeDialogAPI_1.
Since: 19
ArkUI_NativeDialogAPI_2 nativeDialogAPI2 Collection of native-side custom dialog box APIs provided by ArkUI, covering the scope of ArkUI_NativeDialogAPI_2.
Since: 19

Member Functions

Name Description
int32_t (*setLevelOrder)(ArkUI_NativeDialogHandle handle, double levelOrder) Sets the display order of the custom dialog box.
int32_t (*registerOnWillAppear)(ArkUI_NativeDialogHandle handle, void* userData, void (*callback)(void* userData)) Registers a callback function that is triggered before the custom dialog box appears.
int32_t (*registerOnDidAppear)(ArkUI_NativeDialogHandle handle, void* userData, void (*callback)(void* userData)) Registers a callback function that is triggered after the custom dialog box appears.
int32_t (*registerOnWillDisappear)(ArkUI_NativeDialogHandle handle, void* userData, void (*callback)(void* userData)) Registers a callback function that is triggered before the custom dialog box disappears.
int32_t (*registerOnDidDisappear)(ArkUI_NativeDialogHandle handle, void* userData, void (*callback)(void* userData)) Registers a callback function that is triggered after the custom dialog box disappears.
int32_t (*setBorderWidth)(ArkUI_NativeDialogHandle handle, float top, float right, float bottom, float left, ArkUI_LengthMetricUnit unit) Sets the border width of the custom dialog box.
int32_t (*setBorderColor)(ArkUI_NativeDialogHandle handle, uint32_t top, uint32_t right, uint32_t bottom, uint32_t left) Sets the border color of the custom dialog box.
int32_t (*setBorderStyle)(ArkUI_NativeDialogHandle handle, int32_t top, int32_t right, int32_t bottom, int32_t left) Sets the border style of the custom dialog box.
int32_t (*setWidth)(ArkUI_NativeDialogHandle handle, float width, ArkUI_LengthMetricUnit unit) Sets the backdrop width of the custom dialog box.
int32_t (*setHeight)(ArkUI_NativeDialogHandle handle, float height, ArkUI_LengthMetricUnit unit) Sets the backdrop height of the custom dialog box.
int32_t (*setShadow)(ArkUI_NativeDialogHandle handle, ArkUI_ShadowStyle shadow) Sets the shadow of the custom dialog box's backdrop.
int32_t (*setCustomShadow)(ArkUI_NativeDialogHandle handle, const ArkUI_AttributeItem* customShadow) Sets the shadow of the custom dialog box's backdrop.
int32_t (*setBackgroundBlurStyle)(ArkUI_NativeDialogHandle handle, ArkUI_BlurStyle blurStyle) Sets the backdrop blur style of the custom dialog box.
int32_t (*setKeyboardAvoidMode)(ArkUI_NativeDialogHandle handle, ArkUI_KeyboardAvoidMode keyboardAvoidMode) Sets the keyboard avoidance mode of the custom dialog box.
int32_t (*enableHoverMode)(ArkUI_NativeDialogHandle handle, bool enableHoverMode) Sets whether the custom dialog box responds when the device is in semi-folded mode.
int32_t (*setHoverModeArea)(ArkUI_NativeDialogHandle handle, ArkUI_HoverModeAreaType hoverModeAreaType) Sets the default display area of the custom dialog box in hover mode.
int32_t (*setFocusable)(ArkUI_NativeDialogHandle handle, bool focusable) Sets whether the custom dialog box can gain focus.
int32_t (*setBackgroundBlurStyleOptions)(ArkUI_NativeDialogHandle handle, const ArkUI_AttributeItem* backgroundBlurStyleOptions) Sets the background blur effect of the custom dialog box.
int32_t (*setBackgroundEffect)(ArkUI_NativeDialogHandle handle, const ArkUI_AttributeItem* backgroundEffect) Sets the background effect parameters of the custom dialog box.

Member Function Description

setLevelOrder()

int32_t (*setLevelOrder)(ArkUI_NativeDialogHandle handle, double levelOrder)

Description

Sets the display order of the custom dialog box.

NOTE

This API must be called before the show API is invoked.

Since: 19

Parameters

Name Description
ArkUI_NativeDialogHandle handle Pointer to the custom dialog box controller.
double levelOrder Display order of the custom dialog box.
Default value: 0. Value range: [-100000.0, 100000.0]. If the value is out of the range, the setting does not take effect.

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.

registerOnWillAppear()

int32_t (*registerOnWillAppear)(ArkUI_NativeDialogHandle handle, void* userData, void (*callback)(void* userData))

Description

Registers a callback function that is triggered before the custom dialog box appears.

NOTE

This API must be called before the show API is invoked.

Since: 19

Parameters

Name Description
ArkUI_NativeDialogHandle handle Pointer to the custom dialog box controller.
void* userData Custom data.
callback Callback function that is triggered before the custom 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.

registerOnDidAppear()

int32_t (*registerOnDidAppear)(ArkUI_NativeDialogHandle handle, void* userData, void (*callback)(void* userData))

Description

Registers a callback function that is triggered after the custom dialog box appears.

NOTE

This API must be called before the show API is invoked.

Since: 19

Parameters

Name Description
ArkUI_NativeDialogHandle handle Pointer to the custom dialog box controller.
void* userData Custom data.
callback Callback function that is triggered after the custom 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.

registerOnWillDisappear()

int32_t (*registerOnWillDisappear)(ArkUI_NativeDialogHandle handle, void* userData, void (*callback)(void* userData))

Description

Registers a callback function that is triggered before the custom dialog box disappears.

NOTE

This API must be called before the show API is invoked.

Since: 19

Parameters

Name Description
ArkUI_NativeDialogHandle handle Pointer to the custom dialog box controller.
void* userData Custom data.
callback Callback function that is triggered before the custom 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.

registerOnDidDisappear()

int32_t (*registerOnDidDisappear)(ArkUI_NativeDialogHandle handle, void* userData, void (*callback)(void* userData))

Description

Registers a callback function that is triggered after the custom dialog box disappears.

NOTE

This API must be called before the show API is invoked.

Since: 19

Parameters

Name Description
ArkUI_NativeDialogHandle handle Pointer to the custom dialog box controller.
void* userData Custom data.
callback Callback function that is triggered after the custom 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.

setBorderWidth()

int32_t (*setBorderWidth)(ArkUI_NativeDialogHandle handle, float top, float right, float bottom, float left, ArkUI_LengthMetricUnit unit)

Description

Sets the border width of the custom dialog box.

NOTE

This API must be called before the show API is invoked.

Since: 19

Parameters

Name Description
ArkUI_NativeDialogHandle handle Pointer to the custom dialog box controller.
float top Top border width.
float right Right border width.
float bottom Bottom border width.
float left Left border width.
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.

setBorderColor()

int32_t (*setBorderColor)(ArkUI_NativeDialogHandle handle, uint32_t top, uint32_t right, uint32_t bottom, uint32_t left)

Description

Sets the border color of the custom dialog box.

NOTE

This API must be called before the show API is invoked.

Since: 19

Parameters

Name Description
ArkUI_NativeDialogHandle handle Pointer to the custom dialog box controller.
uint32_t top Top border color.
uint32_t right Right border color.
uint32_t bottom Bottom border color.
uint32_t left Left border color.

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.

setBorderStyle()

int32_t (*setBorderStyle)(ArkUI_NativeDialogHandle handle, int32_t top, int32_t right, int32_t bottom, int32_t left)

Description

Sets the border style of the custom dialog box.

NOTE

This API must be called before the show API is invoked.

Since: 19

Parameters

Name Description
ArkUI_NativeDialogHandle handle Pointer to the custom dialog box controller.
int32_t top Top border style. The parameter type is ArkUI_BorderStyle. The default value is ARKUI_BORDER_STYLE_SOLID.
int32_t right Right border style. The parameter type is ArkUI_BorderStyle. The default value is ARKUI_BORDER_STYLE_SOLID.
int32_t bottom Bottom border style. The parameter type is ArkUI_BorderStyle. The default value is ARKUI_BORDER_STYLE_SOLID.
int32_t left Left border style. 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.

setWidth()

int32_t (*setWidth)(ArkUI_NativeDialogHandle handle, float width, ArkUI_LengthMetricUnit unit)

Description

Sets the backdrop width of the custom dialog box.

NOTE

This API must be called before the show API is invoked.

Since: 19

Parameters

Name Description
ArkUI_NativeDialogHandle handle Pointer to the custom dialog box controller.
float width Backdrop width.
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.

setHeight()

int32_t (*setHeight)(ArkUI_NativeDialogHandle handle, float height, ArkUI_LengthMetricUnit unit)

Description

Sets the backdrop height of the custom dialog box.

NOTE

This API must be called before the show API is invoked.

Since: 19

Parameters

Name Description
ArkUI_NativeDialogHandle handle Pointer to the custom dialog box controller.
float height Backdrop height.
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.

setShadow()

int32_t (*setShadow)(ArkUI_NativeDialogHandle handle, ArkUI_ShadowStyle shadow)

Description

Sets the shadow of the custom dialog box's backdrop.

NOTE

This API must be called before the show API is invoked.

Since: 19

Parameters

Name Description
ArkUI_NativeDialogHandle handle Pointer to the custom dialog box controller.
ArkUI_ShadowStyle shadow Backdrop shadow 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.

setCustomShadow()

int32_t (*setCustomShadow)(ArkUI_NativeDialogHandle handle, const ArkUI_AttributeItem* customShadow)

Description

Sets the shadow of the custom dialog box's backdrop.

NOTE

This API must be called before the show API is invoked.

Since: 19

Parameters

Name Description
ArkUI_NativeDialogHandle handle Pointer to the custom dialog box controller.
const ArkUI_AttributeItem* customShadow Custom shadow parameters. The format is consistent with the NODE_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.

setBackgroundBlurStyle()

int32_t (*setBackgroundBlurStyle)(ArkUI_NativeDialogHandle handle, ArkUI_BlurStyle blurStyle)

Description

Sets the backdrop blur style of the custom dialog box.

NOTE

This API must be called before the show API is invoked.

Since: 19

Parameters

Name Description
ArkUI_NativeDialogHandle handle Pointer to the custom dialog box controller.
ArkUI_BlurStyle blurStyle Backdrop blur material, 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.

setKeyboardAvoidMode()

int32_t (*setKeyboardAvoidMode)(ArkUI_NativeDialogHandle handle, ArkUI_KeyboardAvoidMode keyboardAvoidMode)

Description

Sets the keyboard avoidance mode of the custom dialog box.

NOTE

This API must be called before the show API is invoked.

Since: 19

Parameters

Name Description
ArkUI_NativeDialogHandle handle Pointer to the custom dialog box controller.
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.

enableHoverMode()

int32_t (*enableHoverMode)(ArkUI_NativeDialogHandle handle, bool enableHoverMode)

Description

Sets whether the custom dialog box responds when the device is in semi-folded mode.

NOTE

This API must be called before the show API is invoked.

Since: 19

Parameters

Name Description
ArkUI_NativeDialogHandle handle Pointer to the custom dialog box controller.
bool enableHoverMode 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.

setHoverModeArea()

int32_t (*setHoverModeArea)(ArkUI_NativeDialogHandle handle, ArkUI_HoverModeAreaType hoverModeAreaType)

Description

Sets the default display area of the custom dialog box in hover mode.

NOTE

This API must be called before the show API is invoked.

Since: 19

Parameters

Name Description
ArkUI_NativeDialogHandle handle Pointer to the custom dialog box controller.
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.

setFocusable()

int32_t (*setFocusable)(ArkUI_NativeDialogHandle handle, bool focusable)

Description

Sets whether the custom dialog box can gain focus.

NOTE

This API must be called before the show API is invoked.

Since: 19

Parameters

Name Description
ArkUI_NativeDialogHandle handle Pointer to the custom dialog box controller.
bool focusable Whether the custom dialog box can gain focus. The value true means that the custom dialog box can gain focus, and false means the opposite. The preset value is 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.

setBackgroundBlurStyleOptions()

int32_t (*setBackgroundBlurStyleOptions)(ArkUI_NativeDialogHandle handle, const ArkUI_AttributeItem* backgroundBlurStyleOptions)

Description

Sets the background blur effect of the custom dialog box.

NOTE

This API must be called before the show API is invoked.

Since: 19

Parameters

Name Description
ArkUI_NativeDialogHandle handle Pointer to the custom dialog box controller.
const ArkUI_AttributeItem* backgroundBlurStyleOptions Options for customizing the background blur effect. 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.

setBackgroundEffect()

int32_t (*setBackgroundEffect)(ArkUI_NativeDialogHandle handle, const ArkUI_AttributeItem* backgroundEffect)

Description

Sets the background effect parameters of the custom dialog box.

NOTE

This API must be called before the show API is invoked.

Since: 19

Parameters

Name Description
ArkUI_NativeDialogHandle handle Pointer to the custom dialog box controller.
const ArkUI_AttributeItem* backgroundEffect Background effect parameters. 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.