1885b47fbSopenharmony_ci/* 2885b47fbSopenharmony_ci * Copyright (C) 2022 Huawei Device Co., Ltd. 3885b47fbSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4885b47fbSopenharmony_ci * you may not use this file except in compliance with the License. 5885b47fbSopenharmony_ci * You may obtain a copy of the License at 6885b47fbSopenharmony_ci * 7885b47fbSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8885b47fbSopenharmony_ci * 9885b47fbSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10885b47fbSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11885b47fbSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12885b47fbSopenharmony_ci * See the License for the specific language governing permissions and 13885b47fbSopenharmony_ci * limitations under the License. 14885b47fbSopenharmony_ci */ 15885b47fbSopenharmony_ci 16885b47fbSopenharmony_ci#include "accessibility_window_info.h" 17885b47fbSopenharmony_ci 18885b47fbSopenharmony_ci#include <cinttypes> 19885b47fbSopenharmony_ci 20885b47fbSopenharmony_ci#include "hilog_wrapper.h" 21885b47fbSopenharmony_ci 22885b47fbSopenharmony_cinamespace OHOS { 23885b47fbSopenharmony_cinamespace Accessibility { 24885b47fbSopenharmony_ciAccessibilityWindowType AccessibilityWindowInfo::GetAccessibilityWindowType() const 25885b47fbSopenharmony_ci{ 26885b47fbSopenharmony_ci HILOG_DEBUG("accessibilityWindowType_[%{public}d]", accessibilityWindowType_); 27885b47fbSopenharmony_ci return accessibilityWindowType_; 28885b47fbSopenharmony_ci} 29885b47fbSopenharmony_ci 30885b47fbSopenharmony_civoid AccessibilityWindowInfo::SetAccessibilityWindowType(const AccessibilityWindowType type) 31885b47fbSopenharmony_ci{ 32885b47fbSopenharmony_ci accessibilityWindowType_ = type; 33885b47fbSopenharmony_ci HILOG_DEBUG("accessibilityWindowType_[%{public}d]", accessibilityWindowType_); 34885b47fbSopenharmony_ci} 35885b47fbSopenharmony_ci 36885b47fbSopenharmony_ciint32_t AccessibilityWindowInfo::GetWindowLayer() const 37885b47fbSopenharmony_ci{ 38885b47fbSopenharmony_ci HILOG_DEBUG("window(%{public}d)Layer_[%{public}d]", windowId_, windowLayer_); 39885b47fbSopenharmony_ci return windowLayer_; 40885b47fbSopenharmony_ci} 41885b47fbSopenharmony_ci 42885b47fbSopenharmony_civoid AccessibilityWindowInfo::SetWindowLayer(const int32_t layer) 43885b47fbSopenharmony_ci{ 44885b47fbSopenharmony_ci windowLayer_ = layer; 45885b47fbSopenharmony_ci HILOG_DEBUG("window(%{public}d)Layer[%{public}d]", windowId_, windowLayer_); 46885b47fbSopenharmony_ci} 47885b47fbSopenharmony_ci 48885b47fbSopenharmony_ciint32_t AccessibilityWindowInfo::GetWindowId() const 49885b47fbSopenharmony_ci{ 50885b47fbSopenharmony_ci HILOG_DEBUG("windowId_[%{public}d]", windowId_); 51885b47fbSopenharmony_ci return windowId_; 52885b47fbSopenharmony_ci} 53885b47fbSopenharmony_ci 54885b47fbSopenharmony_civoid AccessibilityWindowInfo::SetWindowId(const int32_t id) 55885b47fbSopenharmony_ci{ 56885b47fbSopenharmony_ci windowId_ = id; 57885b47fbSopenharmony_ci HILOG_DEBUG("windowId_[%{public}d]", windowId_); 58885b47fbSopenharmony_ci} 59885b47fbSopenharmony_ci 60885b47fbSopenharmony_ciconst Rect &AccessibilityWindowInfo::GetRectInScreen() const 61885b47fbSopenharmony_ci{ 62885b47fbSopenharmony_ci return boundsInScreen_; 63885b47fbSopenharmony_ci} 64885b47fbSopenharmony_ci 65885b47fbSopenharmony_civoid AccessibilityWindowInfo::SetRectInScreen(const Rect &bounds) 66885b47fbSopenharmony_ci{ 67885b47fbSopenharmony_ci boundsInScreen_.SetLeftTopScreenPostion(const_cast<Rect &>(bounds).GetLeftTopXScreenPostion(), 68885b47fbSopenharmony_ci const_cast<Rect &>(bounds).GetLeftTopYScreenPostion()); 69885b47fbSopenharmony_ci boundsInScreen_.SetRightBottomScreenPostion(const_cast<Rect &>(bounds).GetRightBottomXScreenPostion(), 70885b47fbSopenharmony_ci const_cast<Rect &>(bounds).GetRightBottomYScreenPostion()); 71885b47fbSopenharmony_ci} 72885b47fbSopenharmony_ci 73885b47fbSopenharmony_cibool AccessibilityWindowInfo::IsActive() const 74885b47fbSopenharmony_ci{ 75885b47fbSopenharmony_ci HILOG_DEBUG("active_[%{public}d] windowId_[%{public}d]", active_, windowId_); 76885b47fbSopenharmony_ci return active_; 77885b47fbSopenharmony_ci} 78885b47fbSopenharmony_ci 79885b47fbSopenharmony_civoid AccessibilityWindowInfo::SetActive(bool active) 80885b47fbSopenharmony_ci{ 81885b47fbSopenharmony_ci active_ = active; 82885b47fbSopenharmony_ci HILOG_DEBUG("active_[%{public}d] windowId_[%{public}d]", active_, windowId_); 83885b47fbSopenharmony_ci} 84885b47fbSopenharmony_ci 85885b47fbSopenharmony_cibool AccessibilityWindowInfo::IsFocused() const 86885b47fbSopenharmony_ci{ 87885b47fbSopenharmony_ci HILOG_DEBUG("focused_[%{public}d]", focused_); 88885b47fbSopenharmony_ci return focused_; 89885b47fbSopenharmony_ci} 90885b47fbSopenharmony_ci 91885b47fbSopenharmony_civoid AccessibilityWindowInfo::SetFocused(bool focused) 92885b47fbSopenharmony_ci{ 93885b47fbSopenharmony_ci focused_ = focused; 94885b47fbSopenharmony_ci HILOG_DEBUG("focused_[%{public}d]", focused_); 95885b47fbSopenharmony_ci} 96885b47fbSopenharmony_ci 97885b47fbSopenharmony_cibool AccessibilityWindowInfo::IsAccessibilityFocused() const 98885b47fbSopenharmony_ci{ 99885b47fbSopenharmony_ci HILOG_DEBUG("accessibilityFocused_[%{public}d]", accessibilityFocused_); 100885b47fbSopenharmony_ci return accessibilityFocused_; 101885b47fbSopenharmony_ci} 102885b47fbSopenharmony_ci 103885b47fbSopenharmony_civoid AccessibilityWindowInfo::SetAccessibilityFocused(const bool accessibilityFocused) 104885b47fbSopenharmony_ci{ 105885b47fbSopenharmony_ci accessibilityFocused_ = accessibilityFocused; 106885b47fbSopenharmony_ci HILOG_DEBUG("accessibilityFocused_[%{public}d]", accessibilityFocused_); 107885b47fbSopenharmony_ci} 108885b47fbSopenharmony_ci 109885b47fbSopenharmony_ciAccessibilityWindowInfo::AccessibilityWindowInfo() 110885b47fbSopenharmony_ci{ 111885b47fbSopenharmony_ci} 112885b47fbSopenharmony_ci 113885b47fbSopenharmony_civoid AccessibilityWindowInfo::SetDisplayId(const uint64_t displayId) 114885b47fbSopenharmony_ci{ 115885b47fbSopenharmony_ci HILOG_DEBUG("displayId:%{public}" PRIu64 "", displayId); 116885b47fbSopenharmony_ci displayId_ = displayId; 117885b47fbSopenharmony_ci} 118885b47fbSopenharmony_ci 119885b47fbSopenharmony_ciuint64_t AccessibilityWindowInfo::GetDisplayId() const 120885b47fbSopenharmony_ci{ 121885b47fbSopenharmony_ci HILOG_DEBUG("displayId:%{public}" PRIu64 "", displayId_); 122885b47fbSopenharmony_ci return displayId_; 123885b47fbSopenharmony_ci} 124885b47fbSopenharmony_ci 125885b47fbSopenharmony_ciuint32_t AccessibilityWindowInfo::GetWindowType() const 126885b47fbSopenharmony_ci{ 127885b47fbSopenharmony_ci HILOG_DEBUG("windowType_[%{public}d]", windowType_); 128885b47fbSopenharmony_ci return windowType_; 129885b47fbSopenharmony_ci} 130885b47fbSopenharmony_ci 131885b47fbSopenharmony_civoid AccessibilityWindowInfo::SetWindowType(const uint32_t type) 132885b47fbSopenharmony_ci{ 133885b47fbSopenharmony_ci windowType_ = type; 134885b47fbSopenharmony_ci HILOG_DEBUG("windowType_[%{public}d]", windowType_); 135885b47fbSopenharmony_ci} 136885b47fbSopenharmony_ci 137885b47fbSopenharmony_ciuint32_t AccessibilityWindowInfo::GetWindowMode() const 138885b47fbSopenharmony_ci{ 139885b47fbSopenharmony_ci HILOG_DEBUG("windowMode_[%{public}d]", windowMode_); 140885b47fbSopenharmony_ci return windowMode_; 141885b47fbSopenharmony_ci} 142885b47fbSopenharmony_ci 143885b47fbSopenharmony_civoid AccessibilityWindowInfo::SetWindowMode(const uint32_t mode) 144885b47fbSopenharmony_ci{ 145885b47fbSopenharmony_ci windowMode_ = mode; 146885b47fbSopenharmony_ci HILOG_DEBUG("windowMode_[%{public}d]", windowMode_); 147885b47fbSopenharmony_ci} 148885b47fbSopenharmony_ci 149885b47fbSopenharmony_cibool AccessibilityWindowInfo::IsDecorEnable() const 150885b47fbSopenharmony_ci{ 151885b47fbSopenharmony_ci HILOG_DEBUG("isDecorEnable_[%{public}d]", isDecorEnable_); 152885b47fbSopenharmony_ci return isDecorEnable_; 153885b47fbSopenharmony_ci} 154885b47fbSopenharmony_ci 155885b47fbSopenharmony_civoid AccessibilityWindowInfo::SetDecorEnable(const bool isDecorEnable) 156885b47fbSopenharmony_ci{ 157885b47fbSopenharmony_ci isDecorEnable_ = isDecorEnable; 158885b47fbSopenharmony_ci HILOG_DEBUG("isDecorEnable_[%{public}d]", isDecorEnable_); 159885b47fbSopenharmony_ci} 160885b47fbSopenharmony_ci 161885b47fbSopenharmony_civoid AccessibilityWindowInfo::SetInnerWid(const int32_t innerWid) 162885b47fbSopenharmony_ci{ 163885b47fbSopenharmony_ci innerWid_ = innerWid; 164885b47fbSopenharmony_ci HILOG_DEBUG("innerWid_[%{public}d]", innerWid_); 165885b47fbSopenharmony_ci} 166885b47fbSopenharmony_ci 167885b47fbSopenharmony_ciint32_t AccessibilityWindowInfo::GetInnerWid() const 168885b47fbSopenharmony_ci{ 169885b47fbSopenharmony_ci HILOG_DEBUG("innerWid_[%{public}d]", innerWid_); 170885b47fbSopenharmony_ci return innerWid_; 171885b47fbSopenharmony_ci} 172885b47fbSopenharmony_ci 173885b47fbSopenharmony_civoid AccessibilityWindowInfo::SetUiNodeId(const int64_t nodeId) 174885b47fbSopenharmony_ci{ 175885b47fbSopenharmony_ci uiNodeId_ = nodeId; 176885b47fbSopenharmony_ci HILOG_DEBUG("uiNodeId_[%{public}" PRId64 "]", uiNodeId_); 177885b47fbSopenharmony_ci} 178885b47fbSopenharmony_ci 179885b47fbSopenharmony_ciint64_t AccessibilityWindowInfo::GetUiNodeId() const 180885b47fbSopenharmony_ci{ 181885b47fbSopenharmony_ci HILOG_DEBUG("uiNodeId_[%{public}" PRId64 "]", uiNodeId_); 182885b47fbSopenharmony_ci return uiNodeId_; 183885b47fbSopenharmony_ci} 184885b47fbSopenharmony_ci 185885b47fbSopenharmony_civoid AccessibilityWindowInfo::SetScaleVal(const float scaleVal) 186885b47fbSopenharmony_ci{ 187885b47fbSopenharmony_ci scaleVal_ = scaleVal; 188885b47fbSopenharmony_ci HILOG_DEBUG("set scaleVal_ [%{public}f]", scaleVal_); 189885b47fbSopenharmony_ci} 190885b47fbSopenharmony_ci 191885b47fbSopenharmony_cifloat AccessibilityWindowInfo::GetScaleVal() const 192885b47fbSopenharmony_ci{ 193885b47fbSopenharmony_ci HILOG_DEBUG("get scaleVal_ [%{public}f]", scaleVal_); 194885b47fbSopenharmony_ci return scaleVal_; 195885b47fbSopenharmony_ci} 196885b47fbSopenharmony_ci 197885b47fbSopenharmony_civoid AccessibilityWindowInfo::SetScaleX(const float scaleX) 198885b47fbSopenharmony_ci{ 199885b47fbSopenharmony_ci scaleX_ = scaleX; 200885b47fbSopenharmony_ci HILOG_DEBUG("set scaleX_ [%{public}f]", scaleX_); 201885b47fbSopenharmony_ci} 202885b47fbSopenharmony_ci 203885b47fbSopenharmony_cifloat AccessibilityWindowInfo::GetScaleX() const 204885b47fbSopenharmony_ci{ 205885b47fbSopenharmony_ci HILOG_DEBUG("get scaleX_ [%{public}f]", scaleX_); 206885b47fbSopenharmony_ci return scaleX_; 207885b47fbSopenharmony_ci} 208885b47fbSopenharmony_ci 209885b47fbSopenharmony_civoid AccessibilityWindowInfo::SetScaleY(const float scaleY) 210885b47fbSopenharmony_ci{ 211885b47fbSopenharmony_ci scaleY_ = scaleY; 212885b47fbSopenharmony_ci HILOG_DEBUG("set scaleY_ [%{public}f]", scaleY_); 213885b47fbSopenharmony_ci} 214885b47fbSopenharmony_ci 215885b47fbSopenharmony_cifloat AccessibilityWindowInfo::GetScaleY() const 216885b47fbSopenharmony_ci{ 217885b47fbSopenharmony_ci HILOG_DEBUG("get scaleY_ [%{public}f]", scaleY_); 218885b47fbSopenharmony_ci return scaleY_; 219885b47fbSopenharmony_ci} 220885b47fbSopenharmony_ci 221885b47fbSopenharmony_civoid AccessibilityWindowInfo::SetBundleName(const std::string bundleName) 222885b47fbSopenharmony_ci{ 223885b47fbSopenharmony_ci bundleName_ = bundleName; 224885b47fbSopenharmony_ci HILOG_DEBUG("set bundleName_ [%{public}s]", bundleName_.c_str()); 225885b47fbSopenharmony_ci} 226885b47fbSopenharmony_ci 227885b47fbSopenharmony_cistd::string AccessibilityWindowInfo::GetBundleName() 228885b47fbSopenharmony_ci{ 229885b47fbSopenharmony_ci HILOG_DEBUG("get bundleName_ [%{public}s]", bundleName_.c_str()); 230885b47fbSopenharmony_ci return bundleName_; 231885b47fbSopenharmony_ci} 232885b47fbSopenharmony_ci 233885b47fbSopenharmony_civoid AccessibilityWindowInfo::SetTouchHotAreas(const std::vector<Rect> &touchHotAreas) 234885b47fbSopenharmony_ci{ 235885b47fbSopenharmony_ci touchHotAreas_ = touchHotAreas; 236885b47fbSopenharmony_ci HILOG_DEBUG("set touchHotAreas_ size(%{public}zu)", touchHotAreas_.size()); 237885b47fbSopenharmony_ci} 238885b47fbSopenharmony_ci 239885b47fbSopenharmony_cistd::vector<Rect> AccessibilityWindowInfo::GetTouchHotAreas() 240885b47fbSopenharmony_ci{ 241885b47fbSopenharmony_ci HILOG_DEBUG("get touchHotAreas_size(%{public}zu)", touchHotAreas_.size()); 242885b47fbSopenharmony_ci return touchHotAreas_; 243885b47fbSopenharmony_ci} 244885b47fbSopenharmony_ci 245885b47fbSopenharmony_ciint32_t AccessibilityWindowInfo::GetMainWindowId() const 246885b47fbSopenharmony_ci{ 247885b47fbSopenharmony_ci HILOG_DEBUG("mainWindowId_[%{public}d]", mainWindowId_); 248885b47fbSopenharmony_ci return mainWindowId_; 249885b47fbSopenharmony_ci} 250885b47fbSopenharmony_ci 251885b47fbSopenharmony_civoid AccessibilityWindowInfo::SetMainWindowId(const int32_t id) 252885b47fbSopenharmony_ci{ 253885b47fbSopenharmony_ci mainWindowId_ = id; 254885b47fbSopenharmony_ci HILOG_DEBUG("mainWindowId_[%{public}d]", mainWindowId_); 255885b47fbSopenharmony_ci} 256885b47fbSopenharmony_ci} // namespace Accessibility 257885b47fbSopenharmony_ci} // namespace OHOS