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