Aurum  0.1.1
 All Classes Functions Variables Pages
UiObject.h
1 #ifndef UI_OBJECT_H
2 #define UI_OBJECT_H
3 #include "config.h"
4 
5 #include "AccessibleNode.h"
6 #include "ISearchable.h"
7 #include "UiSelector.h"
8 #include "Waiter.h"
9 
10 #include <memory>
11 #include <vector>
12 
13 class UiDevice;
18 class UiObject : public ISearchable {
19 public:
24  UiObject(const UiDevice *device, const std::shared_ptr<UiSelector> selector,
25  const AccessibleNode *node);
26 
31  UiObject(const UiDevice *device, const std::shared_ptr<UiSelector> selector,
32  std::unique_ptr<AccessibleNode> node);
33 // UiObject(const UiObject &src); // copy constroctur
34 
39  UiObject(UiObject &&src); // move constructor
40 
45  UiObject();
46 
51  virtual ~UiObject();
52 
57  std::shared_ptr<UiSelector> getSelector();
58 
63  bool hasObject(const std::shared_ptr<UiSelector> selector) const override;
64 
69  std::unique_ptr<UiObject> findObject(
70  const std::shared_ptr<UiSelector> selector) const override;
71 
76  std::vector<std::unique_ptr<UiObject>> findObjects(
77  const std::shared_ptr<UiSelector> selector) const override;
78 
83  bool waitFor(
84  const std::function<bool(const ISearchable *)> condition) const;
85 
90  std::unique_ptr<UiObject> waitFor(
91  const std::function<std::unique_ptr<UiObject>(const ISearchable *)>
92  condition) const;
93 
98  bool waitFor(const std::function<bool(const UiObject *)> condition) const;
99 
100 public:
105  UiObject * getParent() const;
106 
111  int getChildCount() const;
112 
117  std::vector<std::unique_ptr<UiObject>> getChildren() const;
118 
123  std::string getContentDescription() const;
124 
129  std::string getApplicationPackage() const;
130 
135  std::string getResourceName() const;
136 
141  std::string getText() const;
142 
147  void setText(std::string text);
148 
153  const Rect<int> getBoundingBox() const;
154 
159  bool isCheckable() const;
160 
165  bool isChecked() const;
166 
171  bool isClickable() const;
172 
177  bool isEnabled() const;
178 
183  bool isFocusable() const;
184 
189  bool isFocused() const;
190 
195  bool isLongClickable() const;
196 
201  bool isScrollable() const;
202 
207  bool isSelectable() const;
208 
213  bool isSelected() const;
214 
219  bool isVisible() const;
220 
225  bool isShowing() const;
226 
231  bool isActive() const;
232 
237  void click() const;
238 
243  void longClick(const unsigned int intv = LOGNCLICK_INTERVAL) const;
244 
249  bool DoAtspiActivate() const;
250 
255  void refresh() const;
256 
257 private:
262  const AccessibleNode *getAccessibleNode() const;
263 
264 private:
268  const UiDevice * mDevice;
269 
273  std::shared_ptr<UiSelector> mSelector;
274 
278  std::unique_ptr<AccessibleNode> mNode;
279 
283  const Waiter * mWaiter;
284  //std::unique_ptr<AccessibleNode> mNode_src;
285 
289  static const unsigned int LOGNCLICK_INTERVAL = 50;
290 };
291 
292 #endif