Merge "[Tizen] Disable PreRotation function" into tizen_6.0
[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) 2020 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 // EXTERNAL INCLUDES
22 #include <dali/devel-api/events/touch-point.h>
23 #include <dali/public-api/dali-adaptor-common.h>
24 #include <dali/public-api/object/base-handle.h>
25
26 namespace Dali
27 {
28 namespace Internal DALI_INTERNAL
29 {
30 namespace Adaptor
31 {
32 class AccessibilityAdaptor;
33 }
34 } // namespace DALI_INTERNAL
35
36 class AccessibilityActionHandler;
37 class AccessibilityGestureHandler;
38 struct TouchPoint;
39
40 /**
41  * @brief The AccessibilityAdaptor provides communication to the accessibility manager interface (implemented in toolkit).
42  *
43  */
44 class DALI_ADAPTOR_API AccessibilityAdaptor : public BaseHandle
45 {
46 public:
47   /**
48    * @brief Create an uninitialized handle.
49    *
50    * This can be initialized by calling getting the adaptor from Dali::Adaptor.
51    */
52   AccessibilityAdaptor();
53
54   /**
55    * @brief Retrieve a handle to the AccessibilityAdaptor.
56    *
57    * @return A handle to the AccessibilityAdaptor.
58    */
59   static AccessibilityAdaptor Get();
60
61   /**
62    * @brief Destructor
63    *
64    * This is non-virtual since derived Handle types must not contain data or virtual methods.
65    */
66   ~AccessibilityAdaptor();
67
68   /**
69    * @brief Returns the current position of the read action.
70    * @return The current event position.
71    */
72   Vector2 GetReadPosition() const;
73
74   /**
75    * @brief Enables Accessibility action or not.
76    * @param[in] enabled True if Accessibility action should be enabled.
77    */
78   void EnableAccessibility( bool enabled );
79
80   /**
81    * @brief Query whether the accessibility(screen-reader) is enabled.
82    *
83    * The accessibility will be enabled by system setting.
84    * @return True if the accessibility(screen-reader) is enabled.
85    */
86   bool IsEnabled() const;
87
88   /**
89    * @brief Sets Accessibility enabled forcibly.
90    * @param forced Whether accessibility sets enabled forcibly
91    */
92   void SetForcedEnable( bool forced );
93
94   /**
95    * @brief Set the handler to handle accessibility actions.
96    *
97    * @param[in] handler The Accessibility action handler.
98    * @note Handlers should remove themselves when they are destroyed.
99    */
100   void SetActionHandler(AccessibilityActionHandler& handler);
101
102   /**
103    * @brief Set the handler to handle accessibility gestures.
104    *
105    * @param[in] handler The Accessibility gesture handler.
106    * @note Handlers should remove themselves when they are destroyed.
107    */
108   void SetGestureHandler(AccessibilityGestureHandler& handler);
109
110   /**
111    * @brief Handle the accessibility action to move focus to the next focusable actor
112    * (by one finger flick down).
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 HandleActionNextEvent(bool allowEndFeedback = true);
118
119   /**
120    * @brief Handle the accessibility action to move focus to the previous focusable actor
121    * (by one finger flick up).
122    *
123    * @param allowEndFeedback true if end of list feedback should be played when the focus is alread reached to the end
124    * @return Whether the action is performed successfully or not.
125    */
126   bool HandleActionPreviousEvent(bool allowEndFeedback = true);
127
128   /**
129    * @brief Handle the accessibility action to activate the current focused actor (by one
130    * finger )
131    *
132    * @return Whether the action is performed successfully or not.
133    */
134   bool HandleActionActivateEvent();
135
136   /**
137    * @brief Handle the accessibility action to focus and read the actor (by one finger tap or move).
138    *
139    * @param x x position of event
140    * @param y y position of event
141    * @param allowReadAgain true if the action read again the same object (i.e. read action)
142    *                       false if the action just read when the focus object is changed (i.e. over action)
143    * @return Whether the action is performed successfully or not.
144    */
145   bool HandleActionReadEvent(unsigned int x, unsigned int y, bool allowReadAgain);
146
147   /**
148    * @brief Handle the accessibility action to move focus to the next focusable actor
149    * (by one finger flick right).
150    *
151    * @param allowEndFeedback true if end of list feedback should be played when the focus is alread reached to the end
152    * @return Whether the action is performed successfully or not.
153    */
154   bool HandleActionReadNextEvent(bool allowEndFeedback = true);
155
156   /**
157    * @brief Handle the accessibility action to move focus to the previous focusable actor
158    * (by one finger flick up).
159    *
160    * @param allowEndFeedback true if end of list feedback should be played when the focus is alread reached to the front
161    * @return Whether the action is performed successfully or not.
162    */
163   bool HandleActionReadPreviousEvent(bool allowEndFeedback = true);
164
165   /**
166    * @brief Handle the accessibility action to change the value when the current focused
167    * actor is a slider (by double finger down and move up and right).
168    *
169    * @return Whether the action is performed successfully or not.
170    */
171   bool HandleActionUpEvent();
172
173   /**
174    * @brief Handle the accessibility action to change the value when the current focused
175    * actor is a slider (by double finger down and move down and left).
176    *
177    * @return Whether the action is performed successfully or not.
178    */
179   bool HandleActionDownEvent();
180
181   /**
182    * @brief Handle the accessibility action to clear the focus from the current focused
183    * actor if any, so that no actor is focused in the focus chain.
184    *
185    * @return Whether the action is performed successfully or not.
186    */
187   bool HandleActionClearFocusEvent();
188
189   /**
190    * @brief Handle the accessibility action to scroll when there is a scroller on the touched position
191    * (by 2 finger touch & move, 2 finger flick).
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 HandleActionScrollEvent(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 pause/resume the current speech
307    * (by two fingers single tap).
308    *
309    * @return Whether the action is performed successfully or not.
310    */
311   bool HandleActionReadPauseResumeEvent();
312
313   /**
314    * @brief Handle the accessibility action to start/stop the current action
315    * (by two fingers double tap).
316    *
317    * @return Whether the action is performed successfully or not.
318    */
319   bool HandleActionStartStopEvent();
320
321 public: // Not intended for application developers
322   /**
323    * @brief Creates a handle using the Adaptor::Internal implementation.
324    *
325    * @param[in] adaptor The AccessibilityAdaptor implementation.
326    */
327   DALI_INTERNAL AccessibilityAdaptor(Internal::Adaptor::AccessibilityAdaptor& adaptor);
328
329   /**
330    * @brief This constructor is used by AccessibilityAdaptor::Get().
331    *
332    * @param[in] adaptor A pointer to the accessibility adaptor.
333    */
334   explicit DALI_INTERNAL AccessibilityAdaptor(Internal::Adaptor::AccessibilityAdaptor* adaptor);
335 };
336
337 } // namespace Dali
338
339 #endif // DALI_ACCESSIBILITY_ADAPTOR_H