• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 /**
17  * @addtogroup ArkUI_NativeModule
18  * @{
19  *
20  * @brief Provides UI capabilities of ArkUI on the native side, such as UI component creation and destruction,
21  * tree node operations, attribute setting, and event listening.
22  *
23  * @since 12
24  */
25 
26 /**
27  * @file native_dialog.h
28  *
29  * @brief Defines a set of custom dialog box APIs of ArkUI on the native side.
30  *
31  * @library libace_ndk.z.so
32  * @syscap SystemCapability.ArkUI.ArkUI.Full
33  * @kit ArkUI
34  * @since 12
35  */
36 
37 #ifndef ARKUI_NATIVE_DIALOG_H
38 #define ARKUI_NATIVE_DIALOG_H
39 
40 #include <stdbool.h>
41 #include "native_type.h"
42 #include "native_node.h"
43 
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47 
48 /**
49 * @brief Enumerates the actions for triggering closure of the dialog box.
50 *
51 * @since 12
52 */
53 typedef enum {
54     /** Touching the system-defined Back button or pressing the Esc key. */
55     DIALOG_DISMISS_BACK_PRESS = 0,
56     /** Touching the mask. */
57     DIALOG_DISMISS_TOUCH_OUTSIDE,
58     /** Touching the Close button. */
59     DIALOG_DISMISS_CLOSE_BUTTON,
60     /** Sliding down. */
61     DIALOG_DISMISS_SLIDE_DOWN,
62 } ArkUI_DismissReason;
63 
64 /**
65 * @brief Enumerates the state of dialog.
66 *
67 * @syscap SystemCapability.ArkUI.ArkUI.Full
68 *
69 * @since 20
70 */
71 typedef enum {
72     /**
73      * @brief Uninitialized.
74      * @syscap SystemCapability.ArkUI.ArkUI.Full
75      * @since 20
76      */
77     DIALOG_UNINITIALIZED = 0,
78     /**
79      * @brief Initialized.
80      * @syscap SystemCapability.ArkUI.ArkUI.Full
81      * @since 20
82      */
83     DIALOG_INITIALIZED,
84     /**
85      * @brief Appearing.
86      * @syscap SystemCapability.ArkUI.ArkUI.Full
87      * @since 20
88      */
89     DIALOG_APPEARING,
90     /**
91      * @brief Appeared.
92      * @syscap SystemCapability.ArkUI.ArkUI.Full
93      * @since 20
94      */
95     DIALOG_APPEARED,
96     /**
97      * @brief Disappearing.
98      * @syscap SystemCapability.ArkUI.ArkUI.Full
99      * @since 20
100      */
101     DIALOG_DISAPPEARING,
102     /**
103      * @brief Disappeared.
104      * @syscap SystemCapability.ArkUI.ArkUI.Full
105      * @since 20
106      */
107     DIALOG_DISAPPEARED,
108 } ArkUI_DialogState;
109 
110 /**
111 * @brief Enumerates the level mode.
112 *
113 * @since 15
114 */
115 typedef enum {
116     /** overlay mode. */
117     ARKUI_LEVEL_MODE_OVERLAY = 0,
118     /** embedded mode. */
119     ARKUI_LEVEL_MODE_EMBEDDED,
120 } ArkUI_LevelMode;
121 
122 /**
123 * @brief Enumerates the immersive mode.
124 *
125 * @since 15
126 */
127 typedef enum {
128     /** Mask covering the parent node area. */
129     ARKUI_IMMERSIVE_MODE_DEFAULT = 0,
130     /** Mask extend safe area includes status bar and navigation bar. */
131     ARKUI_IMMERSIVE_MODE_EXTEND,
132 } ArkUI_ImmersiveMode;
133 
134 /**
135 * @brief Invoked when the dialog box is closed.
136 *
137 * @since 12
138 */
139 typedef bool (*ArkUI_OnWillDismissEvent)(int32_t reason);
140 
141 /**
142  * @brief Defines a struct for a dialog box dismiss event.
143  *
144  * @since 12
145  */
146 typedef struct ArkUI_DialogDismissEvent ArkUI_DialogDismissEvent;
147 
148 /**
149  * @brief Defines a struct for the content object of a custom dialog box.
150  *
151  * @since 19
152  */
153 typedef struct ArkUI_CustomDialogOptions ArkUI_CustomDialogOptions;
154 
155 /**
156  * @brief Provides the custom dialog box APIs for the native side.
157  *
158  * @version 1
159  * @since 12
160  */
161 typedef struct {
162     /**
163     * @brief Creates a custom dialog box and returns the pointer to the created dialog box.
164     *
165     * @note This method must be called before the <b>show</b> method.
166     * @return Returns the pointer to the created custom dialog box; returns a null pointer if the creation fails.
167     */
168     ArkUI_NativeDialogHandle (*create)();
169     /**
170     * @brief Destroys a custom dialog box.
171     *
172     * @param handle Indicates the pointer to the custom dialog box controller.
173     */
174     void (*dispose)(ArkUI_NativeDialogHandle handle);
175     /**
176     * @brief Attaches the content of a custom dialog box.
177     *
178     * @note This method must be called before the <b>show</b> method.
179     * @param handle Indicates the pointer to the custom dialog box controller.
180     * @param content Indicates the pointer to the root node of the custom dialog box content.
181     * @return Returns the error code.
182     *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
183     *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
184     */
185     int32_t (*setContent)(ArkUI_NativeDialogHandle handle, ArkUI_NodeHandle content);
186     /**
187     * @brief Detaches the content of a custom dialog box.
188     *
189     * @note This method must be called before the <b>show</b> method.
190     * @param handle Indicates the pointer to the custom dialog box controller.
191     * @return Returns the error code.
192     *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
193     *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
194     */
195     int32_t (*removeContent)(ArkUI_NativeDialogHandle handle);
196     /**
197     * @brief Sets the alignment mode for a custom dialog box.
198     *
199     * @note This method must be called before the <b>show</b> method.
200     * @param handle Indicates the pointer to the custom dialog box controller.
201     * @param alignment Indicates the alignment mode. The parameter type is {@link ArkUI_Alignment}.
202     * @param offsetX Indicates the horizontal offset of the custom dialog box. The value is a floating point number.
203     * @param offsetY Indicates the vertical offset of the custom dialog box. The value is a floating point number.
204     * @return Returns the error code.
205     *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
206     *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
207     */
208     int32_t (*setContentAlignment)(ArkUI_NativeDialogHandle handle, int32_t alignment, float offsetX, float offsetY);
209     /**
210     * @brief Resets the alignment mode of a custom dialog box to its default settings.
211     *
212     * @note This method must be called before the <b>show</b> method.
213     * @param handle Indicates the pointer to the custom dialog box controller.
214     * @return Returns the error code.
215     *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
216     *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
217     */
218     int32_t (*resetContentAlignment)(ArkUI_NativeDialogHandle handle);
219     /**
220     * @brief Sets the modal mode for a custom dialog box.
221     *
222     * @note This method must be called before the <b>show</b> method.
223     * @param handle Indicates the pointer to the custom dialog box controller.
224     * @param isModal Specifies whether the custom dialog box is a modal, which has a mask applied. The value
225     * <b>true</b> means that the custom dialog box is a modal, and <b>false</b> means the opposite.
226     * @return Returns the error code.
227     *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
228     *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
229     */
230     int32_t (*setModalMode)(ArkUI_NativeDialogHandle handle, bool isModal);
231     /**
232     * @brief Specifies whether to allow users to touch the mask to dismiss the custom dialog box.
233     *
234     * @note This method must be called before the <b>show</b> method.
235     * @param handle Indicates the pointer to the custom dialog box controller.
236     * @param autoCancel Specifies whether to allow users to touch the mask to dismiss the dialog box.
237     * The value <b>true</b> means to allow users to do so, and <b>false</b> means the opposite.
238     * @return Returns the error code.
239     *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
240     *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
241     */
242     int32_t (*setAutoCancel)(ArkUI_NativeDialogHandle handle, bool autoCancel);
243     /**
244     * @brief Sets the mask for a custom dialog box.
245     *
246     * @note This method must be called before the <b>show</b> method.
247     * @param handle Indicates the pointer to the custom dialog box controller.
248     * @param maskColor Indicates the mask color, in 0xARGB format.
249     * @param maskRect Indicates the pointer to the mask area. Events outside the mask area are transparently
250     * transmitted, and events within the mask area are not. The parameter type is {@link ArkUI_Rect}.
251     * @return Returns the error code.
252     *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
253     *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
254     */
255     int32_t (*setMask)(ArkUI_NativeDialogHandle handle, uint32_t maskColor, const ArkUI_Rect* maskRect);
256     /**
257     * @brief Sets the background color for a custom dialog box.
258     *
259     * @note This method must be called before the <b>show</b> method.
260     * @param handle Indicates the pointer to the custom dialog box controller.
261     * @param backgroundColor Indicates the background color of the custom dialog box, in 0xARGB format.
262     * @return Returns the error code.
263     *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
264     *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
265     */
266     int32_t (*setBackgroundColor)(ArkUI_NativeDialogHandle handle, uint32_t backgroundColor);
267     /**
268     * @brief Sets the background corner radius for a custom dialog box.
269     *
270     * @note This method must be called before the <b>show</b> method.
271     * @param handle Indicates the pointer to the custom dialog box controller.
272     * @param topLeft Indicates the radius of the upper left corner of the custom dialog box background.
273     * @param topRight Indicates the radius of the upper right corner of the custom dialog box background.
274     * @param bottomLeft Indicates the radius of the lower left corner of the custom dialog box background.
275     * @param bottomRight Indicates the radius of the lower right corner of the custom dialog box background.
276     * @return Returns the error code.
277     *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
278     *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
279     */
280     int32_t (*setCornerRadius)(ArkUI_NativeDialogHandle handle, float topLeft, float topRight,
281         float bottomLeft, float bottomRight);
282     /**
283     * @brief Sets the number of grid columns occupied by a custom dialog box.
284     *
285     * @note This method must be called before the <b>show</b> method.
286     * @param handle Indicates the pointer to the custom dialog box controller.
287     * @param gridCount Indicates the number of grid columns occupied by the dialog box. The default value is subject to
288     * the window size, and the maximum value is the maximum number of columns supported by the system.
289     * @return Returns the error code.
290     *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
291     *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
292     */
293     int32_t (*setGridColumnCount)(ArkUI_NativeDialogHandle handle, int32_t gridCount);
294     /**
295     * @brief Specifies whether to use a custom style for the custom dialog box.
296     *
297     * @note This method must be called before the <b>show</b> method.
298     * @param handle Indicates the pointer to the custom dialog box controller.
299     * @param enableCustomStyle Specifies whether to use a custom style for the dialog box.
300     * <b>true</b>: The dialog box automatically adapts its width to the child components; the rounded corner is 0;
301     * the background color is transparent.
302     * <b>false</b>: The dialog box automatically adapts its width to the grid system and its height to the child
303     * components; the rounded corner is 24 vp.
304     * @return Returns the error code.
305     *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
306     *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
307     */
308     int32_t (*enableCustomStyle)(ArkUI_NativeDialogHandle handle, bool enableCustomStyle);
309     /**
310     * @brief Specifies whether to use a custom animation for a custom dialog box.
311     *
312     * @note This method must be called before the <b>show</b> method.
313     * @param handle Indicates the pointer to the custom dialog box controller.
314     * @param enableCustomAnimation Specifies whether to use a custom animation. The value <b>true</b> means to use a
315     * custom animation, and <b>false</b> means to use the default animation.
316     * @return Returns the error code.
317     *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
318     *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
319     */
320     int32_t (*enableCustomAnimation)(ArkUI_NativeDialogHandle handle, bool enableCustomAnimation);
321     /**
322     * @brief Registers a callback for a custom dialog box so that the user can decide whether to close the dialog box
323     * after they touch the Back button or press the Esc key.
324     *
325     * @note This method must be called before the <b>show</b> method.
326     * @param handle Indicates the pointer to the custom dialog box controller.
327     * @param eventHandler Indicates the callback to register. The parameter type is {@link ArkUI_OnWillDismissEvent}.
328     * @return Returns the error code.
329     *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
330     *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
331     */
332     int32_t (*registerOnWillDismiss)(ArkUI_NativeDialogHandle handle, ArkUI_OnWillDismissEvent eventHandler);
333     /**
334     * @brief Shows a custom dialog box.
335     *
336     * @param handle Indicates the pointer to the custom dialog box controller.
337     * @param showInSubWindow Specifies whether to show the dialog box in a sub-window.
338     * @return Returns the error code.
339     *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
340     *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
341     */
342     int32_t (*show)(ArkUI_NativeDialogHandle handle, bool showInSubWindow);
343     /**
344     * @brief Closes a custom dialog box. If the dialog box has been closed, this API does not take effect.
345     *
346     * @param handle Indicates the pointer to the custom dialog box controller.
347     * @return Returns the error code.
348     *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
349     *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
350     */
351     int32_t (*close)(ArkUI_NativeDialogHandle handle);
352     /**
353     * @brief Registers a listener for the dismiss event of the custom dialog box.
354     *
355     * @param handle Indicates the pointer to the custom dialog box controller.
356     * @param userData Indicates the pointer to the custom data.
357     * @param callback Indicates the callback for the dismiss event of the custom dialog box.
358     * @return Returns the result code.
359     *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
360     *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
361     */
362     int32_t (*registerOnWillDismissWithUserData)(
363         ArkUI_NativeDialogHandle handle, void* userData, void (*callback)(ArkUI_DialogDismissEvent* event));
364 } ArkUI_NativeDialogAPI_1;
365 
366 /**
367  * @brief Provides the custom dialog box APIs for the native side.
368  *
369  * @version 2
370  * @since 15
371  */
372 typedef struct {
373     /**
374      * @brief Provides the custom dialog box APIs for the native side. The API scope is {@link ArkUI_NativeDialogAPI_1}
375      *
376      * @since 15
377      */
378     ArkUI_NativeDialogAPI_1 nativeDialogAPI1;
379     /**
380      * @brief Defines the distance between the customDialog and system keyboard.
381      *
382 	 * @note This method must be called before the <b>show</b> method.
383      * @param handle Indicates the pointer to the custom dialog box controller.
384      * @param distance distance, in vp.
385      * @param unit  Indicates the unit, which is an enumerated value of {@link ArkUI_LengthMetricUnit}
386      * @return Returns the result code.
387      *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
388      *         Returns {@link ARKUI_ERROR_CODE_CAPI_INIT_ERROR} if the CAPI init error.
389      *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
390      * @since 15
391      */
392     int32_t (*setKeyboardAvoidDistance)(ArkUI_NativeDialogHandle handle, float distance, ArkUI_LengthMetricUnit unit);
393 
394     /**
395     * @brief Sets the level mode for a custom dialog box.
396     *
397     * @note This method must be called before the <b>show</b> method.
398     * @param handle Indicates the pointer to the custom dialog box controller.
399     * @param levelMode Indicates the level mode. The parameter type is {@link ArkUI_LevelMode}.
400     * @return Returns the error code.
401     *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
402     *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
403     * @since 15
404     */
405     int32_t (*setLevelMode)(ArkUI_NativeDialogHandle handle, ArkUI_LevelMode levelMode);
406 
407     /**
408     * @brief Sets the level uniqueId for a custom dialog box.
409     *
410     * @note This method must be called before the <b>setLevelMode</b> method.
411     * @param handle Indicates the pointer to the custom dialog box controller.
412     * @param uniqueId Indicates the uniquedId of any nodes in router or navigation pages.
413     * @return Returns the error code.
414     *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
415     *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
416     * @since 15
417     */
418     int32_t (*setLevelUniqueId)(ArkUI_NativeDialogHandle handle, int32_t uniqueId);
419 
420     /**
421     * @brief Sets the immersive mode for a custom dialog box.
422     *
423     * @note This method must be called before the <b>show</b> method.
424     * @param handle Indicates the pointer to the custom dialog box controller.
425     * @param immersiveMode Indicates the immersive mode. The parameter type is {@link ArkUI_ImmersiveMode}.
426     * @return Returns the error code.
427     *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
428     *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
429     * @since 15
430     */
431     int32_t (*setImmersiveMode)(ArkUI_NativeDialogHandle handle, ArkUI_ImmersiveMode immersiveMode);
432 } ArkUI_NativeDialogAPI_2;
433 
434 /**
435  * @brief Provides the custom dialog box APIs for the native side.
436  *
437  * @version 3
438  * @since 19
439  */
440 typedef struct {
441     /**
442      * @brief Provides the custom dialog box APIs for the native side. The API scope is {@link ArkUI_NativeDialogAPI_1}
443      *
444      * @since 19
445      */
446     ArkUI_NativeDialogAPI_1 nativeDialogAPI1;
447     /**
448      * @brief Provides the custom dialog box APIs for the native side. The API scope is {@link ArkUI_NativeDialogAPI_2}
449      *
450      * @since 19
451      */
452     ArkUI_NativeDialogAPI_2 nativeDialogAPI2;
453     /**
454      * @brief Sets the display order for a custom dialog box.
455      *
456      * @note This method must be called before the <b>show</b> method.
457      * @param handle Indicates the pointer to the custom dialog box controller.
458      * @param levelOrder Indicates the display order. The valid range is [-100000.0, 100000.0].
459      * @return Returns the error code.
460      *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
461      *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
462      * @since 19
463      */
464     int32_t (*setLevelOrder)(ArkUI_NativeDialogHandle handle, double levelOrder);
465     /**
466      * @brief Registers a listener callback before the dialog openAnimation starts.
467      *
468      * @param handle Indicates the pointer to the custom dialog box controller.
469      * @param userData Indicates the pointer to the custom data.
470      * @param callback Indicates the callback before the dialog openAnimation starts.
471      * @return Returns the result code.
472      *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
473      *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
474      * @since 19
475      */
476 
477     int32_t (*registerOnWillAppear)(
478         ArkUI_NativeDialogHandle handle, void* userData, void (*callback)(void* userData));
479 
480     /**
481      * @brief Registers a listener callback when the dialog appears.
482      *
483      * @param handle Indicates the pointer to the custom dialog box controller.
484      * @param userData Indicates the pointer to the custom data.
485      * @param callback Indicates the callback when the dialog appears.
486      * @return Returns the result code.
487      *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
488      *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
489      * @since 19
490      */
491     int32_t (*registerOnDidAppear)(
492         ArkUI_NativeDialogHandle handle, void* userData, void (*callback)(void* userData));
493 
494     /**
495      * @brief Registers a listener callback before the dialog closeAnimation starts.
496      *
497      * @param handle Indicates the pointer to the custom dialog box controller.
498      * @param userData Indicates the pointer to the custom data.
499      * @param callback Indicates the callback before the dialog closeAnimation starts.
500      * @return Returns the result code.
501      *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
502      *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
503      * @since 19
504      */
505     int32_t (*registerOnWillDisappear)(
506         ArkUI_NativeDialogHandle handle, void* userData, void (*callback)(void* userData));
507 
508     /**
509      * @brief Registers a listener callback when the dialog disappears.
510      *
511      * @param handle Indicates the pointer to the custom dialog box controller.
512      * @param userData Indicates the pointer to the custom data.
513      * @param callback Indicates the callback when the dialog disappears.
514      * @return Returns the result code.
515      *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
516      *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
517      * @since 19
518      */
519     int32_t (*registerOnDidDisappear)(
520         ArkUI_NativeDialogHandle handle, void* userData, void (*callback)(void* userData));
521 
522     /**
523      * @brief Sets the border width of the dialog box.
524      *
525      * @note This method must be called before the <b>show</b> method.
526      * @param handle Pointer to the dialog box controller.
527      * @param top Width of the top border.
528      * @param right Width of the right border.
529      * @param bottom Width of the bottom border.
530      * @param left Width of the left border.
531      * @param unit Unit of the width. The default value is vp.
532      * @return Returns the error code.
533      *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
534      *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occur..
535      * @since 19
536      */
537     int32_t (*setBorderWidth)(
538         ArkUI_NativeDialogHandle handle, float top, float right, float bottom, float left, ArkUI_LengthMetricUnit unit);
539 
540     /**
541      * @brief Sets the border color of the dialog box.
542      *
543      * @note This method must be called before the <b>show</b> method.
544      * @param handle Pointer to the dialog box controller.
545      * @param top Color of the top border.
546      * @param right Color of the right border.
547      * @param bottom Color of the bottom border.
548      * @param left Color of the left border.
549      * @return Returns the error code.
550      *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
551      *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occur..
552      * @since 19
553      */
554     int32_t (*setBorderColor)(
555         ArkUI_NativeDialogHandle handle, uint32_t top, uint32_t right, uint32_t bottom, uint32_t left);
556 
557     /**
558      * @brief Sets the border style of the dialog box.
559      *
560      * @note This method must be called before the <b>show</b> method.
561      * @param handle Pointer to the dialog box controller.
562      * @param top Style of the top border.
563      * @param right Style of the right border.
564      * @param bottom Style of the bottom border.
565      * @param left Style of the left border.
566      * @return Returns the error code.
567      *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
568      *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occur..
569      * @since 19
570      */
571     int32_t (*setBorderStyle)(
572         ArkUI_NativeDialogHandle handle, int32_t top, int32_t right, int32_t bottom, int32_t left);
573 
574     /**
575      * @brief Sets the width of the dialog box background.
576      *
577      * @note This method must be called before the <b>show</b> method.
578      * @param handle Pointer to the dialog box controller.
579      * @param width Width of the background.
580      * @param unit Unit of the width. The default value is vp.
581      * @return Returns the error code.
582      *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
583      *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occur..
584      * @since 19
585      */
586     int32_t (*setWidth)(ArkUI_NativeDialogHandle handle, float width, ArkUI_LengthMetricUnit unit);
587 
588     /**
589      * @brief Sets the height of the dialog box background.
590      *
591      * @note This method must be called before the <b>show</b> method.
592      * @param handle Pointer to the dialog box controller.
593      * @param height Height of the background.
594      * @param unit Unit of the height. The default value is vp.
595      * @return Returns the error code.
596      *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
597      *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occur..
598      * @since 19
599      */
600     int32_t (*setHeight)(ArkUI_NativeDialogHandle handle, float height, ArkUI_LengthMetricUnit unit);
601 
602     /**
603      * @brief Sets the shadow of the dialog box background.
604      *
605      * @note This method must be called before the <b>show</b> method.
606      * @param handle Pointer to the dialog box controller.
607      * @param shadow Shadow style of the background, specified by an enumerated value.
608      * @return Returns the error code.
609      *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
610      *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occur..
611      * @since 19
612      */
613     int32_t (*setShadow)(ArkUI_NativeDialogHandle handle, ArkUI_ShadowStyle shadow);
614 
615     /**
616      * @brief Sets the custom shadow of the dialog box background.
617      *
618      * @note This method must be called before the <b>show</b> method.
619      * @param handle Pointer to the dialog box controller.
620      * @param customShadow Custom shadow parameter. The format is the same as that of the <b>NODE_SHADOW</b> property.
621      * @return Returns the error code.
622      *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
623      *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occur..
624      * @since 19
625      */
626     int32_t (*setCustomShadow)(ArkUI_NativeDialogHandle handle, const ArkUI_AttributeItem* customShadow);
627 
628     /**
629      * @brief Sets the background blur style of the dialog box.
630      *
631      * @note This method must be called before the <b>show</b> method.
632      * @param handle Pointer to the dialog box controller.
633      * @param blurStyle Background blur style, specified by an enumerated value.
634      * @return Returns the error code.
635      *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
636      *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occur..
637      * @since 19
638      */
639     int32_t (*setBackgroundBlurStyle)(ArkUI_NativeDialogHandle handle, ArkUI_BlurStyle blurStyle);
640 
641     /**
642      * @brief Sets the keyboard avoidance mode of the dialog box.
643      *
644      * @note This method must be called before the <b>show</b> method.
645      * @param handle Pointer to the dialog box controller.
646      * @param keyboardAvoidMode Keyboard avoidance mode, specified by an enumerated value.
647      * @return Returns the error code.
648      *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
649      *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occur..
650      * @since 19
651      */
652     int32_t (*setKeyboardAvoidMode)(ArkUI_NativeDialogHandle handle, ArkUI_KeyboardAvoidMode keyboardAvoidMode);
653 
654     /**
655      * @brief Sets whether to enable the hover mode for the dialog box.
656      *
657      * @note This method must be called before the <b>show</b> method.
658      * @param handle Pointer to the dialog box controller.
659      * @param enableHoverMode Whether to enable the hover mode. The default value is <b>false</b>.
660      * @return Returns the error code.
661      *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
662      *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occur..
663      * @since 19
664      */
665     int32_t (*enableHoverMode)(ArkUI_NativeDialogHandle handle, bool enableHoverMode);
666 
667     /**
668      * @brief Set the default display area of the dialog box in hover mode.
669      *
670      * @note This method must be called before the <b>show</b> method.
671      * @param handle Pointer to the dialog box controller.
672      * @param hoverModeAreaType Display area in hover mode, specified by an enumerated value.
673      * @return Returns the error code.
674      *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
675      *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occur.
676      * @since 19
677      */
678     int32_t (*setHoverModeArea)(ArkUI_NativeDialogHandle handle, ArkUI_HoverModeAreaType hoverModeAreaType);
679 
680     /**
681      * @brief Sets whether to get focus when the custom dialog is displayed.
682      *
683      * @param handle Indicates the pointer to the custom dialog box controller.
684      * @param focusable Specifies whether to get focus when the custom dialog is displayed. The default value is true.
685      * @return Returns the error code.
686      *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
687      *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
688      * @since 19
689      */
690     int32_t (*setFocusable)(ArkUI_NativeDialogHandle handle, bool focusable);
691 
692     /**
693      * @brief Sets the background blur effect for a custom dialog box.
694      *
695      * @note This method must be called before the <b>show</b> method.
696      * @param handle Indicates the pointer to the custom dialog box controller.
697      * @param backgroundBlurStyleOptions Background blur effect options.
698      *        Format of the {@link ArkUI_AttributeItem} parameter: \n
699      *        .value[0].i32: color mode. The value is an enum of {@link ArkUI_ColorMode}. \n
700      *        .value[1]?.i32: adaptive color mode. The value is an enum of {@link ArkUI_AdaptiveColor}. \n
701      *        .value[2]?.f32: blur degree. The value range is [0.0, 1.0]. \n
702      *        .value[3]?.u32: brightness of black in the grayscale blur. The value range is [0, 127]. \n
703      *        .value[4]?.u32: degree of darkening the white color in the grayscale blur. The value range is [0, 127]. \n
704      *        .value[5]?.i32: blur activation policy. The value is an enum of {@link ArkUI_BlurStyleActivePolicy}. \n
705      *        .value[6]?.u32: background color, in 0xARGB format, of the components within the window after the window
706      *                        loses focus (in which case, the blur effect on the components within the window is
707      *                        removed). \n
708      * @return Returns the result code.
709      *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
710      *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
711      * @since 19
712      */
713     int32_t (*setBackgroundBlurStyleOptions)(
714         ArkUI_NativeDialogHandle handle, const ArkUI_AttributeItem* backgroundBlurStyleOptions);
715 
716     /**
717      * @brief Sets the background effect parameters for a custom dialog box.
718      *
719      * @note This method must be called before the <b>show</b> method.
720      * @param handle Indicates the pointer to the custom dialog box controller.
721      * @param backgroundEffect Background effect.
722      *        Format of the {@link ArkUI_AttributeItem} parameter: \n
723      *        .value[0].f32: blur radius, in vp. \n
724      *        .value[1]?.f32: saturation. \n
725      *        .value[2]?.f32: brightness. \n
726      *        .value[3]?.u32: color, in 0xARGB format. \n
727      *        .value[4]?.i32: adaptive color mode. The value is an enum of {@link ArkUI_AdaptiveColor}. \n
728      *        .value[5]?.u32: brightness of black in the grayscale blur. The value range is [0, 127]. \n
729      *        .value[6]?.u32: degree of darkening the white color in the grayscale blur. The value range is [0, 127]. \n
730      *        .value[7]?.i32: blur activation policy. The value is an enum of {@link ArkUI_BlurStyleActivePolicy}. \n
731      *        .value[8]?.u32: background color, in 0xARGB format, of the components within the window after the window
732      *                        loses focus (in which case, the blur effect on the components within the window is
733      *                        removed). \n
734      * @return Returns the result code.
735      *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
736      *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
737      * @since 19
738      */
739     int32_t (*setBackgroundEffect)(ArkUI_NativeDialogHandle handle, const ArkUI_AttributeItem* backgroundEffect);
740 } ArkUI_NativeDialogAPI_3;
741 
742 /**
743  * @brief Sets whether to block the system behavior of dismissing a dialog box.
744  *
745  * @param event Indicates the pointer to a dialog box dismiss event object.
746  * @param shouldBlockDismiss Indicates whether to block the system behavior of dismissing the dialog box. The value
747  *                           <b>true</b> means to block the system behavior, and <b>false</b> means the opposite.
748  * @since 12
749  */
750 void OH_ArkUI_DialogDismissEvent_SetShouldBlockDismiss(ArkUI_DialogDismissEvent* event, bool shouldBlockDismiss);
751 
752 /**
753  * @brief Obtains the pointer to user data in a dialog box dismiss event object.
754  *
755  * @param event Indicates the pointer to a dialog box dismiss event object.
756  *
757  * @return Returns the pointer to user data.
758  * @since 12
759  */
760 void* OH_ArkUI_DialogDismissEvent_GetUserData(ArkUI_DialogDismissEvent* event);
761 
762 /**
763  * @brief Obtains the c from a dialog box dismiss event object.
764  *
765  * @param event Indicates the pointer to a dialog box dismiss event object.
766  *
767  * @return Returns the dismissal reason. Returns <b>-1</b> if an exception occurs.
768  *         {@link DIALOG_DISMISS_BACK_PRESS}: touching the Back button, swiping left or right on the screen, or
769  *                                            pressing the Esc key.
770  *         {@link DIALOG_DISMISS_TOUCH_OUTSIDE}: touching the mask.
771  *         {@link DIALOG_DISMISS_CLOSE_BUTTON}: touching the Close button.
772  *         {@link DIALOG_DISMISS_SLIDE_DOWN}: sliding down.
773  * @since 12
774  */
775 int32_t OH_ArkUI_DialogDismissEvent_GetDismissReason(ArkUI_DialogDismissEvent* event);
776 
777 /**
778  * @brief Displays a custom dialog box.
779  *
780  * @param options Dialog box parameters.
781  * @param callback Callback to be invoked when the custom dialog box displays.
782  * @return Returns the error code.
783  *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
784  *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
785  * @since 19
786  */
787 int32_t OH_ArkUI_CustomDialog_OpenDialog(ArkUI_CustomDialogOptions* options, void (*callback)(int32_t dialogId));
788 
789 /**
790  * @brief Updates a custom dialog box.
791  *
792  * @param options Dialog box parameters.
793  * @param callback Callback to be invoked when the custom dialog box updates.
794  * @return Returns the error code.
795  *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
796  *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
797  * @since 19
798  */
799 int32_t OH_ArkUI_CustomDialog_UpdateDialog(ArkUI_CustomDialogOptions* options, void (*callback)(int32_t dialogId));
800 
801 /**
802  * @brief Closes a custom dialog box.
803  *
804  * @param dialogId Dialog id.
805  * @return Returns the error code.
806  *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
807  *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
808  * @since 19
809  */
810 int32_t OH_ArkUI_CustomDialog_CloseDialog(int32_t dialogId);
811 
812 /**
813  * @brief Creates custom dialog box options.
814  *
815  * @param content Content of the custom dialog box.
816  * @return Returns the pointer to the custom dialog box options.
817  * @since 19
818  */
819 ArkUI_CustomDialogOptions* OH_ArkUI_CustomDialog_CreateOptions(ArkUI_NodeHandle content);
820 
821 /**
822  * @brief Destroys the custom dialog box options.
823  *
824  * @param options The pointer to the custom dialog box options.
825  * @since 19
826  */
827 void OH_ArkUI_CustomDialog_DisposeOptions(ArkUI_CustomDialogOptions* options);
828 
829 /**
830  * @brief Sets the level mode for a custom dialog box.
831  *
832  * @note This method must be called before the <b>OH_ArkUI_CustomDialog_OpenDialog</b> method.
833  * @param options Indicates the pointer to the custom dialog options.
834  * @param levelMode Indicates the level mode. The parameter type is {@link ArkUI_LevelMode}.
835  * @return Returns the error code.
836  *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
837  *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
838  * @since 19
839  */
840 int32_t OH_ArkUI_CustomDialog_SetLevelMode(ArkUI_CustomDialogOptions* options, ArkUI_LevelMode levelMode);
841 
842 /**
843  * @brief Sets the level uniqueId for a custom dialog box.
844  *
845  * @param options Indicates the pointer to the custom dialog options.
846  * @param uniqueId Indicates the unique id of any nodes in router or navigation pages.
847  * @return Returns the error code.
848  *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
849  *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
850  * @since 19
851  */
852 int32_t OH_ArkUI_CustomDialog_SetLevelUniqueId(ArkUI_CustomDialogOptions* options, int32_t uniqueId);
853 
854 /**
855  * @brief Sets the immersive mode for a custom dialog box.
856  *
857  * @note This method must be called before the <b>OH_ArkUI_CustomDialog_OpenDialog</b> method.
858  * @param options Indicates the pointer to the custom dialog options.
859  * @param immersiveMode Indicates the immersive mode. The parameter type is {@link ArkUI_ImmersiveMode}.
860  * @return Returns the error code.
861  *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
862  *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
863  * @since 19
864  */
865 int32_t OH_ArkUI_CustomDialog_SetImmersiveMode(ArkUI_CustomDialogOptions* options, ArkUI_ImmersiveMode immersiveMode);
866 
867 /**
868  * @brief Sets the background color of the dialog box.
869  *
870  * @param options Dialog box parameters.
871  * @param backgroundColor Background color of the dialog box.
872  * @return Returns the error code.
873  *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
874  *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
875  * @since 19
876  */
877 int32_t OH_ArkUI_CustomDialog_SetBackgroundColor(ArkUI_CustomDialogOptions* options, uint32_t backgroundColor);
878 
879 /**
880  * @brief Sets the corner radius for a custom dialog box.
881  *
882  * @param options Dialog box parameters.
883  * @param topLeft Corner radius of the upper left corner.
884  * @param topRight Corner radius of the upper right corner.
885  * @param bottomLeft Corner radius of the lower left corner.
886  * @param bottomRight Corner radius of the lower right corner.
887  * @return Returns the error code.
888  *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
889  *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
890  * @since 19
891  */
892 int32_t OH_ArkUI_CustomDialog_SetCornerRadius(
893     ArkUI_CustomDialogOptions* options, float topLeft, float topRight, float bottomLeft, float bottomRight);
894 
895 /**
896  * @brief Sets the border width of the dialog box.
897  *
898  * @param options Dialog box parameters.
899  * @param top Width of the top border.
900  * @param right Width of the right border.
901  * @param bottom Width of the bottom border.
902  * @param left Width of the left border.
903  * @param unit Unit of the width. The default value is vp.
904  * @return Returns the error code.
905  *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
906  *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
907  * @since 19
908  */
909 int32_t OH_ArkUI_CustomDialog_SetBorderWidth(
910     ArkUI_CustomDialogOptions* options, float top, float right, float bottom, float left, ArkUI_LengthMetricUnit unit);
911 
912 /**
913  * @brief Sets the border color of the dialog box.
914  *
915  * @param options Dialog box parameters.
916  * @param top Color of the top border.
917  * @param right Color of the right border.
918  * @param bottom Color of the bottom border.
919  * @param left Color of the left border.
920  * @return Returns the error code.
921  *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
922  *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
923  * @since 19
924  */
925 int32_t OH_ArkUI_CustomDialog_SetBorderColor(
926     ArkUI_CustomDialogOptions* options, uint32_t top, uint32_t right, uint32_t bottom, uint32_t left);
927 
928 /**
929  * @brief Sets the border style of the dialog box.
930  *
931  * @param options Dialog box parameters.
932  * @param top Style of the top border.
933  * @param right Style of the right border.
934  * @param bottom Style of the bottom border.
935  * @param left Style of the left border.
936  * @return Returns the error code.
937  *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
938  *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
939  * @since 19
940  */
941 int32_t OH_ArkUI_CustomDialog_SetBorderStyle(
942     ArkUI_CustomDialogOptions* options, int32_t top, int32_t right, int32_t bottom, int32_t left);
943 
944 /**
945  * @brief Sets the width of the dialog box background.
946  *
947  * @param options Dialog box parameters.
948  * @param width Width of the background.
949  * @param unit Unit of the width. The default value is vp.
950  * @return Returns the error code.
951  *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
952  *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
953  * @since 19
954  */
955 int32_t OH_ArkUI_CustomDialog_SetWidth(ArkUI_CustomDialogOptions* options, float width, ArkUI_LengthMetricUnit unit);
956 
957 /**
958  * @brief Sets the height of the dialog box background.
959  *
960  * @param options Dialog box parameters.
961  * @param height Height of the background.
962  * @param unit Unit of the height. The default value is vp.
963  * @return Returns the error code.
964  *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
965  *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
966  * @since 19
967  */
968 int32_t OH_ArkUI_CustomDialog_SetHeight(ArkUI_CustomDialogOptions* options, float height, ArkUI_LengthMetricUnit unit);
969 
970 /**
971  * @brief Sets the shadow of the dialog box background.
972  *
973  * @param options Dialog box parameters.
974  * @param shadow Shadow style of the background, specified by an enumerated value.
975  * @return Returns the error code.
976  *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
977  *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
978  * @since 19
979  */
980 int32_t OH_ArkUI_CustomDialog_SetShadow(ArkUI_CustomDialogOptions* options, ArkUI_ShadowStyle shadow);
981 
982 /**
983  * @brief Sets the custom shadow of the dialog box background.
984  *
985  * @param options Dialog box parameters.
986  * @param customShadow Custom shadow parameter. The format is the same as that of
987  * the <b>NODE_CUSTOM_SHADOW</b> property.
988  * @return Returns the error code.
989  *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
990  *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
991  * @since 19
992  */
993 int32_t OH_ArkUI_CustomDialog_SetCustomShadow(
994     ArkUI_CustomDialogOptions* options, const ArkUI_AttributeItem* customShadow);
995 
996 /**
997  * @brief Sets the background blur style of the dialog box.
998  *
999  * @param options Dialog box parameters.
1000  * @param blurStyle Background blur style, specified by an enumerated value.
1001  * @return Returns the error code.
1002  *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
1003  *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
1004  * @since 19
1005  */
1006 int32_t OH_ArkUI_CustomDialog_SetBackgroundBlurStyle(ArkUI_CustomDialogOptions* options, ArkUI_BlurStyle blurStyle);
1007 
1008 /**
1009  * @brief Sets the alignment mode of the dialog box.
1010  *
1011  * @param options Dialog box parameters.
1012  * @param alignment Alignment mode of the dialog box. The parameter type is {@link ArkUI_Alignment}.
1013  * @param offsetX Indicates the horizontal offset of the custom dialog box. The value is a floating point number.
1014  * @param offsetY Indicates the vertical offset of the custom dialog box. The value is a floating point number.
1015  * @return Returns the error code.
1016  *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
1017  *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
1018  * @since 19
1019  */
1020 int32_t OH_ArkUI_CustomDialog_SetAlignment(
1021     ArkUI_CustomDialogOptions* options, int32_t alignment, float offsetX, float offsetY);
1022 
1023 /**
1024  * @brief Sets the modal mode for a custom dialog box.
1025  *
1026  * @param options Dialog box parameters.
1027  * @param isModal Whether the dialog box is a modal. A modal dialog box has a mask applied,
1028  * while a non-modal dialog box does not. The value <b>true</b> means that the dialog box is a modal.
1029  * @return Returns the error code.
1030  *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
1031  *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
1032  * @since 19
1033  */
1034 int32_t OH_ArkUI_CustomDialog_SetModalMode(ArkUI_CustomDialogOptions* options, bool isModal);
1035 
1036 /**
1037  * @brief Specifies whether to allow users to touch the mask to dismiss the custom dialog box.
1038  *
1039  * @param options Dialog box parameters.
1040  * @param autoCancel Specifies whether to allow users to touch the mask to dismiss the dialog box.
1041  * The value <b>true</b> means to allow users to do so, and <b>false</b> means the opposite.
1042  * @return Returns the error code.
1043  *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
1044  *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
1045  * @since 19
1046  */
1047 int32_t OH_ArkUI_CustomDialog_SetAutoCancel(ArkUI_CustomDialogOptions* options, bool autoCancel);
1048 
1049 /**
1050  * @brief Sets whether to display the dialog box in a subwindow.
1051  *
1052  * @param options Dialog box parameters.
1053  * @param showInSubwindow Whether to display the dialog box in a subwindow when it is not in the main window.
1054  * The default value is <b>false</b>, meaning the dialog box is displayed within the application, not in a
1055  * separate subwindow.
1056  * @return Returns the error code.
1057  *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
1058  *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
1059  * @since 19
1060  */
1061 int32_t OH_ArkUI_CustomDialog_SetSubwindowMode(ArkUI_CustomDialogOptions* options, bool showInSubwindow);
1062 
1063 /**
1064  * @brief Sets the mask for a custom dialog box.
1065  *
1066  * @param options Dialog box parameters.
1067  * @param maskColor Mask color, in 0xargb format.
1068  * @param maskRect Pointer to the mask area. Events outside the mask area are transparently transmitted,
1069  * and events within the mask area are not. The parameter type is {@link ArkUI_Rect}.
1070  * @return Returns the error code.
1071  *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
1072  *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
1073  * @since 19
1074  */
1075 int32_t OH_ArkUI_CustomDialog_SetMask(
1076     ArkUI_CustomDialogOptions* options, uint32_t maskColor, const ArkUI_Rect* maskRect);
1077 
1078 /**
1079  * @brief Sets the keyboard avoidance mode of the dialog box.
1080  *
1081  * @param options Dialog box parameters.
1082  * @param keyboardAvoidMode Keyboard avoidance mode, specified by an enumerated value.
1083  * @return Returns the error code.
1084  *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
1085  *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
1086  * @since 19
1087  */
1088 int32_t OH_ArkUI_CustomDialog_SetKeyboardAvoidMode(
1089     ArkUI_CustomDialogOptions* options, ArkUI_KeyboardAvoidMode keyboardAvoidMode);
1090 
1091 /**
1092  * @brief Sets whether to enable the hover mode for the dialog box.
1093  *
1094  * @param options Dialog box parameters.
1095  * @param enabled Whether to enable the hover mode. The default value is <b>false</b>.
1096  * @return Returns the error code.
1097  *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
1098  *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
1099  * @since 19
1100  */
1101 int32_t OH_ArkUI_CustomDialog_SetHoverModeEnabled(ArkUI_CustomDialogOptions* options, bool enabled);
1102 
1103 /**
1104  * @brief Set the default display area of the dialog box in hover mode.
1105  *
1106  * @param options Dialog box parameters.
1107  * @param hoverModeAreaType Display area in hover mode, specified by an enumerated value.
1108  * @return Returns the error code.
1109  *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
1110  *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
1111  * @since 19
1112  */
1113 int32_t OH_ArkUI_CustomDialog_SetHoverModeArea(
1114     ArkUI_CustomDialogOptions* options, ArkUI_HoverModeAreaType hoverModeAreaType);
1115 
1116 /**
1117  * @brief Registers a callback for the dismissal event of the custom dialog box.
1118  *
1119  * @param options Dialog box parameters.
1120  * @param userData Pointer to the user-defined data.
1121  * @param callback Callback for the dismissal event of the custom dialog box.
1122  * @return Returns the error code.
1123  *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
1124  *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
1125  * @since 19
1126  */
1127 int32_t OH_ArkUI_CustomDialog_RegisterOnWillDismissCallback(
1128     ArkUI_CustomDialogOptions* options, void* userData, void (*callback)(ArkUI_DialogDismissEvent* event));
1129 
1130 /**
1131  * @brief Registers a callback to be invoked when the custom dialog box is about to appear.
1132  *
1133  * @param options Dialog box parameters.
1134  * @param userData Pointer to the user-defined data.
1135  * @param callback Callback to be invoked when the dialog box is about to appear.
1136  * @return Returns the error code.
1137  *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
1138  *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
1139  * @since 19
1140  */
1141 int32_t OH_ArkUI_CustomDialog_RegisterOnWillAppearCallback(
1142     ArkUI_CustomDialogOptions* options, void* userData, void (*callback)(void* userData));
1143 
1144 /**
1145  * @brief Registers a callback to be invoked when the custom dialog box appears.
1146  *
1147  * @param options Dialog box parameters.
1148  * @param userData Pointer to the user-defined data.
1149  * @param callback Callback to be invoked when the custom dialog box appears.
1150  * @return Returns the error code.
1151  *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
1152  *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
1153  * @since 19
1154  */
1155 int32_t OH_ArkUI_CustomDialog_RegisterOnDidAppearCallback(
1156     ArkUI_CustomDialogOptions* options, void* userData, void (*callback)(void* userData));
1157 
1158 /**
1159  * @brief Registers a callback to be invoked when the custom dialog box is about to disappear.
1160  *
1161  * @param options Dialog box parameters.
1162  * @param userData Pointer to the user-defined data.
1163  * @param callback Callback to be invoked when the dialog box is about to disappear.
1164  * @return Returns the error code.
1165  *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
1166  *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
1167  * @since 19
1168  */
1169 int32_t OH_ArkUI_CustomDialog_RegisterOnWillDisappearCallback(
1170     ArkUI_CustomDialogOptions* options, void* userData, void (*callback)(void* userData));
1171 
1172 /**
1173  * @brief Registers a callback to be invoked when the custom dialog box disappears.
1174  *
1175  * @param options Dialog box parameters.
1176  * @param userData Pointer to the user-defined data.
1177  * @param callback Callback to be invoked when the custom dialog box disappears.
1178  * @return Returns the error code.
1179  *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
1180  *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
1181  * @since 19
1182  */
1183 int32_t OH_ArkUI_CustomDialog_RegisterOnDidDisappearCallback(
1184     ArkUI_CustomDialogOptions* options, void* userData, void (*callback)(void* userData));
1185 
1186 /**
1187  * @brief Get state of dialog.
1188  *
1189  * @param handle Indicates the pointer to the custom dialog box controller.
1190  * @param state Dialog state object.
1191  * @return Returns the error code.
1192  *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
1193  *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
1194  * @since 20
1195  */
1196 int32_t OH_ArkUI_CustomDialog_GetState(ArkUI_NativeDialogHandle handle, ArkUI_DialogState* state);
1197 
1198 /**
1199  * @brief Sets the background blur effect for a dialog box.
1200  *
1201  * @param options Dialog box parameters.
1202  * @param backgroundBlurStyleOptions Background blur effect options of the dialog box.
1203  *        Format of the {@link ArkUI_AttributeItem} parameter: \n
1204  *        .value[0].i32: color mode. The value is an enum of {@link ArkUI_ColorMode}. \n
1205  *        .value[1]?.i32: adaptive color mode. The value is an enum of {@link ArkUI_AdaptiveColor}. \n
1206  *        .value[2]?.f32: blur degree. The value range is [0.0, 1.0]. \n
1207  *        .value[3]?.u32: brightness of black in the grayscale blur. The value range is [0, 127]. \n
1208  *        .value[4]?.u32: degree of darkening the white color in the grayscale blur. The value range is [0, 127]. \n
1209  *        .value[5]?.i32: blur activation policy. The value is an enum of {@link ArkUI_BlurStyleActivePolicy}. \n
1210  *        .value[6]?.u32: background color, in 0xARGB format, of the components within the window after the window loses
1211  *                        focus (in which case, the blur effect on the components within the window is removed). \n
1212  * @return Returns the result code.
1213  *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
1214  *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
1215  * @since 19
1216  */
1217 int32_t OH_ArkUI_CustomDialog_SetBackgroundBlurStyleOptions(
1218     ArkUI_CustomDialogOptions* options, const ArkUI_AttributeItem* backgroundBlurStyleOptions);
1219 
1220 /**
1221  * @brief Sets the background effect parameters for a dialog box.
1222  *
1223  * @param options Dialog box parameters.
1224  * @param backgroundEffect Background effect of the dialog box.
1225  *        Format of the {@link ArkUI_AttributeItem} parameter: \n
1226  *        .value[0].f32: blur radius, in vp. \n
1227  *        .value[1]?.f32: saturation. \n
1228  *        .value[2]?.f32: brightness. \n
1229  *        .value[3]?.u32: color, in 0xARGB format. \n
1230  *        .value[4]?.i32: adaptive color mode. The value is an enum of {@link ArkUI_AdaptiveColor}. \n
1231  *        .value[5]?.u32: brightness of black in the grayscale blur. The value range is [0, 127]. \n
1232  *        .value[6]?.u32: degree of darkening the white color in the grayscale blur. The value range is [0, 127]. \n
1233  *        .value[7]?.i32: blur activation policy. The value is an enum of {@link ArkUI_BlurStyleActivePolicy}. \n
1234  *        .value[8]?.u32: background color, in 0xARGB format, of the components within the window after the window loses
1235  *                        focus (in which case, the blur effect on the components within the window is removed). \n
1236  * @return Returns the result code.
1237  *         Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
1238  *         Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
1239  * @since 19
1240  */
1241 int32_t OH_ArkUI_CustomDialog_SetBackgroundEffect(
1242     ArkUI_CustomDialogOptions* options, const ArkUI_AttributeItem* backgroundEffect);
1243 
1244 #ifdef __cplusplus
1245 };
1246 #endif
1247 
1248 #endif // ARKUI_NATIVE_DIALOG_H
1249 /** @} */
1250