build: get doxygen generating selective
[platform/core/uifw/aurum.git] / libaurum / inc / AccessibleNode.h
1 #ifndef ACCESSIBLE_NODE_H
2 #define ACCESSIBLE_NODE_H
3 #include <atspi/atspi.h>
4
5 #include <map>
6 #include <memory>
7 #include <string>
8 #include <vector>
9
10 #include "AccessibleUtils.h"
11 #include "config.h"
12
13 /**
14  * @brief AccessibleNodeInterface enum class
15  * @since_tizen 5.5
16  */
17 enum class AccessibleNodeInterface {
18     ACTION = 0x0001,
19     COLLECTION = 0X0002,
20     COMPONENT = 0X0004,
21     DOCUMENT = 0X0008,
22
23     EDITABLETEXT = 0X0010,
24     HYPERTEXT = 0X0020,
25     IMAGE = 0X0040,
26     SELECTION = 0X0080,
27
28     TEXT = 0X0100,
29     VALUE = 0X0200,
30     ACCESSIBLE = 0X0400,
31     TABLE = 0X0800,
32
33     TABLECELL = 0X1000,
34 };
35
36 /**
37  * @brief NodeFeatureProperties enum class
38  * @since_tizen 5.5
39  */
40 enum class NodeFeatureProperties {
41     CHECKABLE = 0x0001,
42     CHECKED = 0X0002,
43     CLICKABLE = 0X0004,
44     ENABLED = 0X0008,
45     FOCUSABLE = 0X0010,
46     FOCUSED = 0X0020,
47     LONGCLICKABLE = 0X0040,
48     SCROLLABLE = 0X0080,
49
50     SELECTABLE = 0X0100,
51     SELECTED = 0X0200,
52     VISIBLE = 0X0400,
53     SHOWING = 0X0800,
54     ACTIVE = 0X0800,
55 };
56
57 /**
58  * @brief Point2d Class
59  * @since_tizen 5.5
60  */
61 template <typename T>
62 class Point2D {
63 public:
64     /**
65      * @brief TBD
66      * @since_tizen 5.5
67      */
68     Point2D() : x{0}, y{0} {}
69
70     /**
71      * @brief TBD
72      * @since_tizen 5.5
73      */
74     Point2D(const Point2D &src)
75     {
76         x = src.x;
77         y = src.y;
78     }
79
80     /**
81      * @brief TBD
82      * @since_tizen 5.5
83      */
84     Point2D(const T &x, const T &y)
85     {
86         this->x = x;
87         this->y = y;
88     }
89
90     /**
91      * @brief TBD
92      */
93     T x;
94
95     /**
96      * @brief TBD
97      */
98     T y;
99 };
100
101 /**
102  * @brief Rect Class
103  * @since_tizen 5.5
104  */
105 template <typename T>
106 class Rect {
107 public:
108     /**
109      * @brief TBD
110      * @since_tizen 5.5
111      */
112     Rect() : mTopLeft{0, 0}, mBottomRight{0, 0} {}
113
114     /**
115      * @brief TBD
116      * @since_tizen 5.5
117      */
118     Rect(const Point2D<T> &tl, const Point2D<T> &br)
119         : mTopLeft(tl), mBottomRight(br)
120     {
121     }
122
123     /**
124      * @brief TBD
125      * @since_tizen 5.5
126      */
127     Rect(const T &x1, const T &y1, const T &x2, const T &y2)
128         : mTopLeft{x1, y1}, mBottomRight{x2, y2}
129     {
130     }
131
132     /**
133      * @brief TBD
134      * @since_tizen 5.5
135      */
136     Rect(const Rect<T> &src)
137
138     {
139         this->mTopLeft = Point2D<int>{src.mTopLeft};
140         this->mBottomRight = Point2D<int>{src.mBottomRight};
141     }
142
143     /**
144      * @brief TBD
145      * @since_tizen 5.5
146      */
147     Point2D<T> midPoint() const
148     {
149         return Point2D<T>{mTopLeft.x + static_cast<T>(width() / 2),
150                           mTopLeft.y + static_cast<T>(height() / 2)};
151     }
152
153     /**
154      * @brief TBD
155      * @since_tizen 5.5
156      */
157     T width() const { return mBottomRight.x - mTopLeft.x; }
158
159     /**
160      * @brief TBD
161      * @since_tizen 5.5
162      */
163     T height() const { return mBottomRight.y - mTopLeft.y; }
164
165     /**
166      * @brief TBD
167      */
168     Point2D<T> mTopLeft;
169
170     /**
171      * @brief TBD
172      */
173     Point2D<T> mBottomRight;
174 };
175
176 /**
177  * @brief AccessibleNode Class
178  * @since_tizen 5.5
179  */
180 class AccessibleNode {
181 public:  // Constructor & Destructor
182     /**
183      * @brief TBD
184      * @since_tizen 5.5
185      */
186     AccessibleNode();
187
188     /**
189      * @brief TBD
190      * @since_tizen 5.5
191      */
192     AccessibleNode(AtspiAccessible *node);
193
194     /**
195      * @brief TBD
196      * @since_tizen 5.5
197      */
198     ~AccessibleNode();
199
200     /**
201      * @brief TBD
202      * @since_tizen 5.5
203      */
204     static std::unique_ptr<AccessibleNode> get(AtspiAccessible *node);
205
206 public:
207     /**
208      * @brief TBD
209      * @since_tizen 5.5
210      */
211     int getChildCount() const;
212
213     /**
214      * @brief TBD
215      * @since_tizen 5.5
216      */
217     std::unique_ptr<AccessibleNode> getChildAt(int index) const;
218
219     /**
220      * @brief TBD
221      * @since_tizen 5.5
222      */
223     std::unique_ptr<AccessibleNode> getParent() const;
224
225     /**
226      * @brief TBD
227      * @since_tizen 5.5
228      */
229     AtspiAccessible *getAccessible() const;
230
231 public:
232     /**
233      * @brief TBD
234      * @since_tizen 5.5
235      */
236     std::string getDesc() const;
237
238     /**
239      * @brief TBD
240      * @since_tizen 5.5
241      */
242     std::string getText() const;
243
244     /**
245      * @brief TBD
246      * @since_tizen 5.5
247      */
248     std::string getPkg() const;
249
250     /**
251      * @brief TBD
252      * @since_tizen 5.5
253      */
254     std::string getRes() const;
255
256     /**
257      * @brief TBD
258      * @since_tizen 5.5
259      */
260     std::string getType() const;
261
262     /**
263      * @brief TBD
264      * @since_tizen 5.5
265      */
266     std::string getStyle() const;
267
268     /**
269      * @brief TBD
270      * @since_tizen 5.5
271      */
272     Rect<int> getBoundingBox() const;
273
274     /**
275      * @brief TBD
276      * @since_tizen 5.5
277      */
278     bool isCheckable() const;
279
280     /**
281      * @brief TBD
282      * @since_tizen 5.5
283      */
284     bool isChecked() const;
285
286     /**
287      * @brief TBD
288      * @since_tizen 5.5
289      */
290     bool isClickable() const;
291
292     /**
293      * @brief TBD
294      * @since_tizen 5.5
295      */
296     bool isEnabled() const;
297
298     /**
299      * @brief TBD
300      * @since_tizen 5.5
301      */
302     bool isFocusable() const;
303
304     /**
305      * @brief TBD
306      * @since_tizen 5.5
307      */
308     bool isFocused() const;
309
310     /**
311      * @brief TBD
312      * @since_tizen 5.5
313      */
314     bool isLongClickable() const;
315
316     /**
317      * @brief TBD
318      * @since_tizen 5.5
319      */
320     bool isScrollable() const;
321
322     /**
323      * @brief TBD
324      * @since_tizen 5.5
325      */
326     bool isSelectable() const;
327
328     /**
329      * @brief TBD
330      * @since_tizen 5.5
331      */
332     bool isSelected() const;
333
334     /**
335      * @brief TBD
336      * @since_tizen 5.5
337      */
338     bool isVisible() const;
339
340     /**
341      * @brief TBD
342      * @since_tizen 5.5
343      */
344     bool isShowing() const;
345
346     /**
347      * @brief TBD
348      * @since_tizen 5.5
349      */
350     bool isActive() const;
351
352     /**
353      * @brief TBD
354      * @since_tizen 5.5
355      */
356     std::vector<std::string> getActions() const;
357
358 public:
359     /**
360      * @brief TBD
361      * @since_tizen 5.5
362      */
363     void print(int) const;
364
365     /**
366      * @brief TBD
367      * @since_tizen 5.5
368      */
369     void print(int, int) const;
370
371     /**
372      * @brief TBD
373      * @since_tizen 5.5
374      */
375     void refresh() const;
376
377     /**
378      * @brief TBD
379      * @since_tizen 5.5
380      */
381     void setValue(std::string text) const;
382
383     /**
384      * @brief TBD
385      * @since_tizen 5.5
386      */
387     bool doAction(std::string action) const;
388
389 private:
390     /**
391      * @brief TBD
392      * @since_tizen 5.5
393      */
394     bool isSupporting(AccessibleNodeInterface thisIface) const;
395
396     /**
397      * @brief TBD
398      * @since_tizen 5.5
399      */
400     bool hasFeatureProperty(NodeFeatureProperties prop) const;
401
402     /**
403      * @brief TBD
404      * @since_tizen 5.5
405      */
406     void setFeatureProperty(NodeFeatureProperties prop, bool has) const;
407
408     /**
409      * @brief TBD
410      * @since_tizen 5.5
411      */
412     void setFeatureProperty(AtspiStateType type) const;
413
414     /**
415      * @brief TBD
416      * @since_tizen 5.5
417      */
418     static std::map<AtspiAccessible *, AccessibleNode *> mNodeMap;
419
420 private:
421     /**
422      * @brief TBD
423      */
424     unique_ptr_gobj<AtspiAccessible> mNode;
425
426     mutable std::string mText;
427
428     /**
429      * @brief TBD
430      */
431     mutable std::string mPkg;
432
433     /**
434      * @brief TBD
435      */
436     mutable std::string mRole;
437
438     /**
439      * @brief TBD
440      */
441     mutable std::string mDesc;
442
443     /**
444      * @brief TBD
445      */
446     mutable std::string mRes;
447
448     /**
449      * @brief TBD
450      */
451     mutable std::string mType;
452
453     /**
454      * @brief TBD
455      */
456     mutable std::string mStyle;
457
458     /**
459      * @brief TBD
460      */
461     mutable Rect<int> mBoundingBox;
462
463     /**
464      * @brief TBD
465      */
466     int mSupportingIfaces;
467
468     /**
469      * @brief TBD
470      */
471     mutable int mFeatureProperty;
472
473     /**
474      * @brief TBD
475      */
476     bool mIsAlive;
477 };
478
479 #endif