Dali 3D User Interface Engine
toolkit-accessibility-adaptor.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 
19 
22 #include <dali/devel-api/adaptor-framework/accessibility-action-handler.h>
23 
24 namespace Dali
25 {
26 
27 namespace Internal
28 {
29 
30 namespace Adaptor
31 {
32 
36 class AccessibilityAdaptor : public BaseObject
37 {
38 public: // Creation & Destruction
39 
41 
44 
45 public:
46 
47  // Functions to modify mock returns:
48 
49  void MockSetReadPosition( Vector2& position );
50 
51 public:
52 
53  bool IsEnabled() const;
54  void SetActionHandler(Dali::AccessibilityActionHandler& handler);
55  void SetGestureHandler(Dali::AccessibilityGestureHandler& handler);
56 
57  Vector2 GetReadPosition() const;
58 
59  bool HandleActionNextEvent();
62  bool HandleActionReadEvent(unsigned int x, unsigned int y, bool allowReadAgain);
65  bool HandleActionUpEvent();
66  bool HandleActionDownEvent();
68  bool HandleActionScrollEvent(TouchPoint& point, unsigned long timeStamp);
69  bool HandleActionBackEvent();
82  bool HandleActionZoomEvent();
86 
87 public: // Signals
88 
89 private:
90 
91  bool mIsEnabled;
92  Dali::AccessibilityActionHandler* mActionHandler;
93  Dali::AccessibilityGestureHandler* mGestureHandler;
95 
97 };
98 
100 
101 
103 {
105  {
107  }
109 }
110 
112 : mIsEnabled(false),
113  mReadPosition( 0.0f, 0.0f )
114 {
115 }
116 
118 {
119 }
120 
122 {
123  return mReadPosition;
124 }
125 
127 {
128  mReadPosition = position;
129 }
130 
132 {
133  return mIsEnabled;
134 }
135 
136 void AccessibilityAdaptor::SetActionHandler(Dali::AccessibilityActionHandler& handler)
137 {
138  mActionHandler = &handler;
139 }
140 
141 void AccessibilityAdaptor::SetGestureHandler(Dali::AccessibilityGestureHandler& handler)
142 {
143  mGestureHandler = &handler;
144 }
145 
147 {
148  if( mActionHandler )
149  {
150  return mActionHandler->AccessibilityActionNext( true );
151  }
152  return false;
153 }
154 
156 {
157  if( mActionHandler )
158  {
159  return mActionHandler->AccessibilityActionPrevious( true );
160  }
161  return false;
162 }
163 
165 {
166  if( mActionHandler )
167  {
168  return mActionHandler->AccessibilityActionActivate();
169  }
170  return false;
171 }
172 
173 bool AccessibilityAdaptor::HandleActionReadEvent(unsigned int x, unsigned int y, bool allowReadAgain)
174 {
175  if( mActionHandler )
176  {
177  return mActionHandler->AccessibilityActionRead( allowReadAgain );
178  }
179  return false;
180 }
181 
183 {
184  if( mActionHandler )
185  {
186  return mActionHandler->AccessibilityActionReadNext( true );
187  }
188  return false;
189 }
190 
192 {
193  if( mActionHandler )
194  {
195  return mActionHandler->AccessibilityActionReadPrevious( true );
196  }
197  return false;
198 }
199 
201 {
202  if( mActionHandler )
203  {
204  return mActionHandler->AccessibilityActionUp();
205  }
206  return false;
207 }
208 
210 {
211  if( mActionHandler )
212  {
213  return mActionHandler->AccessibilityActionDown();
214  }
215  return false;
216 }
217 
219 {
220  if( mActionHandler )
221  {
222  return mActionHandler->ClearAccessibilityFocus();
223  }
224  return false;
225 }
226 
227 bool AccessibilityAdaptor::HandleActionScrollEvent(TouchPoint& point, unsigned long timeStamp)
228 {
229  if( mActionHandler )
230  {
231  Dali::TouchEvent touchEvent;
232  touchEvent.points.push_back( point );
233  return mActionHandler->AccessibilityActionScroll( touchEvent );
234  }
235  return false;
236 }
237 
239 {
240  if( mActionHandler )
241  {
242  return mActionHandler->AccessibilityActionBack();
243  }
244  return false;
245 }
246 
248 {
249  if( mActionHandler )
250  {
251  return mActionHandler->ChangeAccessibilityStatus();
252  }
253  return false;
254 }
255 
257 {
258  if( mActionHandler )
259  {
260  return mActionHandler->ChangeAccessibilityStatus();
261  }
262  return false;
263 }
264 
266 {
267  if( mActionHandler )
268  {
269  return mActionHandler->AccessibilityActionScrollUp();
270  }
271  return false;
272 }
273 
275 {
276  if( mActionHandler )
277  {
278  return mActionHandler->AccessibilityActionScrollDown();
279  }
280  return false;
281 }
282 
284 {
285  if( mActionHandler )
286  {
287  return mActionHandler->AccessibilityActionPageLeft();
288  }
289  return false;
290 }
291 
293 {
294  if( mActionHandler )
295  {
296  return mActionHandler->AccessibilityActionPageRight();
297  }
298  return false;
299 }
300 
302 {
303  if( mActionHandler )
304  {
305  return mActionHandler->AccessibilityActionPageUp();
306  }
307  return false;
308 }
309 
311 {
312  if( mActionHandler )
313  {
314  return mActionHandler->AccessibilityActionPageDown();
315  }
316  return false;
317 }
318 
320 {
321  if( mActionHandler )
322  {
323  return mActionHandler->AccessibilityActionMoveToFirst();
324  }
325  return false;
326 }
327 
329 {
330  if( mActionHandler )
331  {
332  return mActionHandler->AccessibilityActionMoveToLast();
333  }
334  return false;
335 }
336 
338 {
339  if( mActionHandler )
340  {
341  return mActionHandler->AccessibilityActionReadFromTop();
342  }
343  return false;
344 }
345 
347 {
348  if( mActionHandler )
349  {
350  return mActionHandler->AccessibilityActionReadFromNext();
351  }
352  return false;
353 }
354 
356 {
357  if( mActionHandler )
358  {
359  return mActionHandler->AccessibilityActionZoom();
360  }
361  return false;
362 }
363 
365 {
366  if( mActionHandler )
367  {
368  return mActionHandler->AccessibilityActionReadIndicatorInformation();
369  }
370  return false;
371 }
372 
374 {
375  if( mActionHandler )
376  {
377  return mActionHandler->AccessibilityActionReadPauseResume();
378  }
379  return false;
380 }
381 
383 {
384  if( mActionHandler )
385  {
386  return mActionHandler->AccessibilityActionStartStop();
387  }
388  return false;
389 }
390 
392 {
393  BaseObject& handle = adaptor.GetBaseObject();
394  return static_cast<Internal::Adaptor::AccessibilityAdaptor&>(handle);
395 }
396 
397 
398 } // namespace Adaptor
399 } // namespace Internal
400 
402 
404 {
405 }
406 
408 {
410 }
411 
413 {
414 }
415 
416 // Mock setup:
417 
419 {
420  Internal::Adaptor::GetImplementation(*this).MockSetReadPosition( position );
421 }
422 
423 // Methods:
424 
426 {
427  return Internal::Adaptor::GetImplementation(*this).GetReadPosition();
428 }
429 
431 {
432  //return Internal::Adaptor::GetImplementation(*this).IsEnabled();
433  return false;
434 }
435 
436 void AccessibilityAdaptor::SetActionHandler(AccessibilityActionHandler& handler)
437 {
438  Internal::Adaptor::GetImplementation(*this).SetActionHandler(handler);
439 }
440 
441 void AccessibilityAdaptor::SetGestureHandler(AccessibilityGestureHandler& handler)
442 {
443  Internal::Adaptor::GetImplementation(*this).SetGestureHandler(handler);
444 }
445 
447 {
448  return Internal::Adaptor::GetImplementation(*this).HandleActionNextEvent();
449 }
450 
452 {
453  return Internal::Adaptor::GetImplementation(*this).HandleActionPreviousEvent();
454 }
455 
457 {
458  return Internal::Adaptor::GetImplementation(*this).HandleActionActivateEvent();
459 }
460 
461 bool AccessibilityAdaptor::HandleActionReadEvent(unsigned int x, unsigned int y, bool allowReadAgain)
462 {
463  return Internal::Adaptor::GetImplementation(*this).HandleActionReadEvent( x, y, allowReadAgain );
464 }
465 
467 {
468  return Internal::Adaptor::GetImplementation(*this).HandleActionReadNextEvent();
469 }
470 
472 {
473  return Internal::Adaptor::GetImplementation(*this).HandleActionReadPreviousEvent();
474 }
475 
477 {
478  return Internal::Adaptor::GetImplementation(*this).HandleActionUpEvent();
479 }
480 
482 {
483  return Internal::Adaptor::GetImplementation(*this).HandleActionDownEvent();
484 }
485 
487 {
488  return Internal::Adaptor::GetImplementation(*this).HandleActionClearFocusEvent();
489 }
490 
491 bool AccessibilityAdaptor::HandleActionScrollEvent(TouchPoint& point, unsigned long timeStamp)
492 {
493  return Internal::Adaptor::GetImplementation(*this).HandleActionScrollEvent(point, timeStamp);
494 }
495 
497 {
498  return Internal::Adaptor::GetImplementation(*this).HandleActionBackEvent();
499 }
500 
502 {
503  Internal::Adaptor::GetImplementation(*this).HandleActionEnableEvent();
504 }
505 
507 {
508  Internal::Adaptor::GetImplementation(*this).HandleActionDisableEvent();
509 }
510 
512 {
513  return Internal::Adaptor::GetImplementation(*this).HandleActionScrollUpEvent();
514 }
515 
517 {
518  return Internal::Adaptor::GetImplementation(*this).HandleActionScrollDownEvent();
519 }
520 
522 {
523  return Internal::Adaptor::GetImplementation(*this).HandleActionPageLeftEvent();
524 }
525 
527 {
528  return Internal::Adaptor::GetImplementation(*this).HandleActionPageRightEvent();
529 }
530 
532 {
533  return Internal::Adaptor::GetImplementation(*this).HandleActionPageUpEvent();
534 }
535 
537 {
538  return Internal::Adaptor::GetImplementation(*this).HandleActionPageDownEvent();
539 }
540 
542 {
543  return Internal::Adaptor::GetImplementation(*this).HandleActionMoveToFirstEvent();
544 }
545 
547 {
548  return Internal::Adaptor::GetImplementation(*this).HandleActionMoveToLastEvent();
549 }
550 
552 {
553  return Internal::Adaptor::GetImplementation(*this).HandleActionReadFromTopEvent();
554 }
555 
557 {
558  return Internal::Adaptor::GetImplementation(*this).HandleActionReadFromNextEvent();
559 }
560 
562 {
563  return Internal::Adaptor::GetImplementation(*this).HandleActionZoomEvent();
564 }
565 
567 {
568  return Internal::Adaptor::GetImplementation(*this).HandleActionReadIndicatorInformationEvent();
569 }
570 
572 {
573  return Internal::Adaptor::GetImplementation(*this).HandleActionReadPauseResumeEvent();
574 }
575 
577 {
578  return Internal::Adaptor::GetImplementation(*this).HandleActionStartStopEvent();
579 }
580 
582 : BaseHandle( adaptor )
583 {
584 }
585 
586 } // namespace Dali
Dali Docs Home
Read more about Dali