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,
52 Point2D() : x{0}, y{0} {}
53 Point2D(const Point2D &src)
58 Point2D(const T &x, const T &y)
70 Rect() : mTopLeft{0, 0}, mBottomRight{0, 0} {}
71 Rect(const Point2D<T> &tl, const Point2D<T> &br)
72 : mTopLeft(tl), mBottomRight(br)
75 Rect(const T &x1, const T &y1, const T &x2, const T &y2)
76 : mTopLeft{x1, y1}, mBottomRight{x2, y2}
79 Rect(const Rect<T> &src)
82 this->mTopLeft = Point2D<int>{src.mTopLeft};
83 this->mBottomRight = Point2D<int>{src.mBottomRight};
85 Point2D<T> midPoint() const
87 return Point2D<T>{mTopLeft.x + static_cast<T>(width() / 2),
88 mTopLeft.y + static_cast<T>(height() / 2)};
90 T width() const { return mBottomRight.x - mTopLeft.x; }
92 T height() const { return mBottomRight.y - mTopLeft.y; }
94 Point2D<T> mBottomRight;
97 class AccessibleNode {
100 AccessibleNode(AtspiAccessible *node);
102 static std::unique_ptr<AccessibleNode> get(AtspiAccessible *node);
105 int getChildCount() const;
106 std::unique_ptr<AccessibleNode> getChildAt(int index) const;
107 std::unique_ptr<AccessibleNode> getParent() const;
108 AtspiAccessible *getAccessible() const;
111 std::string getDesc() const;
112 std::string getText() const;
113 std::string getPkg() const;
114 std::string getRes() const;
115 std::string getType() const;
116 std::string getStyle() const;
117 Rect<int> getBoundingBox() const;
119 bool isCheckable() const;
120 bool isChecked() const;
121 bool isClickable() const;
122 bool isEnabled() const;
123 bool isFocusable() const;
124 bool isFocused() const;
125 bool isLongClickable() const;
126 bool isScrollable() const;
127 bool isSelectable() const;
128 bool isSelected() const;
129 bool isVisible() const;
132 void print(int) const;
133 void print(int, int) const;
134 void refresh() const;
136 void setValue(std::string &text) const;
139 bool isSupporting(AccessibleNodeInterface thisIface) const;
140 bool hasFeatureProperty(NodeFeatureProperties prop) const;
141 void setFeatureProperty(NodeFeatureProperties prop, bool has) const;
142 void setFeatureProperty(AtspiStateType type) const;
143 static std::map<AtspiAccessible *, AccessibleNode *> mNodeMap;
146 unique_ptr_gobj<AtspiAccessible> mNode;
148 mutable std::string mText;
149 mutable std::string mPkg;
150 mutable std::string mRole;
151 mutable std::string mDesc;
152 mutable std::string mRes;
153 mutable std::string mType;
154 mutable std::string mStyle;
156 mutable Rect<int> mBoundingBox;
158 int mSupportingIfaces;
159 mutable int mFeatureProperty;