#[repr(C)]pub struct ArkUI_NativeDialogAPI_1 {Show 18 fields
pub create: Option<unsafe extern "C" fn() -> ArkUI_NativeDialogHandle>,
pub dispose: Option<unsafe extern "C" fn(handle: ArkUI_NativeDialogHandle)>,
pub setContent: Option<unsafe extern "C" fn(handle: ArkUI_NativeDialogHandle, content: ArkUI_NodeHandle) -> i32>,
pub removeContent: Option<unsafe extern "C" fn(handle: ArkUI_NativeDialogHandle) -> i32>,
pub setContentAlignment: Option<unsafe extern "C" fn(handle: ArkUI_NativeDialogHandle, alignment: i32, offsetX: f32, offsetY: f32) -> i32>,
pub resetContentAlignment: Option<unsafe extern "C" fn(handle: ArkUI_NativeDialogHandle) -> i32>,
pub setModalMode: Option<unsafe extern "C" fn(handle: ArkUI_NativeDialogHandle, isModal: bool) -> i32>,
pub setAutoCancel: Option<unsafe extern "C" fn(handle: ArkUI_NativeDialogHandle, autoCancel: bool) -> i32>,
pub setMask: Option<unsafe extern "C" fn(handle: ArkUI_NativeDialogHandle, maskColor: u32, maskRect: *const ArkUI_Rect) -> i32>,
pub setBackgroundColor: Option<unsafe extern "C" fn(handle: ArkUI_NativeDialogHandle, backgroundColor: u32) -> i32>,
pub setCornerRadius: Option<unsafe extern "C" fn(handle: ArkUI_NativeDialogHandle, topLeft: f32, topRight: f32, bottomLeft: f32, bottomRight: f32) -> i32>,
pub setGridColumnCount: Option<unsafe extern "C" fn(handle: ArkUI_NativeDialogHandle, gridCount: i32) -> i32>,
pub enableCustomStyle: Option<unsafe extern "C" fn(handle: ArkUI_NativeDialogHandle, enableCustomStyle: bool) -> i32>,
pub enableCustomAnimation: Option<unsafe extern "C" fn(handle: ArkUI_NativeDialogHandle, enableCustomAnimation: bool) -> i32>,
pub registerOnWillDismiss: Option<unsafe extern "C" fn(handle: ArkUI_NativeDialogHandle, eventHandler: ArkUI_OnWillDismissEvent) -> i32>,
pub show: Option<unsafe extern "C" fn(handle: ArkUI_NativeDialogHandle, showInSubWindow: bool) -> i32>,
pub close: Option<unsafe extern "C" fn(handle: ArkUI_NativeDialogHandle) -> i32>,
pub registerOnWillDismissWithUserData: Option<unsafe extern "C" fn(handle: ArkUI_NativeDialogHandle, userData: *mut c_void, callback: Option<unsafe extern "C" fn(event: *mut ArkUI_DialogDismissEvent)>) -> i32>,
}api-12 only.Expand description
Provides the custom dialog box APIs for the native side.
Version: 1
Available since API-level: 12
Fields§
§create: Option<unsafe extern "C" fn() -> ArkUI_NativeDialogHandle>Creates a custom dialog box and returns the pointer to the created dialog box.
Note: This method must be called before the show method.
§Returns
- Returns the pointer to the created custom dialog box; returns a null pointer if the creation fails.
dispose: Option<unsafe extern "C" fn(handle: ArkUI_NativeDialogHandle)>Destroys a custom dialog box.
§Arguments
handle- Indicates the pointer to the custom dialog box controller.
setContent: Option<unsafe extern "C" fn(handle: ArkUI_NativeDialogHandle, content: ArkUI_NodeHandle) -> i32>Attaches the content of a custom dialog box.
Note: This method must be called before the show method.
§Arguments
-
handle- Indicates the pointer to the custom dialog box controller. -
content- Indicates the pointer to the root node of the custom dialog box content.
§Returns
- Returns the error code.
Returns [
ARKUI_ERROR_CODE_NO_ERROR] if the operation is successful. Returns [ARKUI_ERROR_CODE_PARAM_INVALID] if a parameter error occurs.
removeContent: Option<unsafe extern "C" fn(handle: ArkUI_NativeDialogHandle) -> i32>Detaches the content of a custom dialog box.
Note: This method must be called before the show method.
§Arguments
handle- Indicates the pointer to the custom dialog box controller.
§Returns
- Returns the error code.
Returns [
ARKUI_ERROR_CODE_NO_ERROR] if the operation is successful. Returns [ARKUI_ERROR_CODE_PARAM_INVALID] if a parameter error occurs.
setContentAlignment: Option<unsafe extern "C" fn(handle: ArkUI_NativeDialogHandle, alignment: i32, offsetX: f32, offsetY: f32) -> i32>Sets the alignment mode for a custom dialog box.
Note: This method must be called before the show method.
§Arguments
-
handle- Indicates the pointer to the custom dialog box controller. -
alignment- Indicates the alignment mode. The parameter type isArkUI_Alignment. -
offsetX- Indicates the horizontal offset of the custom dialog box. The value is a floating point number. -
offsetY- Indicates the vertical offset of the custom dialog box. The value is a floating point number.
§Returns
- Returns the error code.
Returns [
ARKUI_ERROR_CODE_NO_ERROR] if the operation is successful. Returns [ARKUI_ERROR_CODE_PARAM_INVALID] if a parameter error occurs.
resetContentAlignment: Option<unsafe extern "C" fn(handle: ArkUI_NativeDialogHandle) -> i32>Resets the alignment mode of a custom dialog box to its default settings.
Note: This method must be called before the show method.
§Arguments
handle- Indicates the pointer to the custom dialog box controller.
§Returns
- Returns the error code.
Returns [
ARKUI_ERROR_CODE_NO_ERROR] if the operation is successful. Returns [ARKUI_ERROR_CODE_PARAM_INVALID] if a parameter error occurs.
setModalMode: Option<unsafe extern "C" fn(handle: ArkUI_NativeDialogHandle, isModal: bool) -> i32>Sets the modal mode for a custom dialog box.
Note: This method must be called before the show method.
§Arguments
-
handle- Indicates the pointer to the custom dialog box controller. -
isModal- Specifies whether the custom dialog box is a modal, which has a mask applied. The value true means that the custom dialog box is a modal, and false means the opposite.
§Returns
- Returns the error code.
Returns [
ARKUI_ERROR_CODE_NO_ERROR] if the operation is successful. Returns [ARKUI_ERROR_CODE_PARAM_INVALID] if a parameter error occurs.
setAutoCancel: Option<unsafe extern "C" fn(handle: ArkUI_NativeDialogHandle, autoCancel: bool) -> i32>Specifies whether to allow users to touch the mask to dismiss the custom dialog box.
Note: This method must be called before the show method.
§Arguments
-
handle- Indicates the pointer to the custom dialog box controller. -
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.
§Returns
- Returns the error code.
Returns [
ARKUI_ERROR_CODE_NO_ERROR] if the operation is successful. Returns [ARKUI_ERROR_CODE_PARAM_INVALID] if a parameter error occurs.
setMask: Option<unsafe extern "C" fn(handle: ArkUI_NativeDialogHandle, maskColor: u32, maskRect: *const ArkUI_Rect) -> i32>Sets the mask for a custom dialog box.
Note: This method must be called before the show method.
§Arguments
-
handle- Indicates the pointer to the custom dialog box controller. -
maskColor- Indicates the mask color, in 0xARGB format. -
maskRect- Indicates the pointer to the mask area. Events outside the mask area are transparently transmitted, and events within the mask area are not. The parameter type isArkUI_Rect.
§Returns
- Returns the error code.
Returns [
ARKUI_ERROR_CODE_NO_ERROR] if the operation is successful. Returns [ARKUI_ERROR_CODE_PARAM_INVALID] if a parameter error occurs.
setBackgroundColor: Option<unsafe extern "C" fn(handle: ArkUI_NativeDialogHandle, backgroundColor: u32) -> i32>Sets the background color for a custom dialog box.
Note: This method must be called before the show method.
§Arguments
-
handle- Indicates the pointer to the custom dialog box controller. -
backgroundColor- Indicates the background color of the custom dialog box, in 0xARGB format.
§Returns
- Returns the error code.
Returns [
ARKUI_ERROR_CODE_NO_ERROR] if the operation is successful. Returns [ARKUI_ERROR_CODE_PARAM_INVALID] if a parameter error occurs.
setCornerRadius: Option<unsafe extern "C" fn(handle: ArkUI_NativeDialogHandle, topLeft: f32, topRight: f32, bottomLeft: f32, bottomRight: f32) -> i32>Sets the background corner radius for a custom dialog box.
Note: This method must be called before the show method.
§Arguments
-
handle- Indicates the pointer to the custom dialog box controller. -
topLeft- Indicates the radius of the upper left corner of the custom dialog box background. -
topRight- Indicates the radius of the upper right corner of the custom dialog box background. -
bottomLeft- Indicates the radius of the lower left corner of the custom dialog box background. -
bottomRight- Indicates the radius of the lower right corner of the custom dialog box background.
§Returns
- Returns the error code.
Returns [
ARKUI_ERROR_CODE_NO_ERROR] if the operation is successful. Returns [ARKUI_ERROR_CODE_PARAM_INVALID] if a parameter error occurs.
setGridColumnCount: Option<unsafe extern "C" fn(handle: ArkUI_NativeDialogHandle, gridCount: i32) -> i32>Sets the number of grid columns occupied by a custom dialog box.
Note: This method must be called before the show method.
§Arguments
-
handle- Indicates the pointer to the custom dialog box controller. -
gridCount- Indicates the number of grid columns occupied by the dialog box. The default value is subject to the window size, and the maximum value is the maximum number of columns supported by the system.
§Returns
- Returns the error code.
Returns [
ARKUI_ERROR_CODE_NO_ERROR] if the operation is successful. Returns [ARKUI_ERROR_CODE_PARAM_INVALID] if a parameter error occurs.
enableCustomStyle: Option<unsafe extern "C" fn(handle: ArkUI_NativeDialogHandle, enableCustomStyle: bool) -> i32>Specifies whether to use a custom style for the custom dialog box.
Note: This method must be called before the show method.
§Arguments
-
handle- Indicates the pointer to the custom dialog box controller. -
enableCustomStyle- Specifies whether to use a custom style for the dialog box. true: The dialog box automatically adapts its width to the child components; the rounded corner is 0; the background color is transparent. false: The dialog box automatically adapts its width to the grid system and its height to the child components; the rounded corner is 24 vp.
§Returns
- Returns the error code.
Returns [
ARKUI_ERROR_CODE_NO_ERROR] if the operation is successful. Returns [ARKUI_ERROR_CODE_PARAM_INVALID] if a parameter error occurs.
enableCustomAnimation: Option<unsafe extern "C" fn(handle: ArkUI_NativeDialogHandle, enableCustomAnimation: bool) -> i32>Specifies whether to use a custom animation for a custom dialog box.
Note: This method must be called before the show method.
§Arguments
-
handle- Indicates the pointer to the custom dialog box controller. -
enableCustomAnimation- Specifies whether to use a custom animation. The value true means to use a custom animation, and false means to use the default animation.
§Returns
- Returns the error code.
Returns [
ARKUI_ERROR_CODE_NO_ERROR] if the operation is successful. Returns [ARKUI_ERROR_CODE_PARAM_INVALID] if a parameter error occurs.
registerOnWillDismiss: Option<unsafe extern "C" fn(handle: ArkUI_NativeDialogHandle, eventHandler: ArkUI_OnWillDismissEvent) -> i32>Registers a callback for a custom dialog box so that the user can decide whether to close the dialog box after they touch the Back button or press the Esc key.
Note: This method must be called before the show method.
§Arguments
-
handle- Indicates the pointer to the custom dialog box controller. -
eventHandler- Indicates the callback to register. The parameter type isArkUI_OnWillDismissEvent.
§Returns
- Returns the error code.
Returns [
ARKUI_ERROR_CODE_NO_ERROR] if the operation is successful. Returns [ARKUI_ERROR_CODE_PARAM_INVALID] if a parameter error occurs.
show: Option<unsafe extern "C" fn(handle: ArkUI_NativeDialogHandle, showInSubWindow: bool) -> i32>Shows a custom dialog box.
§Arguments
-
handle- Indicates the pointer to the custom dialog box controller. -
showInSubWindow- Specifies whether to show the dialog box in a sub-window.
§Returns
- Returns the error code.
Returns [
ARKUI_ERROR_CODE_NO_ERROR] if the operation is successful. Returns [ARKUI_ERROR_CODE_PARAM_INVALID] if a parameter error occurs.
close: Option<unsafe extern "C" fn(handle: ArkUI_NativeDialogHandle) -> i32>Closes a custom dialog box. If the dialog box has been closed, this API does not take effect.
§Arguments
handle- Indicates the pointer to the custom dialog box controller.
§Returns
- Returns the error code.
Returns [
ARKUI_ERROR_CODE_NO_ERROR] if the operation is successful. Returns [ARKUI_ERROR_CODE_PARAM_INVALID] if a parameter error occurs.
registerOnWillDismissWithUserData: Option<unsafe extern "C" fn(handle: ArkUI_NativeDialogHandle, userData: *mut c_void, callback: Option<unsafe extern "C" fn(event: *mut ArkUI_DialogDismissEvent)>) -> i32>Registers a listener for the dismiss event of the custom dialog box.
§Arguments
-
handle- Indicates the pointer to the custom dialog box controller. -
userData- Indicates the pointer to the custom data. -
callback- Indicates the callback for the dismiss event of the custom dialog box.
§Returns
- Returns the result code.
Returns [
ARKUI_ERROR_CODE_NO_ERROR] if the operation is successful. Returns [ARKUI_ERROR_CODE_PARAM_INVALID] if a parameter error occurs.