1 /* 2 * Copyright (c) 2021-2022 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 FOUNDATION_DM_DISPLAY_H 17 #define FOUNDATION_DM_DISPLAY_H 18 19 #include <string> 20 #include "dm_common.h" 21 #include "noncopyable.h" 22 23 namespace OHOS::Rosen { 24 class DisplayInfo; 25 class CutoutInfo; 26 27 enum class DisplayType : uint32_t { 28 DEFAULT = 0, 29 }; 30 31 class Display : public RefBase { 32 friend class DisplayManager; 33 public: 34 ~Display(); 35 Display(const Display&) = delete; 36 Display(Display&&) = delete; 37 Display& operator=(const Display&) = delete; 38 Display& operator=(Display&&) = delete; 39 DisplayId GetId() const; 40 std::string GetName() const; 41 int32_t GetWidth() const; 42 int32_t GetHeight() const; 43 uint32_t GetRefreshRate() const; 44 ScreenId GetScreenId() const; 45 float GetVirtualPixelRatio() const; 46 int GetDpi() const; 47 Rotation GetRotation() const; 48 Orientation GetOrientation() const; 49 sptr<DisplayInfo> GetDisplayInfo() const; 50 sptr<CutoutInfo> GetCutoutInfo() const; 51 protected: 52 // No more methods or variables can be defined here. 53 Display(const std::string& name, sptr<DisplayInfo> info); 54 private: 55 // No more methods or variables can be defined here. 56 void UpdateDisplayInfo(sptr<DisplayInfo>) const; 57 void UpdateDisplayInfo() const; 58 class Impl; 59 sptr<Impl> pImpl_; 60 }; 61 } // namespace OHOS::Rosen 62 63 #endif // FOUNDATION_DM_DISPLAY_H