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 #ifndef ARKUI_NATIVE_DIALOG_H 17 #define ARKUI_NATIVE_DIALOG_H 18 19 #include <stdbool.h> 20 #include "native_type.h" 21 #include "native_node.h" 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 26 27 /** 28 * @brief Enumerates the actions for triggering closure of the dialog box. 29 * 30 * @since 12 31 */ 32 typedef enum { 33 /** Touching the system-defined Back button or pressing the Esc key. */ 34 DIALOG_DISMISS_BACK_PRESS = 0, 35 /** Touching the mask. */ 36 DIALOG_DISMISS_TOUCH_OUTSIDE, 37 /** 点击关闭按钮。*/ 38 DIALOG_DISMISS_CLOSE_BUTTON, 39 /** 下拉关闭。*/ 40 DIALOG_DISMISS_SLIDE_DOWN, 41 } ArkUI_DismissReason; 42 43 /** 44 * @brief Enumerates the level mode. 45 * 46 * @since 16 47 */ 48 typedef enum { 49 /** overlay mode. */ 50 ARKUI_LEVEL_MODE_OVERLAY = 0, 51 /** embedded mode. */ 52 ARKUI_LEVEL_MODE_EMBEDDED, 53 } ArkUI_LevelMode; 54 55 /** 56 * @brief Enumerates the immersive mode. 57 * 58 * @since 16 59 */ 60 typedef enum { 61 /** Mask covering the parent node. */ 62 ARKUI_IMMERSIVE_MODE_DEFAULT = 0, 63 /** Mask extend safe area includes status bar and navigation bar. */ 64 ARKUI_IMMERSIVE_MODE_EXTEND, 65 } ArkUI_ImmersiveMode; 66 67 /** 68 * @brief Invoked when the dialog box is closed. 69 * 70 * @since 12 71 */ 72 typedef bool (*ArkUI_OnWillDismissEvent)(int32_t reason); 73 74 /** 75 * @brief Defines a struct for a dialog box dismiss event. 76 * 77 * @since 12 78 */ 79 typedef struct ArkUI_DialogDismissEvent ArkUI_DialogDismissEvent; 80 81 /** 82 * @brief Defines a struct for the content object of a custom dialog box. 83 * 84 * @since 18 85 */ 86 typedef struct ArkUI_CustomDialogOptions ArkUI_CustomDialogOptions; 87 88 /** 89 * @brief Provides the custom dialog box APIs for the native side. 90 * 91 * @version 1 92 * @since 12 93 */ 94 typedef struct { 95 /** 96 * @brief Creates a custom dialog box and returns the pointer to the created dialog box. 97 * 98 * @note This method must be called before the <b>show</b> method. 99 * @return Returns the pointer to the created custom dialog box; returns a null pointer if the creation fails. 100 */ 101 ArkUI_NativeDialogHandle (*create)(); 102 /** 103 * @brief Destroys a custom dialog box. 104 * 105 * @param handle Indicates the pointer to the custom dialog box controller. 106 */ 107 void (*dispose)(ArkUI_NativeDialogHandle handle); 108 /** 109 * @brief Attaches the content of a custom dialog box. 110 * 111 * @note This method must be called before the <b>show</b> method. 112 * @param handle Indicates the pointer to the custom dialog box controller. 113 * @param content Indicates the pointer to the root node of the custom dialog box content. 114 * @return Returns <b>0</b> if the operation is successful; returns <b>401</b> if a parameter error occurs. 115 */ 116 int32_t (*setContent)(ArkUI_NativeDialogHandle handle, ArkUI_NodeHandle content); 117 /** 118 * @brief Detaches the content of a custom dialog box. 119 * 120 * @note This method must be called before the <b>show</b> method. 121 * @param handle Indicates the pointer to the custom dialog box controller. 122 * @return Returns <b>0</b> if the operation is successful; returns <b>401</b> if a parameter error occurs. 123 */ 124 int32_t (*removeContent)(ArkUI_NativeDialogHandle handle); 125 /** 126 * @brief Sets the alignment mode for a custom dialog box. 127 * 128 * @note This method must be called before the <b>show</b> method. 129 * @param handle Indicates the pointer to the custom dialog box controller. 130 * @param alignment Indicates the alignment mode. The parameter type is {@link ArkUI_Alignment}. 131 * @param offsetX Indicates the horizontal offset of the custom dialog box. The value is a floating point number. 132 * @param offsetY Indicates the vertical offset of the custom dialog box. The value is a floating point number. 133 * @return Returns <b>0</b> if the operation is successful; returns <b>401</b> if a parameter error occurs. 134 */ 135 int32_t (*setContentAlignment)(ArkUI_NativeDialogHandle handle, int32_t alignment, float offsetX, float offsetY); 136 /** 137 * @brief Resets the alignment mode of a custom dialog box to its default settings. 138 * 139 * @note This method must be called before the <b>show</b> method. 140 * @param handle Indicates the pointer to the custom dialog box controller. 141 * @return Returns <b>0</b> if the operation is successful; returns <b>401</b> if a parameter error occurs. 142 */ 143 int32_t (*resetContentAlignment)(ArkUI_NativeDialogHandle handle); 144 /** 145 * @brief Sets the modal mode for a custom dialog box. 146 * 147 * @note This method must be called before the <b>show</b> method. 148 * @param handle Indicates the pointer to the custom dialog box controller. 149 * @param isModal Specifies whether the custom dialog box is a modal, which has a mask applied. The value 150 * <b>true</b> means that the custom dialog box is a modal, and <b>false</b> means the opposite. 151 * @return Returns <b>0</b> if the operation is successful; returns <b>401</b> if a parameter error occurs. 152 */ 153 int32_t (*setModalMode)(ArkUI_NativeDialogHandle handle, bool isModal); 154 /** 155 * @brief Specifies whether to allow users to touch the mask to dismiss the custom dialog box. 156 * 157 * @note This method must be called before the <b>show</b> method. 158 * @param handle Indicates the pointer to the custom dialog box controller. 159 * @param autoCancel Specifies whether to allow users to touch the mask to dismiss the dialog box. 160 * The value <b>true</b> means to allow users to do so, and <b>false</b> means the opposite. 161 * @return Returns <b>0</b> if the operation is successful; returns <b>401</b> if a parameter error occurs. 162 */ 163 int32_t (*setAutoCancel)(ArkUI_NativeDialogHandle handle, bool autoCancel); 164 /** 165 * @brief Sets the mask for a custom dialog box. 166 * 167 * @note This method must be called before the <b>show</b> method. 168 * @param handle Indicates the pointer to the custom dialog box controller. 169 * @param maskColor Indicates the mask color, in 0xARGB format. 170 * @param maskRect Indicates the pointer to the mask area. Events outside the mask area are transparently 171 * transmitted, and events within the mask area are not. The parameter type is {@link ArkUI_Rect}. 172 * @return Returns <b>0</b> if the operation is successful; returns <b>401</b> if a parameter error occurs. 173 */ 174 int32_t (*setMask)(ArkUI_NativeDialogHandle handle, uint32_t maskColor, const ArkUI_Rect* maskRect); 175 /** 176 * @brief Sets the background color for 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 backgroundColor Indicates the background color of the custom dialog box, in 0xARGB format. 181 * @return Returns <b>0</b> if the operation is successful; returns <b>401</b> if a parameter error occurs. 182 */ 183 int32_t (*setBackgroundColor)(ArkUI_NativeDialogHandle handle, uint32_t backgroundColor); 184 /** 185 * @brief Sets the background corner radius for a custom dialog box. 186 * 187 * @note This method must be called before the <b>show</b> method. 188 * @param handle Indicates the pointer to the custom dialog box controller. 189 * @param topLeft Indicates the radius of the upper left corner of the custom dialog box background. 190 * @param topRight Indicates the radius of the upper right corner of the custom dialog box background. 191 * @param bottomLeft Indicates the radius of the lower left corner of the custom dialog box background. 192 * @param bottomRight Indicates the radius of the lower right corner of the custom dialog box background. 193 * @return Returns <b>0</b> if the operation is successful; returns <b>401</b> if a parameter error occurs. 194 */ 195 int32_t (*setCornerRadius)(ArkUI_NativeDialogHandle handle, float topLeft, float topRight, 196 float bottomLeft, float bottomRight); 197 /** 198 * @brief Sets the number of grid columns occupied by a custom dialog box. 199 * 200 * @note This method must be called before the <b>show</b> method. 201 * @param handle Indicates the pointer to the custom dialog box controller. 202 * @param gridCount Indicates the number of grid columns occupied by the dialog box. The default value is subject to 203 * the window size, and the maximum value is the maximum number of columns supported by the system. 204 * @return Returns <b>0</b> if the operation is successful; returns <b>401</b> if a parameter error occurs. 205 */ 206 int32_t (*setGridColumnCount)(ArkUI_NativeDialogHandle handle, int32_t gridCount); 207 /** 208 * @brief Specifies whether to use a custom style for the custom dialog box. 209 * 210 * @note This method must be called before the <b>show</b> method. 211 * @param handle Indicates the pointer to the custom dialog box controller. 212 * @param enableCustomStyle Specifies whether to use a custom style for the dialog box. 213 * <b>true</b>: The dialog box automatically adapts its width to the child components; the rounded corner is 0; 214 * the background color is transparent. 215 * <b>false</b>: The dialog box automatically adapts its width to the grid system and its height to the child 216 * components; the rounded corner is 24 vp. 217 * @return Returns <b>0</b> if the operation is successful; returns <b>401</b> if a parameter error occurs. 218 */ 219 int32_t (*enableCustomStyle)(ArkUI_NativeDialogHandle handle, bool enableCustomStyle); 220 /** 221 * @brief Specifies whether to use a custom animation for a custom dialog box. 222 * 223 * @note This method must be called before the <b>show</b> method. 224 * @param handle Indicates the pointer to the custom dialog box controller. 225 * @param enableCustomAnimation Specifies whether to use a custom animation. The value <b>true</b> means to use a 226 * custom animation, and <b>false</b> means to use the default animation. 227 * @return Returns <b>0</b> if the operation is successful; returns <b>401</b> if a parameter error occurs. 228 */ 229 int32_t (*enableCustomAnimation)(ArkUI_NativeDialogHandle handle, bool enableCustomAnimation); 230 /** 231 * @brief Registers a callback for a custom dialog box so that the user can decide whether to close the dialog box 232 * after they touch the Back button or press the Esc key. 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 eventHandler Indicates the callback to register. The parameter type is {@link ArkUI_OnWillDismissEvent}. 237 * @return Returns <b>0</b> if the operation is successful; returns <b>401</b> if a parameter error occurs. 238 */ 239 int32_t (*registerOnWillDismiss)(ArkUI_NativeDialogHandle handle, ArkUI_OnWillDismissEvent eventHandler); 240 /** 241 * @brief Shows a custom dialog box. 242 * 243 * @param handle Indicates the pointer to the custom dialog box controller. 244 * @param showInSubWindow Specifies whether to show the dialog box in a sub-window. 245 * @return Returns <b>0</b> if the operation is successful; returns <b>401</b> if a parameter error occurs. 246 */ 247 int32_t (*show)(ArkUI_NativeDialogHandle handle, bool showInSubWindow); 248 /** 249 * @brief Closes a custom dialog box. If the dialog box has been closed, this API does not take effect. 250 * 251 * @param handle Indicates the pointer to the custom dialog box controller. 252 * @return Returns <b>0</b> if the operation is successful; returns <b>401</b> if a parameter error occurs. 253 */ 254 int32_t (*close)(ArkUI_NativeDialogHandle handle); 255 256 /** 257 * @brief Registers a listener for the dismiss event of the custom dialog box. 258 * 259 * @param handle Indicates the pointer to the custom dialog box controller. 260 * @param userData Indicates the pointer to the custom data. 261 * @param callback Indicates the callback for the dismiss event of the custom dialog box. 262 * @return Returns the result 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 (*registerOnWillDismissWithUserData)( 267 ArkUI_NativeDialogHandle handle, void* userData, void (*callback)(ArkUI_DialogDismissEvent* event)); 268 } ArkUI_NativeDialogAPI_1; 269 270 /** 271 * @brief Provides the custom dialog box APIs for the native side. 272 * 273 * @version 2 274 * @since 15 275 */ 276 typedef struct { 277 /** 278 * @brief Provides the custom dialog box APIs for the native side. The API scope is {@link ArkUI_NativeDialogAPI_1} 279 * 280 * @since 15 281 */ 282 ArkUI_NativeDialogAPI_1 nativeDialogAPI1; 283 /** 284 * @brief Defines the distance between the customDialog and system keyboard. 285 * 286 * @note This method must be called before the <b>show</b> method. 287 * @param handle Indicates the pointer to the custom dialog box controller. 288 * @param distance distance, in vp. 289 * @param unit Indicates the unit, which is an enumerated value of {@link ArkUI_LengthMetricUnit} 290 * @return Returns the result code. 291 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 292 * Returns {@link ARKUI_ERROR_CODE_CAPI_INIT_ERROR} if the CAPI init error. 293 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 294 * @since 15 295 */ 296 int32_t (*setKeyboardAvoidDistance)(ArkUI_NativeDialogHandle handle, float distance, ArkUI_LengthMetricUnit unit); 297 298 /** 299 * @brief Sets the level mode for a custom dialog box. 300 * 301 * @note This method must be called before the <b>show</b> method. 302 * @param handle Indicates the pointer to the custom dialog box controller. 303 * @param levelMode Indicates the level mode. The parameter type is {@link ArkUI_LevelMode}. 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 * @since 15 308 */ 309 int32_t (*setLevelMode)(ArkUI_NativeDialogHandle handle, ArkUI_LevelMode levelMode); 310 311 /** 312 * @brief Sets the level uniqueId for a custom dialog box. 313 * 314 * @note This method must be called before the <b>setLevelMode</b> method. 315 * @param handle Indicates the pointer to the custom dialog box controller. 316 * @param uniqueId Indicates the unique id of any nodes in router or navigation pages. 317 * @return Returns the error code. 318 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 319 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 320 * @since 15 321 */ 322 int32_t (*setLevelUniqueId)(ArkUI_NativeDialogHandle handle, int32_t uniqueId); 323 324 /** 325 * @brief Sets the immersive mode for a custom dialog box. 326 * 327 * @note This method must be called before the <b>show</b> method. 328 * @param handle Indicates the pointer to the custom dialog box controller. 329 * @param immersiveMode Indicates the immersive mode. The parameter type is {@link ArkUI_ImmersiveMode}. 330 * @return Returns the error code. 331 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 332 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 333 * @since 15 334 */ 335 int32_t (*setImmersiveMode)(ArkUI_NativeDialogHandle handle, ArkUI_ImmersiveMode immersiveMode); 336 } ArkUI_NativeDialogAPI_2; 337 338 /** 339 * @brief Provides the custom dialog box APIs for the native side. 340 * 341 * @version 3 342 * @since 18 343 */ 344 typedef struct { 345 /** 346 * @brief Provides the custom dialog box APIs for the native side. The API scope is {@link ArkUI_NativeDialogAPI_1} 347 * 348 * @since 18 349 */ 350 ArkUI_NativeDialogAPI_1 nativeDialogAPI1; 351 /** 352 * @brief Provides the custom dialog box APIs for the native side. The API scope is {@link ArkUI_NativeDialogAPI_2} 353 * 354 * @since 18 355 */ 356 ArkUI_NativeDialogAPI_2 nativeDialogAPI2; 357 /** 358 * @brief Sets the display order for a custom dialog box. 359 * 360 * @note This method must be called before the <b>show</b> method. 361 * @param handle Indicates the pointer to the custom dialog box controller. 362 * @param levelOrder Indicates the display order. The valid range is [-100000.0, 100000.0]. 363 * @return Returns the error code. 364 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 365 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 366 * @since 18 367 */ 368 int32_t (*setLevelOrder)(ArkUI_NativeDialogHandle handle, double levelOrder); 369 370 /** 371 * @brief Registers a listener callback before the dialog openAnimation starts. 372 * 373 * @param handle Indicates the pointer to the custom dialog box controller. 374 * @param userData Indicates the pointer to the custom data. 375 * @param callback Indicates the callback before the dialog openAnimation starts. 376 * @return Returns the result code. 377 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 378 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 379 * @since 18 380 */ 381 int32_t (*registerOnWillAppear)( 382 ArkUI_NativeDialogHandle handle, void* userData, void (*callback)(void* userData)); 383 384 /** 385 * @brief Registers a listener callback when the dialog appears. 386 * 387 * @param handle Indicates the pointer to the custom dialog box controller. 388 * @param userData Indicates the pointer to the custom data. 389 * @param callback Indicates the callback when the dialog appears. 390 * @return Returns the result code. 391 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 392 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 393 * @since 18 394 */ 395 int32_t (*registerOnDidAppear)( 396 ArkUI_NativeDialogHandle handle, void* userData, void (*callback)(void* userData)); 397 398 /** 399 * @brief Registers a listener callback before the dialog closeAnimation starts. 400 * 401 * @param handle Indicates the pointer to the custom dialog box controller. 402 * @param userData Indicates the pointer to the custom data. 403 * @param callback Indicates the callback before the dialog closeAnimation starts. 404 * @return Returns the result code. 405 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 406 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 407 * @since 18 408 */ 409 int32_t (*registerOnWillDisappear)( 410 ArkUI_NativeDialogHandle handle, void* userData, void (*callback)(void* userData)); 411 412 /** 413 * @brief Registers a listener callback when the dialog disappears. 414 * 415 * @param handle Indicates the pointer to the custom dialog box controller. 416 * @param userData Indicates the pointer to the custom data. 417 * @param callback Indicates the callback when the dialog disappears. 418 * @return Returns the result code. 419 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 420 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 421 * @since 18 422 */ 423 int32_t (*registerOnDidDisappear)( 424 ArkUI_NativeDialogHandle handle, void* userData, void (*callback)(void* userData)); 425 426 /** 427 * @brief Sets the border width of the dialog box. 428 * 429 * @note This method must be called before the <b>show</b> method. 430 * @param handle Pointer to the dialog box controller. 431 * @param top Width of the top border. 432 * @param right Width of the right border. 433 * @param bottom Width of the bottom border. 434 * @param left Width of the left border. 435 * @param unit Unit of the width. The default value is vp. 436 * @return Returns the error code. 437 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 438 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occur.. 439 * @since 18 440 */ 441 int32_t (*setBorderWidth)( 442 ArkUI_NativeDialogHandle handle, float top, float right, float bottom, float left, ArkUI_LengthMetricUnit unit); 443 444 /** 445 * @brief Sets the border color of the dialog box. 446 * 447 * @note This method must be called before the <b>show</b> method. 448 * @param handle Pointer to the dialog box controller. 449 * @param top Color of the top border. 450 * @param right Color of the right border. 451 * @param bottom Color of the bottom border. 452 * @param left Color of the left border. 453 * @return Returns the error code. 454 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 455 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occur.. 456 * @since 18 457 */ 458 int32_t (*setBorderColor)( 459 ArkUI_NativeDialogHandle handle, uint32_t top, uint32_t right, uint32_t bottom, uint32_t left); 460 461 /** 462 * @brief Sets the border style of the dialog box. 463 * 464 * @note This method must be called before the <b>show</b> method. 465 * @param handle Pointer to the dialog box controller. 466 * @param top Style of the top border. 467 * @param right Style of the right border. 468 * @param bottom Style of the bottom border. 469 * @param left Style of the left border. 470 * @return Returns the error code. 471 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 472 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occur.. 473 * @since 18 474 */ 475 int32_t (*setBorderStyle)( 476 ArkUI_NativeDialogHandle handle, int32_t top, int32_t right, int32_t bottom, int32_t left); 477 478 /** 479 * @brief Sets the width of the dialog box background. 480 * 481 * @note This method must be called before the <b>show</b> method. 482 * @param handle Pointer to the dialog box controller. 483 * @param width Width of the background. 484 * @param unit Unit of the width. The default value is vp. 485 * @return Returns the error code. 486 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 487 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occur.. 488 * @since 18 489 */ 490 int32_t (*setWidth)(ArkUI_NativeDialogHandle handle, float width, ArkUI_LengthMetricUnit unit); 491 492 /** 493 * @brief Sets the height of the dialog box background. 494 * 495 * @note This method must be called before the <b>show</b> method. 496 * @param handle Pointer to the dialog box controller. 497 * @param height Height of the background. 498 * @param unit Unit of the height. The default value is vp. 499 * @return Returns the error code. 500 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 501 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occur.. 502 * @since 18 503 */ 504 int32_t (*setHeight)(ArkUI_NativeDialogHandle handle, float height, ArkUI_LengthMetricUnit unit); 505 506 /** 507 * @brief Sets the shadow of the dialog box background. 508 * 509 * @note This method must be called before the <b>show</b> method. 510 * @param handle Pointer to the dialog box controller. 511 * @param shadow Shadow style of the background, specified by an enumerated value. 512 * @return Returns the error code. 513 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 514 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occur.. 515 * @since 18 516 */ 517 int32_t (*setShadow)(ArkUI_NativeDialogHandle handle, ArkUI_ShadowStyle shadow); 518 519 /** 520 * @brief Sets the custom shadow of the dialog box background. 521 * 522 * @note This method must be called before the <b>show</b> method. 523 * @param handle Pointer to the dialog box controller. 524 * @param customShadow Custom shadow parameter. The format is the same as that of the <b>NODE_SHADOW</b> property. 525 * @return Returns the error code. 526 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 527 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occur.. 528 * @since 18 529 */ 530 int32_t (*setCustomShadow)(ArkUI_NativeDialogHandle handle, const ArkUI_AttributeItem* customShadow); 531 532 /** 533 * @brief Sets the background blur style of the dialog box. 534 * 535 * @note This method must be called before the <b>show</b> method. 536 * @param handle Pointer to the dialog box controller. 537 * @param blurStyle Background blur style, specified by an enumerated value. 538 * @return Returns the error code. 539 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 540 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occur.. 541 * @since 18 542 */ 543 int32_t (*setBackgroundBlurStyle)(ArkUI_NativeDialogHandle handle, ArkUI_BlurStyle blurStyle); 544 545 /** 546 * @brief Sets the keyboard avoidance mode of the dialog box. 547 * 548 * @note This method must be called before the <b>show</b> method. 549 * @param handle Pointer to the dialog box controller. 550 * @param keyboardAvoidMode Keyboard avoidance mode, specified by an enumerated value. 551 * @return Returns the error code. 552 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 553 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occur.. 554 * @since 18 555 */ 556 int32_t (*setKeyboardAvoidMode)(ArkUI_NativeDialogHandle handle, ArkUI_KeyboardAvoidMode keyboardAvoidMode); 557 558 /** 559 * @brief Sets whether to enable the hover mode for the dialog box. 560 * 561 * @note This method must be called before the <b>show</b> method. 562 * @param handle Pointer to the dialog box controller. 563 * @param enableHoverMode Whether to enable the hover mode. The default value is <b>false</b>. 564 * @return Returns the error code. 565 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 566 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occur.. 567 * @since 18 568 */ 569 int32_t (*enableHoverMode)(ArkUI_NativeDialogHandle handle, bool enableHoverMode); 570 571 /** 572 * @brief Set the default display area of the dialog box in hover mode. 573 * 574 * @note This method must be called before the <b>show</b> method. 575 * @param handle Pointer to the dialog box controller. 576 * @param hoverModeAreaType Display area in hover mode, specified by an enumerated value. 577 * @return Returns the error code. 578 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 579 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occur. 580 * @since 18 581 */ 582 int32_t (*setHoverModeArea)(ArkUI_NativeDialogHandle handle, ArkUI_HoverModeAreaType hoverModeAreaType); 583 584 /** 585 * @brief Sets whether to get focus when the custom dialog is displayed. 586 * 587 * @param handle Indicates the pointer to the custom dialog box controller. 588 * @param focusable Specifies whether to get focus when the custom dialog is displayed. The default value is true. 589 * @return Returns the error code. 590 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 591 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 592 * @since 18 593 */ 594 int32_t (*setFocusable)(ArkUI_NativeDialogHandle handle, bool focusable); 595 } ArkUI_NativeDialogAPI_3; 596 597 /** 598 * @brief Sets whether to block the system behavior of dismissing a dialog box. 599 * 600 * @param event Indicates the pointer to a dialog box dismiss event object. 601 * @param shouldBlockDismiss Indicates whether to block the system behavior of dismissing the dialog box. The value 602 * <b>true</b> means to block the system behavior, and <b>false</b> means the opposite. 603 * @since 12 604 */ 605 void OH_ArkUI_DialogDismissEvent_SetShouldBlockDismiss(ArkUI_DialogDismissEvent* event, bool shouldBlockDismiss); 606 607 /** 608 * @brief Obtains the pointer to user data in a dialog box dismiss event object. 609 * 610 * @param event Indicates the pointer to a dialog box dismiss event object. 611 * 612 * @return Returns the pointer to user data. 613 * @since 12 614 */ 615 void* OH_ArkUI_DialogDismissEvent_GetUserData(ArkUI_DialogDismissEvent* event); 616 617 /** 618 * @brief Obtains the c from a dialog box dismiss event object. 619 * 620 * @param event Indicates the pointer to a dialog box dismiss event object. 621 * 622 * @return Returns the dismissal reason. Returns <b>-1</b> if an exception occurs. 623 * {@link DIALOG_DISMISS_BACK_PRESS}: touching the Back button, swiping left or right on the screen, or 624 * pressing the Esc key. 625 * {@link DIALOG_DISMISS_TOUCH_OUTSIDE}: touching the mask. 626 * {@link DIALOG_DISMISS_CLOSE_BUTTON}: touching the Close button. 627 * {@link DIALOG_DISMISS_SLIDE_DOWN}: sliding down. 628 * @since 12 629 */ 630 int32_t OH_ArkUI_DialogDismissEvent_GetDismissReason(ArkUI_DialogDismissEvent* event); 631 632 /** 633 * @brief Displays a custom dialog box. 634 * 635 * @param options Dialog box parameters. 636 * @param callback Callback to be invoked when the custom dialog box displays. 637 * @return Returns the error code. 638 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 639 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 640 * @since 18 641 */ 642 int32_t OH_ArkUI_CustomDialog_OpenDialog(ArkUI_CustomDialogOptions* options, void (*callback)(int32_t dialogId)); 643 644 /** 645 * @brief Updates a custom dialog box. 646 * 647 * @param options Dialog box parameters. 648 * @param callback Callback to be invoked when the custom dialog box updates. 649 * @return Returns the error code. 650 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 651 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 652 * @since 18 653 */ 654 int32_t OH_ArkUI_CustomDialog_UpdateDialog(ArkUI_CustomDialogOptions* options, void (*callback)(int32_t dialogId)); 655 656 /** 657 * @brief Closes a custom dialog box. 658 * 659 * @param dialogId Dialog id. 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 occurs. 663 * @since 18 664 */ 665 int32_t OH_ArkUI_CustomDialog_CloseDialog(int32_t dialogId); 666 667 /** 668 * @brief Creates custom dialog box options. 669 * 670 * @param content Content of the custom dialog box. 671 * @return Returns the pointer to the custom dialog box options. 672 * @since 18 673 */ 674 ArkUI_CustomDialogOptions* OH_ArkUI_CustomDialog_CreateOptions(ArkUI_NodeHandle content); 675 676 /** 677 * @brief Destroys the custom dialog box options. 678 * 679 * @param options The pointer to the custom dialog box options. 680 * @since 18 681 */ 682 void OH_ArkUI_CustomDialog_DisposeOptions(ArkUI_CustomDialogOptions* options); 683 684 /** 685 * @brief Sets the level mode for a custom dialog box. 686 * 687 * @note This method must be called before the <b>OH_ArkUI_CustomDialog_OpenDialog</b> method. 688 * @param options Indicates the pointer to the custom dialog options. 689 * @param levelMode Indicates the level mode. The parameter type is {@link ArkUI_LevelMode}. 690 * @return Returns the error code. 691 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 692 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 693 * @since 16 694 */ 695 int32_t OH_ArkUI_CustomDialog_SetLevelMode(ArkUI_CustomDialogOptions* options, ArkUI_LevelMode levelMode); 696 697 /** 698 * @brief Sets the level uniqueId for a custom dialog box. 699 * 700 * @note This method must be called before the <b>OH_ArkUI_CustomDialog_OpenDialog</b> method. 701 * @param options Indicates the pointer to the custom dialog options. 702 * @param uniqueId Indicates the unique id of any nodes in router or navigation pages. 703 * @return Returns the error code. 704 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 705 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 706 * @since 16 707 */ 708 int32_t OH_ArkUI_CustomDialog_SetLevelUniqueId(ArkUI_CustomDialogOptions* options, int32_t uniqueId); 709 710 /** 711 * @brief Sets the immersive mode for a custom dialog box. 712 * 713 * @note This method must be called before the <b>OH_ArkUI_CustomDialog_OpenDialog</b> method. 714 * @param options Indicates the pointer to the custom dialog options. 715 * @param immersiveMode Indicates the immersive mode. The parameter type is {@link ArkUI_ImmersiveMode}. 716 * @return Returns the error code. 717 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 718 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 719 * @since 16 720 */ 721 int32_t OH_ArkUI_CustomDialog_SetImmersiveMode(ArkUI_CustomDialogOptions* options, ArkUI_ImmersiveMode immersiveMode); 722 723 /** 724 * @brief Sets the background color of the dialog box. 725 * 726 * @param options Dialog box parameters. 727 * @param backgroundColor Background color of the dialog box. 728 * @return Returns the error code. 729 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 730 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 731 * @since 18 732 */ 733 int32_t OH_ArkUI_CustomDialog_SetBackgroundColor(ArkUI_CustomDialogOptions* options, uint32_t backgroundColor); 734 735 /** 736 * @brief Sets the corner radius for a custom dialog box. 737 * 738 * @param options Dialog box parameters. 739 * @param topLeft Corner radius of the upper left corner. 740 * @param topRight Corner radius of the upper right corner. 741 * @param bottomLeft Corner radius of the lower left corner. 742 * @param bottomRight Corner radius of the lower right corner. 743 * @return Returns the error code. 744 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 745 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 746 * @since 18 747 */ 748 int32_t OH_ArkUI_CustomDialog_SetCornerRadius( 749 ArkUI_CustomDialogOptions* options, float topLeft, float topRight, float bottomLeft, float bottomRight); 750 751 /** 752 * @brief Sets the border width of the dialog box. 753 * 754 * @param options Dialog box parameters. 755 * @param top Width of the top border. 756 * @param right Width of the right border. 757 * @param bottom Width of the bottom border. 758 * @param left Width of the left border. 759 * @param unit Unit of the width. The default value is vp. 760 * @return Returns the error code. 761 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 762 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 763 * @since 18 764 */ 765 int32_t OH_ArkUI_CustomDialog_SetBorderWidth( 766 ArkUI_CustomDialogOptions* options, float top, float right, float bottom, float left, ArkUI_LengthMetricUnit unit); 767 768 /** 769 * @brief Sets the border color of the dialog box. 770 * 771 * @param options Dialog box parameters. 772 * @param top Color of the top border. 773 * @param right Color of the right border. 774 * @param bottom Color of the bottom border. 775 * @param left Color of the left border. 776 * @return Returns the error code. 777 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 778 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 779 * @since 18 780 */ 781 int32_t OH_ArkUI_CustomDialog_SetBorderColor( 782 ArkUI_CustomDialogOptions* options, uint32_t top, uint32_t right, uint32_t bottom, uint32_t left); 783 784 /** 785 * @brief Sets the border style of the dialog box. 786 * 787 * @param options Dialog box parameters. 788 * @param top Style of the top border. 789 * @param right Style of the right border. 790 * @param bottom Style of the bottom border. 791 * @param left Style of the left border. 792 * @return Returns the error code. 793 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 794 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 795 * @since 18 796 */ 797 int32_t OH_ArkUI_CustomDialog_SetBorderStyle( 798 ArkUI_CustomDialogOptions* options, int32_t top, int32_t right, int32_t bottom, int32_t left); 799 800 /** 801 * @brief Sets the width of the dialog box background. 802 * 803 * @param options Dialog box parameters. 804 * @param width Width of the background. 805 * @param unit Unit of the width. The default value is vp. 806 * @return Returns the error code. 807 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 808 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 809 * @since 18 810 */ 811 int32_t OH_ArkUI_CustomDialog_SetWidth(ArkUI_CustomDialogOptions* options, float width, ArkUI_LengthMetricUnit unit); 812 813 /** 814 * @brief Sets the height of the dialog box background. 815 * 816 * @param options Dialog box parameters. 817 * @param height Height of the background. 818 * @param unit Unit of the height. The default value is vp. 819 * @return Returns the error code. 820 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 821 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 822 * @since 18 823 */ 824 int32_t OH_ArkUI_CustomDialog_SetHeight(ArkUI_CustomDialogOptions* options, float height, ArkUI_LengthMetricUnit unit); 825 826 /** 827 * @brief Sets the shadow of the dialog box background. 828 * 829 * @param options Dialog box parameters. 830 * @param shadow Shadow style of the background, specified by an enumerated value. 831 * @return Returns the error code. 832 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 833 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 834 * @since 18 835 */ 836 int32_t OH_ArkUI_CustomDialog_SetShadow(ArkUI_CustomDialogOptions* options, ArkUI_ShadowStyle shadow); 837 838 /** 839 * @brief Sets the custom shadow of the dialog box background. 840 * 841 * @param options Dialog box parameters. 842 * @param customShadow Custom shadow parameter. The format is the same as that of the <b>NODE_SHADOW</b> property. 843 * @return Returns the error code. 844 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 845 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 846 * @since 18 847 */ 848 int32_t OH_ArkUI_CustomDialog_SetCustomShadow( 849 ArkUI_CustomDialogOptions* options, const ArkUI_AttributeItem* customShadow); 850 851 /** 852 * @brief Sets the background blur style of the dialog box. 853 * 854 * @param options Dialog box parameters. 855 * @param blurStyle Background blur style, specified by an enumerated value. 856 * @return Returns the error code. 857 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 858 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 859 * @since 18 860 */ 861 int32_t OH_ArkUI_CustomDialog_SetBackgroundBlurStyle(ArkUI_CustomDialogOptions* options, ArkUI_BlurStyle blurStyle); 862 863 /** 864 * @brief Sets the alignment mode of the dialog box. 865 * 866 * @param options Dialog box parameters. 867 * @param alignment Alignment mode of the dialog box. The parameter type is {@link ArkUI_Alignment}. 868 * @param offsetX Indicates the horizontal offset of the custom dialog box. The value is a floating point number. 869 * @param offsetY Indicates the vertical offset of the custom dialog box. The value is a floating point number. 870 * @return Returns the error code. 871 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 872 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 873 * @since 18 874 */ 875 int32_t OH_ArkUI_CustomDialog_SetAlignment( 876 ArkUI_CustomDialogOptions* options, int32_t alignment, float offsetX, float offsetY); 877 878 /** 879 * @brief Sets the modal mode for a custom dialog box. 880 * 881 * @param options Dialog box parameters. 882 * @param isModal Whether the dialog box is a modal. A modal dialog box has a mask applied, 883 * while a non-modal dialog box does not. The value <b>true</b> means that the dialog box is a modal. 884 * @return Returns the error code. 885 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 886 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 887 * @since 18 888 */ 889 int32_t OH_ArkUI_CustomDialog_SetModalMode(ArkUI_CustomDialogOptions* options, bool isModal); 890 891 /** 892 * @brief Specifies whether to allow users to touch the mask to dismiss the custom dialog box. 893 * 894 * @param options Dialog box parameters. 895 * @param autoCancel Specifies whether to allow users to touch the mask to dismiss the dialog box. 896 * The value <b>true</b> means to allow users to do so, and <b>false</b> means the opposite. 897 * @return Returns the error code. 898 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 899 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 900 * @since 18 901 */ 902 int32_t OH_ArkUI_CustomDialog_SetAutoCancel(ArkUI_CustomDialogOptions* options, bool autoCancel); 903 904 /** 905 * @brief Sets whether to display the dialog box in a subwindow. 906 * 907 * @param options Dialog box parameters. 908 * @param isShowInSubwindow Whether to display the dialog box in a subwindow when it is not in the main window. 909 * The default value is <b>false</b>, meaning the dialog box is displayed within the application, not in a 910 * separate subwindow. 911 * @return Returns the error code. 912 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 913 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 914 * @since 18 915 */ 916 int32_t OH_ArkUI_CustomDialog_SetSubwindowMode(ArkUI_CustomDialogOptions* options, bool showInSubwindow); 917 918 /** 919 * @brief Sets the mask for a custom dialog box. 920 * 921 * @param options Dialog box parameters. 922 * @param maskColor Mask color, in 0xargb format. 923 * @param maskRect Pointer to the mask area. Events outside the mask area are transparently transmitted, 924 * and events within the mask area are not. The parameter type is {@link ArkUI_Rect}. 925 * @return Returns the error code. 926 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 927 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 928 * @since 18 929 */ 930 int32_t OH_ArkUI_CustomDialog_SetMask( 931 ArkUI_CustomDialogOptions* options, uint32_t maskColor, const ArkUI_Rect* maskRect); 932 933 /** 934 * @brief Sets the keyboard avoidance mode of the dialog box. 935 * 936 * @param options Dialog box parameters. 937 * @param keyboardAvoidMode Keyboard avoidance mode, specified by an enumerated value. 938 * @return Returns the error code. 939 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 940 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 941 * @since 18 942 */ 943 int32_t OH_ArkUI_CustomDialog_SetKeyboardAvoidMode( 944 ArkUI_CustomDialogOptions* options, ArkUI_KeyboardAvoidMode keyboardAvoidMode); 945 946 /** 947 * @brief Sets whether to enable the hover mode for the dialog box. 948 * 949 * @param options Dialog box parameters. 950 * @param enabled Whether to enable the hover mode. The default value is <b>false</b>. 951 * @return Returns the error code. 952 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 953 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 954 * @since 18 955 */ 956 int32_t OH_ArkUI_CustomDialog_SetHoverModeEnabled(ArkUI_CustomDialogOptions* options, bool enabled); 957 958 /** 959 * @brief Set the default display area of the dialog box in hover mode. 960 * 961 * @param options Dialog box parameters. 962 * @param hoverModeAreaType Display area in hover mode, specified by an enumerated value. 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 18 967 */ 968 int32_t OH_ArkUI_CustomDialog_SetHoverModeArea( 969 ArkUI_CustomDialogOptions* options, ArkUI_HoverModeAreaType hoverModeAreaType); 970 971 /** 972 * @brief Registers a callback for the dismissal event of the custom dialog box. 973 * 974 * @param options Dialog box parameters. 975 * @param userData Pointer to the user-defined data. 976 * @param callback Callback for the dismissal event of the custom dialog box. 977 * @return Returns the error code. 978 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 979 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 980 * @since 18 981 */ 982 int32_t OH_ArkUI_CustomDialog_RegisterOnWillDismissCallback( 983 ArkUI_CustomDialogOptions* options, void* userData, void (*callback)(ArkUI_DialogDismissEvent* event)); 984 985 /** 986 * @brief Registers a callback to be invoked when the custom dialog box is about to appear. 987 * 988 * @param options Dialog box parameters. 989 * @param userData Pointer to the user-defined data. 990 * @param callback Callback to be invoked when the dialog box is about to appear. 991 * @return Returns the error code. 992 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 993 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 994 * @since 18 995 */ 996 int32_t OH_ArkUI_CustomDialog_RegisterOnWillAppearCallback( 997 ArkUI_CustomDialogOptions* options, void* userData, void (*callback)(void* userData)); 998 999 /** 1000 * @brief Registers a callback to be invoked when the custom dialog box appears. 1001 * 1002 * @param options Dialog box parameters. 1003 * @param userData Pointer to the user-defined data. 1004 * @param callback Callback to be invoked when the custom dialog box appears. 1005 * @return Returns the error code. 1006 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 1007 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 1008 * @since 18 1009 */ 1010 int32_t OH_ArkUI_CustomDialog_RegisterOnDidAppearCallback( 1011 ArkUI_CustomDialogOptions* options, void* userData, void (*callback)(void* userData)); 1012 1013 /** 1014 * @brief Registers a callback to be invoked when the custom dialog box is about to disappear. 1015 * 1016 * @param options Dialog box parameters. 1017 * @param userData Pointer to the user-defined data. 1018 * @param callback Callback to be invoked when the dialog box is about to disappear. 1019 * @return Returns the error code. 1020 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 1021 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 1022 * @since 18 1023 */ 1024 int32_t OH_ArkUI_CustomDialog_RegisterOnWillDisappearCallback( 1025 ArkUI_CustomDialogOptions* options, void* userData, void (*callback)(void* userData)); 1026 1027 /** 1028 * @brief Registers a callback to be invoked when the custom dialog box disappears. 1029 * 1030 * @param options Dialog box parameters. 1031 * @param userData Pointer to the user-defined data. 1032 * @param callback Callback to be invoked when the custom dialog box disappears. 1033 * @return Returns the error code. 1034 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 1035 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 1036 * @since 18 1037 */ 1038 int32_t OH_ArkUI_CustomDialog_RegisterOnDidDisappearCallback( 1039 ArkUI_CustomDialogOptions* options, void* userData, void (*callback)(void* userData)); 1040 1041 #ifdef __cplusplus 1042 }; 1043 #endif 1044 1045 #endif // ARKUI_NATIVE_DIALOG_H 1046