2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://floralicense.org/license/
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
17 #include <sys/utsname.h>
19 #include <FAppUiApp.h>
20 #include <FAppIAppFrame.h>
21 #include <FBaseRtTimer.h>
22 #include <FLclLocale.h>
23 #include <FUiAnimVisualElement.h>
24 #include <FUiCtrlFrame.h>
25 #include <FUiCtrlForm.h>
26 #include <FGrpCanvas.h>
27 #include <FGrpColor.h>
28 #include <FGrpFloatDimension.h>
29 #include <FGrpEnrichedText.h>
30 #include <FGrpBitmap.h>
31 #include <FBase_StringConverter.h>
32 #include <FGrp_BitmapImpl.h>
33 #include "FUi_AccessibilityGesture.h"
34 #include "FUi_AccessibilitySystemSettingLoader.h"
35 #include "FUi_AccessibilityTtsPlayer.h"
36 #include "FUi_AccessibilityManager.h"
37 #include "FUi_AccessibilityElement.h"
38 #include "FUi_AccessibilityContainer.h"
39 #include "FUi_IAccessibilityListener.h"
40 #include "FUi_ControlManager.h"
41 #include "FUi_TouchManager.h"
42 #include "FUi_UiEventManager.h"
43 #include "FUiAnim_VisualElementImpl.h"
44 #include "FUiCtrl_FrameImpl.h"
45 #include "FUiCtrl_ScrollPanel.h"
46 #include "FUiCtrl_IconListView.h"
47 #include "FUi_ResourceManager.h"
49 using namespace Tizen::App;
50 using namespace Tizen::Base;
51 using namespace Tizen::Base::Collection;
52 using namespace Tizen::Base::Runtime;
53 using namespace Tizen::Graphics;
54 using namespace Tizen::Ui::Animations;
55 using namespace Tizen::Ui::Controls;
60 : public ITimerEventListener
66 timer.Construct(*this);
68 virtual ~GuidePopupTimer(void) {}
69 void SetElement(VisualElement* pElement)
71 if (__pElement != null)
75 __pElement = pElement;
83 virtual void OnTimerExpired(Timer& timer)
87 __pElement->SetShowState(false);
91 VisualElement* __pElement;
95 class AutoReadingTimer
96 : public ITimerEventListener
99 AutoReadingTimer(Tizen::Ui::_AccessibilityManager* pManager)
100 : __pAccessibilityManager(pManager)
101 , __mode(Tizen::Ui::_ACCESSIBILITY_AUTO_READING_MODE_FIRST_ITEM)
105 timer.Construct(*this);
107 virtual ~AutoReadingTimer(void) {}
108 void Start(Tizen::Ui::_AccessibilityAutoReadingMode mode)
110 SysLog(NID_UI, "AccessibilityManager::AutoReadingTimer is requested mode : %d", mode);
116 SysLog(NID_UI, "AccessibilityManager::AutoReadingTimer is started mode : %d", mode);
125 virtual void OnTimerExpired(Timer& timer)
127 SysLog(NID_UI, "mode %d", __mode);
128 if (__pAccessibilityManager->GetTtsStatus() != Tizen::Ui::ACCESSIBILITY_SCREEN_READER_STATUS_READY
129 && __pAccessibilityManager->GetTtsStatus() != Tizen::Ui::ACCESSIBILITY_SCREEN_READER_STATUS_PLAYING)
133 SysLog(NID_UI, "AccessibilityManager::AutoReadingTimer is started again because tts is not initialized.");
137 __pAccessibilityManager->ReadElement(__mode);
139 Tizen::Ui::_AccessibilityManager* __pAccessibilityManager;
141 Tizen::Ui::_AccessibilityAutoReadingMode __mode;
145 GuidePopupTimer* pGuidePopupTimer;
146 AutoReadingTimer* pAutoReadingTimer;
148 namespace Tizen { namespace Ui {
151 class _AccessibilityItemComparer
152 : public Tizen::Base::Collection::IComparerT <T>
155 _AccessibilityItemComparer(void)
158 virtual ~_AccessibilityItemComparer(void)
161 virtual result Compare(const T& obj1, const T& obj2, int& cmp) const
163 Tizen::Graphics::Rectangle rect1= obj1->GetAbsoluteBounds();
164 Tizen::Graphics::Rectangle rect2= obj2->GetAbsoluteBounds();
166 if (rect1.y > rect2.y)
171 else if (rect1.y < rect2.y)
178 if (rect1.x > rect2.x)
183 else if (rect1.x < rect2.x)
195 }; //class _AccessibilityComparer
198 class _ElementComparer
199 : public Tizen::Base::Collection::IComparerT <T>
202 _ElementComparer(void)
205 virtual ~_ElementComparer(void)
208 virtual result Compare(const T& obj1, const T& obj2, int& cmp) const
210 if (obj1->GetParent()->GetPriority() > obj2->GetParent()->GetPriority())
215 else if (obj1->GetParent()->GetPriority() < obj2->GetParent()->GetPriority())
222 Tizen::Graphics::FloatRectangle rect1= obj1->GetAbsoluteBounds();
223 Tizen::Graphics::FloatRectangle rect2= obj2->GetAbsoluteBounds();
225 if (rect1.y > rect2.y)
230 else if (rect1.y < rect2.y)
237 if (rect1.x > rect2.x)
242 else if (rect1.x < rect2.x)
257 static _AccessibilityManager* pAccManager = null;
258 bool _AccessibilityManager::__screenReaderIsEnabled = false;
259 _AccessibilityManager::_AccessibilityManager(void)
260 : __pAccGesture(null)
262 , __pSettingLoader(null)
263 , __pTargetContainer(null)
264 , __pTargetElement(null)
265 , __pTitleElement(null)
271 , __pPanningControl(null)
275 _AccessibilityManager::~_AccessibilityManager(void)
277 delete __pAccGesture;
278 __pAccGesture = null;
281 delete __pSettingLoader;
282 __pSettingLoader = null;
283 delete pGuidePopupTimer;
284 pGuidePopupTimer = null;
285 delete pAutoReadingTimer;
286 pAutoReadingTimer = null;
289 _AccessibilityManager*
290 _AccessibilityManager::GetInstance(void)
296 _AccessibilityManager::CreateInstance(void)
298 static pthread_once_t onceBlock = PTHREAD_ONCE_INIT;
300 if (pAccManager == null)
302 pthread_once(&onceBlock, InitializeInstance);
307 _AccessibilityManager::InitializeInstance(void)
309 pAccManager = new (std::nothrow) _AccessibilityManager;
312 _AccessibilityManager::ReleaseInstance(void)
318 _AccessibilityManager::Initialize(void)
320 __pAccGesture = new (std::nothrow) _AccessibilityGesture(*this);
321 SysTryReturn(NID_UI, __pAccGesture, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
322 __pTtsPlayer = new (std::nothrow) _AccessibilityTtsPlayer(*this);
323 SysTryCatch(NID_UI, __pTtsPlayer, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
324 __pTtsPlayer->Construct();
325 __pSettingLoader = new (std::nothrow) _AccessibilitySystemSettingLoader(*this);
326 SysTryCatch(NID_UI, __pSettingLoader, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
328 if (IsScreenReaderActivated())
330 __pTtsPlayer->SetLocale(__pSettingLoader->GetLocale());
331 __pTtsPlayer->Activate();
333 pGuidePopupTimer = new (std::nothrow) GuidePopupTimer;
334 SysTryCatch(NID_UI, pGuidePopupTimer, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
335 pAutoReadingTimer = new (std::nothrow) AutoReadingTimer(this);
336 SysTryCatch(NID_UI, pAutoReadingTimer, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
340 delete __pAccGesture;
341 __pAccGesture = null;
344 delete __pSettingLoader;
345 __pSettingLoader = null;
346 delete pGuidePopupTimer;
347 pGuidePopupTimer = null;
348 delete pAutoReadingTimer;
349 pAutoReadingTimer = null;
351 AccessibilityScreenReaderStatus
352 _AccessibilityManager::GetTtsStatus(void)
356 return __pTtsPlayer->GetStatus();
358 return ACCESSIBILITY_SCREEN_READER_STATUS_ERROR;
361 _AccessibilityManager::ReadContent(const Tizen::Base::String& content)
366 __pTtsPlayer->ReadGrammar(content);
371 _AccessibilityManager::ReadElement(_AccessibilityAutoReadingMode mode)
374 int count = __candidateList.GetCount();
379 _AccessibilityElement* pElement = null;
382 if (mode == _ACCESSIBILITY_AUTO_READING_MODE_FIRST_ITEM)
384 r = __candidateList.GetAt(0, pElement);
386 else if (mode == _ACCESSIBILITY_AUTO_READING_MODE_FIRST_ITEM_OF_CONTENTS)
388 for (int i = 0 ; i < count ; i++)
390 r = __candidateList.GetAt(i, pElement);
391 if (r == E_SUCCESS && pElement)
393 if (pElement->GetParent()->GetPriority() < ACCESSIBILITY_PRIORITY_TOP)
400 else //_ACCESSIBILITY_AUTO_READING_MODE_CURRENT_FOCUS
402 if (IsContainerValid(__pTargetContainer))
404 pElement = __pTargetElement;
408 if (r != E_SUCCESS || pElement == null)
410 SysLog(NID_UI, "cause 1");
413 if (mode == _ACCESSIBILITY_AUTO_READING_MODE_FIRST_ITEM && __pTitleElement == pElement && !(__pTitleElement->IsUpdated()))
415 SysLog(NID_UI, "cause 2");
418 __pTitleElement = pElement;
419 pElement->GetParent()->SetCurrentFocusedElement(pElement);
420 DrawFocusUi(*pElement);
421 __pTargetContainer = pElement->GetParent();
422 __pTargetElement = pElement;
423 __targetControlHandle = __pTargetContainer->GetOwner().GetHandle();
424 ReadElement(*pElement);
428 _AccessibilityManager::ReadElement(const _AccessibilityElement& element)
432 LinkedListT<_IAccessibilityListener*>* pList = static_cast<LinkedListT<_IAccessibilityListener*>*>(__pTargetContainer->GetListenerListN());
435 for (int i = 0;i<pList->GetCount();i++)
437 _IAccessibilityListener* pListener = null;
438 if (pList->GetAt(i, pListener) == E_SUCCESS)
440 pListener->OnAccessibilityReadingElement(*__pTargetContainer, element);
447 __pTtsPlayer->ReadGrammar(element.GetReadingContents());
452 _AccessibilityManager::ReadingStop(void)
457 _AccessibilityManager::ReadingPause(void)
462 _AccessibilityManager::ReadingResume(void)
468 _AccessibilityManager::OnStartReading(const Tizen::Base::String& grammar)
472 _AccessibilityManager::HidePopup(void)
476 __pReadingVe->Destroy();
479 pGuidePopupTimer->Stop();
482 _AccessibilityManager::ShowPopup(const String& content)
484 if (content.IsEmpty())
490 if (String("i686_emulated") != sysInfo.machine)
494 Canvas* pCanvas = null;
495 Bitmap* pBgBitmap = null;
496 EnrichedText* pEnrichedTitleText = null;
497 EnrichedText* pText = null;
498 Frame* pFrame = null;
500 if (__pReadingVe == null)
502 pFrame = UiApp::GetInstance()->GetAppFrame()->GetFrame();
506 int accesibilityVisualElementLevel = 3000;
507 result r = E_SUCCESS;
508 VisualElement* pRootVe = _ControlManager::GetInstance()->GetTopVisibleWindow()->GetVisualElement();
510 __pReadingVe = new (std::nothrow) VisualElement();
511 SysTryCatch(NID_UI, __pReadingVe, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
513 r = __pReadingVe->Construct();
514 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] System error");
515 __pReadingVe->SetName("Accessibility reading popup");
516 __pReadingVe->SetImplicitAnimationEnabled(false);
517 _VisualElementImpl::GetInstance(*__pReadingVe)->SetZOrderGroup(accesibilityVisualElementLevel);
518 pRootVe->AttachChild(*__pReadingVe);
523 result r = E_SUCCESS;
525 float titleFontSize = 0;
526 float textFontSize = 0;
527 float popupWidth = 0;
529 float bottomMargin = 0;
530 float sideMargin = 0;
531 float titleHeight = 0;
532 float textTopMargin = 0;
533 float textHeight = 0;
535 Color titleTextColor;
536 Color pointTextColor;
538 TextElement* pElement = null;
540 r = GET_SHAPE_CONFIG(ACCESSIBILITY::TITLE_FONT_SIZE, _CONTROL_ORIENTATION_PORTRAIT, titleFontSize);
541 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
542 r = GET_SHAPE_CONFIG(ACCESSIBILITY::TEXT_FONT_SIZE, _CONTROL_ORIENTATION_PORTRAIT, textFontSize);
543 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
544 r = GET_SHAPE_CONFIG(ACCESSIBILITY::POPUP_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, popupWidth);
545 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
546 r = GET_SHAPE_CONFIG(ACCESSIBILITY::TOP_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, topMargin);
547 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
548 r = GET_SHAPE_CONFIG(ACCESSIBILITY::BOTTON_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, bottomMargin);
549 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
550 r = GET_SHAPE_CONFIG(ACCESSIBILITY::SIDE_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, sideMargin);
551 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
552 r = GET_SHAPE_CONFIG(ACCESSIBILITY::TITLE_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, titleHeight);
553 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
554 r = GET_SHAPE_CONFIG(ACCESSIBILITY::TEXT_TOP_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, textTopMargin);
555 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
556 r = GET_SHAPE_CONFIG(ACCESSIBILITY::TEXT_HEGIHT, _CONTROL_ORIENTATION_PORTRAIT, textHeight);
557 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
558 r = GET_COLOR_CONFIG(ACCESSIBILITY::TITLE_TEXT, titleTextColor);
559 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
560 r = GET_COLOR_CONFIG(ACCESSIBILITY::POINT_TEXT, pointTextColor);
561 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
562 r = GET_COLOR_CONFIG(ACCESSIBILITY::TEXT, textColor);
563 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
564 r = GET_BITMAP_CONFIG_N(ACCESSIBILITY::POPUP_BG, BITMAP_PIXEL_FORMAT_ARGB8888, pBgBitmap);
565 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
568 r = titleFont.Construct(FONT_STYLE_PLAIN, titleFontSize);
569 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
571 r = textFont.Construct(FONT_STYLE_PLAIN, textFontSize);
572 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
574 pEnrichedTitleText = new (std::nothrow) EnrichedText;
575 SysTryCatch(NID_UI, pEnrichedTitleText != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
576 pEnrichedTitleText->Construct(FloatDimension(popupWidth-sideMargin*2, titleHeight));
578 pText = new (std::nothrow) EnrichedText;
579 SysTryCatch(NID_UI, pText != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
580 pText->Construct(FloatDimension(popupWidth-sideMargin*2, textHeight));
582 pElement = new (std::nothrow) TextElement;
583 SysTryCatch(NID_UI, pElement != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
584 r = pElement->Construct(L"Screen reading...");
590 pElement->SetTextColor(titleTextColor);
591 pElement->SetFont(titleFont);
592 r = pEnrichedTitleText->Add(*pElement);
593 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
594 pEnrichedTitleText->SetHorizontalAlignment(TEXT_ALIGNMENT_LEFT);
595 pEnrichedTitleText->SetVerticalAlignment(TEXT_ALIGNMENT_TOP);
596 pEnrichedTitleText->SetTextWrapStyle(TEXT_WRAP_CHARACTER_WRAP);
597 pEnrichedTitleText->SetTextAbbreviationEnabled(true);
599 pElement = new (std::nothrow) TextElement;
600 SysTryCatch(NID_UI, pElement != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
601 r = pElement->Construct(content);
607 pElement->SetTextColor(textColor);
608 pElement->SetFont(textFont);
609 r = pText->Add(*pElement);
610 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
611 pText->SetHorizontalAlignment(TEXT_ALIGNMENT_LEFT);
612 pText->SetVerticalAlignment(TEXT_ALIGNMENT_TOP);
613 pText->SetTextWrapStyle(TEXT_WRAP_CHARACTER_WRAP);
614 pText->SetTextAbbreviationEnabled(true);
618 float popupHeight = topMargin + bottomMargin + titleHeight + textTopMargin + textHeight;
620 FloatDimension screen = Tizen::Ui::_ControlManager::GetInstance()->GetScreenSizeF();
621 __pReadingVe->SetBounds(FloatRectangle(x, y, popupWidth, popupHeight));
622 pCanvas = __pReadingVe->GetCanvasN();
623 SysTryCatch(NID_UI, pCanvas != null, , E_SYSTEM, "System error for accessibility popup");
624 pCanvas->DrawNinePatchedBitmap(FloatRectangle(0, 0, popupWidth, popupHeight), *pBgBitmap);
625 float drawingTextY = topMargin;
626 pCanvas->DrawText(FloatPoint(sideMargin, drawingTextY), *pEnrichedTitleText);
627 drawingTextY += textTopMargin + titleHeight;
628 pCanvas->DrawText(FloatPoint(sideMargin, drawingTextY), *pText);
629 __pReadingVe->SetShowState(true);
630 __pReadingVe->SetFlushNeeded();
631 pGuidePopupTimer->SetElement(__pReadingVe);
639 if (pEnrichedTitleText)
641 pEnrichedTitleText->RemoveAll(true);
642 delete pEnrichedTitleText;
646 pText->RemoveAll(true);
654 _AccessibilityManager::ShowPopup()
656 if (__pTargetElement == null)
662 Frame* pFrame = null;
663 Canvas* pCanvas = null;
664 Bitmap* pBgBitmap = null;
665 EnrichedText* pEnrichedTitleText = null;
666 EnrichedText* pEnrichedNameText = null;
667 EnrichedText* pEnrichedLableText = null;
668 EnrichedText* pEnrichedTraitText = null;
669 EnrichedText* pEnrichedStatusText = null;
670 EnrichedText* pEnrichedHintText = null;
671 EnrichedText* pEnrichedValueText = null;
672 EnrichedText* pEnrichedBoundsText = null;
673 EnrichedText* pEnrichedAbsBoundsText = null;
674 TextElement* pElement = null;
675 FloatDimension screen;
677 if (String("i686_emulated") != sysInfo.machine)
682 if (__pReadingVe == null)
684 pFrame = UiApp::GetInstance()->GetAppFrame()->GetFrame();
688 int accesibilityVisualElementLevel = 3000;
689 result r = E_SUCCESS;
690 VisualElement* pRootVe = _ControlManager::GetInstance()->GetTopVisibleWindow()->GetVisualElement();
692 __pReadingVe = new (std::nothrow) VisualElement();
693 SysTryCatch(NID_UI, __pReadingVe, , E_SYSTEM, "[E_SYSTEM] System error");
695 r = __pReadingVe->Construct();
696 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] System error");
697 __pReadingVe->SetName("Accessibility reading popup");
698 __pReadingVe->SetImplicitAnimationEnabled(false);
699 _VisualElementImpl::GetInstance(*__pReadingVe)->SetZOrderGroup(accesibilityVisualElementLevel);
700 pRootVe->AttachChild(*__pReadingVe);
704 screen = _ControlManager::GetInstance()->GetScreenSizeF();
707 result r = E_SUCCESS;
709 float titleFontSize = 0;
710 float textFontSize = 0;
711 float popupWidth = 0;
713 float bottomMargin = 0;
714 float sideMargin = 0;
715 float titleHeight = 0;
716 float textTopMargin = 0;
717 float textHeight = 0;
719 Color titleTextColor;
720 Color pointTextColor;
723 r = GET_SHAPE_CONFIG(ACCESSIBILITY::TITLE_FONT_SIZE, _CONTROL_ORIENTATION_PORTRAIT, titleFontSize);
724 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
725 r = GET_SHAPE_CONFIG(ACCESSIBILITY::TEXT_FONT_SIZE, _CONTROL_ORIENTATION_PORTRAIT, textFontSize);
726 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
727 r = GET_SHAPE_CONFIG(ACCESSIBILITY::POPUP_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, popupWidth);
728 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
729 r = GET_SHAPE_CONFIG(ACCESSIBILITY::TOP_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, topMargin);
730 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
731 r = GET_SHAPE_CONFIG(ACCESSIBILITY::BOTTON_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, bottomMargin);
732 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
733 r = GET_SHAPE_CONFIG(ACCESSIBILITY::SIDE_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, sideMargin);
734 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
735 r = GET_SHAPE_CONFIG(ACCESSIBILITY::TITLE_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, titleHeight);
736 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
737 r = GET_SHAPE_CONFIG(ACCESSIBILITY::TEXT_TOP_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, textTopMargin);
738 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
739 r = GET_SHAPE_CONFIG(ACCESSIBILITY::TEXT_HEGIHT, _CONTROL_ORIENTATION_PORTRAIT, textHeight);
740 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
741 r = GET_COLOR_CONFIG(ACCESSIBILITY::TITLE_TEXT, titleTextColor);
742 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
743 r = GET_COLOR_CONFIG(ACCESSIBILITY::POINT_TEXT, pointTextColor);
744 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
745 r = GET_COLOR_CONFIG(ACCESSIBILITY::TEXT, textColor);
746 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
747 r = GET_BITMAP_CONFIG_N(ACCESSIBILITY::POPUP_BG, BITMAP_PIXEL_FORMAT_ARGB8888, pBgBitmap);
748 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
751 r = titleFont.Construct(FONT_STYLE_PLAIN, titleFontSize);
752 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
755 r = textFont.Construct(FONT_STYLE_PLAIN, textFontSize);
756 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
758 pEnrichedTitleText = new (std::nothrow) EnrichedText;
759 SysTryCatch(NID_UI, pEnrichedTitleText != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
760 pEnrichedTitleText->Construct(FloatDimension(popupWidth-sideMargin*2, titleHeight));
762 pEnrichedNameText = new (std::nothrow) EnrichedText;
763 SysTryCatch(NID_UI, pEnrichedNameText != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
764 pEnrichedNameText->Construct(FloatDimension(popupWidth-sideMargin*2, textHeight));
766 pEnrichedLableText = new (std::nothrow) EnrichedText;
767 SysTryCatch(NID_UI, pEnrichedLableText != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
768 pEnrichedLableText->Construct(FloatDimension(popupWidth-sideMargin*2, textHeight));
770 pEnrichedTraitText = new (std::nothrow) EnrichedText;
771 SysTryCatch(NID_UI, pEnrichedTraitText != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed.");
772 pEnrichedTraitText->Construct(FloatDimension(popupWidth-sideMargin*2, textHeight));
774 pEnrichedStatusText = new (std::nothrow) EnrichedText;
775 SysTryCatch(NID_UI, pEnrichedStatusText != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed.");
776 pEnrichedStatusText->Construct(FloatDimension(popupWidth-sideMargin*2, textHeight));
778 pEnrichedHintText = new (std::nothrow) EnrichedText;
779 SysTryCatch(NID_UI, pEnrichedHintText != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed.");
780 pEnrichedHintText->Construct(FloatDimension(popupWidth-sideMargin*2, textHeight));
782 pEnrichedValueText = new (std::nothrow) EnrichedText;
783 SysTryCatch(NID_UI, pEnrichedValueText != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed.");
784 pEnrichedValueText->Construct(FloatDimension(popupWidth-sideMargin*2, textHeight));
786 pEnrichedBoundsText = new (std::nothrow) EnrichedText;
787 SysTryCatch(NID_UI, pEnrichedBoundsText != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed.");
788 pEnrichedBoundsText->Construct(FloatDimension(popupWidth-sideMargin*2, textHeight));
790 pEnrichedAbsBoundsText = new (std::nothrow) EnrichedText;
791 SysTryCatch(NID_UI, pEnrichedAbsBoundsText != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed.");
792 pEnrichedAbsBoundsText->Construct(FloatDimension(popupWidth-sideMargin*2, textHeight));
794 pElement = new (std::nothrow) TextElement;
795 r = pElement->Construct(L"Screen reading...");
796 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
797 pElement->SetTextColor(titleTextColor);
798 pElement->SetFont(titleFont);
799 r = pEnrichedTitleText->Add(*pElement);
801 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
802 pEnrichedTitleText->SetHorizontalAlignment(TEXT_ALIGNMENT_LEFT);
803 pEnrichedTitleText->SetVerticalAlignment(TEXT_ALIGNMENT_TOP);
804 pEnrichedTitleText->SetTextWrapStyle(TEXT_WRAP_CHARACTER_WRAP);
805 pEnrichedTitleText->SetTextAbbreviationEnabled(true);
807 pElement = new (std::nothrow) TextElement;
808 r = pElement->Construct(L"Name: ");
809 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
811 pElement->SetTextColor(pointTextColor);
812 pElement->SetFont(textFont);
813 r = pEnrichedNameText->Add(*pElement);
814 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
816 if (!(__pTargetElement->GetName().IsEmpty()))
818 pElement = new (std::nothrow) TextElement;
819 r = pElement->Construct(__pTargetElement->GetName());
820 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
822 pElement->SetTextColor(textColor);
823 pElement->SetFont(textFont);
824 r = pEnrichedNameText->Add(*pElement);
825 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
826 SysLog(NID_UI, " Name :::::: %s", _StringConverter::CopyToCharArrayN(__pTargetElement->GetName()));
828 pEnrichedNameText->SetHorizontalAlignment(TEXT_ALIGNMENT_LEFT);
829 pEnrichedNameText->SetVerticalAlignment(TEXT_ALIGNMENT_TOP);
830 pEnrichedNameText->SetTextWrapStyle(TEXT_WRAP_CHARACTER_WRAP);
831 pEnrichedNameText->SetTextAbbreviationEnabled(true);
833 pElement = new (std::nothrow) TextElement;
834 SysTryCatch(NID_UI, pElement != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
835 r = pElement->Construct(L"Label: ");
836 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
838 pElement->SetTextColor(pointTextColor);
839 pElement->SetFont(textFont);
840 r = pEnrichedLableText->Add(*pElement);
841 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
843 if (!(__pTargetElement->GetLabel().IsEmpty()))
845 pElement = new (std::nothrow) TextElement;
846 SysTryCatch(NID_UI, pElement != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
847 r = pElement->Construct(__pTargetElement->GetLabel());
848 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
850 pElement->SetTextColor(textColor);
851 pElement->SetFont(textFont);
852 r = pEnrichedLableText->Add(*pElement);
853 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
854 SysLog(NID_UI, " Label :::::: %s", _StringConverter::CopyToCharArrayN(__pTargetElement->GetLabel()));
856 pEnrichedLableText->SetHorizontalAlignment(TEXT_ALIGNMENT_LEFT);
857 pEnrichedLableText->SetVerticalAlignment(TEXT_ALIGNMENT_TOP);
858 pEnrichedLableText->SetTextWrapStyle(TEXT_WRAP_CHARACTER_WRAP);
859 pEnrichedLableText->SetTextAbbreviationEnabled(true);
861 pElement = new (std::nothrow) TextElement;
862 SysTryCatch(NID_UI, pElement != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
863 r = pElement->Construct(L"Trait: ");
864 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
866 pElement->SetTextColor(pointTextColor);
867 pElement->SetFont(textFont);
868 r = pEnrichedTraitText->Add(*pElement);
869 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
870 if (!(__pTargetElement->GetTraitString().IsEmpty()))
872 pElement = new (std::nothrow) TextElement;
873 SysTryCatch(NID_UI, pElement != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
874 r = pElement->Construct(__pTargetElement->GetTraitString());
875 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
877 pElement->SetTextColor(textColor);
878 pElement->SetFont(textFont);
879 r = pEnrichedTraitText->Add(*pElement);
880 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
882 pEnrichedTraitText->SetHorizontalAlignment(TEXT_ALIGNMENT_LEFT);
883 pEnrichedTraitText->SetVerticalAlignment(TEXT_ALIGNMENT_TOP);
884 pEnrichedTraitText->SetTextWrapStyle(TEXT_WRAP_CHARACTER_WRAP);
885 pEnrichedTraitText->SetTextAbbreviationEnabled(true);
887 pElement = new (std::nothrow) TextElement;
888 SysTryCatch(NID_UI, pElement != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
889 r = pElement->Construct(L"Status: ");
890 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
892 pElement->SetTextColor(pointTextColor);
893 pElement->SetFont(textFont);
894 r = pEnrichedStatusText->Add(*pElement);
895 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
896 if (!(__pTargetElement->GetStatus().IsEmpty()))
898 pElement = new (std::nothrow) TextElement;
899 SysTryCatch(NID_UI, pElement != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
900 r = pElement->Construct(__pTargetElement->GetStatus());
901 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
903 pElement->SetTextColor(textColor);
904 pElement->SetFont(textFont);
905 r = pEnrichedStatusText->Add(*pElement);
906 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
908 pEnrichedStatusText->SetHorizontalAlignment(TEXT_ALIGNMENT_LEFT);
909 pEnrichedStatusText->SetVerticalAlignment(TEXT_ALIGNMENT_TOP);
910 pEnrichedStatusText->SetTextWrapStyle(TEXT_WRAP_CHARACTER_WRAP);
911 pEnrichedStatusText->SetTextAbbreviationEnabled(true);
913 pElement = new (std::nothrow) TextElement;
914 SysTryCatch(NID_UI, pElement != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
915 r = pElement->Construct(L"Hint: ");
916 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
918 pElement->SetTextColor(pointTextColor);
919 pElement->SetFont(textFont);
920 r = pEnrichedHintText->Add(*pElement);
921 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
922 if (!(__pTargetElement->GetHint().IsEmpty()))
924 pElement = new (std::nothrow) TextElement;
925 SysTryCatch(NID_UI, pElement != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
926 r = pElement->Construct(__pTargetElement->GetHint());
927 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
929 pElement->SetTextColor(textColor);
930 pElement->SetFont(textFont);
931 r = pEnrichedHintText->Add(*pElement);
932 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
934 pEnrichedHintText->SetHorizontalAlignment(TEXT_ALIGNMENT_LEFT);
935 pEnrichedHintText->SetVerticalAlignment(TEXT_ALIGNMENT_TOP);
936 pEnrichedHintText->SetTextWrapStyle(TEXT_WRAP_CHARACTER_WRAP);
937 pEnrichedHintText->SetTextAbbreviationEnabled(true);
939 pElement = new (std::nothrow) TextElement;
940 SysTryCatch(NID_UI, pElement != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
941 r = pElement->Construct(L"Value: ");
942 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
944 pElement->SetTextColor(pointTextColor);
945 pElement->SetFont(textFont);
946 r = pEnrichedValueText->Add(*pElement);
947 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
948 if (!(__pTargetElement->GetValue().IsEmpty()))
950 pElement = new (std::nothrow) TextElement;
951 SysTryCatch(NID_UI, pElement != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
952 r = pElement->Construct(__pTargetElement->GetValue());
953 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
955 pElement->SetTextColor(textColor);
956 pElement->SetFont(textFont);
957 r = pEnrichedValueText->Add(*pElement);
958 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
960 pEnrichedValueText->SetHorizontalAlignment(TEXT_ALIGNMENT_LEFT);
961 pEnrichedValueText->SetVerticalAlignment(TEXT_ALIGNMENT_TOP);
962 pEnrichedValueText->SetTextWrapStyle(TEXT_WRAP_CHARACTER_WRAP);
963 pEnrichedValueText->SetTextAbbreviationEnabled(true);
965 pElement = new (std::nothrow) TextElement;
966 SysTryCatch(NID_UI, pElement != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
967 r = pElement->Construct(L"Bound: ");
968 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
970 pElement->SetTextColor(pointTextColor);
971 pElement->SetFont(textFont);
972 r = pEnrichedBoundsText->Add(*pElement);
973 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
975 pElement = new (std::nothrow) TextElement;
976 SysTryCatch(NID_UI, pElement != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
977 FloatRectangle rect = __pTargetElement->GetBounds();
979 rectString.Format(40, L"x:%f, y:%f, w:%f, h:%f", rect.x, rect.y, rect.width, rect.height);
980 r = pElement->Construct(rectString);
981 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
983 pElement->SetTextColor(textColor);
984 pElement->SetFont(textFont);
985 r = pEnrichedBoundsText->Add(*pElement);
986 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
987 pEnrichedBoundsText->SetHorizontalAlignment(TEXT_ALIGNMENT_LEFT);
988 pEnrichedBoundsText->SetVerticalAlignment(TEXT_ALIGNMENT_TOP);
989 pEnrichedBoundsText->SetTextWrapStyle(TEXT_WRAP_CHARACTER_WRAP);
990 pEnrichedBoundsText->SetTextAbbreviationEnabled(true);
992 pElement = new (std::nothrow) TextElement;
993 SysTryCatch(NID_UI, pElement != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
994 r = pElement->Construct(L"AbsBound: ");
995 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
997 pElement->SetTextColor(pointTextColor);
998 pElement->SetFont(textFont);
999 r = pEnrichedAbsBoundsText->Add(*pElement);
1000 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
1002 pElement = new (std::nothrow) TextElement;
1003 SysTryCatch(NID_UI, pElement != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
1004 rect = __pTargetElement->GetAbsoluteBounds();
1006 rectString.Format(40, L"x:%f, y:%f, w:%f, h:%f", rect.x, rect.y, rect.width, rect.height);
1007 r = pElement->Construct(rectString);
1008 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
1010 pElement->SetTextColor(textColor);
1011 pElement->SetFont(textFont);
1012 r = pEnrichedAbsBoundsText->Add(*pElement);
1013 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
1014 pEnrichedAbsBoundsText->SetHorizontalAlignment(TEXT_ALIGNMENT_LEFT);
1015 pEnrichedAbsBoundsText->SetVerticalAlignment(TEXT_ALIGNMENT_TOP);
1016 pEnrichedAbsBoundsText->SetTextWrapStyle(TEXT_WRAP_CHARACTER_WRAP);
1017 pEnrichedAbsBoundsText->SetTextAbbreviationEnabled(true);
1021 float popupHeight = topMargin + bottomMargin + titleHeight + textTopMargin + textHeight * 8;
1022 Frame* pFrame = UiApp::GetInstance()->GetAppFrame()->GetFrame();
1023 Form* pForm = pFrame->GetCurrentForm();
1024 FloatDimension screen = Tizen::Ui::_ControlManager::GetInstance()->GetScreenSizeF();
1026 if (pForm->GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT
1027 || pForm->GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT_REVERSE)
1029 x = (screen.width-popupWidth) / 2;
1030 if (rect.y < screen.height/2)
1032 y = (screen.height/2 - popupHeight) /2 + screen.height/2;
1036 y = (screen.height/2 - popupHeight) /2;
1041 y = (screen.width-popupHeight) / 2;
1042 if (rect.x < screen.height/2)
1044 x = (screen.height/2 - popupWidth) /2 + screen.height/2;
1048 x = (screen.height/2 - popupWidth) /2;
1052 __pReadingVe->SetBounds(FloatRectangle(x, y, popupWidth, popupHeight));
1053 pCanvas = __pReadingVe->GetCanvasN();
1054 SysTryCatch(NID_UI, pCanvas != null, , E_SYSTEM, "System error for accessibility popup");
1055 pCanvas->DrawNinePatchedBitmap(FloatRectangle(0, 0, popupWidth, popupHeight), *pBgBitmap);
1056 float drawingTextY = topMargin;
1057 pCanvas->DrawText(FloatPoint(sideMargin, drawingTextY), *pEnrichedTitleText);
1058 drawingTextY += textTopMargin + titleHeight;
1059 pCanvas->DrawText(FloatPoint(sideMargin, drawingTextY), *pEnrichedNameText);
1060 drawingTextY += textHeight;
1061 pCanvas->DrawText(FloatPoint(sideMargin, drawingTextY), *pEnrichedLableText);
1062 drawingTextY += textHeight;
1063 pCanvas->DrawText(FloatPoint(sideMargin, drawingTextY), *pEnrichedTraitText);
1064 drawingTextY += textHeight;
1065 pCanvas->DrawText(FloatPoint(sideMargin, drawingTextY), *pEnrichedStatusText);
1066 drawingTextY += textHeight;
1067 pCanvas->DrawText(FloatPoint(sideMargin, drawingTextY), *pEnrichedHintText);
1068 drawingTextY += textHeight;
1069 pCanvas->DrawText(FloatPoint(sideMargin, drawingTextY), *pEnrichedValueText);
1070 drawingTextY += textHeight;
1071 pCanvas->DrawText(FloatPoint(sideMargin, drawingTextY), *pEnrichedBoundsText);
1072 drawingTextY += textHeight;
1073 pCanvas->DrawText(FloatPoint(sideMargin, drawingTextY), *pEnrichedAbsBoundsText);
1074 __pReadingVe->SetShowState(true);
1075 __pReadingVe->SetFlushNeeded();
1076 pGuidePopupTimer->SetElement(__pReadingVe);
1085 if (pEnrichedTitleText)
1087 pEnrichedTitleText->RemoveAll(true);
1088 delete pEnrichedTitleText;
1090 if (pEnrichedNameText)
1092 pEnrichedNameText->RemoveAll(true);
1093 delete pEnrichedNameText;
1095 if (pEnrichedLableText)
1097 pEnrichedLableText->RemoveAll(true);
1098 delete pEnrichedLableText;
1100 if (pEnrichedTraitText)
1102 pEnrichedTraitText->RemoveAll(true);
1103 delete pEnrichedTraitText;
1105 if (pEnrichedStatusText)
1107 pEnrichedStatusText->RemoveAll(true);
1108 delete pEnrichedStatusText;
1110 if (pEnrichedHintText)
1112 pEnrichedHintText->RemoveAll(true);
1113 delete pEnrichedHintText;
1115 if (pEnrichedValueText)
1117 pEnrichedValueText->RemoveAll(true);
1118 delete pEnrichedValueText;
1120 if (pEnrichedBoundsText)
1122 pEnrichedBoundsText->RemoveAll(true);
1123 delete pEnrichedBoundsText;
1125 if (pEnrichedAbsBoundsText)
1127 pEnrichedAbsBoundsText->RemoveAll(true);
1128 delete pEnrichedAbsBoundsText;
1135 _AccessibilityManager::OnFinishReading(const Tizen::Base::String& grammar)
1139 __pReadingVe->SetShowState(false);
1141 if (!IsContainerValid(__pTargetContainer))
1145 LinkedListT<_IAccessibilityListener*>* pList = static_cast<LinkedListT<_IAccessibilityListener*>*>(__pTargetContainer->GetListenerListN());
1148 for (int i = 0;i<pList->GetCount();i++)
1150 _IAccessibilityListener* pListener = null;
1151 if (pList->GetAt(i, pListener) == E_SUCCESS)
1153 if (__pTargetElement)
1155 pListener->OnAccessibilityReadedElement(*__pTargetContainer, *__pTargetElement);
1166 _AccessibilityManager::GetCurrentGrammar(void)
1171 _AccessibilityManager::AddContainer(const _AccessibilityContainer& container)
1173 __containerList.Add(&const_cast<_AccessibilityContainer&>(container));
1174 SetGestureMode(MODE_TAP);
1178 _AccessibilityManager::RemoveContainer(const _AccessibilityContainer& container)
1180 __containerList.Remove(&const_cast<_AccessibilityContainer&>(container));
1181 SetGestureMode(MODE_TAP);
1182 if (__pTargetContainer == &container)
1184 __pTargetContainer = null;
1185 __pTargetElement = null;
1191 _AccessibilityManager::MakeList(void)
1195 DownVisitor(_Control& control, LinkedListT<_Control*>& list)
1197 LinkedListT<_Control*> _list;
1198 int count = control.GetChildCount();
1199 _Control* pControl = null;
1200 for (int i = 0; i < count ; i++)
1202 pControl = control.GetChild(i);
1205 _list.Add(pControl);
1208 _AccessibilityItemComparer<_Control*> comparer;
1209 _list.Sort(comparer);
1211 list.IndexOf(&control, index);
1212 list.InsertItemsFrom(_list,index+1);
1213 for (int i = 0; i < count ; i++)
1215 pControl = control.GetChild(i);
1216 DownVisitor(*pControl, list);
1220 if (GetGestureMode() == MODE_FOCUS_MOVE)
1224 result r = E_SUCCESS;
1226 _Control* pControl = null;
1227 _AccessibilityContainer* pContainer = null;
1228 _TouchManager* pTouchManager = _TouchManager::GetInstance();
1229 LinkedListT<_Control*> controlList;
1230 LinkedListT<_AccessibilityElement*> elementPositionList;
1231 LinkedListT<_AccessibilityElement*> elementPositionByControlList;
1232 __candidateList.RemoveAll();
1236 pControl = pTouchManager->GetCapturedControl();
1239 controlList.Add(pControl);
1243 if (pControl == null)
1245 pControl = static_cast<_Control*>(_ControlManager::GetInstance()->GetWindow(_ControlManager::GetInstance()->GetWindowCount() - 1));
1246 controlList.Add(pControl);
1248 DownVisitor(*pControl, controlList);
1249 _AccessibilityItemComparer<_Control*> controlComparer;
1250 //controlList.Sort(controlComparer);
1251 for (int i = 0; i < controlList.GetCount() ; i++)
1253 if (controlList.GetAt(i, pControl) == E_SUCCESS)
1255 pContainer = pControl->GetAccessibilityContainer();
1256 if (pContainer == null)
1260 if (IsContainerValid(pContainer))
1262 pContainer->SortElements();
1263 pContainer->GetElements(elementPositionList);
1264 pContainer->GetElements(elementPositionByControlList);
1269 _ElementComparer<_AccessibilityElement*> comparer;
1270 elementPositionList.Sort(comparer);
1271 count = elementPositionList.GetCount();
1273 _AccessibilityElement* pPositionListElement = null;
1274 _AccessibilityElement* pPositionByControlListElement = null;
1275 while (!done && index < count && index < count)
1278 r = elementPositionList.GetAt(index, pPositionListElement);
1285 r = elementPositionByControlList.GetAt(index, pPositionByControlListElement);
1292 if (pPositionListElement == pPositionByControlListElement)
1294 __candidateList.Add(pPositionByControlListElement);
1299 if (pPositionListElement->GetParent()->GetPriority() > pPositionByControlListElement->GetParent()->GetPriority())
1301 elementPositionByControlList.Remove(pPositionListElement);
1302 elementPositionByControlList.InsertAt(pPositionListElement, index);
1303 __candidateList.Add(pPositionListElement);
1307 else if (pPositionListElement->GetParent()->GetPriority() < pPositionByControlListElement->GetParent()->GetPriority())
1309 elementPositionList.Remove(pPositionByControlListElement);
1310 elementPositionList.InsertAt(pPositionByControlListElement, index);
1311 __candidateList.Add(pPositionByControlListElement);
1316 if (pPositionListElement->GetAbsoluteBounds().y > pPositionByControlListElement->GetAbsoluteBounds().y)
1318 elementPositionList.Remove(pPositionByControlListElement);
1319 elementPositionList.InsertAt(pPositionByControlListElement, index);
1320 __candidateList.Add(pPositionByControlListElement);
1324 else if (pPositionListElement->GetAbsoluteBounds().y < pPositionByControlListElement->GetAbsoluteBounds().y)
1326 pControl = &(pPositionByControlListElement->GetParent()->GetOwner());
1329 rect = pControl->GetAbsoluteBounds();
1336 if(pControl->GetParent())
1338 pControl = pControl->GetParent();
1348 controlList.RemoveAll();
1349 controlList.Add(pControl);
1350 DownVisitor(*pControl, controlList);
1351 int _count = controlList.GetCount();
1352 LinkedListT<_AccessibilityElement*> _elementPositionList;
1353 for (int i = 0; i < _count ; i++)
1355 if (controlList.GetAt(i, pControl) == E_SUCCESS)
1357 pContainer = pControl->GetAccessibilityContainer();
1358 if (pContainer == null)
1362 if (IsContainerValid(pContainer))
1364 pContainer->GetElements(_elementPositionList);
1368 _elementPositionList.Sort(comparer);
1369 _count = _elementPositionList.GetCount();
1370 _AccessibilityElement* pElement = null;
1371 for (int i = 0 ; i < _count ; i++)
1373 r = _elementPositionList.GetAt(i, pElement);
1378 if (__candidateList.Contains(pElement))
1382 __candidateList.Add(pElement);
1383 elementPositionByControlList.Remove(pElement);
1384 elementPositionByControlList.InsertAt(pElement, index);
1385 elementPositionList.Remove(pElement);
1386 elementPositionList.InsertAt(pElement, index);
1393 elementPositionList.Remove(pPositionByControlListElement);
1394 elementPositionList.InsertAt(pPositionByControlListElement, index);
1395 __candidateList.Add(pPositionByControlListElement);
1401 count = __candidateList.GetCount();
1402 SysLog(NID_UI, "Accessibility element candidate count : %d", count);
1408 _AccessibilityElement* pElement = null;
1409 int fastScrollIndex = -1;
1410 int listItemStartIndex = -1;
1411 int listItemEndIndex = -1;
1412 for (int i = 0 ; i < count ; i++)
1414 r = __candidateList.GetAt(i, pElement);
1419 if (pElement->GetName() == "HeaderTitleText")
1421 __candidateList.Remove(pElement);
1422 __candidateList.InsertAt(pElement, 0);
1424 if (pElement->GetName() == L"ListViewItemText" ||pElement->GetName() == L"TableViewItem")
1426 listItemEndIndex = i;
1428 if (listItemStartIndex == -1 && (pElement->GetName() == L"ListViewItemText" ||pElement->GetName() == L"TableViewItem"))
1430 listItemStartIndex = i;
1432 if (fastScrollIndex == -1 && pElement->GetName() == L"FastScroll")
1434 fastScrollIndex = i;
1438 if (listItemStartIndex != -1 && fastScrollIndex != -1)
1440 if (fastScrollIndex > listItemStartIndex)
1442 result r = __candidateList.GetAt(fastScrollIndex, pElement);
1445 __candidateList.Remove(pElement);
1446 __candidateList.InsertAt(pElement, listItemStartIndex);
1454 _AccessibilityManager::MakeList(_AccessibilityContainer* pContainer)
1456 if (pContainer->GetOwner().IsVisible() && pContainer->IsActivated())
1458 pContainer->GetElements(__candidateList);
1460 _Control* pControl = &(pContainer->GetOwner());
1461 int count = pControl->GetChildCount();
1462 for (int i = 0 ; i<count;i++)
1464 _Control* pChildControl = pControl->GetChild(i);
1467 MakeList(pChildControl->GetAccessibilityContainer());
1473 _AccessibilityManager::MoveFocus(_AccessibilityFocusDirection direction)
1475 if (direction == _ACCESSIBILITY_FOCUS_DIRECTION_PREVIOUS
1476 || direction == _ACCESSIBILITY_FOCUS_DIRECTION_NEXT)
1485 int count = __candidateList.GetCount();
1490 result r = E_SUCCESS;
1492 _AccessibilityElement* pElement = null;
1493 _AccessibilityContainer* pContainer = null;
1494 bool focusManaged = false;
1495 if (IsContainerValid(__pTargetContainer))
1497 r = __candidateList.IndexOf(__pTargetElement, 0, index);
1501 __pTargetElement = null;
1502 __pTargetContainer = null;
1506 if ((__pTargetContainer->MoveFocus(direction)))
1508 pElement = __pTargetContainer->GetCurrentFocusedElement();
1509 focusManaged = true;
1518 if (index > count - 1)
1522 __candidateList.GetAt(index, pElement);
1523 if (pElement->GetParent()->IsFocusManaged())
1525 if ((pElement->GetParent()->MoveFocus(direction)))
1527 focusManaged = true;
1535 SysTryReturn(NID_UI, __candidateList.GetAt(0, pElement) == E_SUCCESS, false, E_SUCCESS, "[E_SUCCESS] Candidates are not exist.");
1539 pContainer = pElement->GetParent();
1540 IListT<_IAccessibilityListener*>* pListenerList = pContainer->GetListenerListN();
1543 int listenerCount = pListenerList->GetCount();
1544 if (listenerCount > 0)
1546 for (int i = 0;i<listenerCount;i++)
1548 _IAccessibilityListener* pListener = null;
1549 if (pListenerList->GetAt(i, pListener) == E_SUCCESS)
1551 if (pListener->OnAccessibilityItemRefreshed(*pContainer, *pElement, direction) == true)
1553 return MoveFocus(direction);
1558 delete pListenerList;
1559 pListenerList = null;
1561 pContainer->SetCurrentFocusedElement(pElement);
1563 if (__pTargetContainer)
1565 __pTargetContainer->SetCurrentFocusedElement(null);
1567 pListenerList = __pTargetContainer->GetListenerListN();
1570 int listenerCount = pListenerList->GetCount();
1571 if (listenerCount > 0)
1573 for (int i = 0;i<listenerCount;i++)
1575 _IAccessibilityListener* pListener = null;
1576 if (pListenerList->GetAt(i, pListener) == E_SUCCESS)
1578 pListener->OnAccessibilityFocusOut(*__pTargetContainer, *__pTargetElement);
1582 delete pListenerList;
1583 pListenerList = null;
1589 __pTargetElement = pElement;
1590 __pTargetContainer = pContainer;
1591 __targetControlHandle = pContainer->GetOwner().GetHandle();
1597 DrawFocusUi(*pElement);
1598 __pTargetElement = pElement;
1599 __pTargetContainer = pContainer;
1600 __targetControlHandle = pContainer->GetOwner().GetHandle();
1601 pListenerList = __pTargetContainer->GetListenerListN();
1604 int listenerCount = pListenerList->GetCount();
1605 if (listenerCount > 0)
1607 for (int i = 0;i<listenerCount;i++)
1609 _IAccessibilityListener* pListener = null;
1610 if (pListenerList->GetAt(i, pListener) == E_SUCCESS)
1612 pListener->OnAccessibilityFocusIn(*__pTargetContainer, *__pTargetElement);
1613 if (direction == _ACCESSIBILITY_FOCUS_DIRECTION_PREVIOUS)
1615 pListener->OnAccessibilityFocusMovedPrevious(*__pTargetContainer, *__pTargetElement);
1617 else if (direction == _ACCESSIBILITY_FOCUS_DIRECTION_NEXT)
1619 pListener->OnAccessibilityFocusMovedNext(*__pTargetContainer, *__pTargetElement);
1625 delete pListenerList;
1626 pListenerList = null;
1628 ReadElement(*pElement);
1635 _AccessibilityManager::RequestToDrawFocusUi()
1637 if (__pTargetContainer)
1640 DrawFocusUi(*__pTargetElement);
1645 _AccessibilityManager::RequestAutoReading(_AccessibilityAutoReadingMode mode)
1647 pAutoReadingTimer->Start(mode);
1651 _AccessibilityManager::SetTtsMode(_AccessibilityTtsMode mode)
1655 //__pTtsPlayer->SetMode(mode);
1660 _AccessibilityManager::SetGlobalFocusedElement(_AccessibilityElement& element)
1662 _AccessibilityElement* pElement = &element;
1663 if (!IsContainerValid(pElement->GetParent()))
1667 __pTargetContainer = pElement->GetParent();
1668 __pTargetElement = pElement;
1669 RequestAutoReading(_ACCESSIBILITY_AUTO_READING_MODE_CURRENT_FOCUS);
1673 _AccessibilityManager::EraseFocusUi(void)
1677 __pFocusVe->Destroy();
1682 _AccessibilityManager::DrawFocusUi(const _AccessibilityElement& element)
1684 FloatRectangle rectangle = element.GetBounds();
1685 Canvas* pCanvas = null;
1687 _AccessibilityContainer* pContainer = element.GetParent();
1689 if (__focusedControlHandle.IsValid())
1693 __pFocusVe->Destroy();
1698 result r = E_SUCCESS;
1699 _Control* pControl = &const_cast<_Control&>(pContainer->GetOwner());
1700 _VisualElement* pControlVe = pControl->GetVisualElement();
1702 __pFocusVe = new (std::nothrow) VisualElement();
1703 SysTryCatch(NID_UI, __pFocusVe != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
1704 r = __pFocusVe->Construct();
1705 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] System error");
1707 __pFocusVe->SetName("Accessibility focus ui");
1708 __pFocusVe->SetImplicitAnimationEnabled(false);
1709 __focusedControlHandle = pControl->GetHandle();
1710 pControlVe->AttachChild(*__pFocusVe);
1714 __pFocusVe->SetBounds(FloatRectangle(rectangle.x, rectangle.y, rectangle.width, rectangle.height));
1715 pCanvas = __pFocusVe->GetCanvasN();
1716 SysTryCatch(NID_UI, pCanvas, , E_SYSTEM, "[E_SYSTEM] System error");
1717 pCanvas->SetBackgroundColor(0x00000000);
1719 Bitmap* pBitmap = null;
1720 result r = GET_BITMAP_CONFIG_N(ACCESSIBILITY::FOCUS, BITMAP_PIXEL_FORMAT_ARGB8888, pBitmap);
1723 if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*pBitmap))
1725 r = pCanvas->DrawNinePatchedBitmap(Rectangle(0, 0, rectangle.width, rectangle.height), *pBitmap);
1726 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] System error");
1730 r = pCanvas->DrawBitmap(Rectangle(0, 0, rectangle.width, rectangle.height), *pBitmap);
1731 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] System error");
1735 __pFocusVe->SetShowState(true);
1744 __pFocusVe->Destroy();
1750 _AccessibilityManager::ProcessGesture(_AccessibilityGestureType type, const FloatPoint& point, const _TouchGestureDetector* pDetector)
1754 case _ACCESSIBILITY_GESTURE_TYPE_FLICK_UP:
1755 case _ACCESSIBILITY_GESTURE_TYPE_FLICK_LEFT:
1756 if (MoveFocus(_ACCESSIBILITY_FOCUS_DIRECTION_PREVIOUS))
1758 SetGestureMode(MODE_FOCUS_MOVE);
1761 case _ACCESSIBILITY_GESTURE_TYPE_FLICK_DOWN:
1762 case _ACCESSIBILITY_GESTURE_TYPE_FLICK_RIGHT:
1763 if (MoveFocus(_ACCESSIBILITY_FOCUS_DIRECTION_NEXT))
1765 SetGestureMode(MODE_FOCUS_MOVE);
1768 case _ACCESSIBILITY_GESTURE_TYPE_ONE_FINGER_ONE_TAP:
1770 if (GetGestureMode() == MODE_FOCUS_MOVE)
1772 SetGestureMode(MODE_TAP);
1773 __candidateList.RemoveAll();
1775 Point pt((int)point.x, (int)point.y);
1776 _Control* pControl = _ControlManager::GetInstance()->GetTopmostTouchedControl(pt);
1777 if (pControl == null)
1781 _AccessibilityContainer* pAccContainer = pControl->GetAccessibilityContainer();
1782 while(!(pAccContainer->IsActivated()))
1784 _Control* _pControl = pAccContainer->GetOwner().GetParent();
1785 if (_pControl == null)
1789 pAccContainer = _pControl->GetAccessibilityContainer();
1790 if (pAccContainer == null)
1795 _AccessibilityElement* pElement = pAccContainer->Hit(pt);
1796 if (pElement == null)
1801 if (__pTargetElement == pElement)
1805 AccessibilityScreenReaderStatus status = __pTtsPlayer->GetStatus();
1806 if (status == ACCESSIBILITY_SCREEN_READER_STATUS_PLAYING)
1813 if (!(pAccContainer->MoveFocus(pt)))
1817 LinkedListT<_IAccessibilityListener*>* pList = null;
1818 if (IsContainerValid(__pTargetContainer))
1820 __pTargetContainer->ResetFocus();
1821 __pTargetContainer->GetOwner().Invalidate();
1822 pList = static_cast<LinkedListT<_IAccessibilityListener*>*>(__pTargetContainer->GetListenerListN());
1825 int count = pList->GetCount();
1826 for (int i = 0;i<count;i++)
1828 _IAccessibilityListener* pListener = null;
1829 if (pList->GetAt(i, pListener) == E_SUCCESS)
1831 pListener->OnAccessibilityFocusOut(*__pTargetContainer, *__pTargetElement);
1838 if (pAccContainer->IsFocusManaged())
1840 __pTargetContainer = pAccContainer;
1841 __targetControlHandle = pAccContainer->GetOwner().GetHandle();
1842 __pTargetElement = pElement;
1846 DrawFocusUi(*pElement);
1847 __pTargetContainer = pAccContainer;
1848 __targetControlHandle = pAccContainer->GetOwner().GetHandle();
1849 __pTargetElement = pElement;
1850 pList = static_cast<LinkedListT<_IAccessibilityListener*>*>(__pTargetContainer->GetListenerListN());
1853 int count = pList->GetCount();
1854 for (int i = 0;i<count;i++)
1856 _IAccessibilityListener* pListener = null;
1857 if (pList->GetAt(i, pListener) == E_SUCCESS)
1859 pListener->OnAccessibilityFocusIn(*__pTargetContainer, *__pTargetElement);
1864 ReadElement(*pElement);
1868 case _ACCESSIBILITY_GESTURE_TYPE_ONE_FINGER_DOUBLE_TAP:
1870 if (GetGestureMode() == MODE_FOCUS_MOVE)
1872 SetGestureMode(MODE_TAP);
1873 __candidateList.RemoveAll();
1875 if (__pTargetElement == null)
1879 _TouchManager* pTouchMgr = _TouchManager::GetInstance();
1880 _Control* _pControl = null;
1881 if (pTouchMgr == null)
1885 if (IsContainerValid(__pTargetContainer))
1887 _pControl = &(__pTargetContainer->GetOwner());
1893 if (_pControl == null)
1897 if (_pControl->GetEnableState() == false)
1899 ReadContent(L"Unavailable");
1903 if (__pTargetElement->GetSupportOperatingGesture())
1905 FloatRectangle rect = __pTargetElement->GetAbsoluteBounds();
1906 Point _point((int)(rect.x + rect.width/2), (int)(rect.y + rect.height/2));
1907 _UiTouchEvent pressedEvent(_pControl->GetHandle(), _TouchInfo(0, _TOUCH_PRESSED, _point, false, 0));
1908 _UiTouchEvent releasedEvent(_pControl->GetHandle(), _TouchInfo(0, _TOUCH_RELEASED, _point, false, 0));
1909 pressedEvent.SetAccessibilityEvent(true);
1910 releasedEvent.SetAccessibilityEvent(true);
1912 unsigned int pointId = 0;
1913 pointId = pTouchMgr->GeneratePointId(0);
1914 SysLog(NID_UI, "Accessibility manager generated touch pressed event. id: %d", pointId);
1915 _UiEventManager::GetInstance()->SendEvent(pressedEvent);
1916 pointId = pTouchMgr->GetPointId(0);
1917 SysLog(NID_UI, "Accessibility manager generated touch released event. id: %d", pointId);
1918 _UiEventManager::GetInstance()->SendEvent(releasedEvent);
1919 if (!IsContainerValid(__pTargetContainer))
1924 LinkedListT<_IAccessibilityListener*>* pList = static_cast<LinkedListT<_IAccessibilityListener*>*>(__pTargetContainer->GetListenerListN());
1927 int count = pList->GetCount();
1928 SysLog(NID_UI, "Accessibility manager called listeners. count : %d", count);
1929 for (int i = 0;i<count;i++)
1931 _IAccessibilityListener* pListener = null;
1932 if (pList->GetAt(i, pListener) == E_SUCCESS)
1934 pListener->OnAccessibilityActionPerformed(*__pTargetContainer, *__pTargetElement);
1943 case _ACCESSIBILITY_GESTURE_TYPE_ONE_FINGER_LONGPRESS:
1944 SetGestureMode(MODE_TAP);
1946 case _ACCESSIBILITY_GESTURE_TYPE_ONE_FINGER_PANNING_STARTED:
1947 case _ACCESSIBILITY_GESTURE_TYPE_ONE_FINGER_PANNING_CHANGED:
1948 case _ACCESSIBILITY_GESTURE_TYPE_ONE_FINGER_PANNING_FINISHED:
1949 SetGestureMode(MODE_TAP);
1951 case _ACCESSIBILITY_GESTURE_TYPE_VALUE_INCREASED:
1953 if (!IsContainerValid(__pTargetContainer))
1958 _Control* pControl = &(__pTargetContainer->GetOwner());
1959 if (pControl->GetEnableState() == false)
1961 ReadContent(L"Unavailable");
1965 LinkedListT<_IAccessibilityListener*>* pList = static_cast<LinkedListT<_IAccessibilityListener*>*>(__pTargetContainer->GetListenerListN());
1968 int count = pList->GetCount();
1969 for (int i = 0;i<count;i++)
1971 _IAccessibilityListener* pListener = null;
1972 if (pList->GetAt(i, pListener) == E_SUCCESS)
1974 pListener->OnAccessibilityValueIncreased(*__pTargetContainer, *__pTargetElement);
1981 case _ACCESSIBILITY_GESTURE_TYPE_VALUE_DECREASED:
1983 if (!IsContainerValid(__pTargetContainer))
1988 _Control* pControl = &(__pTargetContainer->GetOwner());
1989 if (pControl->GetEnableState() == false)
1991 ReadContent(L"Unavailable");
1995 LinkedListT<_IAccessibilityListener*>* pList = static_cast<LinkedListT<_IAccessibilityListener*>*>(__pTargetContainer->GetListenerListN());
1998 int count = pList->GetCount();
1999 for (int i = 0;i<count;i++)
2001 _IAccessibilityListener* pListener = null;
2002 if (pList->GetAt(i, pListener) == E_SUCCESS)
2004 pListener->OnAccessibilityValueDecreased(*__pTargetContainer, *__pTargetElement);
2011 case _ACCESSIBILITY_GESTURE_TYPE_TWO_FINGER_PANNING_STARTED:
2013 Point pt((int)point.x, (int)point.y);
2014 _Control* pControl = _ControlManager::GetInstance()->GetTopmostTouchedControl(pt);
2015 if (pControl == null)
2020 _UiTouchEvent pressedEvent(pControl->GetHandle(), _TouchInfo(0, _TOUCH_PRESSED, pt, false, 0));
2021 pressedEvent.SetAccessibilityEvent(true);
2022 _UiEventManager::GetInstance()->SendEvent(pressedEvent);
2023 __pPanningControl = pControl;
2024 SetGestureMode(MODE_PANNING);
2027 case _ACCESSIBILITY_GESTURE_TYPE_TWO_FINGER_PANNING_CHANGED:
2029 if (__pPanningControl == null || GetGestureMode() != MODE_PANNING)
2033 Point pt((int)point.x, (int)point.y);
2034 _UiTouchEvent movedEvent(__pPanningControl->GetHandle(), _TouchInfo(0, _TOUCH_MOVED, pt, false, 0));
2035 movedEvent.SetAccessibilityEvent(true);
2036 _UiEventManager::GetInstance()->SendEvent(movedEvent);
2039 case _ACCESSIBILITY_GESTURE_TYPE_TWO_FINGER_PANNING_FINISHED:
2041 if (__pPanningControl == null || GetGestureMode() != MODE_PANNING)
2045 Point pt((int)point.x, (int)point.y);
2046 _UiTouchEvent releasedEvent(__pPanningControl->GetHandle(), _TouchInfo(0, _TOUCH_RELEASED, pt, false, 0));
2047 releasedEvent.SetAccessibilityEvent(true);
2048 _UiEventManager::GetInstance()->SendEvent(releasedEvent);
2049 __pPanningControl = null;
2050 SetGestureMode(MODE_TAP);
2054 SetGestureMode(MODE_TAP);
2060 Tizen::Base::_HandleT<_AccessibilityContainer>
2061 _AccessibilityManager::Register(_AccessibilityContainer* pObject)
2063 if (pObject == null)
2065 return Tizen::Base::_HandleT<_AccessibilityContainer>();
2068 return __objectManager.Register(*pObject);
2071 _AccessibilityManager::Unregister(Tizen::Base::_HandleT <_AccessibilityContainer> handle)
2073 __objectManager.Unregister(handle);
2078 _AccessibilityManager::OnChangedLocale(void)
2080 if (__pTtsPlayer && __pSettingLoader)
2082 __pTtsPlayer->SetLocale(__pSettingLoader->GetLocale());
2087 _AccessibilityManager::OnAccessibilityScreenReaderIsActivated(bool set)
2089 if (__screenReaderIsEnabled == set)
2095 __screenReaderIsEnabled = set;
2096 if (__screenReaderIsEnabled)
2100 __pTtsPlayer->SetLocale(__pSettingLoader->GetLocale());
2101 __pTtsPlayer->Activate();
2106 __pTtsPlayer->Deactivate();
2111 _AccessibilityManager::IsAccessibilityActivated(void)
2113 return __pSettingLoader->IsAccessibilityActivated();
2116 _AccessibilityManager::IsScreenReaderActivated(void)
2118 __screenReaderIsEnabled = __pSettingLoader->IsScreenReaderActivated();
2119 return __screenReaderIsEnabled;
2122 _AccessibilityManager::GetLargeFontSize(void)
2124 return __pSettingLoader->GetLargeFontSize();
2128 _AccessibilityManager::IsActivated()
2130 return __screenReaderIsEnabled;
2134 _AccessibilityManager::IsContainerValid(_AccessibilityContainer* pContainer)
2136 if (pContainer == null)
2140 if (!(pContainer->IsActivated()))
2144 if (!(pContainer->GetHandle().IsValid()))
2148 if (!(pContainer->GetOwner().GetHandle().IsValid()))
2152 if (!(pContainer->GetOwner().IsVisible()))
2156 if (!IsVisible(pContainer))
2163 _AccessibilityManager::IsTargetContainerValid(void)
2166 if (__pTargetContainer && __targetControlHandle.IsValid() && __pTargetContainer->GetOwner().IsVisible() && __pTargetContainer->GetOwner().GetRootWindow() && IsVisible(__pTargetContainer))
2173 _AccessibilityManager::IsVisible(_AccessibilityElement* pElement)
2175 return IsVisible(pElement->GetParent());
2178 _AccessibilityManager::IsVisible(_AccessibilityContainer* pContainer)
2180 _ControlManager* pControlManager = _ControlManager::GetInstance();
2181 int count = pControlManager->GetWindowCount();
2186 _Window* pTopWindow = pControlManager->GetWindow(count - 1);
2187 if (pTopWindow != pContainer->GetOwner().GetRootWindow())
2194 _AccessibilityManager::SetGestureMode(GestureMode mode)
2198 _AccessibilityManager::GestureMode
2199 _AccessibilityManager::GetGestureMode(void)