1 /* 2 * Copyright (c) 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 #include "ohos_adapter/bridge/ark_display_adapter_wrapper.h" 17 18 namespace OHOS::ArkWeb { 19 ArkDisplayAdapterWrapper(ArkWebRefPtr<ArkDisplayAdapter> ref)20ArkDisplayAdapterWrapper::ArkDisplayAdapterWrapper(ArkWebRefPtr<ArkDisplayAdapter> ref) : ctocpp_(ref) {} 21 GetId()22OHOS::NWeb::DisplayId ArkDisplayAdapterWrapper::GetId() 23 { 24 return ctocpp_->GetId(); 25 } 26 GetWidth()27int32_t ArkDisplayAdapterWrapper::GetWidth() 28 { 29 return ctocpp_->GetWidth(); 30 } 31 GetHeight()32int32_t ArkDisplayAdapterWrapper::GetHeight() 33 { 34 return ctocpp_->GetHeight(); 35 } 36 GetVirtualPixelRatio()37float ArkDisplayAdapterWrapper::GetVirtualPixelRatio() 38 { 39 return ctocpp_->GetVirtualPixelRatio(); 40 } 41 GetRotation()42OHOS::NWeb::RotationType ArkDisplayAdapterWrapper::GetRotation() 43 { 44 uint32_t type = ctocpp_->GetRotation(); 45 return (OHOS::NWeb::RotationType)type; 46 } 47 GetOrientation()48OHOS::NWeb::OrientationType ArkDisplayAdapterWrapper::GetOrientation() 49 { 50 uint32_t type = ctocpp_->GetOrientation(); 51 return (OHOS::NWeb::OrientationType)type; 52 } 53 GetDpi()54int32_t ArkDisplayAdapterWrapper::GetDpi() 55 { 56 return ctocpp_->GetDpi(); 57 } 58 GetDisplayOrientation()59OHOS::NWeb::DisplayOrientation ArkDisplayAdapterWrapper::GetDisplayOrientation() 60 { 61 uint32_t type = ctocpp_->GetDisplayOrientation(); 62 return (OHOS::NWeb::DisplayOrientation)type; 63 } 64 GetFoldStatus()65OHOS::NWeb::FoldStatus ArkDisplayAdapterWrapper::GetFoldStatus() 66 { 67 uint32_t foldstatus = ctocpp_->GetFoldStatus(); 68 return static_cast<OHOS::NWeb::FoldStatus>(foldstatus); 69 } 70 IsFoldable()71bool ArkDisplayAdapterWrapper::IsFoldable() 72 { 73 return ctocpp_->IsFoldable(); 74 } 75 GetName()76std::string ArkDisplayAdapterWrapper::GetName() 77 { 78 ArkWebString str = ctocpp_->GetName(); 79 std::string result = ArkWebStringStructToClass(str); 80 81 ArkWebStringStructRelease(str); 82 return result; 83 } 84 GetAvailableWidth()85int32_t ArkDisplayAdapterWrapper::GetAvailableWidth() 86 { 87 return ctocpp_->GetAvailableWidth(); 88 } 89 GetAvailableHeight()90int32_t ArkDisplayAdapterWrapper::GetAvailableHeight() 91 { 92 return ctocpp_->GetAvailableHeight(); 93 } 94 GetAliveStatus()95bool ArkDisplayAdapterWrapper::GetAliveStatus() 96 { 97 return ctocpp_->GetAliveStatus(); 98 } 99 GetDisplayState()100OHOS::NWeb::DisplayState ArkDisplayAdapterWrapper::GetDisplayState() 101 { 102 uint32_t state = ctocpp_->GetDisplayState(); 103 return (OHOS::NWeb::DisplayState)state; 104 } 105 GetDensityDpi()106int32_t ArkDisplayAdapterWrapper::GetDensityDpi() 107 { 108 return ctocpp_->GetDensityDpi(); 109 } 110 GetX()111int32_t ArkDisplayAdapterWrapper::GetX() 112 { 113 return ctocpp_->GetX(); 114 } 115 GetY()116int32_t ArkDisplayAdapterWrapper::GetY() 117 { 118 return ctocpp_->GetY(); 119 } 120 GetDisplaySourceMode()121OHOS::NWeb::DisplaySourceMode ArkDisplayAdapterWrapper::GetDisplaySourceMode() 122 { 123 uint32_t mode = ctocpp_->GetDisplaySourceMode(); 124 return (OHOS::NWeb::DisplaySourceMode)mode; 125 } 126 GetPhysicalWidth()127int32_t ArkDisplayAdapterWrapper::GetPhysicalWidth() 128 { 129 return ctocpp_->GetPhysicalWidth(); 130 } 131 GetPhysicalHeight()132int32_t ArkDisplayAdapterWrapper::GetPhysicalHeight() 133 { 134 return ctocpp_->GetPhysicalHeight(); 135 } 136 GetDefaultVirtualPixelRatio()137float ArkDisplayAdapterWrapper::GetDefaultVirtualPixelRatio() 138 { 139 return ctocpp_->GetDefaultVirtualPixelRatio(); 140 } 141 142 } // namespace OHOS::ArkWeb 143