[Tizen](ATSPI) Fix Native TC fails
[platform/core/uifw/dali-adaptor.git] / dali / devel-api / adaptor-framework / accessibility-adaptor.h
1 #ifndef DALI_ACCESSIBILITY_ADAPTOR_H
2 #define DALI_ACCESSIBILITY_ADAPTOR_H
3
4 /*
5  * Copyright (c) 2019 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21
22 // EXTERNAL INCLUDES
23 #include <dali/public-api/events/touch-event.h>
24 #include <dali/public-api/object/base-handle.h>
25 #include <dali/public-api/dali-adaptor-common.h>
26
27 namespace Dali
28 {
29
30 namespace Internal DALI_INTERNAL
31 {
32 namespace Adaptor
33 {
34 class AccessibilityAdaptor;
35 }
36 }
37
38 class AccessibilityActionHandler;
39 class AccessibilityGestureHandler;
40 class TouchPoint;
41
42 /**
43  * @brief The AccessibilityAdaptor provides communication to the accessibility manager interface (implemented in toolkit).
44  *
45  */
46 class DALI_ADAPTOR_API AccessibilityAdaptor : public BaseHandle
47 {
48 public:
49
50   /**
51    * @brief Create an uninitialized handle.
52    *
53    * This can be initialized by calling getting the adaptor from Dali::Adaptor.
54    */
55   AccessibilityAdaptor();
56
57   /**
58    * @brief Retrieve a handle to the AccessibilityAdaptor.
59    *
60    * @return A handle to the AccessibilityAdaptor.
61    */
62   static AccessibilityAdaptor Get();
63
64   /**
65    * @brief Destructor
66    *
67    * This is non-virtual since derived Handle types must not contain data or virtual methods.
68    */
69   ~AccessibilityAdaptor();
70
71   /**
72    * @brief Returns the current position of the read action.
73    * @return The current event position.
74    */
75   Vector2 GetReadPosition() const;
76
77   /**
78    * @brief Query whether the accessibility(screen-reader) is enabled.
79    *
80    * The accessibility will be enabled by system setting.
81    * @return True if the accessibility(screen-reader) is enabled.
82    */
83   bool IsEnabled() const;
84
85   /**
86    * @brief Set the handler to handle accessibility actions.
87    *
88    * @param[in] handler The Accessibility action handler.
89    * @note Handlers should remove themselves when they are destroyed.
90    */
91   void SetActionHandler(AccessibilityActionHandler& handler);
92
93   /**
94    * @brief Set the handler to handle accessibility gestures.
95    *
96    * @param[in] handler The Accessibility gesture handler.
97    * @note Handlers should remove themselves when they are destroyed.
98    */
99   void SetGestureHandler(AccessibilityGestureHandler& handler);
100
101   /**
102    * @brief Handle the accessibility action to move focus to the next focusable actor
103    * (by one finger flick down).
104    *
105    * @param allowEndFeedback true if end of list feedback should be played when the focus is alread reached to the end
106    * @return Whether the action is performed successfully or not.
107    */
108   bool HandleActionNextEvent(bool allowEndFeedback = true);
109
110   /**
111    * @brief Handle the accessibility action to move focus to the previous focusable actor
112    * (by one finger flick up).
113    *
114    * @param allowEndFeedback true if end of list feedback should be played when the focus is alread reached to the end
115    * @return Whether the action is performed successfully or not.
116    */
117   bool HandleActionPreviousEvent(bool allowEndFeedback = true);
118
119   /**
120    * @brief Handle the accessibility action to activate the current focused actor (by one
121    * finger )
122    *
123    * @return Whether the action is performed successfully or not.
124    */
125   bool HandleActionActivateEvent();
126
127   /**
128    * @brief Handle the accessibility action to focus and read the actor (by one finger tap or move).
129    *
130    * @param x x position of event
131    * @param y y position of event
132    * @param allowReadAgain true if the action read again the same object (i.e. read action)
133    *                       false if the action just read when the focus object is changed (i.e. over action)
134    * @return Whether the action is performed successfully or not.
135    */
136   bool HandleActionReadEvent(unsigned int x, unsigned int y, bool allowReadAgain);
137
138   /**
139    * @brief Handle the accessibility action to move focus to the next focusable actor
140    * (by one finger flick right).
141    *
142    * @param allowEndFeedback true if end of list feedback should be played when the focus is alread reached to the end
143    * @return Whether the action is performed successfully or not.
144    */
145   bool HandleActionReadNextEvent(bool allowEndFeedback = true);
146
147   /**
148    * @brief Handle the accessibility action to move focus to the previous focusable actor
149    * (by one finger flick up).
150    *
151    * @param allowEndFeedback true if end of list feedback should be played when the focus is alread reached to the front
152    * @return Whether the action is performed successfully or not.
153    */
154   bool HandleActionReadPreviousEvent(bool allowEndFeedback = true);
155
156   /**
157    * @brief Handle the accessibility action to change the value when the current focused
158    * actor is a slider (by double finger down and move up and right).
159    *
160    * @return Whether the action is performed successfully or not.
161    */
162   bool HandleActionUpEvent();
163
164   /**
165    * @brief Handle the accessibility action to change the value when the current focused
166    * actor is a slider (by double finger down and move down and left).
167    *
168    * @return Whether the action is performed successfully or not.
169    */
170   bool HandleActionDownEvent();
171
172   /**
173    * @brief Handle the accessibility action to clear the focus from the current focused
174    * actor if any, so that no actor is focused in the focus chain.
175    *
176    * @return Whether the action is performed successfully or not.
177    */
178   bool HandleActionClearFocusEvent();
179
180   /**
181    * @brief Handle the accessibility action to scroll when there is a scroller on the touched position
182    * (by 2 finger touch & move, 2 finger flick).
183    *
184    * @param[in]  point      The touch point information.
185    * @param[in]  timeStamp  The time the touch occurred.
186    * @return Whether the action is performed successfully or not.
187    */
188   bool HandleActionScrollEvent(const TouchPoint& point, unsigned long timeStamp);
189
190   /**
191    * @brief Handle the accessibility action to move for the current focused actor
192    * (by 1 finger tap & hold and move).
193    *
194    * @param[in]  point      The touch point information.
195    * @param[in]  timeStamp  The time the touch occurred.
196    * @return Whether the action is performed successfully or not.
197    */
198   bool HandleActionTouchEvent(const TouchPoint& point, unsigned long timeStamp);
199
200   /**
201    * @brief Handle the accessibility action to navigate back (by two fingers circle draw).
202    * @return Whether the action is performed successfully or not.
203    */
204   bool HandleActionBackEvent();
205
206   /**
207    * @brief Handle the accessibility action to enable the feature.
208    */
209   void HandleActionEnableEvent();
210
211   /**
212    * @brief Handle the accessibility action to disable the feature.
213    */
214   void HandleActionDisableEvent();
215
216   /**
217    * @brief Handle the accessibility action to scroll up the list and focus on
218    * the first item on the list after the scrolling and read the item
219    * (by two finger swipe up).
220    *
221    * @return Whether the action is performed successfully or not.
222    */
223   bool HandleActionScrollUpEvent();
224
225   /**
226    * @brief Handle the accessibility action to scroll down the list and focus on
227    * the first item on the list after the scrolling and read the item
228    * (by two finger swipe down).
229    *
230    * @return Whether the action is performed successfully or not.
231    */
232   bool HandleActionScrollDownEvent();
233
234   /**
235    * @brief Handle the accessibility action to scroll left to the previous page
236    * (by two finger swipe left).
237    *
238    * @return Whether the action is performed successfully or not.
239    */
240   bool HandleActionPageLeftEvent();
241
242   /**
243    * @brief Handle the accessibility action to scroll right to the next page
244    * (by two finger swipe right).
245    *
246    * @return Whether the action is performed successfully or not.
247    */
248   bool HandleActionPageRightEvent();
249
250   /**
251    * @brief Handle the accessibility action to scroll up to the previous page
252    * (by one finger swipe left and right).
253    *
254    * @return Whether the action is performed successfully or not.
255    */
256   bool HandleActionPageUpEvent();
257
258   /**
259    * @brief Handle the accessibility action to scroll down to the next page
260    * (by one finger swipe right and left).
261    *
262    * @return Whether the action is performed successfully or not.
263    */
264   bool HandleActionPageDownEvent();
265
266   /**
267    * @brief Handle the accessibility action to move the focus to the first item on the screen
268    * (by one finger swipe up and down).
269    *
270    * @return Whether the action is performed successfully or not.
271    */
272   bool HandleActionMoveToFirstEvent();
273
274   /**
275    * @brief Handle the accessibility action to move the focus to the last item on the screen
276    * (by one finger swipe down and up).
277    *
278    * @return Whether the action is performed successfully or not.
279    */
280   bool HandleActionMoveToLastEvent();
281
282   /**
283    * @brief Handle the accessibility action to move the focus to the first item on the top
284    * and read from the top item continuously (by three fingers single tap).
285    *
286    * @return Whether the action is performed successfully or not.
287    */
288   bool HandleActionReadFromTopEvent();
289
290   /**
291    * @brief Handle the accessibility action to move focus to and read from the next focusable
292    * actor continuously (by three fingers double tap).
293    *
294    * @return Whether the action is performed successfully or not.
295    */
296   bool HandleActionReadFromNextEvent();
297
298   /**
299    * @brief Handle the accessibility action to do the zooming
300    * (by one finger triple tap).
301    *
302    * @return Whether the action is performed successfully or not.
303    */
304   bool HandleActionZoomEvent();
305
306   /**
307    * @brief Handle the accessibility action to pause/resume the current speech
308    * (by two fingers single tap).
309    *
310    * @return Whether the action is performed successfully or not.
311    */
312   bool HandleActionReadPauseResumeEvent();
313
314   /**
315    * @brief Handle the accessibility action to start/stop the current action
316    * (by two fingers double tap).
317    *
318    * @return Whether the action is performed successfully or not.
319    */
320   bool HandleActionStartStopEvent();
321
322 public: // Not intended for application developers
323
324   /**
325    * @brief Creates a handle using the Adaptor::Internal implementation.
326    *
327    * @param[in] adaptor The AccessibilityAdaptor implementation.
328    */
329   DALI_INTERNAL AccessibilityAdaptor( Internal::Adaptor::AccessibilityAdaptor& adaptor );
330
331   /**
332    * @brief This constructor is used by AccessibilityAdaptor::Get().
333    *
334    * @param[in] adaptor A pointer to the accessibility adaptor.
335    */
336   explicit DALI_INTERNAL AccessibilityAdaptor( Internal::Adaptor::AccessibilityAdaptor* adaptor );
337 };
338
339 } // namespace Dali
340
341 #endif // DALI_ACCESSIBILITY_ADAPTOR_H