1/* 2* Copyright (c) 2021 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/// <reference path="../component/common_ts_ets_api.d.ts"/> 17 18import { AsyncCallback, Callback } from './basic' ; 19import BaseContext from './application/BaseContext'; 20import { LocalStorage } from 'StateManagement'; 21import image from './@ohos.multimedia.image'; 22import rpc from './@ohos.rpc'; 23import dialogRequest from "./@ohos.app.ability.dialogRequest"; 24 25/** 26 * Window manager. 27 * @syscap SystemCapability.WindowManager.WindowManager.Core 28 */ 29declare namespace window { 30 /** 31 * The type of a window. 32 * @syscap SystemCapability.WindowManager.WindowManager.Core 33 * @since 7 34 */ 35 enum WindowType { 36 /** 37 * App. 38 * @FAModelOnly 39 */ 40 TYPE_APP, 41 /** 42 * System alert. 43 */ 44 TYPE_SYSTEM_ALERT, 45 /** 46 * Input method. 47 * @systemapi Hide this for inner system use. 48 * @since 9 49 * @StageModelOnly 50 */ 51 TYPE_INPUT_METHOD, 52 /** 53 * Status bar. 54 * @systemapi Hide this for inner system use. 55 * @since 9 56 * @StageModelOnly 57 */ 58 TYPE_STATUS_BAR, 59 /** 60 * Panel. 61 * @systemapi Hide this for inner system use. 62 * @since 9 63 * @StageModelOnly 64 */ 65 TYPE_PANEL, 66 /** 67 * Keyguard. 68 * @systemapi Hide this for inner system use. 69 * @since 9 70 * @StageModelOnly 71 */ 72 TYPE_KEYGUARD, 73 /** 74 * Volume. 75 * @systemapi Hide this for inner system use. 76 * @since 9 77 * @StageModelOnly 78 */ 79 TYPE_VOLUME_OVERLAY, 80 /** 81 * Navigation bar. 82 * @systemapi Hide this for inner system use. 83 * @since 9 84 * @StageModelOnly 85 */ 86 TYPE_NAVIGATION_BAR, 87 /** 88 * Float. 89 * @permission ohos.permission.SYSTEM_FLOAT_WINDOW 90 * @since 9 91 * @StageModelOnly 92 */ 93 TYPE_FLOAT, 94 /** 95 * Wallpaper. 96 * @systemapi Hide this for inner system use. 97 * @since 9 98 * @StageModelOnly 99 */ 100 TYPE_WALLPAPER, 101 /** 102 * Desktop. 103 * @systemapi Hide this for inner system use. 104 * @since 9 105 * @StageModelOnly 106 */ 107 TYPE_DESKTOP, 108 /** 109 * Recent. 110 * @systemapi Hide this for inner system use. 111 * @since 9 112 * @StageModelOnly 113 */ 114 TYPE_LAUNCHER_RECENT, 115 /** 116 * Dock. 117 * @systemapi Hide this for inner system use. 118 * @since 9 119 * @StageModelOnly 120 */ 121 TYPE_LAUNCHER_DOCK, 122 /** 123 * Voice interaction. 124 * @systemapi Hide this for inner system use. 125 * @since 9 126 * @StageModelOnly 127 */ 128 TYPE_VOICE_INTERACTION, 129 /** 130 * Pointer. 131 * @systemapi Hide this for inner system use. 132 * @since 9 133 * @StageModelOnly 134 */ 135 TYPE_POINTER, 136 /** 137 * Float camera. 138 * @systemapi Hide this for inner system use. 139 * @since 9 140 * @StageModelOnly 141 */ 142 TYPE_FLOAT_CAMERA, 143 /** 144 * Dialog. 145 * @systemapi Hide this for inner system use. 146 * @since 9 147 * @StageModelOnly 148 */ 149 TYPE_DIALOG, 150 /** 151 * Screenshot. 152 * @systemapi Hide this for inner system use. 153 * @since 9 154 * @StageModelOnly 155 */ 156 TYPE_SCREENSHOT 157 } 158 159 /** 160 * Describes the type of avoid area 161 * @syscap SystemCapability.WindowManager.WindowManager.Core 162 * @since 7 163 */ 164 enum AvoidAreaType { 165 /** 166 * Default area of the system 167 */ 168 TYPE_SYSTEM, 169 170 /** 171 * Notch 172 */ 173 TYPE_CUTOUT, 174 175 /** 176 * Area for system gesture 177 * @since 9 178 */ 179 TYPE_SYSTEM_GESTURE, 180 181 /** 182 * Area for keyboard 183 * @since 9 184 */ 185 TYPE_KEYBOARD 186 } 187 /** 188 * Describes the window mode of an application 189 * @systemapi Hide this for inner system use. 190 * @since 7 191 */ 192 enum WindowMode { 193 UNDEFINED = 1, 194 FULLSCREEN, 195 PRIMARY, 196 SECONDARY, 197 FLOATING 198 } 199 200 /** 201 * Describes the mode of window layout 202 * @syscap SystemCapability.WindowManager.WindowManager.Core 203 * @systemapi Hide this for inner system use. 204 * @since 9 205 */ 206 enum WindowLayoutMode { 207 /** 208 * CASCADE 209 * @systemapi Hide this for inner system use. 210 * @since 9 211 */ 212 WINDOW_LAYOUT_MODE_CASCADE, 213 /** 214 * TILE 215 * @systemapi Hide this for inner system use. 216 * @since 9 217 */ 218 WINDOW_LAYOUT_MODE_TILE 219 } 220 221 /** 222 * Properties of status bar and navigation bar, it couldn't update automatically 223 * @syscap SystemCapability.WindowManager.WindowManager.Core 224 * @since 6 225 */ 226 interface SystemBarProperties { 227 /** 228 * The color of the status bar. 229 * @since 6 230 */ 231 statusBarColor?: string; 232 233 /** 234 * The light icon of the status bar. 235 * @since 7 236 */ 237 isStatusBarLightIcon?: boolean; 238 239 /** 240 * The content color of the status bar 241 * @since 8 242 */ 243 statusBarContentColor?: string; 244 245 /** 246 * The color of the navigation bar. 247 * @since 6 248 */ 249 navigationBarColor?: string; 250 251 /** 252 * The light icon of the navigation bar. 253 * @since 7 254 */ 255 isNavigationBarLightIcon?: boolean; 256 257 /** 258 * The content color of the navigation bar 259 * @since 8 260 */ 261 navigationBarContentColor?: string; 262 } 263 264 /** 265 * System bar tint of region 266 * @syscap SystemCapability.WindowManager.WindowManager.Core 267 * @systemapi Hide this for inner system use. 268 * @since 8 269 */ 270 interface SystemBarRegionTint { 271 /** 272 * System bar type 273 */ 274 type: WindowType; 275 276 /** 277 * The visibility of system bar 278 */ 279 isEnable?: boolean; 280 281 /** 282 * The region of system bar 283 */ 284 region?: Rect; 285 286 /** 287 * The background color of the system bar. 288 */ 289 backgroundColor?: string; 290 291 /** 292 * The content color of the system bar. 293 */ 294 contentColor?: string 295 } 296 297 /** 298 * System bar tint state for systemui 299 * @syscap SystemCapability.WindowManager.WindowManager.Core 300 * @systemapi Hide this for inner system use. 301 * @since 8 302 */ 303 interface SystemBarTintState { 304 /** 305 * Id of display 306 */ 307 displayId: number; 308 /** 309 * Region tint of systembar 310 */ 311 regionTint: Array<SystemBarRegionTint>; 312 } 313 314 /** 315 * Rectangle 316 * @syscap SystemCapability.WindowManager.WindowManager.Core 317 * @since 7 318 */ 319 interface Rect { 320 left: number; 321 322 top: number; 323 324 width: number; 325 326 height: number; 327 } 328 329 /** 330 * Avoid area 331 * @syscap SystemCapability.WindowManager.WindowManager.Core 332 * @since 7 333 */ 334 interface AvoidArea { 335 /** 336 * Whether avoidArea is visible on screen 337 * @since 9 338 */ 339 visible: boolean; 340 341 /** 342 * Rectangle on the left of the screen 343 */ 344 leftRect: Rect; 345 346 /** 347 * Rectangle on the top of the screen 348 */ 349 topRect: Rect; 350 351 /** 352 * Rectangle on the right of the screen 353 */ 354 rightRect: Rect; 355 356 /** 357 * Rectangle on the bottom of the screen 358 */ 359 bottomRect: Rect; 360 } 361 362 /** 363 * Window size 364 * @syscap SystemCapability.WindowManager.WindowManager.Core 365 * @since 7 366 */ 367 interface Size { 368 /** 369 * The width of the window. 370 */ 371 width: number; 372 373 /** 374 * The height of the window. 375 */ 376 height: number; 377 } 378 379 /** 380 * Properties of window, it couldn't update automatically 381 * @syscap SystemCapability.WindowManager.WindowManager.Core 382 * @since 6 383 */ 384 interface WindowProperties { 385 /** 386 * The position and size of the window 387 * @since 7 388 */ 389 windowRect: Rect; 390 391 /** 392 * Window type 393 * @since 7 394 */ 395 type: WindowType; 396 397 /** 398 * Whether the window is displayed in full screen mode. The default value is false. 399 * @since 6 400 */ 401 isFullScreen: boolean 402 403 /** 404 * Whether the window layout is in full screen mode(whether the window is immersive). The default value is false. 405 * @since 7 406 */ 407 isLayoutFullScreen: boolean 408 409 /** 410 * Whether the window can gain focus. The default value is true 411 * @since 7 412 */ 413 focusable: boolean 414 415 /** 416 * Whether the window is touchable. The default value is false 417 * @since 7 418 */ 419 touchable: boolean 420 421 /** 422 * Brightness value of window. 423 * @since 6 424 */ 425 brightness: number 426 427 /** 428 * The dimbehind value of window. 429 * @since 7 430 * @deprecated since 9 431 */ 432 dimBehindValue: number 433 434 /** 435 * Whether keep screen on. 436 * @since 6 437 */ 438 isKeepScreenOn: boolean 439 440 /** 441 * Whether make window in privacy mode or not. 442 * @since 7 443 */ 444 isPrivacyMode: boolean 445 446 /** 447 * Whether is round corner or not. 448 * @since 7 449 * @deprecated since 9 450 */ 451 isRoundCorner: boolean 452 453 /** 454 * Whether is transparent or not. 455 * @since 7 456 */ 457 isTransparent: boolean 458 459 /** 460 * Window id. 461 * @since 9 462 */ 463 id: number 464 } 465 466 /** 467 * Type of allowing the specified of color space. 468 * @since 8 469 */ 470 enum ColorSpace { 471 /** 472 * Default color space. 473 */ 474 DEFAULT, 475 /** 476 * Wide gamut color space. The specific wide color gamut depends on thr screen. 477 */ 478 WIDE_GAMUT, 479 } 480 /** 481 * Describes the scale Transition Options of window 482 * @syscap SystemCapability.WindowManager.WindowManager.Core 483 * @since 9 484 * @systemapi 485 */ 486 interface ScaleOptions { 487 /** 488 * The scale param of x direction. Default is 1.f 489 * @since 9 490 */ 491 x?: number; 492 493 /** 494 * The scale param of y direction. Default is 1.f 495 * @since 9 496 */ 497 y?: number; 498 499 /** 500 * The scale param of pivot point of x. Default is 0.5f, Interval is 0.f - 1.f 501 * @since 9 502 */ 503 pivotX?: number; 504 505 /** 506 * The scale param of pivot point of y. Default is 0.5f, Interval is 0.f - 1.f 507 * @since 9 508 */ 509 pivotY?: number; 510 } 511 512 /** 513 * Describes the rotate Transition Options of window 514 * @syscap SystemCapability.WindowManager.WindowManager.Core 515 * @since 9 516 * @systemapi 517 */ 518 interface RotateOptions { 519 /** 520 * The rotate degree of x direction. Default value is 0.f 521 * @since 9 522 */ 523 x?: number; 524 525 /** 526 * The rotate degree of y direction. Default value is 0.f 527 * @since 9 528 */ 529 y?: number; 530 531 /** 532 * The rotate degree of z direction. Default value is 0.f 533 * @since 9 534 */ 535 z?: number; 536 537 /** 538 * The param of pivot point of x. Default is 0.5f, Interval is 0.f - 1.f 539 * @since 9 540 */ 541 pivotX?: number; 542 543 /** 544 * The param of pivot point of y. Default is 0.5f, Interval is 0.f - 1.f 545 * @since 9 546 */ 547 pivotY?: number; 548 } 549 550 /** 551 * Describes the translate Transition Options of window 552 * @syscap SystemCapability.WindowManager.WindowManager.Core 553 * @since 9 554 * @systemapi 555 */ 556 interface TranslateOptions { 557 /** 558 * The translate pixel param of x direction. Default is 0.f 559 * @since 9 560 */ 561 x?: number; 562 563 /** 564 * The translate pixel param of y direction. Default is 0.f 565 * @since 9 566 */ 567 y?: number; 568 569 /** 570 * The translate pixel param of z direction. Default is 0.f 571 * @since 9 572 */ 573 z?: number; 574 } 575 576 /** 577 * Transition Context 578 * @syscap SystemCapability.WindowManager.WindowManager.Core 579 * @systemapi 580 * @since 9 581 */ 582 interface TransitionContext { 583 /** 584 * The target window with animation 585 * @since 9 586 */ 587 toWindow: Window 588 589 /** 590 * Set complete state of animation transition 591 * @param isCompleted is Completed if true, or not if false. 592 * @throws {BusinessError} 401 - If param is invalid 593 * @since 9 594 */ 595 completeTransition(isCompleted: boolean): void; 596 } 597 598 /** 599 * Transition Controller 600 * @syscap SystemCapability.WindowManager.WindowManager.Core 601 * @systemapi 602 * @since 9 603 */ 604 interface TransitionController { 605 /** 606 * Animation configuration when showing window 607 * @param context transition Context. 608 * @since 9 609 * @throws {BusinessError} 401 - If param is invalid 610 */ 611 animationForShown(context: TransitionContext): void; 612 /** 613 * Animation configuration when hiding window 614 * @param context transition context. 615 * @since 9 616 * @throws {BusinessError} 401 - If param is invalid 617 */ 618 animationForHidden(context: TransitionContext): void; 619 } 620 621 /** 622 * Configuration parameters for window creation. 623 * @since 9 624 */ 625 interface Configuration { 626 /** 627 * Indicates window id. 628 * @since 9 629 */ 630 name: string 631 632 /** 633 * Indicates window type 634 * @since 9 635 */ 636 windowType: WindowType 637 638 /** 639 * Indicates window context. 640 * @since 9 641 */ 642 ctx?: BaseContext 643 644 /** 645 * Indicates display ID. 646 * @since 9 647 */ 648 displayId?: number 649 650 /** 651 * Indicates Parent window id 652 * @since 9 653 */ 654 parentId?: number 655 } 656 657 /** 658 * Create a window with a specific configuration 659 * @param Configuration Configuration parameters for window creation. 660 * @since 9 661 * @throws {BusinessError} 201 - If there is no permission 662 * @throws {BusinessError} 401 - If param is invalid 663 * @throws {BusinessError} 1300001 - If window has created 664 * @throws {BusinessError} 1300006 - If window context is abnormally 665 */ 666 function createWindow(config: Configuration, callback: AsyncCallback<Window>): void; 667 668 /** 669 * Create a window with a specific configuration 670 * @param Configuration Configuration parameters for window creation. 671 * @since 9 672 * @throws {BusinessError} 201 - If there is no permission 673 * @throws {BusinessError} 401 - If param is invalid 674 * @throws {BusinessError} 1300001 - If window has created 675 * @throws {BusinessError} 1300006 - If window context is abnormally 676 */ 677 function createWindow(config: Configuration): Promise<Window>; 678 679 /** 680 * Create a sub window with a specific id and type, only support 7. 681 * @param id Indicates window id. 682 * @param type Indicates window type. 683 * @since 7 684 * @deprecated since 9 685 * @useinstead ohos.window#createWindow 686 * @FAModelOnly 687 */ 688 function create(id: string, type: WindowType, callback: AsyncCallback<Window>): void; 689 690 /** 691 * Create a sub window with a specific id and type, only support 7. 692 * @param id Indicates window id. 693 * @param type Indicates window type. 694 * @since 7 695 * @deprecated since 9 696 * @useinstead ohos.window#createWindow 697 * @FAModelOnly 698 */ 699 function create(id: string, type: WindowType): Promise<Window>; 700 701 /** 702 * Create a system or float window with a specific id and type. 703 * @param ctx Indicates the context on which the window depends 704 * @param id Indicates window id. 705 * @param type Indicates window type. 706 * @since 8 707 * @deprecated since 9 708 * @useinstead ohos.window#createWindow 709 */ 710 function create(ctx: BaseContext, id: string, type: WindowType): Promise<Window>; 711 712 /** 713 * Create a system or float window with a specific id and type. 714 * @param ctx Indicates the context on which the window depends 715 * @param id Indicates window id. 716 * @param type Indicates window type. 717 * @since 8 718 * @deprecated since 9 719 * @useinstead ohos.window#createWindow 720 */ 721 function create(ctx: BaseContext, id: string, type: WindowType, callback: AsyncCallback<Window>): void; 722 723 /** 724 * Find the window by id. 725 * @param id Indicates window id. 726 * @since 7 727 * @deprecated since 9 728 * @useinstead ohos.window#findWindow 729 */ 730 function find(id: string, callback: AsyncCallback<Window>): void; 731 732 /** 733 * Find the window by id. 734 * @param id Indicates window id. 735 * @since 7 736 * @deprecated since 9 737 * @useinstead ohos.window#findWindow 738 */ 739 function find(id: string): Promise<Window>; 740 741 /** 742 * Find the window by name. 743 * @param name Indicates window name. 744 * @throws {BusinessError} 401 - If param is invalid 745 * @since 9 746 */ 747 function findWindow(name: string): Window; 748 749 /** 750 * Get the final show window. 751 * @param id Indicates window id. 752 * @since 6 753 * @deprecated since 9 754 * @useinstead ohos.window#getLastWindow 755 * @FAModelOnly 756 */ 757 function getTopWindow(callback: AsyncCallback<Window>): void; 758 759 /** 760 * Get the final show window. 761 * @since 6 762 * @deprecated since 9 763 * @useinstead ohos.window#getLastWindow 764 * @FAModelOnly 765 */ 766 function getTopWindow(): Promise<Window>; 767 768 /** 769 * Get the final show window. 770 * @param ctx Indicates the context on which the window depends 771 * @since 8 772 * @deprecated since 9 773 * @useinstead ohos.window#getLastWindow 774 */ 775 function getTopWindow(ctx: BaseContext): Promise<Window>; 776 777 /** 778 * Get the final show window. 779 * @param ctx Indicates the context on which the window depends 780 * @since 8 781 * @deprecated since 9 782 * @useinstead ohos.window#getLastWindow 783 */ 784 function getTopWindow(ctx: BaseContext, callback: AsyncCallback<Window>): void; 785 786 /** 787 * Get the final show window. 788 * @param ctx Indicates the context on which the window depends. 789 * @throws {BusinessError} 401 - If param is invalid 790 * @throws {BusinessError} 1300002 - If window state is abnormally 791 * @throws {BusinessError} 1300006 - If window context is abnormally 792 * @since 9 793 */ 794 function getLastWindow(ctx: BaseContext, callback: AsyncCallback<Window>): void; 795 796 /** 797 * Get the final show window. 798 * @throws {BusinessError} 401 - If param is invalid 799 * @throws {BusinessError} 1300002 - If window state is abnormally 800 * @throws {BusinessError} 1300006 - If window context is abnormally 801 * @since 9 802 */ 803 function getLastWindow(ctx: BaseContext): Promise<Window>; 804 805 /** 806 * Minimize all app windows. 807 * @systemapi Hide this for inner system use. 808 * @throws {BusinessError} 401 - If param is invalid 809 * @throws {BusinessError} 1300003 - If system state is abnormally 810 * @since 9 811 */ 812 function minimizeAll(id: number, callback: AsyncCallback<void>): void; 813 814 /** 815 * Minimize all app windows. 816 * @systemapi Hide this for inner system use. 817 * @throws {BusinessError} 401 - If param is invalid 818 * @throws {BusinessError} 1300003 - If system state is abnormally 819 * @since 9 820 */ 821 function minimizeAll(id: number): Promise<void>; 822 823 /** 824 * Toggle shown state for all app windows. Minimize or restore all app windows. 825 * @throws {BusinessError} 1300003 - If system state is abnormally 826 * @systemapi Hide this for inner system use. 827 * @since 9 828 */ 829 function toggleShownStateForAllAppWindows(callback: AsyncCallback<void>): void; 830 831 /** 832 * Toggle shown state for all app windows. Minimize or restore all app windows. 833 * @throws {BusinessError} 1300003 - If system state is abnormally 834 * @systemapi Hide this for inner system use. 835 * @since 9 836 */ 837 function toggleShownStateForAllAppWindows(): Promise<void>; 838 839 /** 840 * Set the layout mode of a window. 841 * @param mode the layout mode of a window. 842 * @systemapi Hide this for inner system use. 843 * @throws {BusinessError} 401 - If param is invalid 844 * @throws {BusinessError} 1300003 - If system state is abnormally 845 * @since 9 846 */ 847 function setWindowLayoutMode(mode: WindowLayoutMode, callback: AsyncCallback<void>): void; 848 849 /** 850 * Set the layout mode of a window. 851 * @param mode the layout mode of a window. 852 * @systemapi Hide this for inner system use. 853 * @throws {BusinessError} 401 - If param is invalid 854 * @throws {BusinessError} 1300003 - If system state is abnormally 855 * @since 9 856 */ 857 function setWindowLayoutMode(mode: WindowLayoutMode): Promise<void>; 858 859 /** 860 * Register the callback of systemBarTintChange 861 * @param type: 'systemBarTintChange' 862 * @systemapi Hide this for inner system use. 863 * @throws {BusinessError} 401 - If param is invalid 864 * @since 8 865 */ 866 function on(type: 'systemBarTintChange', callback: Callback<SystemBarTintState>): void; 867 868 /** 869 * Unregister the callback of systemBarTintChange 870 * @param type: 'systemBarTintChange' 871 * @systemapi Hide this for inner system use. 872 * @throws {BusinessError} 401 - If param is invalid 873 * @since 8 874 */ 875 function off(type: 'systemBarTintChange', callback?: Callback<SystemBarTintState>): void; 876 877 /** 878 * Display orientation 879 * @syscap SystemCapability.WindowManager.WindowManager.Core 880 * @since 9 881 */ 882 enum Orientation { 883 /** 884 * Default value. The direction mode is not clearly defined. It is determined by the system. 885 * @since 9 886 */ 887 UNSPECIFIED = 0, 888 889 /** 890 * Display in portrait orientation. 891 * @since 9 892 */ 893 PORTRAIT = 1, 894 895 /** 896 * Display in landscape orientation. 897 * @since 9 898 */ 899 LANDSCAPE = 2, 900 901 /** 902 * Display in inverted portrait orientation. 903 * @since 9 904 */ 905 PORTRAIT_INVERTED = 3, 906 907 /** 908 * Display in inverted landscape orientation. 909 * @since 9 910 */ 911 LANDSCAPE_INVERTED = 4, 912 913 /** 914 * Follow the rotation of the sensor, ignore auto rotation lock. 915 * @since 9 916 */ 917 AUTO_ROTATION = 5, 918 919 /** 920 * Follow the rotation of the sensor, only work in the vertical direction, ignore auto rotation lock. 921 * @since 9 922 */ 923 AUTO_ROTATION_PORTRAIT = 6, 924 925 /** 926 * Follow the rotation of the sensor, only work in the horizontal direction, ignore auto rotation lock. 927 * @since 9 928 */ 929 AUTO_ROTATION_LANDSCAPE = 7, 930 931 /** 932 * Follow the rotation of the sensor, controlled by auto rotation lock. 933 * @since 9 934 */ 935 AUTO_ROTATION_RESTRICTED = 8, 936 937 /** 938 * Follow the rotation of the sensor, only work in the vertical direction, controlled by auto rotation lock. 939 * @since 9 940 */ 941 AUTO_ROTATION_PORTRAIT_RESTRICTED = 9, 942 943 /** 944 * Follow the rotation of the sensor, only work in the horizontal direction, controlled by auto rotation lock. 945 * @since 9 946 */ 947 AUTO_ROTATION_LANDSCAPE_RESTRICTED = 10, 948 949 /** 950 * Locked mode, keep the same direction as previous one. 951 * @since 9 952 */ 953 LOCKED = 11, 954 } 955 956 /** 957 * Type of blur style 958 * @syscap SystemCapability.WindowManager.WindowManager.Core 959 * @systemapi Hide this for inner system use. 960 * @since 9 961 */ 962 enum BlurStyle { 963 /** 964 * Close blur. 965 * @since 9 966 */ 967 OFF, 968 /** 969 * Blur style thin. 970 * @since 9 971 */ 972 THIN, 973 /** 974 * Blur style regular. 975 * @since 9 976 */ 977 REGULAR, 978 /** 979 * Blur style thick. 980 * @since 9 981 */ 982 THICK, 983 } 984 985 interface Window { 986 /** 987 * Hide window. 988 * @throws {BusinessError} 1300002 - If window state is abnormally 989 * @systemapi Hide this for inner system use. 990 * @since 7 991 */ 992 hide (callback: AsyncCallback<void>): void; 993 994 /** 995 * Hide window. 996 * @throws {BusinessError} 1300002 - If window state is abnormally 997 * @systemapi Hide this for inner system use. 998 * @since 7 999 */ 1000 hide(): Promise<void>; 1001 1002 /** 1003 * Hide window with animation. 1004 * @throws {BusinessError} 1300002 - If window state is abnormally 1005 * @throws {BusinessError} 1300003 - If system state is abnormally 1006 * @throws {BusinessError} 1300004 - If this window can not showWithAnimation 1007 * @since 9 1008 * @systemapi 1009 */ 1010 hideWithAnimation(callback: AsyncCallback<void>): void; 1011 1012 /** 1013 * Hide window with animation. 1014 * @throws {BusinessError} 1300002 - If window state is abnormally 1015 * @throws {BusinessError} 1300003 - If system state is abnormally 1016 * @throws {BusinessError} 1300004 - If this window can not showWithAnimation 1017 * @since 9 1018 * @systemapi 1019 */ 1020 hideWithAnimation(): Promise<void>; 1021 1022 /** 1023 * Show window. 1024 * @since 7 1025 * @deprecated since 9 1026 * @useinstead ohos.window.Window#showWindow 1027 */ 1028 show(callback: AsyncCallback<void>): void; 1029 1030 /** 1031 * Show window. 1032 * @since 7 1033 * @deprecated since 9 1034 * @useinstead ohos.window.Window#showWindow 1035 */ 1036 show(): Promise<void>; 1037 1038 /** 1039 * Show window. 1040 * @throws {BusinessError} 1300002 - If window state is abnormally 1041 * @since 9 1042 */ 1043 showWindow(callback: AsyncCallback<void>): void; 1044 1045 /** 1046 * Show window. 1047 * @throws {BusinessError} 1300002 - If window state is abnormally 1048 * @since 9 1049 */ 1050 showWindow(): Promise<void>; 1051 1052 /** 1053 * Show window with animation. 1054 * @throws {BusinessError} 1300002 - If window state is abnormally 1055 * @throws {BusinessError} 1300003 - If system state is abnormally 1056 * @throws {BusinessError} 1300004 - If this window can not showWithAnimation 1057 * @since 9 1058 * @systemapi 1059 */ 1060 showWithAnimation(callback: AsyncCallback<void>): void; 1061 1062 /** 1063 * Show window with animation. 1064 * @throws {BusinessError} 1300002 - If window state is abnormally 1065 * @throws {BusinessError} 1300003 - If system state is abnormally 1066 * @throws {BusinessError} 1300004 - If this window can not showWithAnimation 1067 * @since 9 1068 * @systemapi 1069 */ 1070 showWithAnimation(): Promise<void>; 1071 1072 /** 1073 * Destroy the window. 1074 * @since 7 1075 * @deprecated since 9 1076 * @useinstead ohos.window.Window#destroyWindow 1077 */ 1078 destroy(callback: AsyncCallback<void>): void; 1079 1080 /** 1081 * Destroy the window. 1082 * @since 7 1083 * @deprecated since 9 1084 * @useinstead ohos.window.Window#destroyWindow 1085 */ 1086 destroy(): Promise<void>; 1087 1088 /** 1089 * Destroy the window. 1090 * @throws {BusinessError} 1300002 - If window state is abnormally 1091 * @throws {BusinessError} 1300003 - If system state is abnormally 1092 * @since 9 1093 */ 1094 destroyWindow(callback: AsyncCallback<void>): void; 1095 1096 /** 1097 * Destroy the window. 1098 * @throws {BusinessError} 1300002 - If window state is abnormally 1099 * @throws {BusinessError} 1300003 - If system state is abnormally 1100 * @since 9 1101 */ 1102 destroyWindow(): Promise<void>; 1103 1104 /** 1105 * Set the position of a window. 1106 * @param x Indicate the X-coordinate of the window. 1107 * @param y Indicate the Y-coordinate of the window. 1108 * @syscap SystemCapability.WindowManager.WindowManager.Core 1109 * @since 7 1110 * @deprecated since 9 1111 * @useinstead ohos.window.Window#moveWindowTo 1112 */ 1113 moveTo(x: number, y: number): Promise<void>; 1114 1115 /** 1116 * Set the position of a window. 1117 * @param x Indicate the X-coordinate of the window. 1118 * @param y Indicate the Y-coordinate of the window. 1119 * @syscap SystemCapability.WindowManager.WindowManager.Core 1120 * @since 7 1121 * @deprecated since 9 1122 * @useinstead ohos.window.Window#moveWindowTo 1123 */ 1124 moveTo(x: number, y: number, callback: AsyncCallback<void>): void; 1125 1126 /** 1127 * Set the position of a window. 1128 * @param x Indicate the X-coordinate of the window. 1129 * @param y Indicate the Y-coordinate of the window. 1130 * @throws {BusinessError} 401 - If param is invalid 1131 * @throws {BusinessError} 1300002 - If window state is abnormally 1132 * @throws {BusinessError} 1300003 - If system state is abnormally 1133 * @syscap SystemCapability.WindowManager.WindowManager.Core 1134 * @since 9 1135 */ 1136 moveWindowTo(x: number, y: number): Promise<void>; 1137 1138 /** 1139 * Set the position of a window. 1140 * @param x Indicate the X-coordinate of the window. 1141 * @param y Indicate the Y-coordinate of the window. 1142 * @throws {BusinessError} 401 - If param is invalid 1143 * @throws {BusinessError} 1300002 - If window state is abnormally 1144 * @throws {BusinessError} 1300003 - If system state is abnormally 1145 * @syscap SystemCapability.WindowManager.WindowManager.Core 1146 * @since 9 1147 */ 1148 moveWindowTo(x: number, y: number, callback: AsyncCallback<void>): void; 1149 1150 /** 1151 * Set the size of a window . 1152 * @param width Indicates the width of the window. 1153 * @param height Indicates the height of the window. 1154 * @syscap SystemCapability.WindowManager.WindowManager.Core 1155 * @since 7 1156 * @deprecated since 9 1157 * @useinstead ohos.window.Window#resize 1158 */ 1159 resetSize(width: number, height: number): Promise<void>; 1160 1161 /** 1162 * Set the size of a window . 1163 * @param width Indicates the width of the window. 1164 * @param height Indicates the height of the window. 1165 * @syscap SystemCapability.WindowManager.WindowManager.Core 1166 * @since 7 1167 * @deprecated since 9 1168 * @useinstead ohos.window.Window#resize 1169 */ 1170 resetSize(width: number, height: number, callback: AsyncCallback<void>): void; 1171 1172 /** 1173 * Set the size of a window . 1174 * @param width Indicates the width of the window. 1175 * @param height Indicates the height of the window. 1176 * @throws {BusinessError} 401 - If param is invalid 1177 * @throws {BusinessError} 1300002 - If window state is abnormally 1178 * @throws {BusinessError} 1300003 - If system state is abnormally 1179 * @syscap SystemCapability.WindowManager.WindowManager.Core 1180 * @since 9 1181 */ 1182 resize(width: number, height: number): Promise<void>; 1183 1184 /** 1185 * Set the size of a window . 1186 * @param width Indicates the width of the window. 1187 * @param height Indicates the height of the window. 1188 * @throws {BusinessError} 401 - If param is invalid 1189 * @throws {BusinessError} 1300002 - If window state is abnormally 1190 * @throws {BusinessError} 1300003 - If system state is abnormally 1191 * @syscap SystemCapability.WindowManager.WindowManager.Core 1192 * @since 9 1193 */ 1194 resize(width: number, height: number, callback: AsyncCallback<void>): void; 1195 1196 /** 1197 * Set the type of a window. 1198 * @param type Indicate the type of a window. 1199 * @syscap SystemCapability.WindowManager.WindowManager.Core 1200 * @systemapi Hide this for inner system use. 1201 * @since 7 1202 * @deprecated since 9 1203 */ 1204 setWindowType(type: WindowType): Promise<void>; 1205 1206 /** 1207 * Set the type of a window. 1208 * @param type Indicate the type of a window. 1209 * @syscap SystemCapability.WindowManager.WindowManager.Core 1210 * @systemapi Hide this for inner system use. 1211 * @since 7 1212 * @deprecated since 9 1213 */ 1214 setWindowType(type: WindowType, callback: AsyncCallback<void>): void; 1215 1216 /** 1217 * Set the mode of a window. 1218 * @param mode Indicate the mode of a window. 1219 * @throws {BusinessError} 401 - If param is invalid 1220 * @throws {BusinessError} 1300002 - If window state is abnormally 1221 * @throws {BusinessError} 1300003 - If system state is abnormally 1222 * @syscap SystemCapability.WindowManager.WindowManager.Core 1223 * @systemapi Hide this for inner system use. 1224 * @since 9 1225 */ 1226 setWindowMode(mode: WindowMode): Promise<void>; 1227 1228 /** 1229 * Set the mode of a window. 1230 * @param mode Indicate the mode of a window. 1231 * @throws {BusinessError} 401 - If param is invalid 1232 * @throws {BusinessError} 1300002 - If window state is abnormally 1233 * @throws {BusinessError} 1300003 - If system state is abnormally 1234 * @syscap SystemCapability.WindowManager.WindowManager.Core 1235 * @systemapi Hide this for inner system use. 1236 * @since 9 1237 */ 1238 setWindowMode(mode: WindowMode, callback: AsyncCallback<void>): void; 1239 1240 /** 1241 * Get the properties of current window 1242 * @syscap SystemCapability.WindowManager.WindowManager.Core 1243 * @since 6 1244 * @deprecated since 9 1245 * @useinstead ohos.window.Window#getWindowProperties 1246 */ 1247 getProperties(callback: AsyncCallback<WindowProperties>): void; 1248 1249 /** 1250 * Get the properties of current window 1251 * @syscap SystemCapability.WindowManager.WindowManager.Core 1252 * @since 6 1253 * @deprecated since 9 1254 * @useinstead ohos.window.Window#getWindowProperties 1255 */ 1256 getProperties(): Promise<WindowProperties>; 1257 1258 /** 1259 * Get the properties of current window 1260 * @throws {BusinessError} 1300002 - If window state is abnormally 1261 * @syscap SystemCapability.WindowManager.WindowManager.Core 1262 * @since 9 1263 */ 1264 getWindowProperties(): WindowProperties; 1265 1266 /** 1267 * Get the avoid area 1268 * @param type Type of the area 1269 * @since 7 1270 * @deprecated since 9 1271 * @useinstead ohos.window.Window#getWindowAvoidArea 1272 */ 1273 getAvoidArea(type: AvoidAreaType, callback: AsyncCallback<AvoidArea>): void; 1274 1275 /** 1276 * Get the avoid area 1277 * @param type Type of the area 1278 * @since 7 1279 * @deprecated since 9 1280 * @useinstead ohos.window.Window#getWindowAvoidArea 1281 */ 1282 getAvoidArea(type: AvoidAreaType): Promise<AvoidArea>; 1283 1284 /** 1285 * Get the avoid area 1286 * @param type Type of the area 1287 * @throws {BusinessError} 401 - If param is invalid 1288 * @throws {BusinessError} 1300002 - If window state is abnormally 1289 * @since 9 1290 */ 1291 getWindowAvoidArea(type: AvoidAreaType): AvoidArea; 1292 1293 /** 1294 * Set the flag of the window is shown full screen 1295 * @param isFullScreen the flag of the window is shown full screen 1296 * @syscap SystemCapability.WindowManager.WindowManager.Core 1297 * @since 6 1298 * @deprecated since 9 1299 * @useinstead ohos.window.Window#setWindowSystemBarEnable 1300 */ 1301 setFullScreen(isFullScreen: boolean, callback: AsyncCallback<void>): void; 1302 1303 /** 1304 * Set the flag of the window is shown full screen 1305 * @param isFullScreen the flag of the window is shown full screen 1306 * @syscap SystemCapability.WindowManager.WindowManager.Core 1307 * @since 6 1308 * @deprecated since 9 1309 * @useinstead ohos.window.Window#setWindowSystemBarEnable 1310 */ 1311 setFullScreen(isFullScreen: boolean): Promise<void>; 1312 1313 /** 1314 * Set the property of the window can layout in full screen 1315 * @param isLayoutFullScreen the window can layout in full screen 1316 * @syscap SystemCapability.WindowManager.WindowManager.Core 1317 * @since 7 1318 * @deprecated since 9 1319 * @useinstead ohos.window.Window#setWindowLayoutFullScreen 1320 */ 1321 setLayoutFullScreen(isLayoutFullScreen: boolean, callback: AsyncCallback<void>): void; 1322 1323 /** 1324 * Set the property of the window can layout in full screen 1325 * @param isLayoutFullScreen the window can layout in full screen 1326 * @syscap SystemCapability.WindowManager.WindowManager.Core 1327 * @since 7 1328 * @deprecated since 9 1329 * @useinstead ohos.window.Window#setWindowLayoutFullScreen 1330 */ 1331 setLayoutFullScreen(isLayoutFullScreen: boolean): Promise<void>; 1332 1333 /** 1334 * Set the property of the window can layout in full screen 1335 * @param isLayoutFullScreen the window can layout in full screen 1336 * @syscap SystemCapability.WindowManager.WindowManager.Core 1337 * @throws {BusinessError} 401 - If param is invalid 1338 * @throws {BusinessError} 1300002 - If window state is abnormally 1339 * @throws {BusinessError} 1300003 - If system state is abnormally 1340 * @since 9 1341 */ 1342 setWindowLayoutFullScreen(isLayoutFullScreen: boolean, callback: AsyncCallback<void>): void; 1343 1344 /** 1345 * Set the property of the window can layout in full screen 1346 * @param isLayoutFullScreen the window can layout in full screen 1347 * @syscap SystemCapability.WindowManager.WindowManager.Core 1348 * @throws {BusinessError} 401 - If param is invalid 1349 * @throws {BusinessError} 1300002 - If window state is abnormally 1350 * @throws {BusinessError} 1300003 - If system state is abnormally 1351 * @since 9 1352 */ 1353 setWindowLayoutFullScreen(isLayoutFullScreen: boolean): Promise<void>; 1354 1355 /** 1356 * Set the system bar to have visible. 1357 * @param names the set of system bar 1358 * @syscap SystemCapability.WindowManager.WindowManager.Core 1359 * @since 7 1360 * @deprecated since 9 1361 * @useinstead ohos.window.Window#setWindowSystemBarEnable 1362 */ 1363 setSystemBarEnable(names: Array<'status'|'navigation'>, callback: AsyncCallback<void>): void; 1364 1365 /** 1366 * Set the system bar to have visible. 1367 * @param names the set of system bar 1368 * @syscap SystemCapability.WindowManager.WindowManager.Core 1369 * @since 7 1370 * @deprecated since 9 1371 * @useinstead ohos.window.Window#setWindowSystemBarEnable 1372 */ 1373 setSystemBarEnable(names: Array<'status'|'navigation'>): Promise<void>; 1374 1375 /** 1376 * Set the system bar to have visible. 1377 * @param names the set of system bar 1378 * @syscap SystemCapability.WindowManager.WindowManager.Core 1379 * @throws {BusinessError} 401 - If param is invalid 1380 * @throws {BusinessError} 1300002 - If window state is abnormally 1381 * @throws {BusinessError} 1300003 - If system state is abnormally 1382 * @since 9 1383 */ 1384 setWindowSystemBarEnable(names: Array<'status'|'navigation'>, callback: AsyncCallback<void>): void; 1385 1386 /** 1387 * Set the system bar to have visible. 1388 * @param names the set of system bar 1389 * @syscap SystemCapability.WindowManager.WindowManager.Core 1390 * @throws {BusinessError} 401 - If param is invalid 1391 * @throws {BusinessError} 1300002 - If window state is abnormally 1392 * @throws {BusinessError} 1300003 - If system state is abnormally 1393 * @since 9 1394 */ 1395 setWindowSystemBarEnable(names: Array<'status'|'navigation'>): Promise<void>; 1396 1397 /** 1398 * Set the properties of system bar 1399 * @param systemBarProperties the properties of system bar 1400 * @syscap SystemCapability.WindowManager.WindowManager.Core 1401 * @since 6 1402 * @deprecated since 9 1403 * @useinstead ohos.window.Window#setWindowSystemBarProperties 1404 */ 1405 setSystemBarProperties(systemBarProperties: SystemBarProperties, callback: AsyncCallback<void>): void; 1406 1407 /** 1408 * Set the properties of system bar 1409 * @param systemBarProperties the properties of system bar 1410 * @syscap SystemCapability.WindowManager.WindowManager.Core 1411 * @since 6 1412 * @deprecated since 9 1413 * @useinstead ohos.window.Window#setWindowSystemBarProperties 1414 */ 1415 setSystemBarProperties(systemBarProperties: SystemBarProperties): Promise<void>; 1416 1417 /** 1418 * Set the properties of system bar 1419 * @param systemBarProperties the properties of system bar 1420 * @syscap SystemCapability.WindowManager.WindowManager.Core 1421 * @throws {BusinessError} 401 - If param is invalid 1422 * @throws {BusinessError} 1300002 - If window state is abnormally 1423 * @throws {BusinessError} 1300003 - If system state is abnormally 1424 * @since 9 1425 */ 1426 setWindowSystemBarProperties(systemBarProperties: SystemBarProperties, callback: AsyncCallback<void>): void; 1427 1428 /** 1429 * Set the properties of system bar 1430 * @param systemBarProperties the properties of system bar 1431 * @syscap SystemCapability.WindowManager.WindowManager.Core 1432 * @throws {BusinessError} 401 - If param is invalid 1433 * @throws {BusinessError} 1300002 - If window state is abnormally 1434 * @throws {BusinessError} 1300003 - If system state is abnormally 1435 * @since 9 1436 */ 1437 setWindowSystemBarProperties(systemBarProperties: SystemBarProperties): Promise<void>; 1438 1439 /** 1440 * Set the preferred orientation config of the window 1441 * @param orientation the orientation config of the window 1442 * @syscap SystemCapability.WindowManager.WindowManager.Core 1443 * @throws {BusinessError} 401 - If param is invalid 1444 * @throws {BusinessError} 1300002 - If window state is abnormally 1445 * @since 9 1446 */ 1447 setPreferredOrientation(orientation: Orientation): Promise<void>; 1448 1449 /** 1450 * Set the preferred orientation config of the window 1451 * @param orientation the orientation config of the window 1452 * @syscap SystemCapability.WindowManager.WindowManager.Core 1453 * @throws {BusinessError} 401 - If param is invalid 1454 * @throws {BusinessError} 1300002 - If window state is abnormally 1455 * @since 9 1456 */ 1457 setPreferredOrientation(orientation: Orientation, callback: AsyncCallback<void>): void; 1458 1459 /** 1460 * Loads content 1461 * @param path path Path of the page to which the content will be loaded 1462 * @param storage storage The data object shared within the content instance loaded by the window 1463 * @syscap SystemCapability.WindowManager.WindowManager.Core 1464 * @throws {BusinessError} 401 - If param is invalid 1465 * @throws {BusinessError} 1300002 - If window state is abnormally 1466 * @throws {BusinessError} 1300003 - If system state is abnormally 1467 * @since 9 1468 * @StageModelOnly 1469 */ 1470 loadContent(path: string, storage: LocalStorage, callback: AsyncCallback<void>): void; 1471 1472 /** 1473 * Loads content 1474 * @param path path of the page to which the content will be loaded 1475 * @param storage storage The data object shared within the content instance loaded by the window 1476 * @syscap SystemCapability.WindowManager.WindowManager.Core 1477 * @throws {BusinessError} 401 - If param is invalid 1478 * @throws {BusinessError} 1300002 - If window state is abnormally 1479 * @throws {BusinessError} 1300003 - If system state is abnormally 1480 * @since 9 1481 * @StageModelOnly 1482 */ 1483 loadContent(path: string, storage: LocalStorage): Promise<void>; 1484 1485 /** 1486 * Loads content 1487 * @param path path of the page to which the content will be loaded 1488 * @syscap SystemCapability.WindowManager.WindowManager.Core 1489 * @since 7 1490 * @deprecated since 9 1491 * @useinstead ohos.window.Window#setUIContent 1492 */ 1493 loadContent(path: string, callback: AsyncCallback<void>): void; 1494 1495 /** 1496 * Loads content 1497 * @param path path of the page to which the content will be loaded 1498 * @syscap SystemCapability.WindowManager.WindowManager.Core 1499 * @since 7 1500 * @deprecated since 9 1501 * @useinstead ohos.window.Window#setUIContent 1502 */ 1503 loadContent(path: string): Promise<void>; 1504 1505 /** 1506 * Loads content 1507 * @param path path of the page to which the content will be loaded 1508 * @syscap SystemCapability.WindowManager.WindowManager.Core 1509 * @throws {BusinessError} 401 - If param is invalid 1510 * @throws {BusinessError} 1300002 - If window state is abnormally 1511 * @throws {BusinessError} 1300003 - If system state is abnormally 1512 * @since 9 1513 */ 1514 setUIContent(path: string, callback: AsyncCallback<void>): void; 1515 1516 /** 1517 * Loads content 1518 * @param path path of the page to which the content will be loaded 1519 * @syscap SystemCapability.WindowManager.WindowManager.Core 1520 * @throws {BusinessError} 401 - If param is invalid 1521 * @throws {BusinessError} 1300002 - If window state is abnormally 1522 * @throws {BusinessError} 1300003 - If system state is abnormally 1523 * @since 9 1524 */ 1525 setUIContent(path: string): Promise<void>; 1526 1527 /** 1528 * Checks whether the window is displayed 1529 * @syscap SystemCapability.WindowManager.WindowManager.Core 1530 * @since 7 1531 * @deprecated since 9 1532 * @useinstead ohos.window.Window#isWindowShowing 1533 */ 1534 isShowing(callback: AsyncCallback<boolean>): void; 1535 1536 /** 1537 * Checks whether the window is displayed 1538 * @syscap SystemCapability.WindowManager.WindowManager.Core 1539 * @since 7 1540 * @deprecated since 9 1541 * @useinstead ohos.window.Window#isWindowShowing 1542 */ 1543 isShowing(): Promise<boolean>; 1544 1545 /** 1546 * Checks whether the window is displayed 1547 * @throws {BusinessError} 1300002 - If window state is abnormally 1548 * @syscap SystemCapability.WindowManager.WindowManager.Core 1549 * @since 9 1550 */ 1551 isWindowShowing(): boolean; 1552 1553 /** 1554 * Register the callback of windowSizeChange 1555 * @param type: 'windowSizeChange' 1556 * @throws {BusinessError} 401 - If param is invalid 1557 * @syscap SystemCapability.WindowManager.WindowManager.Core 1558 * @since 7 1559 */ 1560 on(type: 'windowSizeChange', callback: Callback<Size>): void; 1561 1562 /** 1563 * Unregister the callback of windowSizeChange 1564 * @param type: 'windowSizeChange' 1565 * @throws {BusinessError} 401 - If param is invalid 1566 * @syscap SystemCapability.WindowManager.WindowManager.Core 1567 * @since 7 1568 */ 1569 off(type: 'windowSizeChange', callback?: Callback<Size>): void; 1570 1571 /** 1572 * Register the callback of systemAvoidAreaChange 1573 * @param type: 'systemAvoidAreaChange' 1574 * @syscap SystemCapability.WindowManager.WindowManager.Core 1575 * @since 7 1576 * @deprecated since 9 1577 * @useinstead ohos.window.Window#on_avoidAreaChange 1578 */ 1579 on(type: 'systemAvoidAreaChange', callback: Callback<AvoidArea>): void; 1580 1581 /** 1582 * Unregister the callback of systemAvoidAreaChange 1583 * @param type: 'systemAvoidAreaChange' 1584 * @syscap SystemCapability.WindowManager.WindowManager.Core 1585 * @since 7 1586 * @deprecated since 9 1587 * @useinstead ohos.window.Window#off_avoidAreaChange 1588 */ 1589 off(type: 'systemAvoidAreaChange', callback?: Callback<AvoidArea>): void; 1590 1591 /** 1592 * Register the callback of avoidAreaChange 1593 * @param type: 'avoidAreaChange' 1594 * @throws {BusinessError} 401 - If param is invalid 1595 * @syscap SystemCapability.WindowManager.WindowManager.Core 1596 * @since 9 1597 */ 1598 on(type: 'avoidAreaChange', callback: Callback<{ type: AvoidAreaType, area: AvoidArea }>): void; 1599 1600 /** 1601 * Unregister the callback of avoidAreaChange 1602 * @param type: 'avoidAreaChange' 1603 * @throws {BusinessError} 401 - If param is invalid 1604 * @syscap SystemCapability.WindowManager.WindowManager.Core 1605 * @since 9 1606 */ 1607 off(type: 'avoidAreaChange', callback?: Callback<{ type: AvoidAreaType, area: AvoidArea }>): void; 1608 1609 /** 1610 * Register the callback of keyboardHeightChange 1611 * @param type: 'keyboardHeightChange' 1612 * @syscap SystemCapability.WindowManager.WindowManager.Core 1613 * @since 7 1614 * @throws {BusinessError} 401 - If param is invalid 1615 */ 1616 on(type: 'keyboardHeightChange', callback: Callback<number>): void; 1617 1618 /** 1619 * Unregister the callback of keyboardHeightChange 1620 * @param type: 'keyboardHeightChange' 1621 * @syscap SystemCapability.WindowManager.WindowManager.Core 1622 * @since 7 1623 * @throws {BusinessError} 401 - If param is invalid 1624 */ 1625 off(type: 'keyboardHeightChange', callback?: Callback<number>): void; 1626 1627 /** 1628 * Touch outside callback on. 1629 * @throws {BusinessError} 401 - If param is invalid 1630 * @systemapi Hide this for inner system use. 1631 * @since 9 1632 */ 1633 on(type: 'touchOutside', callback: Callback<void>): void; 1634 1635 /** 1636 * Touch outside callback off. 1637 * @throws {BusinessError} 401 - If param is invalid 1638 * @systemapi Hide this for inner system use. 1639 * @since 9 1640 */ 1641 off(type: 'touchOutside', callback?: Callback<void>): void; 1642 1643 /** 1644 * Register the callback of screenshot, only the focused window called back 1645 * @param type: 'screenshot' 1646 * @throws {BusinessError} 401 - If param is invalid 1647 * @syscap SystemCapability.WindowManager.WindowManager.Core 1648 * @since 9 1649 */ 1650 on(type: 'screenshot', callback: Callback<void>): void; 1651 1652 /** 1653 * Unregister the callback of screenshot 1654 * @param type: 'screenshot' 1655 * @throws {BusinessError} 401 - If param is invalid 1656 * @syscap SystemCapability.WindowManager.WindowManager.Core 1657 * @since 9 1658 */ 1659 off(type: 'screenshot', callback?: Callback<void>): void; 1660 1661 /** 1662 * Bind dialog to the target window. 1663 * @param token token of the target window. 1664 * @param deathCallback the callback of dialogDeath. 1665 * @throws {BusinessError} 401 - If param is invalid 1666 * @throws {BusinessError} 1300002 - If window state is abnormally 1667 * @throws {BusinessError} 1300003 - If system state is abnormally 1668 * @systemapi Hide this for inner system use. 1669 * @since 9 1670 */ 1671 bindDialogTarget(token: rpc.RemoteObject, deathCallback: Callback<void>): Promise<void>; 1672 1673 /** 1674 * Bind dialog to the target window. 1675 * @param token token of the target window. 1676 * @param deathCallback the callback of dialogDeath. 1677 * @throws {BusinessError} 401 - If param is invalid 1678 * @throws {BusinessError} 1300002 - If window state is abnormally 1679 * @throws {BusinessError} 1300003 - If system state is abnormally 1680 * @systemapi Hide this for inner system use. 1681 * @since 9 1682 */ 1683 bindDialogTarget(token: rpc.RemoteObject, deathCallback: Callback<void>, callback: AsyncCallback<void>): void; 1684 1685 /** 1686 * Bind dialog to the target window. 1687 * @param requestInfo requestInfo of the target window. 1688 * @param deathCallback the callback of dialogDeath. 1689 * @throws {BusinessError} 401 - If param is invalid 1690 * @throws {BusinessError} 1300002 - If window state is abnormally 1691 * @throws {BusinessError} 1300003 - If system state is abnormally 1692 * @systemapi Hide this for inner system use. 1693 * @since 9 1694 */ 1695 bindDialogTarget(requestInfo: dialogRequest.RequestInfo, deathCallback: Callback<void>): Promise<void>; 1696 1697 /** 1698 * Bind dialog to the target window. 1699 * @param requestInfo requestInfo of the target window. 1700 * @param deathCallback the callback of dialogDeath. 1701 * @throws {BusinessError} 401 - If param is invalid 1702 * @throws {BusinessError} 1300002 - If window state is abnormally 1703 * @throws {BusinessError} 1300003 - If system state is abnormally 1704 * @systemapi Hide this for inner system use. 1705 * @since 9 1706 */ 1707 bindDialogTarget(requestInfo: dialogRequest.RequestInfo, deathCallback: Callback<void>, callback: AsyncCallback<void>): void; 1708 1709 /** 1710 * Whether the window supports thr wide gamut setting. 1711 * @since 8 1712 * @deprecated since 9 1713 * @useinstead ohos.window.Window#isWindowSupportWideGamut 1714 */ 1715 isSupportWideGamut(): Promise<boolean>; 1716 1717 /** 1718 * Whether the window supports thr wide gamut setting. 1719 * @since 8 1720 * @deprecated since 9 1721 * @useinstead ohos.window.Window#isWindowSupportWideGamut 1722 */ 1723 isSupportWideGamut(callback: AsyncCallback<boolean>): void; 1724 1725 /** 1726 * Whether the window supports thr wide gamut setting. 1727 * @throws {BusinessError} 1300002 - If window state is abnormally 1728 * @since 9 1729 */ 1730 isWindowSupportWideGamut(): Promise<boolean>; 1731 1732 /** 1733 * Whether the window supports thr wide gamut setting. 1734 * @throws {BusinessError} 1300002 - If window state is abnormally 1735 * @since 9 1736 */ 1737 isWindowSupportWideGamut(callback: AsyncCallback<boolean>): void; 1738 1739 /** 1740 * Sets the specified color space. 1741 * @param colorSpace the specified color space. 1742 * @since 8 1743 * @deprecated since 9 1744 * @useinstead ohos.window.Window#setWindowColorSpace 1745 */ 1746 setColorSpace(colorSpace:ColorSpace): Promise<void>; 1747 1748 /** 1749 * Sets the specified color space. 1750 * @param colorSpace the specified color space. 1751 * @since 8 1752 * @deprecated since 9 1753 * @useinstead ohos.window.Window#setWindowColorSpace 1754 */ 1755 setColorSpace(colorSpace:ColorSpace, callback: AsyncCallback<void>): void; 1756 1757 /** 1758 * Sets the specified color space. 1759 * @param colorSpace the specified color space. 1760 * @throws {BusinessError} 401 - If param is invalid 1761 * @throws {BusinessError} 1300002 - If window state is abnormally 1762 * @since 9 1763 */ 1764 setWindowColorSpace(colorSpace:ColorSpace): Promise<void>; 1765 1766 /** 1767 * Sets the specified color space. 1768 * @param colorSpace the specified color space. 1769 * @throws {BusinessError} 401 - If param is invalid 1770 * @throws {BusinessError} 1300002 - If window state is abnormally 1771 * @since 9 1772 */ 1773 setWindowColorSpace(colorSpace:ColorSpace, callback: AsyncCallback<void>): void; 1774 1775 /** 1776 * Obtains the set color space. 1777 * @since 8 1778 * @deprecated since 9 1779 * @useinstead ohos.window.Window#getWindowColorSpace 1780 */ 1781 getColorSpace(): Promise<ColorSpace>; 1782 1783 /** 1784 * Obtains the set color space. 1785 * @since 8 1786 * @deprecated since 9 1787 * @useinstead ohos.window.Window#getWindowColorSpace 1788 */ 1789 getColorSpace(callback: AsyncCallback<ColorSpace>): void; 1790 1791 /** 1792 * Obtains the set color space. 1793 * @throws {BusinessError} 1300002 - If window state is abnormally 1794 * @since 9 1795 */ 1796 getWindowColorSpace(): ColorSpace; 1797 1798 /** 1799 * Sets the background color of window. 1800 * @param color the specified color. 1801 * @syscap SystemCapability.WindowManager.WindowManager.Core 1802 * @since 6 1803 * @deprecated since 9 1804 * @useinstead ohos.window.Window#setWindowBackgroundColor 1805 */ 1806 setBackgroundColor(color: string): Promise<void>; 1807 1808 /** 1809 * Sets the background color of window. 1810 * @param color the specified color. 1811 * @syscap SystemCapability.WindowManager.WindowManager.Core 1812 * @since 6 1813 * @deprecated since 9 1814 * @useinstead ohos.window.Window#setWindowBackgroundColor 1815 */ 1816 setBackgroundColor(color: string, callback: AsyncCallback<void>): void; 1817 1818 /** 1819 * Sets the background color of window. 1820 * @param color the specified color. 1821 * @throws {BusinessError} 401 - If param is invalid 1822 * @throws {BusinessError} 1300002 - If window state is abnormally 1823 * @syscap SystemCapability.WindowManager.WindowManager.Core 1824 * @since 9 1825 */ 1826 setWindowBackgroundColor(color: string): void; 1827 1828 /** 1829 * Sets the brightness of window. 1830 * @param brightness the specified brightness value. 1831 * @syscap SystemCapability.WindowManager.WindowManager.Core 1832 * @since 6 1833 * @deprecated since 9 1834 * @useinstead ohos.window.Window#setWindowBrightness 1835 */ 1836 setBrightness(brightness: number): Promise<void>; 1837 1838 /** 1839 * Sets the brightness of window. 1840 * @param brightness the specified brightness value. 1841 * @syscap SystemCapability.WindowManager.WindowManager.Core 1842 * @since 6 1843 * @deprecated since 9 1844 * @useinstead ohos.window.Window#setWindowBrightness 1845 */ 1846 setBrightness(brightness: number, callback: AsyncCallback<void>): void; 1847 1848 /** 1849 * Sets the brightness of window. 1850 * @param brightness the specified brightness value. 1851 * @syscap SystemCapability.WindowManager.WindowManager.Core 1852 * @throws {BusinessError} 401 - If param is invalid 1853 * @throws {BusinessError} 1300002 - If window state is abnormally 1854 * @throws {BusinessError} 1300003 - If system state is abnormally 1855 * @since 9 1856 */ 1857 setWindowBrightness(brightness: number): Promise<void>; 1858 1859 /** 1860 * Sets the brightness of window. 1861 * @param brightness the specified brightness value. 1862 * @syscap SystemCapability.WindowManager.WindowManager.Core 1863 * @throws {BusinessError} 401 - If param is invalid 1864 * @throws {BusinessError} 1300002 - If window state is abnormally 1865 * @throws {BusinessError} 1300003 - If system state is abnormally 1866 * @since 9 1867 */ 1868 setWindowBrightness(brightness: number, callback: AsyncCallback<void>): void; 1869 1870 /** 1871 * Sets the dimBehind of window. 1872 * @param dimBehindValue the specified dimBehind. 1873 * @syscap SystemCapability.WindowManager.WindowManager.Core 1874 * @since 7 1875 * @deprecated since 9 1876 */ 1877 setDimBehind(dimBehindValue: number, callback: AsyncCallback<void>): void; 1878 1879 /** 1880 * Sets the dimBehind of window. 1881 * @param dimBehind the specified dimBehind. 1882 * @syscap SystemCapability.WindowManager.WindowManager.Core 1883 * @since 7 1884 * @deprecated since 9 1885 */ 1886 setDimBehind(dimBehindValue: number): Promise<void>; 1887 1888 /** 1889 * Sets whether focusable or not. 1890 * @param isFocusable can be focus if true, or can not be focus if false. 1891 * @syscap SystemCapability.WindowManager.WindowManager.Core 1892 * @since 7 1893 * @deprecated since 9 1894 * @useinstead ohos.window.Window#setWindowFocusable 1895 */ 1896 setFocusable(isFocusable: boolean): Promise<void>; 1897 1898 /** 1899 * Sets whether focusable or not. 1900 * @param isFocusable can be focus if true, or can not be focus if false. 1901 * @syscap SystemCapability.WindowManager.WindowManager.Core 1902 * @since 7 1903 * @deprecated since 9 1904 * @useinstead ohos.window.Window#setWindowFocusable 1905 */ 1906 setFocusable(isFocusable: boolean, callback: AsyncCallback<void>): void; 1907 1908 /** 1909 * Sets whether focusable or not. 1910 * @param isFocusable can be focus if true, or can not be focus if false. 1911 * @syscap SystemCapability.WindowManager.WindowManager.Core 1912 * @throws {BusinessError} 401 - If param is invalid 1913 * @throws {BusinessError} 1300002 - If window state is abnormally 1914 * @throws {BusinessError} 1300003 - If system state is abnormally 1915 * @since 9 1916 */ 1917 setWindowFocusable(isFocusable: boolean): Promise<void>; 1918 1919 /** 1920 * Sets whether focusable or not. 1921 * @param isFocusable can be focus if true, or can not be focus if false. 1922 * @syscap SystemCapability.WindowManager.WindowManager.Core 1923 * @throws {BusinessError} 401 - If param is invalid 1924 * @throws {BusinessError} 1300002 - If window state is abnormally 1925 * @throws {BusinessError} 1300003 - If system state is abnormally 1926 * @since 9 1927 */ 1928 setWindowFocusable(isFocusable: boolean, callback: AsyncCallback<void>): void; 1929 1930 /** 1931 * Sets whether keep screen on or not. 1932 * @param isKeepScreenOn keep screen on if true, or not if false. 1933 * @syscap SystemCapability.WindowManager.WindowManager.Core 1934 * @since 6 1935 * @deprecated since 9 1936 * @useinstead ohos.window.Window#setWindowKeepScreenOn 1937 */ 1938 setKeepScreenOn(isKeepScreenOn: boolean): Promise<void>; 1939 1940 /** 1941 * Sets whether keep screen on or not. 1942 * @param isKeepScreenOn keep screen on if true, or not if false. 1943 * @syscap SystemCapability.WindowManager.WindowManager.Core 1944 * @since 6 1945 * @deprecated since 9 1946 * @useinstead ohos.window.Window#setWindowKeepScreenOn 1947 */ 1948 setKeepScreenOn(isKeepScreenOn: boolean, callback: AsyncCallback<void>): void; 1949 1950 /** 1951 * Sets whether keep screen on or not. 1952 * @param isKeepScreenOn keep screen on if true, or not if false. 1953 * @throws {BusinessError} 401 - If param is invalid 1954 * @throws {BusinessError} 1300002 - If window state is abnormally 1955 * @throws {BusinessError} 1300003 - If system state is abnormally 1956 * @syscap SystemCapability.WindowManager.WindowManager.Core 1957 * @since 9 1958 */ 1959 setWindowKeepScreenOn(isKeepScreenOn: boolean): Promise<void>; 1960 1961 /** 1962 * Sets whether keep screen on or not. 1963 * @param isKeepScreenOn keep screen on if true, or not if false. 1964 * @throws {BusinessError} 401 - If param is invalid 1965 * @throws {BusinessError} 1300002 - If window state is abnormally 1966 * @throws {BusinessError} 1300003 - If system state is abnormally 1967 * @syscap SystemCapability.WindowManager.WindowManager.Core 1968 * @since 9 1969 */ 1970 setWindowKeepScreenOn(isKeepScreenOn: boolean, callback: AsyncCallback<void>): void; 1971 1972 /** 1973 * Sets whether to wake up the screen when this ability is restored. 1974 * @param wakeUp Specifies whether to wake up the screen. True means to wake it up, false means not. 1975 * @throws {BusinessError} 401 - If param is invalid 1976 * @throws {BusinessError} 1300002 - If window state is abnormally 1977 * @throws {BusinessError} 1300003 - If system state is abnormally 1978 * @syscap SystemCapability.WindowManager.WindowManager.Core 1979 * @systemapi Hide this for inner system use. 1980 * @since 9 1981 */ 1982 setWakeUpScreen(wakeUp: boolean): void; 1983 1984 /** 1985 * Sets whether outside can be touch or not. 1986 * @param touchable outside can be touch if true, or not if false. 1987 * @syscap SystemCapability.WindowManager.WindowManager.Core 1988 * @since 7 1989 * @deprecated since 9 1990 */ 1991 setOutsideTouchable(touchable: boolean): Promise<void>; 1992 1993 /** 1994 * Sets whether outside can be touch or not. 1995 * @param touchable outside can be touch if true, or not if false. 1996 * @syscap SystemCapability.WindowManager.WindowManager.Core 1997 * @since 7 1998 * @deprecated since 9 1999 */ 2000 setOutsideTouchable(touchable: boolean, callback: AsyncCallback<void>): void; 2001 2002 /** 2003 * Sets whether is private mode or not. 2004 * @param isPrivacyMode in private mode if true, or not if false. 2005 * @syscap SystemCapability.WindowManager.WindowManager.Core 2006 * @since 7 2007 * @deprecated since 9 2008 * @useinstead ohos.window.Window#setWindowPrivacyMode 2009 */ 2010 setPrivacyMode(isPrivacyMode: boolean): Promise<void>; 2011 2012 /** 2013 * Sets whether is private mode or not. 2014 * @param isPrivacyMode in private mode if true, or not if false. 2015 * @syscap SystemCapability.WindowManager.WindowManager.Core 2016 * @since 7 2017 * @deprecated since 9 2018 * @useinstead ohos.window.Window#setWindowPrivacyMode 2019 */ 2020 setPrivacyMode(isPrivacyMode: boolean, callback: AsyncCallback<void>): void; 2021 2022 /** 2023 * Sets whether is private mode or not. 2024 * @param isPrivacyMode in private mode if true, or not if false. 2025 * @throws {BusinessError} 201 - If there is no permission 2026 * @throws {BusinessError} 401 - If param is invalid 2027 * @throws {BusinessError} 1300002 - If window state is abnormally 2028 * @permission ohos.permission.PRIVACY_WINDOW 2029 * @syscap SystemCapability.WindowManager.WindowManager.Core 2030 * @since 9 2031 */ 2032 setWindowPrivacyMode(isPrivacyMode: boolean): Promise<void>; 2033 2034 /** 2035 * Sets whether is private mode or not. 2036 * @param isPrivacyMode in private mode if true, or not if false. 2037 * @throws {BusinessError} 201 - If there is no permission 2038 * @throws {BusinessError} 401 - If param is invalid 2039 * @throws {BusinessError} 1300002 - If window state is abnormally 2040 * @permission ohos.permission.PRIVACY_WINDOW 2041 * @syscap SystemCapability.WindowManager.WindowManager.Core 2042 * @since 9 2043 */ 2044 setWindowPrivacyMode(isPrivacyMode: boolean, callback: AsyncCallback<void>): void; 2045 2046 /** 2047 * Ignore this window during screenshot. 2048 * @param isSkip skip if true, or not if false. 2049 * @throws {BusinessError} 401 - If param is invalid 2050 * @throws {BusinessError} 1300002 - If window state is abnormally 2051 * @syscap SystemCapability.WindowManager.WindowManager.Core 2052 * @systemapi Hide this for inner system use. 2053 * @since 9 2054 */ 2055 setSnapshotSkip(isSkip: boolean): void; 2056 2057 /** 2058 * Sets whether is touchable or not. 2059 * @param isTouchable is touchable if true, or not if false. 2060 * @syscap SystemCapability.WindowManager.WindowManager.Core 2061 * @since 7 2062 * @deprecated since 9 2063 * @useinstead ohos.window.Window#setWindowTouchable 2064 */ 2065 setTouchable(isTouchable: boolean): Promise<void>; 2066 2067 /** 2068 * Sets whether is touchable or not. 2069 * @param isTouchable is touchable if true, or not if false. 2070 * @syscap SystemCapability.WindowManager.WindowManager.Core 2071 * @since 7 2072 * @deprecated since 9 2073 * @useinstead ohos.window.Window#setWindowTouchable 2074 */ 2075 setTouchable(isTouchable: boolean, callback: AsyncCallback<void>): void; 2076 2077 /** 2078 * Sets whether is touchable or not. 2079 * @param isTouchable is touchable if true, or not if false. 2080 * @throws {BusinessError} 401 - If param is invalid 2081 * @throws {BusinessError} 1300002 - If window state is abnormally 2082 * @throws {BusinessError} 1300003 - If system state is abnormally 2083 * @syscap SystemCapability.WindowManager.WindowManager.Core 2084 * @since 9 2085 */ 2086 setWindowTouchable(isTouchable: boolean): Promise<void>; 2087 2088 /** 2089 * Sets whether is touchable or not. 2090 * @param isTouchable is touchable if true, or not if false. 2091 * @throws {BusinessError} 401 - If param is invalid 2092 * @throws {BusinessError} 1300002 - If window state is abnormally 2093 * @throws {BusinessError} 1300003 - If system state is abnormally 2094 * @syscap SystemCapability.WindowManager.WindowManager.Core 2095 * @since 9 2096 */ 2097 setWindowTouchable(isTouchable: boolean, callback: AsyncCallback<void>): void; 2098 2099 /** 2100 * Sets the flag of the window is forbidden to move in split screen mode 2101 * @param isForbidSplitMove the flag of the window is forbidden to move in split screen mode 2102 * @throws {BusinessError} 401 - If param is invalid 2103 * @throws {BusinessError} 1300002 - If window state is abnormally 2104 * @throws {BusinessError} 1300003 - If system state is abnormally 2105 * @syscap SystemCapability.WindowManager.WindowManager.Core 2106 * @systemapi 2107 * @since 9 2108 */ 2109 setForbidSplitMove(isForbidSplitMove: boolean, callback: AsyncCallback<void>): void; 2110 2111 /** 2112 * Sets the flag of the window is forbidden to move in split screen mode 2113 * @param isForbidSplitMove the flag of the window is forbidden to move in split screen mode 2114 * @throws {BusinessError} 401 - If param is invalid 2115 * @throws {BusinessError} 1300002 - If window state is abnormally 2116 * @throws {BusinessError} 1300003 - If system state is abnormally 2117 * @syscap SystemCapability.WindowManager.WindowManager.Core 2118 * @systemapi 2119 * @since 9 2120 */ 2121 setForbidSplitMove(isForbidSplitMove: boolean): Promise<void>; 2122 2123 /** 2124 * Obtains snapshot of window 2125 * @throws {BusinessError} 1300002 - If window state is abnormally 2126 * @syscap SystemCapability.WindowManager.WindowManager.Core 2127 * @since 9 2128 */ 2129 snapshot(callback: AsyncCallback<image.PixelMap>): void; 2130 2131 /** 2132 * Obtains snapshot of window 2133 * @throws {BusinessError} 1300002 - If window state is abnormally 2134 * @syscap SystemCapability.WindowManager.WindowManager.Core 2135 * @since 9 2136 */ 2137 snapshot(): Promise<image.PixelMap>; 2138 2139 /** Sets opacity of window 2140 * @param opacity Interval is 0.f-1.f. 2141 * @throws {BusinessError} 401 - If param is invalid 2142 * @throws {BusinessError} 1300002 - If window state is abnormally 2143 * @throws {BusinessError} 1300004 - If this window can not opacity 2144 * @systemapi 2145 * @since 9 2146 */ 2147 opacity(opacity: number): void; 2148 2149 /** 2150 * Sets scale options of window. 2151 * @param scaleOptions scale param of window. 2152 * @throws {BusinessError} 401 - If param is invalid 2153 * @throws {BusinessError} 1300002 - If window state is abnormally 2154 * @throws {BusinessError} 1300004 - If this window can not scale 2155 * @systemapi 2156 * @since 9 2157 */ 2158 scale(scaleOptions: ScaleOptions): void; 2159 2160 /** 2161 * Sets rotate options of window. 2162 * @param rotateOptions rotate param of window. 2163 * @throws {BusinessError} 401 - If param is invalid 2164 * @throws {BusinessError} 1300002 - If window state is abnormally 2165 * @throws {BusinessError} 1300004 - If this window can not rotate 2166 * @systemapi 2167 * @since 9 2168 */ 2169 rotate(rotateOptions: RotateOptions): void; 2170 2171 /** 2172 * Sets translate options of window. 2173 * @param translateOptions translate param of window. 2174 * @throws {BusinessError} 401 - If param is invalid 2175 * @throws {BusinessError} 1300002 - If window state is abnormally 2176 * @throws {BusinessError} 1300004 - If this window can not translate 2177 * @systemapi 2178 * @since 9 2179 */ 2180 translate(translateOptions: TranslateOptions): void; 2181 2182 /** 2183 * Get Transition Controller. 2184 * @throws {BusinessError} 1300002 - If window state is abnormally 2185 * @throws {BusinessError} 1300004 - If this window can not getTransitionController 2186 * @systemapi 2187 * @since 9 2188 */ 2189 getTransitionController(): TransitionController; 2190 2191 /** 2192 * Sets the window blur radius. 2193 * @param radius the blur radius. 2194 * @throws {BusinessError} 401 - If param is invalid 2195 * @throws {BusinessError} 1300002 - If window state is abnormally 2196 * @throws {BusinessError} 1300004 - If this window can not setBlur 2197 * @systemapi Hide this for inner system use. 2198 * @since 9 2199 */ 2200 setBlur(radius: number): void; 2201 2202 /** 2203 * Sets the window backdrop blur radius. 2204 * @param radius the blur radius. 2205 * @throws {BusinessError} 401 - If param is invalid 2206 * @throws {BusinessError} 1300002 - If window state is abnormally 2207 * @throws {BusinessError} 1300004 - If this window can not setBackdropBlur 2208 * @systemapi Hide this for inner system use. 2209 * @since 9 2210 */ 2211 setBackdropBlur(radius: number): void; 2212 2213 /** 2214 * Sets the window backdrop blur style. 2215 * @param blurStyle the specified blur style. 2216 * @throws {BusinessError} 401 - If param is invalid 2217 * @throws {BusinessError} 1300002 - If window state is abnormally 2218 * @throws {BusinessError} 1300004 - If this window can not setBackdropBlurStyle 2219 * @systemapi Hide this for inner system use. 2220 * @since 9 2221 */ 2222 setBackdropBlurStyle(blurStyle: BlurStyle): void; 2223 2224 /** 2225 * Sets shadow. 2226 * @param radius the radius of the shadow. 2227 * @param color the color of the shadow. 2228 * @param offsetX the offset of the shadow on the x-axis. 2229 * @param offsetY the offset of the shadow on the y-axis. 2230 * @throws {BusinessError} 401 - If param is invalid 2231 * @throws {BusinessError} 1300002 - If window state is abnormally 2232 * @throws {BusinessError} 1300004 - If this window can not setShadow 2233 * @systemapi Hide this for inner system use. 2234 * @since 9 2235 */ 2236 setShadow(radius: number, color?: string, offsetX?: number, offsetY?: number): void; 2237 2238 /** 2239 * Sets corner radius. 2240 * @param cornerRadius the corner radius. 2241 * @throws {BusinessError} 401 - If param is invalid 2242 * @throws {BusinessError} 1300002 - If window state is abnormally 2243 * @throws {BusinessError} 1300004 - If this window can not setCornerRadius 2244 * @systemapi Hide this for inner system use. 2245 * @since 9 2246 */ 2247 setCornerRadius(cornerRadius: number): void; 2248 } 2249 /** 2250 * Window stage callback event type 2251 * @syscap SystemCapability.WindowManager.WindowManager.Core 2252 * @since 9 2253 * @StageModelOnly 2254 */ 2255 enum WindowStageEventType { 2256 /** 2257 * The window stage is running in the foreground. 2258 * @since 9 2259 */ 2260 SHOWN = 1, 2261 /** 2262 * The window stage gains focus. 2263 * @since 9 2264 */ 2265 ACTIVE, 2266 /** 2267 * The window stage loses focus. 2268 * @since 9 2269 */ 2270 INACTIVE, 2271 /** 2272 * The window stage is running in the background. 2273 * @since 9 2274 */ 2275 HIDDEN, 2276 } 2277 /** 2278 * WindowStage 2279 * @syscap SystemCapability.WindowManager.WindowManager.Core 2280 * @since 9 2281 */ 2282 interface WindowStage { 2283 /** 2284 * Get main window of the stage. 2285 * @throws {BusinessError} 1300002 - If window state is abnormally 2286 * @throws {BusinessError} 1300005 - If window stage is abnormally 2287 * @since 9 2288 * @StageModelOnly 2289 */ 2290 getMainWindow(): Promise<Window>; 2291 /** 2292 * Get main window of the stage. 2293 * @throws {BusinessError} 1300002 - If window state is abnormally 2294 * @throws {BusinessError} 1300005 - If window stage is abnormally 2295 * @since 9 2296 * @StageModelOnly 2297 */ 2298 getMainWindow(callback: AsyncCallback<Window>): void; 2299 /** 2300 * Get main window of the stage. 2301 * @throws {BusinessError} 1300002 - If window state is abnormally 2302 * @throws {BusinessError} 1300005 - If window stage is abnormally 2303 * @since 9 2304 * @StageModelOnly 2305 */ 2306 getMainWindowSync(): Window; 2307 /** 2308 * Create sub window of the stage. 2309 * @param name window name of sub window 2310 * @throws {BusinessError} 401 - If param is invalid 2311 * @throws {BusinessError} 1300002 - If window state is abnormally 2312 * @throws {BusinessError} 1300005 - If window stage is abnormally 2313 * @since 9 2314 * @StageModelOnly 2315 */ 2316 createSubWindow(name: string): Promise<Window>; 2317 /** 2318 * Create sub window of the stage. 2319 * @param name window name of sub window 2320 * @throws {BusinessError} 401 - If param is invalid 2321 * @throws {BusinessError} 1300002 - If window state is abnormally 2322 * @throws {BusinessError} 1300005 - If window stage is abnormally 2323 * @since 9 2324 * @StageModelOnly 2325 */ 2326 createSubWindow(name: string, callback: AsyncCallback<Window>): void; 2327 /** 2328 * Get sub window of the stage. 2329 * @throws {BusinessError} 1300005 - If window stage is abnormally 2330 * @since 9 2331 * @StageModelOnly 2332 */ 2333 getSubWindow(): Promise<Array<Window>>; 2334 /** 2335 * Get sub window of the stage. 2336 * @throws {BusinessError} 1300005 - If window stage is abnormally 2337 * @since 9 2338 * @StageModelOnly 2339 */ 2340 getSubWindow(callback: AsyncCallback<Array<Window>>): void; 2341 /** 2342 * Loads content 2343 * @param path path Path of the page to which the content will be loaded 2344 * @param storage storage The data object shared within the content instance loaded by the window 2345 * @throws {BusinessError} 401 - If param is invalid 2346 * @throws {BusinessError} 1300002 - If window state is abnormally 2347 * @throws {BusinessError} 1300005 - If window stage is abnormally 2348 * @syscap SystemCapability.WindowManager.WindowManager.Core 2349 * @since 9 2350 * @StageModelOnly 2351 */ 2352 loadContent(path: string, storage: LocalStorage, callback: AsyncCallback<void>): void; 2353 /** 2354 * Loads content 2355 * @param path path of the page to which the content will be loaded 2356 * @param storage storage The data object shared within the content instance loaded by the window 2357 * @throws {BusinessError} 401 - If param is invalid 2358 * @throws {BusinessError} 1300002 - If window state is abnormally 2359 * @throws {BusinessError} 1300005 - If window stage is abnormally 2360 * @syscap SystemCapability.WindowManager.WindowManager.Core 2361 * @since 9 2362 * @StageModelOnly 2363 */ 2364 loadContent(path: string, storage?: LocalStorage): Promise<void>; 2365 /** 2366 * Loads content 2367 * @param path path of the page to which the content will be loaded 2368 * @throws {BusinessError} 401 - If param is invalid 2369 * @throws {BusinessError} 1300002 - If window state is abnormally 2370 * @throws {BusinessError} 1300005 - If window stage is abnormally 2371 * @syscap SystemCapability.WindowManager.WindowManager.Core 2372 * @since 9 2373 * @StageModelOnly 2374 */ 2375 loadContent(path: string, callback: AsyncCallback<void>): void; 2376 /** 2377 * Window stage event callback on. 2378 * @throws {BusinessError} 401 - If param is invalid 2379 * @throws {BusinessError} 1300002 - If window state is abnormally 2380 * @throws {BusinessError} 1300005 - If window stage is abnormally 2381 * @since 9 2382 * @StageModelOnly 2383 */ 2384 on(eventType: 'windowStageEvent', callback: Callback<WindowStageEventType>): void; 2385 /** 2386 * Window stage event callback off. 2387 * @throws {BusinessError} 401 - If param is invalid 2388 * @throws {BusinessError} 1300002 - If window state is abnormally 2389 * @throws {BusinessError} 1300005 - If window stage is abnormally 2390 * @since 9 2391 * @StageModelOnly 2392 */ 2393 off(eventType: 'windowStageEvent', callback?: Callback<WindowStageEventType>): void; 2394 2395 /** 2396 * Disable window decoration. It must be called before loadContent. 2397 * @throws {BusinessError} 1300002 - If window state is abnormally 2398 * @throws {BusinessError} 1300005 - If window stage is abnormally 2399 * @systemapi 2400 * @since 9 2401 * @StageModelOnly 2402 */ 2403 disableWindowDecor(): void; 2404 2405 /** 2406 * Sets whether can show on lock screen or not 2407 * @param showOnLockScreen can show on lock screen if true, or not if false 2408 * @throws {BusinessError} 401 - If param is invalid 2409 * @throws {BusinessError} 1300002 - If window state is abnormally 2410 * @throws {BusinessError} 1300005 - If window stage is abnormally 2411 * @syscap SystemCapability.WindowManager.WindowManager.Core 2412 * @systemapi Hide this for inner system use. 2413 * @since 9 2414 * @StageModelOnly 2415 */ 2416 setShowOnLockScreen(showOnLockScreen: boolean): void; 2417 } 2418} 2419 2420export default window; 2421