1 #ifndef ACCESSIBLE_NODE_H
2 #define ACCESSIBLE_NODE_H
5 #include "AccessibleUtils.h"
7 #include <atspi/atspi.h>
13 enum class AccessibleNodeInterface {
19 EDITABLETEXT = 0X0010,
32 enum class NodeFeatureProperties {
39 LONGCLICKABLE = 0X0040,
50 Point2D() : x{0}, y{0} {}
51 Point2D(const Point2D &src)
56 Point2D(const T &x, const T &y)
68 Rect() : mTopLeft{0, 0}, mBottomRight{0, 0} {}
69 Rect(const Point2D<T> &tl, const Point2D<T> &br)
70 : mTopLeft(tl), mBottomRight(br)
73 Rect(const T &x1, const T &y1, const T &x2, const T &y2)
74 : mTopLeft{x1, y1}, mBottomRight{x2, y2}
77 Rect(const Rect<T> &src)
80 this->mTopLeft = Point2D<int>{src.mTopLeft};
81 this->mBottomRight = Point2D<int>{src.mBottomRight};
83 Point2D<T> midPoint() const
85 return Point2D<T>{mTopLeft.x + static_cast<T>(width() / 2),
86 mTopLeft.y + static_cast<T>(height() / 2)};
88 T width() const { return mBottomRight.x - mTopLeft.x; }
90 T height() const { return mBottomRight.y - mTopLeft.y; }
92 Point2D<T> mBottomRight;
95 class AccessibleNode {
98 AccessibleNode(AtspiAccessible *node);
100 static std::unique_ptr<AccessibleNode> get(AtspiAccessible *node);
103 int getChildCount() const;
104 std::unique_ptr<AccessibleNode> getChildAt(int index) const;
105 std::unique_ptr<AccessibleNode> getParent() const;
106 AtspiAccessible *getAccessible() const;
109 std::string getDesc() const;
110 std::string getText() const;
111 std::string getPkg() const;
112 std::string getRes() const;
113 std::string getType() const;
114 std::string getStyle() const;
115 Rect<int> getBoundingBox() const;
117 bool isCheckable() const;
118 bool isChecked() const;
119 bool isClickable() const;
120 bool isEnabled() const;
121 bool isFocusable() const;
122 bool isFocused() const;
123 bool isLongClickable() const;
124 bool isScrollable() const;
125 bool isSelectable() const;
126 bool isSelected() const;
127 bool isVisible() const;
130 void print(int) const;
131 void print(int, int) const;
132 void refresh() const;
134 void setValue(std::string &text) const;
137 bool isSupporting(AccessibleNodeInterface thisIface) const;
138 bool hasFeatureProperty(NodeFeatureProperties prop) const;
139 void setFeatureProperty(NodeFeatureProperties prop, bool has);
140 static std::map<AtspiAccessible *, AccessibleNode *> mNodeMap;
143 unique_ptr_gobj<AtspiAccessible> mNode;
145 mutable std::string mText;
146 mutable std::string mPkg;
147 mutable std::string mRole;
148 mutable std::string mDesc;
149 mutable std::string mRes;
150 mutable std::string mType;
151 mutable std::string mStyle;
153 mutable Rect<int> mBoundingBox;
155 int mSupportingIfaces;
156 int mFeatureProperty;