5 #include "AccessibleNode.h"
6 #include "ISearchable.h"
7 #include "UiSelector.h"
15 class Node : public std::enable_shared_from_this<Node> {
17 Node(std::shared_ptr<UiObject> node, std::vector<std::shared_ptr<Node>> children)
18 :mNode{node}, mChildren{children}{}
20 std::shared_ptr<UiObject> mNode;
21 std::vector<std::shared_ptr<Node>> mChildren;
25 * @brief UiObject class
28 class UiObject : public ISearchable , public std::enable_shared_from_this<UiObject> {
34 UiObject(const std::shared_ptr<UiDevice> device, const std::shared_ptr<UiSelector> selector,
35 const AccessibleNode *node);
41 UiObject(const std::shared_ptr<UiDevice> device, const std::shared_ptr<UiSelector> selector,
42 std::shared_ptr<AccessibleNode> node);
43 // UiObject(const UiObject &src); // copy constroctur
49 UiObject(UiObject &&src); // move constructor
67 std::shared_ptr<UiSelector> getSelector();
73 bool hasObject(const std::shared_ptr<UiSelector> selector) const override;
79 std::shared_ptr<UiObject> findObject(
80 const std::shared_ptr<UiSelector> selector) const override;
86 std::vector<std::shared_ptr<UiObject>> findObjects(
87 const std::shared_ptr<UiSelector> selector) const override;
94 const std::function<bool(const ISearchable *)> condition) const;
100 std::shared_ptr<UiObject> waitFor(
101 const std::function<std::shared_ptr<UiObject>(const ISearchable *)>
108 bool waitFor(const std::function<bool(const UiObject *)> condition) const;
115 UiObject * getParent() const;
121 int getChildCount() const;
127 std::vector<std::shared_ptr<UiObject>> getChildren() const;
133 std::shared_ptr<UiObject> getChildAt(int index) const;
139 std::shared_ptr<Node> getDescendant();
145 std::string getApplicationPackage() const;
151 std::string getId() const;
157 std::string getAutomationId() const;
163 std::string getElementType() const;
169 std::string getElementStyle() const;
175 std::string getText() const;
181 std::string getRole() const;
187 void setText(std::string text);
193 const Rect<int> getBoundingBox() const;
199 bool isCheckable() const;
205 bool isChecked() const;
211 bool isClickable() const;
217 bool isEnabled() const;
223 bool isFocusable() const;
229 bool isFocused() const;
235 bool isLongClickable() const;
241 bool isScrollable() const;
247 bool isSelectable() const;
253 bool isSelected() const;
259 bool isVisible() const;
265 bool isShowing() const;
271 bool isActive() const;
283 void longClick(const unsigned int intv = LOGNCLICK_INTERVAL) const;
289 bool DoAtspiActivate() const;
295 void refresh() const;
301 bool isValid() const;
307 std::shared_ptr<AccessibleNode> getAccessibleNode() const;
313 std::shared_ptr<UiDevice> mDevice;
318 std::shared_ptr<UiSelector> mSelector;
323 std::shared_ptr<AccessibleNode> mNode;
328 const Waiter *mWaiter;
333 static const unsigned int LOGNCLICK_INTERVAL = 50;