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 class ACE_EXPORT DisplayInfo : public AceType { 54 DECLARE_ACE_TYPE(DisplayInfo, AceType); 55 56 public: 57 DisplayInfo() = default; 58 ~DisplayInfo() override = default; 59 GetIsFoldable()60 bool GetIsFoldable() 61 { 62 return isFoldable_; 63 } 64 SetIsFoldable(bool isFoldable)65 void SetIsFoldable(bool isFoldable) 66 { 67 isFoldable_ = isFoldable; 68 } 69 GetFoldStatus()70 FoldStatus GetFoldStatus() 71 { 72 return foldStatus_; 73 } 74 SetFoldStatus(FoldStatus foldStatus)75 void SetFoldStatus(FoldStatus foldStatus) 76 { 77 foldStatus_ = foldStatus; 78 } 79 GetRotation()80 Rotation GetRotation() 81 { 82 return rotation_; 83 } 84 SetRotation(Rotation rotation)85 void SetRotation(Rotation rotation) 86 { 87 rotation_ = rotation; 88 } 89 GetCurrentFoldCreaseRegion()90 std::vector<Rect> GetCurrentFoldCreaseRegion() 91 { 92 return currentFoldCreaseRegion_; 93 } 94 SetCurrentFoldCreaseRegion(std::vector<Rect> currentFoldCreaseRegion)95 void SetCurrentFoldCreaseRegion(std::vector<Rect> currentFoldCreaseRegion) 96 { 97 currentFoldCreaseRegion_ = currentFoldCreaseRegion; 98 } 99 GetDisplayId()100 uint64_t GetDisplayId() const 101 { 102 return displayId_; 103 } 104 SetDisplayId(uint64_t displayId)105 void SetDisplayId(uint64_t displayId) 106 { 107 displayId_ = displayId; 108 } 109 110 private: 111 FoldStatus foldStatus_ = FoldStatus::UNKNOWN; 112 bool isFoldable_ = false; 113 Rotation rotation_ = Rotation::ROTATION_0; 114 std::vector<Rect> currentFoldCreaseRegion_; 115 uint64_t displayId_ = 0; 116 }; 117 } // namespace OHOS::Ace 118 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMMON_DISPLAY_INFO_H 119