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