• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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,
36    /**
37     * System alert.
38     */
39    TYPE_SYSTEM_ALERT,
40  }
41
42  /**
43   * The interface of window.
44   */
45  interface Window {
46    /**
47     * Set the position of a window.
48     * @param x Indicate the X-coordinate of the window.
49     * @param y Indicate the Y-coordinate of the window.
50     * @devices tv, phone, tablet, wearable, liteWearable.
51     */
52    moveTo(x: number, y: number): Promise<void>;
53
54    /**
55     * Set the size of a window .
56     * @param width Indicates the width of the window.
57     * @param height Indicates the height of the window.
58     * @devices tv, phone, tablet, wearable, liteWearable.
59     */
60    resetSize(width: number, height: number): Promise<void>;
61
62    /**
63     * Set the type of a window.
64     * @param type Indicate the type of a window.
65     * @devices tv, phone, tablet, wearable, liteWearable.
66     */
67    setWindowType(type: WindowType): Promise<void>;
68  }
69}
70
71export default window;
72