2 * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #ifndef _ACCESSIBLE_NODE_H_
19 #define _ACCESSIBLE_NODE_H_
27 #include "IEventConsumer.h"
34 * @brief AccessibleNodeInterface enum class
38 enum class AccessibleNodeInterface {
44 EDITABLETEXT = 0X0010,
58 * @brief NodeFeatureProperties enum class
62 enum class NodeFeatureProperties {
70 LONGCLICKABLE = 0X0040,
82 * @brief AccessibleNode Class that provides the abstracted object information to uses.
86 class AccessibleNode : public std::enable_shared_from_this<AccessibleNode>, public IEventConsumer {
89 * @brief AccessibleNode constructor.
96 * @brief AccessibleNode desctructor.
100 virtual ~AccessibleNode();
103 * @brief Gets Node information as string.
109 std::string description();
113 * @copydoc UiObject::getChildCount()
115 virtual int getChildCount() const = 0;
118 * @copydoc UiObject::getChildAt()
120 virtual std::shared_ptr<AccessibleNode> getChildAt(int index) const = 0;
123 * @copydoc UiObject::getChildren()
125 virtual std::vector<std::shared_ptr<AccessibleNode>> getChildren() const = 0;
128 * @copydoc UiObject::getParent()
130 virtual std::shared_ptr<AccessibleNode> getParent() const = 0;
133 * @brief Called by @AccessibleWatcher::notifyAll.
134 * Changes Node property If it's @EventType, @ObjectEventType are matches.
136 * @param[in] type @EventType
137 * @param[in] type2 @ObjectEventType
138 * @param[in] src Atspi Node ptr
142 void notify(int type, int type2, void *src) override;
145 * @brief Changes Node state to invalidate.
153 * @copydoc UiObject::getText()
155 std::string getText() const;
158 * @copydoc UiObject::getPkg()
160 std::string getPkg() const;
163 * @copydoc UiObject::getId()
165 std::string getId() const;
168 * @copydoc UiObject::getAutomationId()
170 std::string getAutomationId() const;
173 * @copydoc UiObject::getRole()
175 std::string getRole() const;
178 * @copydoc UiObject::getType()
180 std::string getType() const;
183 * @copydoc UiObject::getStyle()
185 std::string getStyle() const;
187 * @copydoc UiObject::getXPath()
189 std::string getXPath() const;
192 * @copydoc UiObject::getScreenBoundingBox()
194 Rect<int> getScreenBoundingBox() const;
197 * @copydoc UiObject::getWindowBoundingBox()
199 Rect<int> getWindowBoundingBox() const;
202 * @copydoc UiObject::isCheckable()
204 bool isCheckable() const;
207 * @copydoc UiObject::isChecked()
209 bool isChecked() const;
212 * @copydoc UiObject::isClickable()
214 bool isClickable() const;
217 * @copydoc UiObject::isEnabled()
219 bool isEnabled() const;
222 * @copydoc UiObject::isFocusable()
224 bool isFocusable() const;
227 * @copydoc UiObject::isFocused()
229 bool isFocused() const;
232 * @copydoc UiObject::isLongClickable()
234 bool isLongClickable() const;
237 * @copydoc UiObject::isScrollable()
239 bool isScrollable() const;
242 * @copydoc UiObject::isSelectable()
244 bool isSelectable() const;
247 * @copydoc UiObject::isSelected()
249 bool isSelected() const;
252 * @copydoc UiObject::isVisible()
254 bool isVisible() const;
257 * @copydoc UiObject::isShowing()
259 bool isShowing() const;
262 * @copydoc UiObject::isActive()
264 bool isActive() const;
268 * @brief Print Node information.
270 * @param[in] int depth
277 * @brief Print Node information.
279 * @param[in] int depth
280 * @param[in] int maxdepth
284 void print(int, int);
287 * @brief Gets matched Atspi node ptr.
289 * @return Atspi node ptr
293 virtual void* getRawHandler(void) const = 0;
296 * @copydoc UiObject::updateRoleName()
298 virtual void updateRoleName() = 0;
301 * @copydoc UiObject::updateUniqueId()
303 virtual void updateUniqueId() = 0;
306 * @copydoc UiObject::updateName()
308 virtual void updateName() = 0;
311 * @copydoc UiObject::updateApplication()
313 virtual void updateApplication() = 0;
316 * @copydoc UiObject::updateAttributes()
318 virtual void updateAttributes() = 0;
321 * @copydoc UiObject::updateStates()
323 virtual void updateStates() = 0;
326 * @copydoc UiObject::updateExtents()
328 virtual void updateExtents() = 0;
331 * @copydoc UiObject::updateXPath()
333 virtual void updateXPath() = 0;
336 * @copydoc UiObject::setFocus()
338 virtual bool setFocus() = 0;
341 * @brief Updates Node information from atspi server.
345 virtual void refresh(bool updateAll = true) = 0;
348 * @brief Gets available atspi action name.
350 * @return string vector
354 virtual std::vector<std::string> getActions() const = 0;
357 * @brief Do atspi action.
359 * @param[in] action name of action
361 * @return true if success, else false
365 virtual bool doAction(std::string action) = 0;
368 * @brief Sets Node's value.
370 * @param[in] text string
372 * @return true if success, else false
376 virtual bool setValue(std::string text) = 0;
379 * @brief Check object valid or not.
381 * @return true if valid, else false
385 virtual bool isValid() const;
389 * @brief Check Node support given interface or not.
391 * @param[in] thisIface @AccessibleNodeInterface
393 * @return true if supporting, else false
397 bool isSupporting(AccessibleNodeInterface thisIface) const;
400 * @brief Check Node has given property or not.
402 * @param[in] prop @NodeFeatureProperties
404 * @return true if has, else false
408 bool hasFeatureProperty(NodeFeatureProperties prop) const;
411 * @brief Sets Node's property.
413 * @param[in] prop @NodeFeatureProperties
414 * @param[in] has Node has given property ot not
418 void setFeatureProperty(NodeFeatureProperties prop, bool has);
421 * @brief Resets all the property value on Node.
425 void resetFeatureProperty();
432 std::string mAutomationId;
436 Rect<int> mScreenBoundingBox;
437 Rect<int> mWindowBoundingBox;
438 int mSupportingIfaces;
439 int mFeatureProperty;
443 mutable std::mutex mLock;