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 "accessibility_window_info.h"
17
18 #include <cinttypes>
19
20 #include "hilog_wrapper.h"
21
22 namespace OHOS {
23 namespace Accessibility {
GetAccessibilityWindowType() const24 AccessibilityWindowType AccessibilityWindowInfo::GetAccessibilityWindowType() const
25 {
26 HILOG_DEBUG("accessibilityWindowType_[%{public}d]", accessibilityWindowType_);
27 return accessibilityWindowType_;
28 }
29
SetAccessibilityWindowType(const AccessibilityWindowType type)30 void AccessibilityWindowInfo::SetAccessibilityWindowType(const AccessibilityWindowType type)
31 {
32 accessibilityWindowType_ = type;
33 HILOG_DEBUG("accessibilityWindowType_[%{public}d]", accessibilityWindowType_);
34 }
35
GetWindowLayer() const36 int32_t AccessibilityWindowInfo::GetWindowLayer() const
37 {
38 HILOG_DEBUG("window(%{public}d)Layer_[%{public}d]", windowId_, windowLayer_);
39 return windowLayer_;
40 }
41
SetWindowLayer(const int32_t layer)42 void AccessibilityWindowInfo::SetWindowLayer(const int32_t layer)
43 {
44 windowLayer_ = layer;
45 HILOG_DEBUG("window(%{public}d)Layer[%{public}d]", windowId_, windowLayer_);
46 }
47
GetWindowId() const48 int32_t AccessibilityWindowInfo::GetWindowId() const
49 {
50 HILOG_DEBUG("windowId_[%{public}d]", windowId_);
51 return windowId_;
52 }
53
SetWindowId(const int32_t id)54 void AccessibilityWindowInfo::SetWindowId(const int32_t id)
55 {
56 windowId_ = id;
57 HILOG_DEBUG("windowId_[%{public}d]", windowId_);
58 }
59
GetRectInScreen() const60 const Rect &AccessibilityWindowInfo::GetRectInScreen() const
61 {
62 return boundsInScreen_;
63 }
64
SetRectInScreen(const Rect & bounds)65 void AccessibilityWindowInfo::SetRectInScreen(const Rect &bounds)
66 {
67 boundsInScreen_.SetLeftTopScreenPostion(const_cast<Rect &>(bounds).GetLeftTopXScreenPostion(),
68 const_cast<Rect &>(bounds).GetLeftTopYScreenPostion());
69 boundsInScreen_.SetRightBottomScreenPostion(const_cast<Rect &>(bounds).GetRightBottomXScreenPostion(),
70 const_cast<Rect &>(bounds).GetRightBottomYScreenPostion());
71 }
72
IsActive() const73 bool AccessibilityWindowInfo::IsActive() const
74 {
75 HILOG_DEBUG("active_[%{public}d] windowId_[%{public}d]", active_, windowId_);
76 return active_;
77 }
78
SetActive(bool active)79 void AccessibilityWindowInfo::SetActive(bool active)
80 {
81 active_ = active;
82 HILOG_DEBUG("active_[%{public}d] windowId_[%{public}d]", active_, windowId_);
83 }
84
IsFocused() const85 bool AccessibilityWindowInfo::IsFocused() const
86 {
87 HILOG_DEBUG("focused_[%{public}d]", focused_);
88 return focused_;
89 }
90
SetFocused(bool focused)91 void AccessibilityWindowInfo::SetFocused(bool focused)
92 {
93 focused_ = focused;
94 HILOG_DEBUG("focused_[%{public}d]", focused_);
95 }
96
IsAccessibilityFocused() const97 bool AccessibilityWindowInfo::IsAccessibilityFocused() const
98 {
99 HILOG_DEBUG("accessibilityFocused_[%{public}d]", accessibilityFocused_);
100 return accessibilityFocused_;
101 }
102
SetAccessibilityFocused(const bool accessibilityFocused)103 void AccessibilityWindowInfo::SetAccessibilityFocused(const bool accessibilityFocused)
104 {
105 accessibilityFocused_ = accessibilityFocused;
106 HILOG_DEBUG("accessibilityFocused_[%{public}d]", accessibilityFocused_);
107 }
108
AccessibilityWindowInfo()109 AccessibilityWindowInfo::AccessibilityWindowInfo()
110 {
111 }
112
SetDisplayId(const uint64_t displayId)113 void AccessibilityWindowInfo::SetDisplayId(const uint64_t displayId)
114 {
115 HILOG_DEBUG("displayId:%{public}" PRIu64 "", displayId);
116 displayId_ = displayId;
117 }
118
GetDisplayId() const119 uint64_t AccessibilityWindowInfo::GetDisplayId() const
120 {
121 HILOG_DEBUG("displayId:%{public}" PRIu64 "", displayId_);
122 return displayId_;
123 }
124
GetWindowType() const125 uint32_t AccessibilityWindowInfo::GetWindowType() const
126 {
127 HILOG_DEBUG("windowType_[%{public}d]", windowType_);
128 return windowType_;
129 }
130
SetWindowType(const uint32_t type)131 void AccessibilityWindowInfo::SetWindowType(const uint32_t type)
132 {
133 windowType_ = type;
134 HILOG_DEBUG("windowType_[%{public}d]", windowType_);
135 }
136
GetWindowMode() const137 uint32_t AccessibilityWindowInfo::GetWindowMode() const
138 {
139 HILOG_DEBUG("windowMode_[%{public}d]", windowMode_);
140 return windowMode_;
141 }
142
SetWindowMode(const uint32_t mode)143 void AccessibilityWindowInfo::SetWindowMode(const uint32_t mode)
144 {
145 windowMode_ = mode;
146 HILOG_DEBUG("windowMode_[%{public}d]", windowMode_);
147 }
148
IsDecorEnable() const149 bool AccessibilityWindowInfo::IsDecorEnable() const
150 {
151 HILOG_DEBUG("isDecorEnable_[%{public}d]", isDecorEnable_);
152 return isDecorEnable_;
153 }
154
SetDecorEnable(const bool isDecorEnable)155 void AccessibilityWindowInfo::SetDecorEnable(const bool isDecorEnable)
156 {
157 isDecorEnable_ = isDecorEnable;
158 HILOG_DEBUG("isDecorEnable_[%{public}d]", isDecorEnable_);
159 }
160
SetInnerWid(const int32_t innerWid)161 void AccessibilityWindowInfo::SetInnerWid(const int32_t innerWid)
162 {
163 innerWid_ = innerWid;
164 HILOG_DEBUG("innerWid_[%{public}d]", innerWid_);
165 }
166
GetInnerWid() const167 int32_t AccessibilityWindowInfo::GetInnerWid() const
168 {
169 HILOG_DEBUG("innerWid_[%{public}d]", innerWid_);
170 return innerWid_;
171 }
172
SetUiNodeId(const int64_t nodeId)173 void AccessibilityWindowInfo::SetUiNodeId(const int64_t nodeId)
174 {
175 uiNodeId_ = nodeId;
176 HILOG_DEBUG("uiNodeId_[%{public}" PRId64 "]", uiNodeId_);
177 }
178
GetUiNodeId() const179 int64_t AccessibilityWindowInfo::GetUiNodeId() const
180 {
181 HILOG_DEBUG("uiNodeId_[%{public}" PRId64 "]", uiNodeId_);
182 return uiNodeId_;
183 }
184
SetScaleVal(const float scaleVal)185 void AccessibilityWindowInfo::SetScaleVal(const float scaleVal)
186 {
187 scaleVal_ = scaleVal;
188 HILOG_DEBUG("set scaleVal_ [%{public}f]", scaleVal_);
189 }
190
GetScaleVal() const191 float AccessibilityWindowInfo::GetScaleVal() const
192 {
193 HILOG_DEBUG("get scaleVal_ [%{public}f]", scaleVal_);
194 return scaleVal_;
195 }
196
SetScaleX(const float scaleX)197 void AccessibilityWindowInfo::SetScaleX(const float scaleX)
198 {
199 scaleX_ = scaleX;
200 HILOG_DEBUG("set scaleX_ [%{public}f]", scaleX_);
201 }
202
GetScaleX() const203 float AccessibilityWindowInfo::GetScaleX() const
204 {
205 HILOG_DEBUG("get scaleX_ [%{public}f]", scaleX_);
206 return scaleX_;
207 }
208
SetScaleY(const float scaleY)209 void AccessibilityWindowInfo::SetScaleY(const float scaleY)
210 {
211 scaleY_ = scaleY;
212 HILOG_DEBUG("set scaleY_ [%{public}f]", scaleY_);
213 }
214
GetScaleY() const215 float AccessibilityWindowInfo::GetScaleY() const
216 {
217 HILOG_DEBUG("get scaleY_ [%{public}f]", scaleY_);
218 return scaleY_;
219 }
220
SetBundleName(const std::string bundleName)221 void AccessibilityWindowInfo::SetBundleName(const std::string bundleName)
222 {
223 bundleName_ = bundleName;
224 HILOG_DEBUG("set bundleName_ [%{public}s]", bundleName_.c_str());
225 }
226
GetBundleName()227 std::string AccessibilityWindowInfo::GetBundleName()
228 {
229 HILOG_DEBUG("get bundleName_ [%{public}s]", bundleName_.c_str());
230 return bundleName_;
231 }
232
SetTouchHotAreas(const std::vector<Rect> & touchHotAreas)233 void AccessibilityWindowInfo::SetTouchHotAreas(const std::vector<Rect> &touchHotAreas)
234 {
235 touchHotAreas_ = touchHotAreas;
236 HILOG_DEBUG("set touchHotAreas_ size(%{public}zu)", touchHotAreas_.size());
237 }
238
GetTouchHotAreas()239 std::vector<Rect> AccessibilityWindowInfo::GetTouchHotAreas()
240 {
241 HILOG_DEBUG("get touchHotAreas_size(%{public}zu)", touchHotAreas_.size());
242 return touchHotAreas_;
243 }
244
GetMainWindowId() const245 int32_t AccessibilityWindowInfo::GetMainWindowId() const
246 {
247 HILOG_DEBUG("mainWindowId_[%{public}d]", mainWindowId_);
248 return mainWindowId_;
249 }
250
SetMainWindowId(const int32_t id)251 void AccessibilityWindowInfo::SetMainWindowId(const int32_t id)
252 {
253 mainWindowId_ = id;
254 HILOG_DEBUG("mainWindowId_[%{public}d]", mainWindowId_);
255 }
256 } // namespace Accessibility
257 } // namespace OHOS