1 /*
2  * Copyright (c) 2023 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 #ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMMON_DISPLAY_INFO_H
16 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMMON_DISPLAY_INFO_H
17 
18 #include "base/geometry/rect.h"
19 #include "base/memory/ace_type.h"
20 
21 namespace OHOS::Ace {
22 /**
23  * souce is Rosen::FoldDisplayMode
24  */
25 enum class FoldDisplayMode: uint32_t {
26     UNKNOWN = 0,
27     FULL = 1,   // EXPAND
28     MAIN = 2,   // FOLDED
29     SUB = 3,
30     COORDINATION = 4,
31 };
32 
33 /**
34  * souce is Rosen::FoldStatus
35  */
36 enum class FoldStatus : uint32_t {
37     UNKNOWN = 0,
38     EXPAND = 1,
39     FOLDED = 2,
40     HALF_FOLD = 3,
41 };
42 
43 /**
44  * souce is Rosen::Rotation
45  */
46 enum class Rotation : uint32_t {
47     ROTATION_0,
48     ROTATION_90,
49     ROTATION_180,
50     ROTATION_270,
51 };
52 
53 /**
54  * souce is Rosen::WindowStatus
55  */
56 enum class WindowStatus : uint32_t {
57     WINDOW_STATUS_UNDEFINED = 0,
58     WINDOW_STATUS_FULLSCREEN = 1,
59     WINDOW_STATUS_MAXMIZE,
60     WINDOW_STATUS_MINIMIZE,
61     WINDOW_STATUS_FLOATING,
62     WINDOW_STATUS_SPLITSCREEN
63 };
64 
65 class ACE_EXPORT DisplayInfo : public AceType {
66     DECLARE_ACE_TYPE(DisplayInfo, AceType);
67 
68 public:
69     DisplayInfo() = default;
70     ~DisplayInfo() override = default;
71 
GetIsFoldable()72     bool GetIsFoldable()
73     {
74         return isFoldable_;
75     }
76 
SetIsFoldable(bool isFoldable)77     void SetIsFoldable(bool isFoldable)
78     {
79         isFoldable_ = isFoldable;
80     }
81 
GetFoldStatus()82     FoldStatus GetFoldStatus()
83     {
84         return foldStatus_;
85     }
86 
SetFoldStatus(FoldStatus foldStatus)87     void SetFoldStatus(FoldStatus foldStatus)
88     {
89         foldStatus_ = foldStatus;
90     }
91 
GetRotation()92     Rotation GetRotation()
93     {
94         return rotation_;
95     }
96 
SetRotation(Rotation rotation)97     void SetRotation(Rotation rotation)
98     {
99         rotation_ = rotation;
100     }
101 
GetCurrentFoldCreaseRegion()102     std::vector<Rect> GetCurrentFoldCreaseRegion()
103     {
104         return currentFoldCreaseRegion_;
105     }
106 
SetCurrentFoldCreaseRegion(std::vector<Rect> currentFoldCreaseRegion)107     void SetCurrentFoldCreaseRegion(std::vector<Rect> currentFoldCreaseRegion)
108     {
109         currentFoldCreaseRegion_ = currentFoldCreaseRegion;
110     }
111 
GetDisplayId()112     uint64_t GetDisplayId() const
113     {
114         return displayId_;
115     }
116 
SetDisplayId(uint64_t displayId)117     void SetDisplayId(uint64_t displayId)
118     {
119         displayId_ = displayId;
120     }
121 
GetWidth()122     int32_t GetWidth() const
123     {
124         return width_;
125     }
126 
SetWidth(int32_t width)127     void SetWidth(int32_t width)
128     {
129         width_ = width;
130     }
131 
GetHeight()132     int32_t GetHeight() const
133     {
134         return height_;
135     }
136 
SetHeight(int32_t height)137     void SetHeight(int32_t height)
138     {
139         height_ = height;
140     }
141 
142 private:
143     FoldStatus foldStatus_ = FoldStatus::UNKNOWN;
144     bool isFoldable_ = false;
145     Rotation rotation_ = Rotation::ROTATION_0;
146     std::vector<Rect> currentFoldCreaseRegion_;
147     uint64_t displayId_ = 0;
148     int32_t width_ = 0;
149     int32_t height_ = 0;
150 };
151 } // namespace OHOS::Ace
152 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMMON_DISPLAY_INFO_H
153