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/** 17 * Window manager. 18 * @devices tv, phone, tablet, wearable. 19*/ 20declare namespace window { 21 /** 22 * Obtain the top window of the current application. 23 * @devices tv, phone, tablet, wearable. 24 */ 25 function getTopWindow(): Promise<Window>; 26 27 /** 28 * The type of a window. 29 * @devices tv, phone, tablet, wearable. 30 */ 31 enum WindowType { 32 /** 33 * App. 34 */ 35 TYPE_APP = 0, 36 /** 37 * System alert. 38 */ 39 TYPE_SYSTEM_ALERT = 30, 40 /** 41 * System volume. 42 */ 43 TYPE_SYSTEM_VOLUME = 70, 44 /** 45 * System panel. 46 */ 47 TYPE_SYSTEM_PANEL = 90, 48 } 49 50 /** 51 * The interface of window. 52 */ 53 interface Window { 54 /** 55 * Set the position of a window. 56 * @param x Indicate the X-coordinate of the window. 57 * @param y Indicate the Y-coordinate of the window. 58 * @devices tv, phone, tablet, wearable, liteWearable. 59 */ 60 moveTo(x: number, y: number): Promise<void>; 61 62 /** 63 * Set the size of a window . 64 * @param width Indicates the width of the window. 65 * @param height Indicates the height of the window. 66 * @devices tv, phone, tablet, wearable, liteWearable. 67 */ 68 resetSize(width: number, height: number): Promise<void>; 69 70 /** 71 * Set the type of a window. 72 * @param type Indicate the type of a window. 73 * @devices tv, phone, tablet, wearable, liteWearable. 74 */ 75 setWindowType(type: WindowType): Promise<void>; 76 } 77 78 function setSystemBarEnable(names: Array<'status' | 'navigation'>): Promise<void>; 79} 80 81export default window; 82