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;
188 * @copydoc UiObject::getScreenBoundingBox()
190 Rect<int> getScreenBoundingBox() const;
193 * @copydoc UiObject::getWindowBoundingBox()
195 Rect<int> getWindowBoundingBox() const;
198 * @copydoc UiObject::isCheckable()
200 bool isCheckable() const;
203 * @copydoc UiObject::isChecked()
205 bool isChecked() const;
208 * @copydoc UiObject::isClickable()
210 bool isClickable() const;
213 * @copydoc UiObject::isEnabled()
215 bool isEnabled() const;
218 * @copydoc UiObject::isFocusable()
220 bool isFocusable() const;
223 * @copydoc UiObject::isFocused()
225 bool isFocused() const;
228 * @copydoc UiObject::isLongClickable()
230 bool isLongClickable() const;
233 * @copydoc UiObject::isScrollable()
235 bool isScrollable() const;
238 * @copydoc UiObject::isSelectable()
240 bool isSelectable() const;
243 * @copydoc UiObject::isSelected()
245 bool isSelected() const;
248 * @copydoc UiObject::isVisible()
250 bool isVisible() const;
253 * @copydoc UiObject::isShowing()
255 bool isShowing() const;
258 * @copydoc UiObject::isActive()
260 bool isActive() const;
264 * @brief Print Node information.
266 * @param[in] int depth
273 * @brief Print Node information.
275 * @param[in] int depth
276 * @param[in] int maxdepth
280 void print(int, int);
283 * @brief Gets matched Atspi node ptr.
285 * @return Atspi node ptr
289 virtual void* getRawHandler(void) const = 0;
292 * @copydoc UiObject::updateRoleName()
294 virtual void updateRoleName() = 0;
297 * @copydoc UiObject::updateUniqueId()
299 virtual void updateUniqueId() = 0;
302 * @copydoc UiObject::updateName()
304 virtual void updateName() = 0;
307 * @copydoc UiObject::updateApplication()
309 virtual void updateApplication() = 0;
312 * @copydoc UiObject::updateAttributes()
314 virtual void updateAttributes() = 0;
317 * @copydoc UiObject::updateStates()
319 virtual void updateStates() = 0;
322 * @copydoc UiObject::updateExtents()
324 virtual void updateExtents() = 0;
327 * @copydoc UiObject::updateXPath()
329 virtual void updateXPath() = 0;
332 * @copydoc UiObject::setFocus()
334 virtual bool setFocus() = 0;
337 * @brief Updates Node information from atspi server.
341 virtual void refresh(bool updateAll = true) = 0;
344 * @brief Gets available atspi action name.
346 * @return string vector
350 virtual std::vector<std::string> getActions() const = 0;
353 * @brief Do atspi action.
355 * @param[in] action name of action
357 * @return true if success, else false
361 virtual bool doAction(std::string action) = 0;
364 * @brief Sets Node's value.
366 * @param[in] text string
368 * @return true if success, else false
372 virtual bool setValue(std::string text) = 0;
375 * @brief Check object valid or not.
377 * @return true if valid, else false
381 virtual bool isValid() const;
385 * @brief Check Node support given interface or not.
387 * @param[in] thisIface @AccessibleNodeInterface
389 * @return true if supporting, else false
393 bool isSupporting(AccessibleNodeInterface thisIface) const;
396 * @brief Check Node has given property or not.
398 * @param[in] prop @NodeFeatureProperties
400 * @return true if has, else false
404 bool hasFeatureProperty(NodeFeatureProperties prop) const;
407 * @brief Sets Node's property.
409 * @param[in] prop @NodeFeatureProperties
410 * @param[in] has Node has given property ot not
414 void setFeatureProperty(NodeFeatureProperties prop, bool has);
417 * @brief Resets all the property value on Node.
421 void resetFeatureProperty();
428 std::string mAutomationId;
432 Rect<int> mScreenBoundingBox;
433 Rect<int> mWindowBoundingBox;
434 int mSupportingIfaces;
435 int mFeatureProperty;
439 mutable std::mutex mLock;