[dali_2.1.23] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / accessibility-manager / accessibility-manager-impl.h
1 #ifndef DALI_TOOLKIT_INTERNAL_ACCESSIBILITY_MANAGER_H
2 #define DALI_TOOLKIT_INTERNAL_ACCESSIBILITY_MANAGER_H
3
4 /*
5  * Copyright (c) 2021 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/public-api/object/base-object.h>
23 #include <string>
24 #include <vector>
25
26 // INTERNAL INCLUDES
27 #include <dali-toolkit/devel-api/accessibility-manager/accessibility-manager.h>
28 #include <dali-toolkit/public-api/controls/control.h>
29
30 namespace Dali
31 {
32 namespace Toolkit
33 {
34 namespace Internal
35 {
36 class AccessibilityManager;
37
38 /**
39  * @copydoc Toolkit::AccessibilityManager
40  */
41 class AccessibilityManager : public Dali::BaseObject, public Dali::ConnectionTracker
42 {
43 public:
44   typedef Dali::Toolkit::AccessibilityManager::AccessibilityActionSignalType       AccessibilityActionSignalType;
45   typedef Dali::Toolkit::AccessibilityManager::AccessibilityActionScrollSignalType AccessibilityActionScrollSignalType;
46
47   /**
48    * Construct a new AccessibilityManager.
49    */
50   AccessibilityManager();
51
52   /**
53    * @copydoc Toolkit::AccessibilityManager::SetAccessibilityAttribute
54    */
55   void SetAccessibilityAttribute(Actor actor, Toolkit::AccessibilityManager::AccessibilityAttribute type, const std::string& text);
56
57   /**
58    * @copydoc Toolkit::AccessibilityManager::GetAccessibilityAttribute
59    */
60   std::string GetAccessibilityAttribute(Actor actor, Toolkit::AccessibilityManager::AccessibilityAttribute type) const;
61
62   /**
63    * @copydoc Toolkit::AccessibilityManager::SetFocusOrder
64    */
65   void SetFocusOrder(Actor actor, const unsigned int order);
66
67   /**
68    * @copydoc Toolkit::AccessibilityManager::GetFocusOrder
69    */
70   unsigned int GetFocusOrder(Actor actor) const;
71
72   /**
73    * @copydoc Toolkit::AccessibilityManager::GenerateNewFocusOrder
74    */
75   unsigned int GenerateNewFocusOrder() const;
76
77   /**
78    * @copydoc Toolkit::AccessibilityManager::GetActorByFocusOrder
79    */
80   Actor GetActorByFocusOrder(const unsigned int order);
81
82   /**
83    * @copydoc Toolkit::AccessibilityManager::SetCurrentFocusActor
84    */
85   bool SetCurrentFocusActor(Actor actor);
86
87   /**
88    * @copydoc Toolkit::AccessibilityManager::GetCurrentFocusActor
89    */
90   Actor GetCurrentFocusActor();
91
92   /**
93    * @copydoc Toolkit::AccessibilityManager::GetCurrentFocusGroup
94    */
95   Actor GetCurrentFocusGroup();
96
97   /**
98    * @copydoc Toolkit::AccessibilityManager::GetCurrentFocusOrder
99    */
100   unsigned int GetCurrentFocusOrder();
101
102   /**
103    * @copydoc Toolkit::AccessibilityManager::MoveFocusForward
104    */
105   bool MoveFocusForward();
106
107   /**
108    * @copydoc Toolkit::AccessibilityManager::MoveFocusBackward
109    */
110   bool MoveFocusBackward();
111
112   /**
113    * @copydoc Toolkit::AccessibilityManager::ClearFocus
114    */
115   void ClearFocus();
116
117   /**
118    * @copydoc Toolkit::AccessibilityManager::Reset
119    */
120   void Reset();
121
122   /**
123    * @copydoc Toolkit::AccessibilityManager::SetFocusGroup
124    */
125   void SetFocusGroup(Actor actor, bool isFocusGroup);
126
127   /**
128    * @copydoc Toolkit::AccessibilityManager::IsFocusGroup
129    */
130   bool IsFocusGroup(Actor actor) const;
131
132   /**
133    * @copydoc Toolkit::AccessibilityManager::SetGroupMode
134    */
135   void SetGroupMode(bool enabled);
136
137   /**
138    * @copydoc Toolkit::AccessibilityManager::GetGroupMode
139    */
140   bool GetGroupMode() const;
141
142   /**
143    * @copydoc Toolkit::AccessibilityManager::GetFocusGroup
144    */
145   Actor GetFocusGroup(Actor actor);
146
147   /**
148    * @copydoc Toolkit::AccessibilityManager::GetReadPosition
149    */
150   Vector2 GetReadPosition() const;
151
152   /**
153    * @copydoc Toolkit::AccessibilityManager::SetWrapMode
154    */
155   void SetWrapMode(bool wrapped);
156
157   /**
158    * @copydoc Toolkit::AccessibilityManager::GetWrapMode
159    */
160   bool GetWrapMode() const;
161
162   /**
163    * @copydoc Toolkit::AccessibilityManager::SetFocusIndicatorActor
164    */
165   void SetFocusIndicatorActor(Actor indicator);
166
167   /**
168    * @copydoc Toolkit::AccessibilityManager::GetFocusIndicatorActor
169    */
170   Actor GetFocusIndicatorActor();
171
172 public:
173   /**
174    * @copydoc Toolkit::AccessibilityManager::FocusChangedSignal()
175    */
176   Toolkit::AccessibilityManager::FocusChangedSignalType& FocusChangedSignal();
177
178   /**
179    * @copydoc Toolkit::AccessibilityManager::FocusOvershotSignal()
180    */
181   Toolkit::AccessibilityManager::FocusOvershotSignalType& FocusOvershotSignal();
182
183   /**
184    * @copydoc Toolkit::AccessibilityManager::FocusedActorActivatedSignal()
185    */
186   Toolkit::AccessibilityManager::FocusedActorActivatedSignalType& FocusedActorActivatedSignal();
187
188 public: // Signals
189   /**
190    * @copydoc Dali::Toolkit::AccessibilityManager::StatusChangedSignal
191    */
192   AccessibilityActionSignalType& StatusChangedSignal()
193   {
194     return mStatusChangedSignal;
195   }
196
197   /**
198    * @copydoc Dali::Toolkit::AccessibilityManager::AccessibilityAdaptor::ActionNextSignal
199    */
200   AccessibilityActionSignalType& ActionNextSignal()
201   {
202     return mActionNextSignal;
203   }
204
205   /**
206    * @copydoc Dali::Toolkit::AccessibilityManager::ActionPreviousSignal
207    */
208   AccessibilityActionSignalType& ActionPreviousSignal()
209   {
210     return mActionPreviousSignal;
211   }
212
213   /**
214    * @copydoc Dali::Toolkit::AccessibilityManager::ActionActivateSignal
215    */
216   AccessibilityActionSignalType& ActionActivateSignal()
217   {
218     return mActionActivateSignal;
219   }
220
221   /**
222    * @copydoc Dali::Toolkit::AccessibilityManager::ActionOverSignal
223    */
224   AccessibilityActionSignalType& ActionOverSignal()
225   {
226     return mActionOverSignal;
227   }
228
229   /**
230    * @copydoc Dali::Toolkit::AccessibilityManager::ActionReadSignal
231    */
232   AccessibilityActionSignalType& ActionReadSignal()
233   {
234     return mActionReadSignal;
235   }
236
237   /**
238    * @copydoc Dali::Toolkit::AccessibilityManager::ActionReadNextSignal
239    */
240   AccessibilityActionSignalType& ActionReadNextSignal()
241   {
242     return mActionReadNextSignal;
243   }
244
245   /**
246    * @copydoc Dali::Toolkit::AccessibilityManager::ActionReadPreviousSignal
247    */
248   AccessibilityActionSignalType& ActionReadPreviousSignal()
249   {
250     return mActionReadPreviousSignal;
251   }
252
253   /**
254    * @copydoc Dali::Toolkit::AccessibilityManager::ActionUpSignal
255    */
256   AccessibilityActionSignalType& ActionUpSignal()
257   {
258     return mActionUpSignal;
259   }
260
261   /**
262    * @copydoc Dali::Toolkit::AccessibilityManager::ActionDownSignal
263    */
264   AccessibilityActionSignalType& ActionDownSignal()
265   {
266     return mActionDownSignal;
267   }
268
269   /**
270    * @copydoc Dali::Toolkit::AccessibilityManager::ActionClearFocusSignal
271    */
272   AccessibilityActionSignalType& ActionClearFocusSignal()
273   {
274     return mActionClearFocusSignal;
275   }
276
277   /**
278    * @copydoc Dali::Toolkit::AccessibilityManager::ActionBackSignal
279    */
280   AccessibilityActionSignalType& ActionBackSignal()
281   {
282     return mActionBackSignal;
283   }
284
285   /**
286    * @copydoc Dali::Toolkit::AccessibilityManager::ActionScrollUpSignal
287    */
288   AccessibilityActionSignalType& ActionScrollUpSignal()
289   {
290     return mActionScrollUpSignal;
291   }
292
293   /**
294    * @copydoc Dali::Toolkit::AccessibilityManager::ActionScrollDownSignal
295    */
296   AccessibilityActionSignalType& ActionScrollDownSignal()
297   {
298     return mActionScrollDownSignal;
299   }
300
301   /**
302    * @copydoc Dali::Toolkit::AccessibilityManager::ActionPageLeftSignal
303    */
304   AccessibilityActionSignalType& ActionPageLeftSignal()
305   {
306     return mActionPageLeftSignal;
307   }
308
309   /**
310    * @copydoc Dali::Toolkit::AccessibilityManager::ActionPageRightSignal
311    */
312   AccessibilityActionSignalType& ActionPageRightSignal()
313   {
314     return mActionPageRightSignal;
315   }
316
317   /**
318    * @copydoc Dali::Toolkit::AccessibilityManager::ActionPageUpSignal
319    */
320   AccessibilityActionSignalType& ActionPageUpSignal()
321   {
322     return mActionPageUpSignal;
323   }
324
325   /**
326    * @copydoc Dali::Toolkit::AccessibilityManager::ActionPageDownSignal
327    */
328   AccessibilityActionSignalType& ActionPageDownSignal()
329   {
330     return mActionPageDownSignal;
331   }
332
333   /**
334    * @copydoc Dali::Toolkit::AccessibilityManager::ActionMoveToFirstSignal
335    */
336   AccessibilityActionSignalType& ActionMoveToFirstSignal()
337   {
338     return mActionMoveToFirstSignal;
339   }
340
341   /**
342    * @copydoc Dali::Toolkit::AccessibilityManager::ActionMoveToLastSignal
343    */
344   AccessibilityActionSignalType& ActionMoveToLastSignal()
345   {
346     return mActionMoveToLastSignal;
347   }
348
349   /**
350    * @copydoc Dali::Toolkit::AccessibilityManager::ActionReadFromTopSignal
351    */
352   AccessibilityActionSignalType& ActionReadFromTopSignal()
353   {
354     return mActionReadFromTopSignal;
355   }
356
357   /**
358    * @copydoc Dali::Toolkit::AccessibilityManager::ActionReadFromNextSignal
359    */
360   AccessibilityActionSignalType& ActionReadFromNextSignal()
361   {
362     return mActionReadFromNextSignal;
363   }
364
365   /**
366    * @copydoc Dali::Toolkit::AccessibilityManager::ActionZoomSignal
367    */
368   AccessibilityActionSignalType& ActionZoomSignal()
369   {
370     return mActionZoomSignal;
371   }
372
373   /**
374    * @copydoc Dali::Toolkit::AccessibilityManager::ActionReadPauseResumeSignal
375    */
376   AccessibilityActionSignalType& ActionReadPauseResumeSignal()
377   {
378     return mActionReadPauseResumeSignal;
379   }
380
381   /**
382    * @copydoc Dali::Toolkit::AccessibilityManager::ActionStartStopSignal
383    */
384   AccessibilityActionSignalType& ActionStartStopSignal()
385   {
386     return mActionStartStopSignal;
387   }
388
389   /**
390    * @copydoc Dali::Toolkit::AccessibilityManager::ActionScrollSignal
391    */
392   AccessibilityActionScrollSignalType& ActionScrollSignal()
393   {
394     return mActionScrollSignal;
395   }
396
397 protected:
398   /**
399    * Destructor
400    */
401   virtual ~AccessibilityManager();
402
403 private:
404   // Undefined
405   AccessibilityManager(const AccessibilityManager&);
406
407   AccessibilityManager& operator=(const AccessibilityManager& rhs);
408
409 private:
410   std::vector<Toolkit::Control> mFocusOrder;
411
412   Toolkit::AccessibilityManager::FocusChangedSignalType          mFocusChangedSignal;          ///< The signal to notify the focus change
413   Toolkit::AccessibilityManager::FocusOvershotSignalType         mFocusOvershotSignal;         ///< The signal to notify the focus overshooted
414   Toolkit::AccessibilityManager::FocusedActorActivatedSignalType mFocusedActorActivatedSignal; ///< The signal to notify the activation of focused actor
415
416   // Action signals.
417   AccessibilityActionSignalType       mStatusChangedSignal;
418   AccessibilityActionSignalType       mActionNextSignal;
419   AccessibilityActionSignalType       mActionPreviousSignal;
420   AccessibilityActionSignalType       mActionActivateSignal;
421   AccessibilityActionSignalType       mActionOverSignal;
422   AccessibilityActionSignalType       mActionReadSignal;
423   AccessibilityActionSignalType       mActionReadNextSignal;
424   AccessibilityActionSignalType       mActionReadPreviousSignal;
425   AccessibilityActionSignalType       mActionUpSignal;
426   AccessibilityActionSignalType       mActionDownSignal;
427   AccessibilityActionSignalType       mActionClearFocusSignal;
428   AccessibilityActionSignalType       mActionBackSignal;
429   AccessibilityActionSignalType       mActionScrollUpSignal;
430   AccessibilityActionSignalType       mActionScrollDownSignal;
431   AccessibilityActionSignalType       mActionPageLeftSignal;
432   AccessibilityActionSignalType       mActionPageRightSignal;
433   AccessibilityActionSignalType       mActionPageUpSignal;
434   AccessibilityActionSignalType       mActionPageDownSignal;
435   AccessibilityActionSignalType       mActionMoveToFirstSignal;
436   AccessibilityActionSignalType       mActionMoveToLastSignal;
437   AccessibilityActionSignalType       mActionReadFromTopSignal;
438   AccessibilityActionSignalType       mActionReadFromNextSignal;
439   AccessibilityActionSignalType       mActionZoomSignal;
440   AccessibilityActionSignalType       mActionReadIndicatorInformationSignal;
441   AccessibilityActionSignalType       mActionReadPauseResumeSignal;
442   AccessibilityActionSignalType       mActionStartStopSignal;
443   AccessibilityActionScrollSignalType mActionScrollSignal;
444 };
445
446 } // namespace Internal
447
448 inline Internal::AccessibilityManager& GetImpl(Dali::Toolkit::AccessibilityManager& obj)
449 {
450   DALI_ASSERT_ALWAYS(obj);
451
452   Dali::BaseObject& handle = obj.GetBaseObject();
453
454   return static_cast<Internal::AccessibilityManager&>(handle);
455 }
456
457 inline const Internal::AccessibilityManager& GetImpl(const Dali::Toolkit::AccessibilityManager& obj)
458 {
459   DALI_ASSERT_ALWAYS(obj);
460
461   const Dali::BaseObject& handle = obj.GetBaseObject();
462
463   return static_cast<const Internal::AccessibilityManager&>(handle);
464 }
465
466 } // namespace Toolkit
467
468 } // namespace Dali
469
470 #endif // DALI_TOOLKIT_INTERNAL_ACCESSIBILITY_MANAGER_H