• 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 #ifndef FRAMEWORKS_WM_INCLUDE_WINDOW_ATTRIBUTE_H
17 #define FRAMEWORKS_WM_INCLUDE_WINDOW_ATTRIBUTE_H
18 
19 #include <functional>
20 
21 #include <window_manager_type.h>
22 
23 namespace OHOS {
24 class WindowAttribute {
25 public:
26     void OnPositionChange(WindowPositionChangeFunc func);
27     void OnSizeChange(WindowSizeChangeFunc func);
28     void OnVisibilityChange(WindowVisibilityChangeFunc func);
29     void OnTypeChange(WindowTypeChangeFunc func);
30     void OnModeChange(WindowModeChangeFunc func);
31     void OnPIPModeChange(WindowPIPModeChangeFunc func);
32 
33     int32_t    GetID() const;
34     int32_t    GetX() const;
35     int32_t    GetY() const;
36     uint32_t   GetWidth() const;
37     uint32_t   GetHeight() const;
38     uint32_t   GetDestWidth() const;
39     uint32_t   GetDestHeight() const;
40     bool       GetVisibility() const;
41     WindowType GetType() const;
42     WindowMode GetMode() const;
43     bool       GetPIPMode() const;
44 
45     // setter return true mean attr changed
46     void SetID(int32_t id);
47     bool SetXY(int32_t x, int32_t y);
48     bool SetWidthHeight(uint32_t width, uint32_t height);
49     bool SetDestWidthHeight(uint32_t width, uint32_t height);
50     bool SetVisibility(bool visibility);
51     bool SetType(WindowType type);
52     bool SetMode(WindowMode mode);
53     bool SetPIPMode(bool inPIPMode);
54 
55 private:
56     int32_t    winID = 0;
57     int32_t    winX = 0;
58     int32_t    winY = 0;
59     uint32_t   winWidth = 0;
60     uint32_t   winHeight = 0;
61     uint32_t   winDestWidth = 0;
62     uint32_t   winDestHeight = 0;
63     bool       winVisibility = false;
64     WindowType winType = static_cast<WindowType>(0);
65     WindowMode winMode = static_cast<WindowMode>(0);
66     bool       winPIPMode = false;
67 
68     WindowPositionChangeFunc   positionChangeListener = nullptr;
69     WindowSizeChangeFunc       sizeChangeListener = nullptr;
70     WindowVisibilityChangeFunc visibilityChangeListener = nullptr;
71     WindowTypeChangeFunc       typeChangeListener = nullptr;
72     WindowModeChangeFunc       modeChangeListener = nullptr;
73     WindowPIPModeChangeFunc    pipModeChangeFunc = nullptr;
74 };
75 } // namespace OHOS
76 
77 #endif // FRAMEWORKS_WM_INCLUDE_WINDOW_ATTRIBUTE_H
78