1 #ifndef ACCESSIBLE_NODE_H
2 #define ACCESSIBLE_NODE_H
3 #include <atspi/atspi.h>
10 #include "AccessibleUtils.h"
14 * @brief AccessibleNodeInterface enum class
17 enum class AccessibleNodeInterface {
23 EDITABLETEXT = 0X0010,
37 * @brief NodeFeatureProperties enum class
40 enum class NodeFeatureProperties {
47 LONGCLICKABLE = 0X0040,
58 * @brief Point2d Class
68 Point2D() : x{0}, y{0} {}
74 Point2D(const Point2D &src)
84 Point2D(const T &x, const T &y)
105 template <typename T>
112 Rect() : mTopLeft{0, 0}, mBottomRight{0, 0} {}
118 Rect(const Point2D<T> &tl, const Point2D<T> &br)
119 : mTopLeft(tl), mBottomRight(br)
127 Rect(const T &x1, const T &y1, const T &x2, const T &y2)
128 : mTopLeft{x1, y1}, mBottomRight{x2, y2}
136 Rect(const Rect<T> &src)
139 this->mTopLeft = Point2D<int>{src.mTopLeft};
140 this->mBottomRight = Point2D<int>{src.mBottomRight};
147 Point2D<T> midPoint() const
149 return Point2D<T>{mTopLeft.x + static_cast<T>(width() / 2),
150 mTopLeft.y + static_cast<T>(height() / 2)};
157 T width() const { return mBottomRight.x - mTopLeft.x; }
163 T height() const { return mBottomRight.y - mTopLeft.y; }
173 Point2D<T> mBottomRight;
177 * @brief AccessibleNode Class
180 class AccessibleNode {
181 public: // Constructor & Destructor
192 AccessibleNode(AtspiAccessible *node);
204 static std::unique_ptr<AccessibleNode> get(AtspiAccessible *node);
211 int getChildCount() const;
217 std::unique_ptr<AccessibleNode> getChildAt(int index) const;
223 std::unique_ptr<AccessibleNode> getParent() const;
229 AtspiAccessible *getAccessible() const;
236 std::string getDesc() const;
242 std::string getText() const;
248 std::string getPkg() const;
254 std::string getRes() const;
260 std::string getType() const;
266 std::string getStyle() const;
272 Rect<int> getBoundingBox() const;
278 bool isCheckable() const;
284 bool isChecked() const;
290 bool isClickable() const;
296 bool isEnabled() const;
302 bool isFocusable() const;
308 bool isFocused() const;
314 bool isLongClickable() const;
320 bool isScrollable() const;
326 bool isSelectable() const;
332 bool isSelected() const;
338 bool isVisible() const;
344 bool isShowing() const;
350 bool isActive() const;
356 std::vector<std::string> getActions() const;
363 void print(int) const;
369 void print(int, int) const;
375 void refresh() const;
381 void setValue(std::string text) const;
387 bool doAction(std::string action) const;
394 bool isSupporting(AccessibleNodeInterface thisIface) const;
400 bool hasFeatureProperty(NodeFeatureProperties prop) const;
406 void setFeatureProperty(NodeFeatureProperties prop, bool has) const;
412 void setFeatureProperty(AtspiStateType type) const;
418 static std::map<AtspiAccessible *, AccessibleNode *> mNodeMap;
424 unique_ptr_gobj<AtspiAccessible> mNode;
426 mutable std::string mText;
431 mutable std::string mPkg;
436 mutable std::string mRole;
441 mutable std::string mDesc;
446 mutable std::string mRes;
451 mutable std::string mType;
456 mutable std::string mStyle;
461 mutable Rect<int> mBoundingBox;
466 int mSupportingIfaces;
471 mutable int mFeatureProperty;