2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0/
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>
18 #include <FBaseInteger.h>
20 #include <FAppUiApp.h>
21 #include <FAppIAppFrame.h>
22 #include <FBaseRtTimer.h>
23 #include <FLclLocale.h>
24 #include <FUiAnimVisualElement.h>
25 #include <FUiCtrlFrame.h>
26 #include <FUiCtrlForm.h>
27 #include <FGrpCanvas.h>
28 #include <FGrpColor.h>
29 #include <FGrpFloatDimension.h>
30 #include <FGrpEnrichedText.h>
31 #include <FGrpBitmap.h>
32 #include <FBase_StringConverter.h>
33 #include <FGrp_BitmapImpl.h>
34 #include <FSys_SystemTimeImpl.h>
35 #include "FUi_AccessibilityGesture.h"
36 #include "FUi_AccessibilitySystemSettingLoader.h"
37 #include "FUi_AccessibilityTtsPlayer.h"
38 #include "FUi_AccessibilityManager.h"
39 #include "FUi_AccessibilityElement.h"
40 #include "FUi_AccessibilityContainer.h"
41 #include "FUi_IAccessibilityListener.h"
42 #include "FUi_ControlManager.h"
43 #include "FUi_TouchManager.h"
44 #include "FUi_UiEventManager.h"
45 #include "FUiAnim_VisualElementImpl.h"
46 #include "FUiCtrl_FrameImpl.h"
47 #include "FUiCtrl_ScrollPanel.h"
48 #include "FUiCtrl_IconListView.h"
49 #include "FUi_ResourceManager.h"
51 using namespace Tizen::App;
52 using namespace Tizen::Base;
53 using namespace Tizen::Base::Collection;
54 using namespace Tizen::Base::Runtime;
55 using namespace Tizen::Graphics;
56 using namespace Tizen::Ui::Animations;
57 using namespace Tizen::Ui::Controls;
58 using namespace Tizen::System;
62 : public ITimerEventListener
68 timer.Construct(*this);
70 virtual ~GuidePopupTimer(void) {}
71 void SetElement(VisualElement* pElement)
73 if (__pElement != null)
77 __pElement = pElement;
85 virtual void OnTimerExpired(Timer& timer)
89 __pElement->SetShowState(false);
93 VisualElement* __pElement;
97 class AutoReadingTimer
98 : public ITimerEventListener
101 AutoReadingTimer(Tizen::Ui::_AccessibilityManager* pManager)
102 : __pAccessibilityManager(pManager)
103 , __mode(Tizen::Ui::_ACCESSIBILITY_AUTO_READING_MODE_FIRST_ITEM)
107 timer.Construct(*this);
109 virtual ~AutoReadingTimer(void) {}
110 void Start(Tizen::Ui::_AccessibilityAutoReadingMode mode)
112 if((Tizen::App::_AppInfo::GetAppType() & _APP_TYPE_SERVICE_APP) || (Tizen::App::_AppInfo::GetAppType() & _APP_TYPE_IME_APP))
129 virtual void OnTimerExpired(Timer& timer)
131 if (!(__pAccessibilityManager->IsScreenReaderActivated()) || UiApp::GetInstance()->GetAppUiState() == APP_UI_STATE_BACKGROUND)
135 SysLog(NID_UI, "mode %d", __mode);
136 if (__pAccessibilityManager->GetTtsStatus() != Tizen::Ui::ACCESSIBILITY_SCREEN_READER_STATUS_READY
137 && __pAccessibilityManager->GetTtsStatus() != Tizen::Ui::ACCESSIBILITY_SCREEN_READER_STATUS_PLAYING)
141 SysLog(NID_UI, "AccessibilityManager::AutoReadingTimer is started again because tts is not initialized.");
145 __pAccessibilityManager->ReadElement(__mode);
147 Tizen::Ui::_AccessibilityManager* __pAccessibilityManager;
149 Tizen::Ui::_AccessibilityAutoReadingMode __mode;
153 GuidePopupTimer* pGuidePopupTimer;
154 AutoReadingTimer* pAutoReadingTimer;
156 namespace Tizen { namespace Ui {
159 class _AccessibilityItemComparer
160 : public Tizen::Base::Collection::IComparerT <T>
163 _AccessibilityItemComparer(void)
166 virtual ~_AccessibilityItemComparer(void)
169 virtual result Compare(const T& obj1, const T& obj2, int& cmp) const
171 Tizen::Graphics::Rectangle rect1= obj1->GetAbsoluteBounds();
172 Tizen::Graphics::Rectangle rect2= obj2->GetAbsoluteBounds();
174 if (rect1.y > rect2.y)
179 else if (rect1.y < rect2.y)
186 if (rect1.x > rect2.x)
191 else if (rect1.x < rect2.x)
203 }; //class _AccessibilityComparer
206 class _ElementComparer
207 : public Tizen::Base::Collection::IComparerT <T>
210 _ElementComparer(void)
213 virtual ~_ElementComparer(void)
216 virtual result Compare(const T& obj1, const T& obj2, int& cmp) const
218 if (obj1->GetParent()->GetPriority() > obj2->GetParent()->GetPriority())
223 else if (obj1->GetParent()->GetPriority() < obj2->GetParent()->GetPriority())
230 Tizen::Graphics::FloatRectangle rect1= obj1->GetAbsoluteBounds();
231 Tizen::Graphics::FloatRectangle rect2= obj2->GetAbsoluteBounds();
233 if (rect1.y > rect2.y)
238 else if (rect1.y < rect2.y)
245 if (rect1.x > rect2.x)
250 else if (rect1.x < rect2.x)
265 static _AccessibilityManager* pAccManager = null;
266 bool _AccessibilityManager::__screenReaderIsEnabled = false;
267 _AccessibilityManager::_AccessibilityManager(void)
268 : __pAccGesture(null)
270 , __pSettingLoader(null)
271 , __pTargetContainer(null)
272 , __pTargetElement(null)
273 , __pTitleElement(null)
279 , __pPanningControl(null)
280 , __needRefreshItem(false)
284 _AccessibilityManager::~_AccessibilityManager(void)
286 delete __pAccGesture;
287 __pAccGesture = null;
290 delete __pSettingLoader;
291 __pSettingLoader = null;
292 delete pGuidePopupTimer;
293 pGuidePopupTimer = null;
294 delete pAutoReadingTimer;
295 pAutoReadingTimer = null;
298 _AccessibilityManager*
299 _AccessibilityManager::GetInstance(void)
305 _AccessibilityManager::CreateInstance(void)
307 static pthread_once_t onceBlock = PTHREAD_ONCE_INIT;
309 if (pAccManager == null)
311 pthread_once(&onceBlock, InitializeInstance);
316 _AccessibilityManager::InitializeInstance(void)
318 pAccManager = new (std::nothrow) _AccessibilityManager;
321 _AccessibilityManager::ReleaseInstance(void)
327 _AccessibilityManager::Initialize(void)
329 __pAccGesture = new (std::nothrow) _AccessibilityGesture(*this);
330 SysTryReturn(NID_UI, __pAccGesture, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
331 __pTtsPlayer = new (std::nothrow) _AccessibilityTtsPlayer(*this);
332 SysTryCatch(NID_UI, __pTtsPlayer, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
333 __pTtsPlayer->Construct();
334 __pSettingLoader = new (std::nothrow) _AccessibilitySystemSettingLoader(*this);
335 SysTryCatch(NID_UI, __pSettingLoader, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
337 if (IsScreenReaderActivated())
339 __pTtsPlayer->SetLocale(__pSettingLoader->GetLocale());
340 __pTtsPlayer->Activate();
342 pGuidePopupTimer = new (std::nothrow) GuidePopupTimer;
343 SysTryCatch(NID_UI, pGuidePopupTimer, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
344 pAutoReadingTimer = new (std::nothrow) AutoReadingTimer(this);
345 SysTryCatch(NID_UI, pAutoReadingTimer, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
349 delete __pAccGesture;
350 __pAccGesture = null;
353 delete __pSettingLoader;
354 __pSettingLoader = null;
355 delete pGuidePopupTimer;
356 pGuidePopupTimer = null;
357 delete pAutoReadingTimer;
358 pAutoReadingTimer = null;
360 AccessibilityScreenReaderStatus
361 _AccessibilityManager::GetTtsStatus(void)
365 return __pTtsPlayer->GetStatus();
367 return ACCESSIBILITY_SCREEN_READER_STATUS_ERROR;
370 _AccessibilityManager::ReadContent(const Tizen::Base::String& content)
374 //ShowPopup(content);
375 __pTtsPlayer->ReadGrammar(content);
380 _AccessibilityManager::ReadElement(_AccessibilityAutoReadingMode mode)
383 int count = __candidateList.GetCount();
388 _AccessibilityElement* pElement = null;
391 if (mode == _ACCESSIBILITY_AUTO_READING_MODE_FIRST_ITEM)
393 r = __candidateList.GetAt(0, pElement);
395 else if (mode == _ACCESSIBILITY_AUTO_READING_MODE_FIRST_ITEM_OF_CONTENTS)
397 for (int i = 0 ; i < count ; i++)
399 r = __candidateList.GetAt(i, pElement);
400 if (r == E_SUCCESS && pElement)
402 if (pElement->GetParent()->GetPriority() < ACCESSIBILITY_PRIORITY_TOP)
409 else //_ACCESSIBILITY_AUTO_READING_MODE_CURRENT_FOCUS
411 if (IsContainerValid(__pTargetContainer))
413 pElement = __pTargetElement;
417 if (r != E_SUCCESS || pElement == null)
419 SysLog(NID_UI, "cause 1");
422 if (mode == _ACCESSIBILITY_AUTO_READING_MODE_FIRST_ITEM && __pTitleElement == pElement && !(__pTitleElement->IsUpdated()))
424 SysLog(NID_UI, "cause 2");
427 __pTitleElement = pElement;
428 DrawFocusUi(*pElement);
429 __pTargetContainer = pElement->GetParent();
430 __pTargetElement = pElement;
431 __targetControlHandle = __pTargetContainer->GetOwner().GetHandle();
432 ReadElement(*pElement);
436 _AccessibilityManager::ReadElement(const _AccessibilityElement& element)
440 LinkedListT<_IAccessibilityListener*>* pList = static_cast<LinkedListT<_IAccessibilityListener*>*>(__pTargetContainer->GetListenerListN());
443 for (int i = 0;i<pList->GetCount();i++)
445 _IAccessibilityListener* pListener = null;
446 if (pList->GetAt(i, pListener) == E_SUCCESS)
448 pListener->OnAccessibilityReadingElement(*__pTargetContainer, element);
455 __pTtsPlayer->ReadGrammar(element.GetReadingContents());
460 _AccessibilityManager::ReadingStop(void)
465 _AccessibilityManager::ReadingPause(void)
470 _AccessibilityManager::ReadingResume(void)
476 _AccessibilityManager::OnStartReading(const Tizen::Base::String& grammar)
480 _AccessibilityManager::HidePopup(void)
482 if (__readingPopupParentHandle.IsValid())
486 __pReadingVe->Destroy();
494 pGuidePopupTimer->Stop();
497 _AccessibilityManager::ShowPopup(const String& content)
499 if (content.IsEmpty())
505 if (String("i686_emulated") != sysInfo.machine)
509 Canvas* pCanvas = null;
510 Bitmap* pBgBitmap = null;
511 EnrichedText* pEnrichedTitleText = null;
512 EnrichedText* pText = null;
513 Frame* pFrame = null;
515 if (__readingPopupParentHandle.IsValid())
519 __pReadingVe->Destroy();
528 pFrame = UiApp::GetInstance()->GetAppFrame()->GetFrame();
532 int accesibilityVisualElementLevel = 3000;
533 result r = E_SUCCESS;
534 _Window* pWindow = _ControlManager::GetInstance()->GetTopVisibleWindow();
535 VisualElement* pRootVe = pWindow->GetVisualElement();
537 __pReadingVe = new (std::nothrow) VisualElement();
538 SysTryCatch(NID_UI, __pReadingVe, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
540 r = __pReadingVe->Construct();
541 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] System error");
542 __pReadingVe->SetName("Accessibility reading popup");
543 __pReadingVe->SetImplicitAnimationEnabled(false);
544 _VisualElementImpl::GetInstance(*__pReadingVe)->SetZOrderGroup(accesibilityVisualElementLevel);
545 pRootVe->AttachChild(*__pReadingVe);
546 __readingPopupParentHandle = pWindow->GetHandle();
551 result r = E_SUCCESS;
553 float titleFontSize = 0;
554 float textFontSize = 0;
555 float popupWidth = 0;
557 float bottomMargin = 0;
558 float sideMargin = 0;
559 float titleHeight = 0;
560 float textTopMargin = 0;
561 float textHeight = 0;
563 Color titleTextColor;
564 Color pointTextColor;
566 TextElement* pElement = null;
568 r = GET_SHAPE_CONFIG(ACCESSIBILITY::TITLE_FONT_SIZE, _CONTROL_ORIENTATION_PORTRAIT, titleFontSize);
569 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
570 r = GET_SHAPE_CONFIG(ACCESSIBILITY::TEXT_FONT_SIZE, _CONTROL_ORIENTATION_PORTRAIT, textFontSize);
571 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
572 r = GET_SHAPE_CONFIG(ACCESSIBILITY::POPUP_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, popupWidth);
573 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
574 r = GET_SHAPE_CONFIG(ACCESSIBILITY::TOP_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, topMargin);
575 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
576 r = GET_SHAPE_CONFIG(ACCESSIBILITY::BOTTON_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, bottomMargin);
577 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
578 r = GET_SHAPE_CONFIG(ACCESSIBILITY::SIDE_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, sideMargin);
579 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
580 r = GET_SHAPE_CONFIG(ACCESSIBILITY::TITLE_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, titleHeight);
581 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
582 r = GET_SHAPE_CONFIG(ACCESSIBILITY::TEXT_TOP_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, textTopMargin);
583 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
584 r = GET_SHAPE_CONFIG(ACCESSIBILITY::TEXT_HEGIHT, _CONTROL_ORIENTATION_PORTRAIT, textHeight);
585 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
586 r = GET_COLOR_CONFIG(ACCESSIBILITY::TITLE_TEXT, titleTextColor);
587 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
588 r = GET_COLOR_CONFIG(ACCESSIBILITY::POINT_TEXT, pointTextColor);
589 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
590 r = GET_COLOR_CONFIG(ACCESSIBILITY::TEXT, textColor);
591 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
592 r = GET_BITMAP_CONFIG_N(ACCESSIBILITY::POPUP_BG, BITMAP_PIXEL_FORMAT_ARGB8888, pBgBitmap);
593 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
596 r = titleFont.Construct(FONT_STYLE_PLAIN, titleFontSize);
597 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
599 r = textFont.Construct(FONT_STYLE_PLAIN, textFontSize);
600 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
602 pEnrichedTitleText = new (std::nothrow) EnrichedText;
603 SysTryCatch(NID_UI, pEnrichedTitleText != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
604 pEnrichedTitleText->Construct(FloatDimension(popupWidth-sideMargin*2, titleHeight));
606 pText = new (std::nothrow) EnrichedText;
607 SysTryCatch(NID_UI, pText != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
608 pText->Construct(FloatDimension(popupWidth-sideMargin*2, textHeight));
610 pElement = new (std::nothrow) TextElement;
611 SysTryCatch(NID_UI, pElement != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
612 r = pElement->Construct(L"Screen reading...");
618 pElement->SetTextColor(titleTextColor);
619 pElement->SetFont(titleFont);
620 r = pEnrichedTitleText->Add(*pElement);
621 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
622 pEnrichedTitleText->SetHorizontalAlignment(TEXT_ALIGNMENT_LEFT);
623 pEnrichedTitleText->SetVerticalAlignment(TEXT_ALIGNMENT_TOP);
624 pEnrichedTitleText->SetTextWrapStyle(TEXT_WRAP_CHARACTER_WRAP);
625 pEnrichedTitleText->SetTextAbbreviationEnabled(true);
627 pElement = new (std::nothrow) TextElement;
628 SysTryCatch(NID_UI, pElement != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
629 r = pElement->Construct(content);
635 pElement->SetTextColor(textColor);
636 pElement->SetFont(textFont);
637 r = pText->Add(*pElement);
638 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
639 pText->SetHorizontalAlignment(TEXT_ALIGNMENT_LEFT);
640 pText->SetVerticalAlignment(TEXT_ALIGNMENT_TOP);
641 pText->SetTextWrapStyle(TEXT_WRAP_CHARACTER_WRAP);
642 pText->SetTextAbbreviationEnabled(true);
646 float popupHeight = topMargin + bottomMargin + titleHeight + textTopMargin + textHeight;
648 FloatDimension screen = Tizen::Ui::_ControlManager::GetInstance()->GetScreenSizeF();
649 __pReadingVe->SetBounds(FloatRectangle(x, y, popupWidth, popupHeight));
650 pCanvas = __pReadingVe->GetCanvasN();
651 SysTryCatch(NID_UI, pCanvas != null, , E_SYSTEM, "System error for accessibility popup");
652 pCanvas->DrawNinePatchedBitmap(FloatRectangle(0, 0, popupWidth, popupHeight), *pBgBitmap);
653 float drawingTextY = topMargin;
654 pCanvas->DrawText(FloatPoint(sideMargin, drawingTextY), *pEnrichedTitleText);
655 drawingTextY += textTopMargin + titleHeight;
656 pCanvas->DrawText(FloatPoint(sideMargin, drawingTextY), *pText);
657 __pReadingVe->SetShowState(true);
658 __pReadingVe->SetFlushNeeded();
659 pGuidePopupTimer->SetElement(__pReadingVe);
667 if (pEnrichedTitleText)
669 pEnrichedTitleText->RemoveAll(true);
670 delete pEnrichedTitleText;
674 pText->RemoveAll(true);
682 _AccessibilityManager::ShowPopup()
684 if (__pTargetElement == null)
690 Frame* pFrame = null;
691 Canvas* pCanvas = null;
692 Bitmap* pBgBitmap = null;
693 EnrichedText* pEnrichedTitleText = null;
694 EnrichedText* pEnrichedNameText = null;
695 EnrichedText* pEnrichedLableText = null;
696 EnrichedText* pEnrichedTraitText = null;
697 EnrichedText* pEnrichedStatusText = null;
698 EnrichedText* pEnrichedHintText = null;
699 EnrichedText* pEnrichedValueText = null;
700 EnrichedText* pEnrichedBoundsText = null;
701 EnrichedText* pEnrichedAbsBoundsText = null;
702 TextElement* pElement = null;
703 FloatDimension screen;
705 if (String("i686_emulated") != sysInfo.machine)
710 if (__readingPopupParentHandle.IsValid())
714 __pReadingVe->Destroy();
723 pFrame = UiApp::GetInstance()->GetAppFrame()->GetFrame();
727 int accesibilityVisualElementLevel = 3000;
728 result r = E_SUCCESS;
729 _Window* pWindow = _ControlManager::GetInstance()->GetTopVisibleWindow();
730 VisualElement* pRootVe = pWindow->GetVisualElement();
731 __readingPopupParentHandle = pWindow->GetHandle();
732 __pReadingVe = new (std::nothrow) VisualElement();
733 SysTryCatch(NID_UI, __pReadingVe, , E_SYSTEM, "[E_SYSTEM] System error");
735 r = __pReadingVe->Construct();
736 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] System error");
737 __pReadingVe->SetName("Accessibility reading popup");
738 __pReadingVe->SetImplicitAnimationEnabled(false);
739 _VisualElementImpl::GetInstance(*__pReadingVe)->SetZOrderGroup(accesibilityVisualElementLevel);
740 pRootVe->AttachChild(*__pReadingVe);
743 screen = _ControlManager::GetInstance()->GetScreenSizeF();
746 result r = E_SUCCESS;
748 float titleFontSize = 0;
749 float textFontSize = 0;
750 float popupWidth = 0;
752 float bottomMargin = 0;
753 float sideMargin = 0;
754 float titleHeight = 0;
755 float textTopMargin = 0;
756 float textHeight = 0;
758 Color titleTextColor;
759 Color pointTextColor;
762 r = GET_SHAPE_CONFIG(ACCESSIBILITY::TITLE_FONT_SIZE, _CONTROL_ORIENTATION_PORTRAIT, titleFontSize);
763 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
764 r = GET_SHAPE_CONFIG(ACCESSIBILITY::TEXT_FONT_SIZE, _CONTROL_ORIENTATION_PORTRAIT, textFontSize);
765 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
766 r = GET_SHAPE_CONFIG(ACCESSIBILITY::POPUP_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, popupWidth);
767 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
768 r = GET_SHAPE_CONFIG(ACCESSIBILITY::TOP_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, topMargin);
769 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
770 r = GET_SHAPE_CONFIG(ACCESSIBILITY::BOTTON_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, bottomMargin);
771 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
772 r = GET_SHAPE_CONFIG(ACCESSIBILITY::SIDE_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, sideMargin);
773 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
774 r = GET_SHAPE_CONFIG(ACCESSIBILITY::TITLE_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, titleHeight);
775 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
776 r = GET_SHAPE_CONFIG(ACCESSIBILITY::TEXT_TOP_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, textTopMargin);
777 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
778 r = GET_SHAPE_CONFIG(ACCESSIBILITY::TEXT_HEGIHT, _CONTROL_ORIENTATION_PORTRAIT, textHeight);
779 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
780 r = GET_COLOR_CONFIG(ACCESSIBILITY::TITLE_TEXT, titleTextColor);
781 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
782 r = GET_COLOR_CONFIG(ACCESSIBILITY::POINT_TEXT, pointTextColor);
783 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
784 r = GET_COLOR_CONFIG(ACCESSIBILITY::TEXT, textColor);
785 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
786 r = GET_BITMAP_CONFIG_N(ACCESSIBILITY::POPUP_BG, BITMAP_PIXEL_FORMAT_ARGB8888, pBgBitmap);
787 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
790 r = titleFont.Construct(FONT_STYLE_PLAIN, titleFontSize);
791 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
794 r = textFont.Construct(FONT_STYLE_PLAIN, textFontSize);
795 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
797 pEnrichedTitleText = new (std::nothrow) EnrichedText;
798 SysTryCatch(NID_UI, pEnrichedTitleText != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
799 pEnrichedTitleText->Construct(FloatDimension(popupWidth-sideMargin*2, titleHeight));
801 pEnrichedNameText = new (std::nothrow) EnrichedText;
802 SysTryCatch(NID_UI, pEnrichedNameText != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
803 pEnrichedNameText->Construct(FloatDimension(popupWidth-sideMargin*2, textHeight));
805 pEnrichedLableText = new (std::nothrow) EnrichedText;
806 SysTryCatch(NID_UI, pEnrichedLableText != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
807 pEnrichedLableText->Construct(FloatDimension(popupWidth-sideMargin*2, textHeight));
809 pEnrichedTraitText = new (std::nothrow) EnrichedText;
810 SysTryCatch(NID_UI, pEnrichedTraitText != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed.");
811 pEnrichedTraitText->Construct(FloatDimension(popupWidth-sideMargin*2, textHeight));
813 pEnrichedStatusText = new (std::nothrow) EnrichedText;
814 SysTryCatch(NID_UI, pEnrichedStatusText != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed.");
815 pEnrichedStatusText->Construct(FloatDimension(popupWidth-sideMargin*2, textHeight));
817 pEnrichedHintText = new (std::nothrow) EnrichedText;
818 SysTryCatch(NID_UI, pEnrichedHintText != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed.");
819 pEnrichedHintText->Construct(FloatDimension(popupWidth-sideMargin*2, textHeight));
821 pEnrichedValueText = new (std::nothrow) EnrichedText;
822 SysTryCatch(NID_UI, pEnrichedValueText != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed.");
823 pEnrichedValueText->Construct(FloatDimension(popupWidth-sideMargin*2, textHeight));
825 pEnrichedBoundsText = new (std::nothrow) EnrichedText;
826 SysTryCatch(NID_UI, pEnrichedBoundsText != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed.");
827 pEnrichedBoundsText->Construct(FloatDimension(popupWidth-sideMargin*2, textHeight));
829 pEnrichedAbsBoundsText = new (std::nothrow) EnrichedText;
830 SysTryCatch(NID_UI, pEnrichedAbsBoundsText != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed.");
831 pEnrichedAbsBoundsText->Construct(FloatDimension(popupWidth-sideMargin*2, textHeight));
833 pElement = new (std::nothrow) TextElement;
834 r = pElement->Construct(L"Screen reading...");
835 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
836 pElement->SetTextColor(titleTextColor);
837 pElement->SetFont(titleFont);
838 r = pEnrichedTitleText->Add(*pElement);
840 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
841 pEnrichedTitleText->SetHorizontalAlignment(TEXT_ALIGNMENT_LEFT);
842 pEnrichedTitleText->SetVerticalAlignment(TEXT_ALIGNMENT_TOP);
843 pEnrichedTitleText->SetTextWrapStyle(TEXT_WRAP_CHARACTER_WRAP);
844 pEnrichedTitleText->SetTextAbbreviationEnabled(true);
846 pElement = new (std::nothrow) TextElement;
847 r = pElement->Construct(L"Name: ");
848 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
850 pElement->SetTextColor(pointTextColor);
851 pElement->SetFont(textFont);
852 r = pEnrichedNameText->Add(*pElement);
853 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
855 if (!(__pTargetElement->GetName().IsEmpty()))
857 pElement = new (std::nothrow) TextElement;
858 r = pElement->Construct(__pTargetElement->GetName());
859 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
861 pElement->SetTextColor(textColor);
862 pElement->SetFont(textFont);
863 r = pEnrichedNameText->Add(*pElement);
864 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
865 SysLog(NID_UI, " Name :::::: %s", _StringConverter::CopyToCharArrayN(__pTargetElement->GetName()));
867 pEnrichedNameText->SetHorizontalAlignment(TEXT_ALIGNMENT_LEFT);
868 pEnrichedNameText->SetVerticalAlignment(TEXT_ALIGNMENT_TOP);
869 pEnrichedNameText->SetTextWrapStyle(TEXT_WRAP_CHARACTER_WRAP);
870 pEnrichedNameText->SetTextAbbreviationEnabled(true);
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(L"Label: ");
875 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
877 pElement->SetTextColor(pointTextColor);
878 pElement->SetFont(textFont);
879 r = pEnrichedLableText->Add(*pElement);
880 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
882 if (!(__pTargetElement->GetLabel().IsEmpty()))
884 pElement = new (std::nothrow) TextElement;
885 SysTryCatch(NID_UI, pElement != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
886 r = pElement->Construct(__pTargetElement->GetLabel());
887 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
889 pElement->SetTextColor(textColor);
890 pElement->SetFont(textFont);
891 r = pEnrichedLableText->Add(*pElement);
892 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
893 SysLog(NID_UI, " Label :::::: %s", _StringConverter::CopyToCharArrayN(__pTargetElement->GetLabel()));
895 pEnrichedLableText->SetHorizontalAlignment(TEXT_ALIGNMENT_LEFT);
896 pEnrichedLableText->SetVerticalAlignment(TEXT_ALIGNMENT_TOP);
897 pEnrichedLableText->SetTextWrapStyle(TEXT_WRAP_CHARACTER_WRAP);
898 pEnrichedLableText->SetTextAbbreviationEnabled(true);
900 pElement = new (std::nothrow) TextElement;
901 SysTryCatch(NID_UI, pElement != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
902 r = pElement->Construct(L"Trait: ");
903 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
905 pElement->SetTextColor(pointTextColor);
906 pElement->SetFont(textFont);
907 r = pEnrichedTraitText->Add(*pElement);
908 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
909 if (!(__pTargetElement->GetTraitString().IsEmpty()))
911 pElement = new (std::nothrow) TextElement;
912 SysTryCatch(NID_UI, pElement != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
913 r = pElement->Construct(__pTargetElement->GetTraitString());
914 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
916 pElement->SetTextColor(textColor);
917 pElement->SetFont(textFont);
918 r = pEnrichedTraitText->Add(*pElement);
919 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
921 pEnrichedTraitText->SetHorizontalAlignment(TEXT_ALIGNMENT_LEFT);
922 pEnrichedTraitText->SetVerticalAlignment(TEXT_ALIGNMENT_TOP);
923 pEnrichedTraitText->SetTextWrapStyle(TEXT_WRAP_CHARACTER_WRAP);
924 pEnrichedTraitText->SetTextAbbreviationEnabled(true);
926 pElement = new (std::nothrow) TextElement;
927 SysTryCatch(NID_UI, pElement != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
928 r = pElement->Construct(L"Status: ");
929 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
931 pElement->SetTextColor(pointTextColor);
932 pElement->SetFont(textFont);
933 r = pEnrichedStatusText->Add(*pElement);
934 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
935 if (!(__pTargetElement->GetStatus().IsEmpty()))
937 pElement = new (std::nothrow) TextElement;
938 SysTryCatch(NID_UI, pElement != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
939 r = pElement->Construct(__pTargetElement->GetStatus());
940 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
942 pElement->SetTextColor(textColor);
943 pElement->SetFont(textFont);
944 r = pEnrichedStatusText->Add(*pElement);
945 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
947 pEnrichedStatusText->SetHorizontalAlignment(TEXT_ALIGNMENT_LEFT);
948 pEnrichedStatusText->SetVerticalAlignment(TEXT_ALIGNMENT_TOP);
949 pEnrichedStatusText->SetTextWrapStyle(TEXT_WRAP_CHARACTER_WRAP);
950 pEnrichedStatusText->SetTextAbbreviationEnabled(true);
952 pElement = new (std::nothrow) TextElement;
953 SysTryCatch(NID_UI, pElement != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
954 r = pElement->Construct(L"Hint: ");
955 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
957 pElement->SetTextColor(pointTextColor);
958 pElement->SetFont(textFont);
959 r = pEnrichedHintText->Add(*pElement);
960 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
961 if (!(__pTargetElement->GetHint().IsEmpty()))
963 pElement = new (std::nothrow) TextElement;
964 SysTryCatch(NID_UI, pElement != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
965 r = pElement->Construct(__pTargetElement->GetHint());
966 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
968 pElement->SetTextColor(textColor);
969 pElement->SetFont(textFont);
970 r = pEnrichedHintText->Add(*pElement);
971 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
973 pEnrichedHintText->SetHorizontalAlignment(TEXT_ALIGNMENT_LEFT);
974 pEnrichedHintText->SetVerticalAlignment(TEXT_ALIGNMENT_TOP);
975 pEnrichedHintText->SetTextWrapStyle(TEXT_WRAP_CHARACTER_WRAP);
976 pEnrichedHintText->SetTextAbbreviationEnabled(true);
978 pElement = new (std::nothrow) TextElement;
979 SysTryCatch(NID_UI, pElement != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
980 r = pElement->Construct(L"Value: ");
981 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
983 pElement->SetTextColor(pointTextColor);
984 pElement->SetFont(textFont);
985 r = pEnrichedValueText->Add(*pElement);
986 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
987 if (!(__pTargetElement->GetValue().IsEmpty()))
989 pElement = new (std::nothrow) TextElement;
990 SysTryCatch(NID_UI, pElement != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
991 r = pElement->Construct(__pTargetElement->GetValue());
992 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
994 pElement->SetTextColor(textColor);
995 pElement->SetFont(textFont);
996 r = pEnrichedValueText->Add(*pElement);
997 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
999 pEnrichedValueText->SetHorizontalAlignment(TEXT_ALIGNMENT_LEFT);
1000 pEnrichedValueText->SetVerticalAlignment(TEXT_ALIGNMENT_TOP);
1001 pEnrichedValueText->SetTextWrapStyle(TEXT_WRAP_CHARACTER_WRAP);
1002 pEnrichedValueText->SetTextAbbreviationEnabled(true);
1004 pElement = new (std::nothrow) TextElement;
1005 SysTryCatch(NID_UI, pElement != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
1006 r = pElement->Construct(L"Bound: ");
1007 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
1009 pElement->SetTextColor(pointTextColor);
1010 pElement->SetFont(textFont);
1011 r = pEnrichedBoundsText->Add(*pElement);
1012 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
1014 pElement = new (std::nothrow) TextElement;
1015 SysTryCatch(NID_UI, pElement != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
1016 FloatRectangle rect = __pTargetElement->GetBounds();
1018 rectString.Format(40, L"x:%.1f, y:%.1f, w:%.1f, h:%.1f", rect.x, rect.y, rect.width, rect.height);
1019 r = pElement->Construct(rectString);
1020 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
1022 pElement->SetTextColor(textColor);
1023 pElement->SetFont(textFont);
1024 r = pEnrichedBoundsText->Add(*pElement);
1025 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
1026 pEnrichedBoundsText->SetHorizontalAlignment(TEXT_ALIGNMENT_LEFT);
1027 pEnrichedBoundsText->SetVerticalAlignment(TEXT_ALIGNMENT_TOP);
1028 pEnrichedBoundsText->SetTextWrapStyle(TEXT_WRAP_CHARACTER_WRAP);
1029 pEnrichedBoundsText->SetTextAbbreviationEnabled(true);
1031 pElement = new (std::nothrow) TextElement;
1032 SysTryCatch(NID_UI, pElement != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
1033 r = pElement->Construct(L"AbsBound: ");
1034 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
1036 pElement->SetTextColor(pointTextColor);
1037 pElement->SetFont(textFont);
1038 r = pEnrichedAbsBoundsText->Add(*pElement);
1039 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
1041 pElement = new (std::nothrow) TextElement;
1042 SysTryCatch(NID_UI, pElement != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
1043 rect = __pTargetElement->GetAbsoluteBounds();
1045 rectString.Format(40, L"x:%.1f, y:%.1f, w:%.1f, h:%.1f", rect.x, rect.y, rect.width, rect.height);
1046 r = pElement->Construct(rectString);
1047 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
1049 pElement->SetTextColor(textColor);
1050 pElement->SetFont(textFont);
1051 r = pEnrichedAbsBoundsText->Add(*pElement);
1052 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "System error for accessibility popup");
1053 pEnrichedAbsBoundsText->SetHorizontalAlignment(TEXT_ALIGNMENT_LEFT);
1054 pEnrichedAbsBoundsText->SetVerticalAlignment(TEXT_ALIGNMENT_TOP);
1055 pEnrichedAbsBoundsText->SetTextWrapStyle(TEXT_WRAP_CHARACTER_WRAP);
1056 pEnrichedAbsBoundsText->SetTextAbbreviationEnabled(true);
1060 float popupHeight = topMargin + bottomMargin + titleHeight + textTopMargin + textHeight * 8;
1061 Frame* pFrame = UiApp::GetInstance()->GetAppFrame()->GetFrame();
1062 Form* pForm = pFrame->GetCurrentForm();
1063 FloatDimension screen = Tizen::Ui::_ControlManager::GetInstance()->GetScreenSizeF();
1065 if (pForm->GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT
1066 || pForm->GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT_REVERSE)
1068 x = (screen.width-popupWidth) / 2;
1069 if (rect.y < screen.height/2)
1071 y = (screen.height/2 - popupHeight) /2 + screen.height/2;
1075 y = (screen.height/2 - popupHeight) /2;
1080 y = (screen.width-popupHeight) / 2;
1081 if (rect.x < screen.height/2)
1083 x = (screen.height/2 - popupWidth) /2 + screen.height/2;
1087 x = (screen.height/2 - popupWidth) /2;
1091 __pReadingVe->SetBounds(FloatRectangle(x, y, popupWidth, popupHeight));
1092 pCanvas = __pReadingVe->GetCanvasN();
1093 SysTryCatch(NID_UI, pCanvas != null, , E_SYSTEM, "System error for accessibility popup");
1094 pCanvas->DrawNinePatchedBitmap(FloatRectangle(0, 0, popupWidth, popupHeight), *pBgBitmap);
1095 float drawingTextY = topMargin;
1096 pCanvas->DrawText(FloatPoint(sideMargin, drawingTextY), *pEnrichedTitleText);
1097 drawingTextY += textTopMargin + titleHeight;
1098 pCanvas->DrawText(FloatPoint(sideMargin, drawingTextY), *pEnrichedNameText);
1099 drawingTextY += textHeight;
1100 pCanvas->DrawText(FloatPoint(sideMargin, drawingTextY), *pEnrichedLableText);
1101 drawingTextY += textHeight;
1102 pCanvas->DrawText(FloatPoint(sideMargin, drawingTextY), *pEnrichedTraitText);
1103 drawingTextY += textHeight;
1104 pCanvas->DrawText(FloatPoint(sideMargin, drawingTextY), *pEnrichedStatusText);
1105 drawingTextY += textHeight;
1106 pCanvas->DrawText(FloatPoint(sideMargin, drawingTextY), *pEnrichedHintText);
1107 drawingTextY += textHeight;
1108 pCanvas->DrawText(FloatPoint(sideMargin, drawingTextY), *pEnrichedValueText);
1109 drawingTextY += textHeight;
1110 pCanvas->DrawText(FloatPoint(sideMargin, drawingTextY), *pEnrichedBoundsText);
1111 drawingTextY += textHeight;
1112 pCanvas->DrawText(FloatPoint(sideMargin, drawingTextY), *pEnrichedAbsBoundsText);
1113 __pReadingVe->SetShowState(true);
1114 __pReadingVe->SetFlushNeeded();
1115 pGuidePopupTimer->SetElement(__pReadingVe);
1124 if (pEnrichedTitleText)
1126 pEnrichedTitleText->RemoveAll(true);
1127 delete pEnrichedTitleText;
1129 if (pEnrichedNameText)
1131 pEnrichedNameText->RemoveAll(true);
1132 delete pEnrichedNameText;
1134 if (pEnrichedLableText)
1136 pEnrichedLableText->RemoveAll(true);
1137 delete pEnrichedLableText;
1139 if (pEnrichedTraitText)
1141 pEnrichedTraitText->RemoveAll(true);
1142 delete pEnrichedTraitText;
1144 if (pEnrichedStatusText)
1146 pEnrichedStatusText->RemoveAll(true);
1147 delete pEnrichedStatusText;
1149 if (pEnrichedHintText)
1151 pEnrichedHintText->RemoveAll(true);
1152 delete pEnrichedHintText;
1154 if (pEnrichedValueText)
1156 pEnrichedValueText->RemoveAll(true);
1157 delete pEnrichedValueText;
1159 if (pEnrichedBoundsText)
1161 pEnrichedBoundsText->RemoveAll(true);
1162 delete pEnrichedBoundsText;
1164 if (pEnrichedAbsBoundsText)
1166 pEnrichedAbsBoundsText->RemoveAll(true);
1167 delete pEnrichedAbsBoundsText;
1174 _AccessibilityManager::OnFinishReading(const Tizen::Base::String& grammar)
1177 if (!IsContainerValid(__pTargetContainer))
1181 LinkedListT<_IAccessibilityListener*>* pList = static_cast<LinkedListT<_IAccessibilityListener*>*>(__pTargetContainer->GetListenerListN());
1184 for (int i = 0;i<pList->GetCount();i++)
1186 _IAccessibilityListener* pListener = null;
1187 if (pList->GetAt(i, pListener) == E_SUCCESS)
1189 if (__pTargetElement)
1191 pListener->OnAccessibilityReadElement(*__pTargetContainer, *__pTargetElement);
1202 _AccessibilityManager::GetCurrentGrammar(void)
1207 _AccessibilityManager::AddContainer(const _AccessibilityContainer& container)
1209 __containerList.Add(&const_cast<_AccessibilityContainer&>(container));
1210 if(__mode == MODE_FOCUS_MOVE)
1212 SetGestureMode(MODE_TAP);
1217 _AccessibilityManager::RemoveContainer(const _AccessibilityContainer& container)
1219 __containerList.Remove(&const_cast<_AccessibilityContainer&>(container));
1220 if(__mode == MODE_FOCUS_MOVE)
1222 SetGestureMode(MODE_TAP);
1224 if (__pTargetContainer == &container)
1226 __pTargetContainer = null;
1227 __pTargetElement = null;
1233 _AccessibilityManager::MakeList(void)
1237 DownVisitor(_Control& control, LinkedListT<_Control*>& list)
1239 LinkedListT<_Control*> _list;
1240 int count = control.GetChildCount();
1241 _Control* pControl = null;
1242 for (int i = 0; i < count ; i++)
1244 pControl = control.GetChild(i);
1247 _list.Add(pControl);
1250 _AccessibilityItemComparer<_Control*> comparer;
1251 _list.Sort(comparer);
1253 list.IndexOf(&control, index);
1254 list.InsertItemsFrom(_list,index+1);
1255 for (int i = 0; i < count ; i++)
1257 pControl = control.GetChild(i);
1258 DownVisitor(*pControl, list);
1262 if ( !__needRefreshItem && GetGestureMode() == MODE_FOCUS_MOVE)
1264 __needRefreshItem = false;
1267 __needRefreshItem = false;
1268 result r = E_SUCCESS;
1270 _Control* pControl = null;
1271 _AccessibilityContainer* pContainer = null;
1272 _TouchManager* pTouchManager = _TouchManager::GetInstance();
1273 LinkedListT<_Control*> controlList;
1274 LinkedListT<_AccessibilityElement*> elementPositionList;
1275 LinkedListT<_AccessibilityElement*> elementPositionByControlList;
1276 __candidateList.RemoveAll();
1280 pControl = pTouchManager->GetCapturedControl();
1283 controlList.Add(pControl);
1287 if (pControl == null)
1289 pControl = static_cast<_Control*>(_ControlManager::GetInstance()->GetWindow(_ControlManager::GetInstance()->GetWindowCount() - 1));
1290 controlList.Add(pControl);
1292 DownVisitor(*pControl, controlList);
1293 count = controlList.GetCount();
1294 Dimension screen = _ResourceManager::GetInstance()->GetLogicalScreenSizen();
1295 int margin = _ControlManager::GetInstance()->GetOrientation() == _CONTROL_ORIENTATION_PORTRAIT ? screen.width : screen.height;
1297 for(int i = 0 ; i < count ; i++)
1299 if (controlList.GetAt(i, pControl) == E_SUCCESS)
1301 FloatRectangle rect = pControl->GetAbsoluteBoundsF();
1302 if (rect.x + rect.width <= 0.0f || (rect.x) >= margin)
1304 bool inside = false;
1305 _Control* _pControl = pControl;
1308 if(dynamic_cast<_IScrollableContainer*>(_pControl))
1310 if (rect.x + rect.width > 0.0f && (rect.x) < margin)
1316 _pControl = _pControl->GetParent();
1320 _AccessibilityContainer* pContainer = pControl->GetAccessibilityContainer()->GetRootParent();
1321 if(pContainer != null)
1323 rect = pContainer->GetAbsoluteBounds();
1324 if (rect.x + rect.width > 0.0f && (rect.x) < margin)
1332 controlList.Remove(pControl);
1339 for (int i = 0; i < controlList.GetCount() ; i++)
1341 if (controlList.GetAt(i, pControl) == E_SUCCESS)
1343 pContainer = pControl->GetAccessibilityContainer();
1344 if (pContainer == null)
1348 if (IsContainerValid(pContainer))
1350 pContainer->SortElements();
1351 pContainer->GetElements(elementPositionList);
1352 pContainer->GetElements(elementPositionByControlList);
1357 _ElementComparer<_AccessibilityElement*> comparer;
1358 elementPositionList.Sort(comparer);
1359 count = elementPositionList.GetCount();
1361 _AccessibilityElement* pPositionListElement = null;
1362 _AccessibilityElement* pPositionByControlListElement = null;
1363 while (!done && index < count && index < count)
1366 r = elementPositionList.GetAt(index, pPositionListElement);
1373 r = elementPositionByControlList.GetAt(index, pPositionByControlListElement);
1380 if (pPositionListElement == pPositionByControlListElement)
1382 __candidateList.Add(pPositionByControlListElement);
1387 if (pPositionListElement->GetParent()->GetPriority() > pPositionByControlListElement->GetParent()->GetPriority())
1389 elementPositionByControlList.Remove(pPositionListElement);
1390 elementPositionByControlList.InsertAt(pPositionListElement, index);
1391 __candidateList.Add(pPositionListElement);
1395 else if (pPositionListElement->GetParent()->GetPriority() < pPositionByControlListElement->GetParent()->GetPriority())
1397 elementPositionList.Remove(pPositionByControlListElement);
1398 elementPositionList.InsertAt(pPositionByControlListElement, index);
1399 __candidateList.Add(pPositionByControlListElement);
1404 if (pPositionListElement->GetAbsoluteBounds().y > pPositionByControlListElement->GetAbsoluteBounds().y)
1406 elementPositionList.Remove(pPositionByControlListElement);
1407 elementPositionList.InsertAt(pPositionByControlListElement, index);
1408 __candidateList.Add(pPositionByControlListElement);
1412 else if (pPositionListElement->GetAbsoluteBounds().y < pPositionByControlListElement->GetAbsoluteBounds().y)
1414 pControl = &(pPositionByControlListElement->GetParent()->GetOwner());
1417 rect = pControl->GetAbsoluteBounds();
1424 if(pControl->GetParent())
1426 pControl = pControl->GetParent();
1436 controlList.RemoveAll();
1437 controlList.Add(pControl);
1438 DownVisitor(*pControl, controlList);
1439 int _count = controlList.GetCount();
1440 LinkedListT<_AccessibilityElement*> _elementPositionList;
1441 for (int i = 0; i < _count ; i++)
1443 if (controlList.GetAt(i, pControl) == E_SUCCESS)
1445 pContainer = pControl->GetAccessibilityContainer();
1446 if (pContainer == null)
1450 if (IsContainerValid(pContainer))
1452 pContainer->GetElements(_elementPositionList);
1456 _elementPositionList.Sort(comparer);
1457 _count = _elementPositionList.GetCount();
1458 _AccessibilityElement* pElement = null;
1459 for (int i = 0 ; i < _count ; i++)
1461 r = _elementPositionList.GetAt(i, pElement);
1466 if (__candidateList.Contains(pElement))
1470 __candidateList.Add(pElement);
1471 elementPositionByControlList.Remove(pElement);
1472 elementPositionByControlList.InsertAt(pElement, index);
1473 elementPositionList.Remove(pElement);
1474 elementPositionList.InsertAt(pElement, index);
1481 elementPositionList.Remove(pPositionByControlListElement);
1482 elementPositionList.InsertAt(pPositionByControlListElement, index);
1483 __candidateList.Add(pPositionByControlListElement);
1489 count = __candidateList.GetCount();
1490 SysLog(NID_UI, "Accessibility element candidate count : %d", count);
1496 _AccessibilityElement* pElement = null;
1497 _AccessibilityElement* pElement2 = null;
1498 int selectedHeader = -1;
1499 int startHeader = -1;
1501 int selectedFooter = -1;
1502 int startFooter = -1;
1504 for (int i = 0 ; i < count ; i++)
1506 r = __candidateList.GetAt(i, pElement);
1507 if(pElement->GetParent()->GetPriority() == ACCESSIBILITY_PRIORITY_TOP)
1509 if (startHeader == -1)
1515 if(pElement->GetParent()->GetPriority() == ACCESSIBILITY_PRIORITY_BOTTOM)
1517 if (startFooter == -1)
1524 if(startHeader != -1 && endHeader - startHeader > 1)
1526 for(int i = startHeader; i <= endHeader ; i++)
1528 r = __candidateList.GetAt(i, pElement);
1534 for(int j = i +1 ; j <= endHeader; j++)
1536 r = __candidateList.GetAt(j, pElement2);
1541 if(pElement->GetAbsoluteBounds().x > pElement2->GetAbsoluteBounds().x)
1543 pElement = pElement2;
1547 if(selectedHeader != i)
1549 __candidateList.Remove(pElement);
1550 __candidateList.InsertAt(pElement, i);
1554 if(startFooter != -1 && endFooter - startFooter > 1)
1556 for(int i = startFooter; i <= endFooter ; i++)
1558 r = __candidateList.GetAt(i, pElement);
1564 for(int j = i +1 ; j <= endFooter; j++)
1566 r = __candidateList.GetAt(j, pElement2);
1571 if(pElement->GetAbsoluteBounds().x > pElement2->GetAbsoluteBounds().x)
1573 pElement = pElement2;
1577 if(selectedFooter != i)
1579 __candidateList.Remove(pElement);
1580 __candidateList.InsertAt(pElement, i);
1588 _AccessibilityManager::MakeList(_AccessibilityContainer* pContainer)
1590 if (pContainer->GetOwner().IsVisible() && pContainer->IsActivated())
1592 pContainer->GetElements(__candidateList);
1594 _Control* pControl = &(pContainer->GetOwner());
1595 int count = pControl->GetChildCount();
1596 for (int i = 0 ; i<count;i++)
1598 _Control* pChildControl = pControl->GetChild(i);
1601 MakeList(pChildControl->GetAccessibilityContainer());
1607 _AccessibilityManager::MoveFocus(_AccessibilityFocusDirection direction)
1609 if (direction == _ACCESSIBILITY_FOCUS_DIRECTION_PREVIOUS
1610 || direction == _ACCESSIBILITY_FOCUS_DIRECTION_NEXT)
1619 int count = __candidateList.GetCount();
1624 SysLog(NID_UI, "count ", count);
1625 result r = E_SUCCESS;
1627 _AccessibilityElement* pElement = null;
1628 _AccessibilityContainer* pContainer = null;
1629 bool focusManaged = false;
1630 if (IsContainerValid(__pTargetContainer))
1632 r = __candidateList.IndexOf(__pTargetElement, 0, index);
1636 __pTargetElement = null;
1637 __pTargetContainer = null;
1641 if ((__pTargetContainer->MoveFocus(direction)))
1643 pElement = __pTargetContainer->GetCurrentFocusedElement();
1644 focusManaged = true;
1653 if (index > count - 1)
1657 __candidateList.GetAt(index, pElement);
1658 if (pElement->GetParent()->IsFocusManaged())
1660 if ((pElement->GetParent()->MoveFocus(direction)))
1662 focusManaged = true;
1670 SysTryReturn(NID_UI, __candidateList.GetAt(0, pElement) == E_SUCCESS, false, E_SUCCESS, "[E_SUCCESS] Candidates are not exist.");
1674 pContainer = pElement->GetParent();
1675 IListT<_IAccessibilityListener*>* pListenerList = pContainer->GetListenerListN();
1678 int listenerCount = pListenerList->GetCount();
1679 if (listenerCount > 0)
1681 for (int i = 0;i<listenerCount;i++)
1683 _IAccessibilityListener* pListener = null;
1684 if (pListenerList->GetAt(i, pListener) == E_SUCCESS)
1686 if (pListener->OnAccessibilityItemRefreshed(*pContainer, *pElement, direction) == true)
1688 return MoveFocus(direction);
1693 delete pListenerList;
1694 pListenerList = null;
1697 if (__pTargetContainer)
1699 pListenerList = __pTargetContainer->GetListenerListN();
1702 int listenerCount = pListenerList->GetCount();
1703 if (listenerCount > 0)
1705 for (int i = 0;i<listenerCount;i++)
1707 _IAccessibilityListener* pListener = null;
1708 if (pListenerList->GetAt(i, pListener) == E_SUCCESS)
1710 pListener->OnAccessibilityFocusOut(*__pTargetContainer, *__pTargetElement);
1714 delete pListenerList;
1715 pListenerList = null;
1718 if(__pTargetContainer)
1720 __pTargetContainer->SetCurrentFocusedElement(null);
1724 __pTargetElement = pElement;
1725 __pTargetContainer = pContainer;
1726 __targetControlHandle = pContainer->GetOwner().GetHandle();
1732 __pTargetElement = pElement;
1733 __pTargetContainer = pContainer;
1734 __targetControlHandle = pContainer->GetOwner().GetHandle();
1735 pListenerList = __pTargetContainer->GetListenerListN();
1738 int listenerCount = pListenerList->GetCount();
1739 if (listenerCount > 0)
1741 for (int i = 0;i<listenerCount;i++)
1743 _IAccessibilityListener* pListener = null;
1744 if (pListenerList->GetAt(i, pListener) == E_SUCCESS)
1746 pListener->OnAccessibilityFocusIn(*__pTargetContainer, *__pTargetElement);
1747 DrawFocusUi(*__pTargetElement);
1748 if (direction == _ACCESSIBILITY_FOCUS_DIRECTION_PREVIOUS)
1750 pListener->OnAccessibilityFocusMovedPrevious(*__pTargetContainer, *__pTargetElement);
1752 else if (direction == _ACCESSIBILITY_FOCUS_DIRECTION_NEXT)
1754 pListener->OnAccessibilityFocusMovedNext(*__pTargetContainer, *__pTargetElement);
1762 DrawFocusUi(*__pTargetElement);
1764 delete pListenerList;
1765 pListenerList = null;
1766 ReadElement(*pElement);
1773 _AccessibilityManager::RequestToDrawFocusUi()
1775 if (__pTargetContainer)
1778 DrawFocusUi(*__pTargetElement);
1783 _AccessibilityManager::RequestAutoReading(_AccessibilityAutoReadingMode mode)
1785 if(__screenReaderIsEnabled)
1787 if (mode == _ACCESSIBILITY_AUTO_READING_MODE_RESET)
1789 __pTitleElement = null;
1792 pAutoReadingTimer->Start(mode);
1797 _AccessibilityManager::SetTtsMode(_AccessibilityTtsMode mode)
1801 //__pTtsPlayer->SetMode(mode);
1806 _AccessibilityManager::SetGlobalFocusedElement(_AccessibilityElement& element)
1808 _AccessibilityElement* pElement = &element;
1809 if (!IsContainerValid(pElement->GetParent()))
1813 __pTargetContainer = pElement->GetParent();
1814 __pTargetElement = pElement;
1815 RequestAutoReading(_ACCESSIBILITY_AUTO_READING_MODE_CURRENT_FOCUS);
1819 _AccessibilityManager::EraseFocusUi(void)
1821 if (__focusedControlHandle.IsValid())
1825 __pFocusVe->Destroy();
1835 _AccessibilityManager::DrawFocusUi(const _AccessibilityElement& element)
1837 FloatRectangle rectangle = element.GetBounds();
1838 Canvas* pCanvas = null;
1840 _AccessibilityContainer* pContainer = element.GetParent();
1842 if (__focusedControlHandle.IsValid())
1846 __pFocusVe->Destroy();
1855 result r = E_SUCCESS;
1856 _Control* pControl = &const_cast<_Control&>(pContainer->GetOwner());
1857 _VisualElement* pControlVe = pControl->GetVisualElement();
1859 __pFocusVe = new (std::nothrow) VisualElement();
1860 SysTryCatch(NID_UI, __pFocusVe != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
1861 r = __pFocusVe->Construct();
1862 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] System error");
1864 __pFocusVe->SetName("Accessibility focus ui");
1865 __pFocusVe->SetImplicitAnimationEnabled(false);
1866 __focusedControlHandle = pControl->GetHandle();
1867 pControlVe->AttachChild(*__pFocusVe);
1871 __pFocusVe->SetBounds(FloatRectangle(rectangle.x, rectangle.y, rectangle.width, rectangle.height));
1872 pCanvas = __pFocusVe->GetCanvasN();
1873 SysTryCatch(NID_UI, pCanvas, , E_SYSTEM, "[E_SYSTEM] System error");
1874 pCanvas->SetBackgroundColor(0x00000000);
1876 Bitmap* pBitmap = null;
1877 result r = GET_BITMAP_CONFIG_N(ACCESSIBILITY::FOCUS, BITMAP_PIXEL_FORMAT_ARGB8888, pBitmap);
1880 if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*pBitmap))
1882 r = pCanvas->DrawNinePatchedBitmap(Rectangle(0, 0, rectangle.width, rectangle.height), *pBitmap);
1883 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] System error");
1887 r = pCanvas->DrawBitmap(Rectangle(0, 0, rectangle.width, rectangle.height), *pBitmap);
1888 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] System error");
1892 __pFocusVe->SetShowState(true);
1895 pContainer ->SetCurrentFocusedElement(const_cast<_AccessibilityElement*>(&element));
1899 if (__focusedControlHandle.IsValid())
1903 __pFocusVe->Destroy();
1914 _AccessibilityManager::ProcessGesture(_AccessibilityGestureType type, const FloatPoint& point)
1918 case _ACCESSIBILITY_GESTURE_TYPE_FLICK_UP:
1919 case _ACCESSIBILITY_GESTURE_TYPE_FLICK_LEFT:
1920 if (MoveFocus(_ACCESSIBILITY_FOCUS_DIRECTION_PREVIOUS))
1922 SetGestureMode(MODE_FOCUS_MOVE);
1925 case _ACCESSIBILITY_GESTURE_TYPE_FLICK_DOWN:
1926 case _ACCESSIBILITY_GESTURE_TYPE_FLICK_RIGHT:
1927 if (MoveFocus(_ACCESSIBILITY_FOCUS_DIRECTION_NEXT))
1929 SetGestureMode(MODE_FOCUS_MOVE);
1932 case _ACCESSIBILITY_GESTURE_TYPE_ONE_FINGER_ONE_TAP:
1934 if (GetGestureMode() == MODE_FOCUS_MOVE)
1936 SetGestureMode(MODE_TAP);
1937 __candidateList.RemoveAll();
1939 _Control* pControl = null;
1940 Point pt((int)point.x, (int)point.y);
1941 _Window* pWindow = _ControlManager::GetInstance()->GetTopVisibleWindow();
1942 if (!(pWindow->IsLayoutChangable()))
1944 Rectangle topWindowAbsBounds = pWindow->GetAbsoluteBounds();
1945 pt.x = pt.x + topWindowAbsBounds.x;
1946 pt.y = pt.y + topWindowAbsBounds.y;
1948 pControl = _ControlManager::GetInstance()->GetTopmostTouchedControl(pt);
1949 if (pControl == null || !(pControl->GetAbsoluteBounds().Contains(pt)))
1953 _AccessibilityContainer* pAccContainer = pControl->GetAccessibilityContainer();
1954 while(!(pAccContainer->IsActivated()))
1956 _Control* _pControl = pAccContainer->GetOwner().GetParent();
1957 if (_pControl == null)
1961 pAccContainer = _pControl->GetAccessibilityContainer();
1962 if (pAccContainer == null)
1967 _AccessibilityElement* pElement = pAccContainer->Hit(pt);
1968 if (pElement == null)
1973 if (__pTargetElement == pElement)
1977 AccessibilityScreenReaderStatus status = __pTtsPlayer->GetStatus();
1978 if (status == ACCESSIBILITY_SCREEN_READER_STATUS_PLAYING)
1985 if (!(pAccContainer->MoveFocus(pt)))
1989 LinkedListT<_IAccessibilityListener*>* pList = null;
1990 if (IsContainerValid(__pTargetContainer))
1992 __pTargetContainer->ResetFocus();
1993 __pTargetContainer->GetOwner().Invalidate();
1994 pList = static_cast<LinkedListT<_IAccessibilityListener*>*>(__pTargetContainer->GetListenerListN());
1997 int count = pList->GetCount();
1998 for (int i = 0;i<count;i++)
2000 _IAccessibilityListener* pListener = null;
2001 if (pList->GetAt(i, pListener) == E_SUCCESS)
2003 pListener->OnAccessibilityFocusOut(*__pTargetContainer, *__pTargetElement);
2009 if(__pTargetContainer)
2011 __pTargetContainer->SetCurrentFocusedElement(null);
2013 if (pAccContainer->IsFocusManaged())
2015 __pTargetContainer = pAccContainer;
2016 __targetControlHandle = pAccContainer->GetOwner().GetHandle();
2017 __pTargetElement = pElement;
2022 __pTargetContainer = pAccContainer;
2023 __targetControlHandle = pAccContainer->GetOwner().GetHandle();
2024 __pTargetElement = pElement;
2025 pList = static_cast<LinkedListT<_IAccessibilityListener*>*>(__pTargetContainer->GetListenerListN());
2028 int count = pList->GetCount();
2029 for (int i = 0;i<count;i++)
2031 _IAccessibilityListener* pListener = null;
2032 if (pList->GetAt(i, pListener) == E_SUCCESS)
2034 pListener->OnAccessibilityFocusIn(*__pTargetContainer, *__pTargetElement);
2039 DrawFocusUi(*pElement);
2040 ReadElement(*pElement);
2044 case _ACCESSIBILITY_GESTURE_TYPE_ONE_FINGER_DOUBLE_TAP:
2046 if (GetGestureMode() == MODE_FOCUS_MOVE)
2048 SetGestureMode(MODE_TAP);
2049 __candidateList.RemoveAll();
2051 if (__pTargetElement == null)
2055 _TouchManager* pTouchMgr = _TouchManager::GetInstance();
2056 _Control* _pControl = null;
2057 if (pTouchMgr == null)
2061 if (IsContainerValid(__pTargetContainer))
2063 _pControl = &(__pTargetContainer->GetOwner());
2069 if (_pControl == null)
2073 if (_pControl->GetEnableState() == false)
2075 ReadContent(L"Unavailable");
2078 if (__pTargetElement->GetSupportOperatingGesture())
2081 if (_SystemTimeImpl::GetTicks(tick) != E_SUCCESS)
2085 FloatRectangle rect = __pTargetElement->GetAbsoluteBounds();
2086 Point _point((int)(rect.x + rect.width/2), (int)(rect.y + rect.height/2));
2087 _UiTouchEvent pressedEvent(_pControl->GetHandle(), _TouchInfo(0, _TOUCH_PRESSED, _point, false, tick));
2088 _UiTouchEvent releasedEvent(_pControl->GetHandle(), _TouchInfo(0, _TOUCH_RELEASED, _point, false, tick+1));
2089 pressedEvent.SetAccessibilityEvent(true);
2090 releasedEvent.SetAccessibilityEvent(true);
2092 unsigned int pointId = 0;
2093 pointId = pTouchMgr->GeneratePointId(0);
2094 SysLog(NID_UI, "Accessibility manager generated touch pressed event. id: %d", pointId);
2095 _UiEventManager::GetInstance()->SendEvent(pressedEvent);
2096 pointId = pTouchMgr->GetPointId(0);
2097 SysLog(NID_UI, "Accessibility manager generated touch released event. id: %d", pointId);
2098 _UiEventManager::GetInstance()->SendEvent(releasedEvent);
2099 if (!IsContainerValid(__pTargetContainer))
2104 LinkedListT<_IAccessibilityListener*>* pList = static_cast<LinkedListT<_IAccessibilityListener*>*>(__pTargetContainer->GetListenerListN());
2107 int count = pList->GetCount();
2108 SysLog(NID_UI, "Accessibility manager called listeners. count : %d", count);
2109 for (int i = 0;i<count;i++)
2111 _IAccessibilityListener* pListener = null;
2112 if (pList->GetAt(i, pListener) == E_SUCCESS)
2114 pListener->OnAccessibilityActionPerformed(*__pTargetContainer, *__pTargetElement);
2122 case _ACCESSIBILITY_GESTURE_TYPE_ONE_FINGER_LONGPRESS:
2124 case _ACCESSIBILITY_GESTURE_TYPE_ONE_FINGER_PANNING_STARTED:
2125 case _ACCESSIBILITY_GESTURE_TYPE_ONE_FINGER_PANNING_CHANGED:
2126 case _ACCESSIBILITY_GESTURE_TYPE_ONE_FINGER_PANNING_FINISHED:
2128 case _ACCESSIBILITY_GESTURE_TYPE_VALUE_INCREASED:
2130 if (!IsContainerValid(__pTargetContainer))
2135 _Control* pControl = &(__pTargetContainer->GetOwner());
2136 if (pControl->GetEnableState() == false)
2138 ReadContent(L"Unavailable");
2142 LinkedListT<_IAccessibilityListener*>* pList = static_cast<LinkedListT<_IAccessibilityListener*>*>(__pTargetContainer->GetListenerListN());
2145 int count = pList->GetCount();
2146 for (int i = 0;i<count;i++)
2148 _IAccessibilityListener* pListener = null;
2149 if (pList->GetAt(i, pListener) == E_SUCCESS)
2151 pListener->OnAccessibilityValueIncreased(*__pTargetContainer, *__pTargetElement);
2158 case _ACCESSIBILITY_GESTURE_TYPE_VALUE_DECREASED:
2160 if (!IsContainerValid(__pTargetContainer))
2165 _Control* pControl = &(__pTargetContainer->GetOwner());
2166 if (pControl->GetEnableState() == false)
2168 ReadContent(L"Unavailable");
2172 LinkedListT<_IAccessibilityListener*>* pList = static_cast<LinkedListT<_IAccessibilityListener*>*>(__pTargetContainer->GetListenerListN());
2175 int count = pList->GetCount();
2176 for (int i = 0;i<count;i++)
2178 _IAccessibilityListener* pListener = null;
2179 if (pList->GetAt(i, pListener) == E_SUCCESS)
2181 pListener->OnAccessibilityValueDecreased(*__pTargetContainer, *__pTargetElement);
2188 case _ACCESSIBILITY_GESTURE_TYPE_TWO_FINGER_PANNING_STARTED:
2190 Point pt((int)point.x, (int)point.y);
2191 _Control* pControl = _ControlManager::GetInstance()->GetTopmostTouchedControl(pt);
2192 if (pControl == null)
2194 SysLog(NID_UI, "Two finger panning is started. but control is null");
2198 if (_SystemTimeImpl::GetTicks(tick) != E_SUCCESS)
2202 _UiTouchEvent pressedEvent(pControl->GetHandle(), _TouchInfo(0, _TOUCH_PRESSED, pt, false, tick));
2203 unsigned int pointId = 0;
2204 pointId = _TouchManager::GetInstance()->GeneratePointId(0);
2205 _UiEventManager::GetInstance()->SendEvent(pressedEvent);
2206 __pPanningControl = pControl;
2207 SetGestureMode(MODE_PANNING);
2208 SysLog(NID_UI, "Two finger panning is started. x:%d, y:%d", pt.x, pt.y);
2211 case _ACCESSIBILITY_GESTURE_TYPE_TWO_FINGER_PANNING_CHANGED:
2213 if (__pPanningControl == null || GetGestureMode() != MODE_PANNING)
2215 SetGestureMode(MODE_TAP);
2216 SysLog(NID_UI, "Two finger panning is started. but control is null");
2220 if (_SystemTimeImpl::GetTicks(tick) != E_SUCCESS)
2224 Point pt((int)point.x, (int)point.y);
2225 _UiTouchEvent movedEvent(__pPanningControl->GetHandle(), _TouchInfo(0, _TOUCH_MOVED, pt, false, tick));
2226 unsigned int pointId = 0;
2227 pointId = _TouchManager::GetInstance()->GetPointId(0);
2228 _UiEventManager::GetInstance()->SendEvent(movedEvent);
2229 SysLog(NID_UI, "Two finger panning is moved. x:%d, y:%d", pt.x, pt.y);
2232 case _ACCESSIBILITY_GESTURE_TYPE_TWO_FINGER_PANNING_FINISHED:
2234 if (__pPanningControl == null || GetGestureMode() != MODE_PANNING)
2236 SetGestureMode(MODE_TAP);
2237 SysLog(NID_UI, "Two finger panning is started. but control is null");
2241 if (_SystemTimeImpl::GetTicks(tick) != E_SUCCESS)
2245 Point pt((int)point.x, (int)point.y);
2246 _UiTouchEvent releasedEvent(__pPanningControl->GetHandle(), _TouchInfo(0, _TOUCH_RELEASED, pt, false, tick));
2247 unsigned int pointId = 0;
2248 pointId = _TouchManager::GetInstance()->GetPointId(0);
2249 _UiEventManager::GetInstance()->SendEvent(releasedEvent);
2250 __pPanningControl = null;
2251 SetGestureMode(MODE_TAP);
2252 SysLog(NID_UI, "Two finger panning is finished. x:%d, y:%d", pt.x, pt.y);
2261 Tizen::Base::_HandleT<_AccessibilityContainer>
2262 _AccessibilityManager::Register(_AccessibilityContainer* pObject)
2264 if (pObject == null)
2266 return Tizen::Base::_HandleT<_AccessibilityContainer>();
2269 return __objectManager.Register(*pObject);
2272 _AccessibilityManager::Unregister(Tizen::Base::_HandleT <_AccessibilityContainer> handle)
2274 __objectManager.Unregister(handle);
2279 _AccessibilityManager::OnChangedLocale(void)
2281 if (__pTtsPlayer && __pSettingLoader)
2283 __pTtsPlayer->SetLocale(__pSettingLoader->GetLocale());
2288 _AccessibilityManager::OnAccessibilityScreenReaderIsActivated(bool set)
2290 SysLog(NID_UI, "Screen reader status is changed. %d", set);
2291 if (__screenReaderIsEnabled == set)
2297 __screenReaderIsEnabled = set;
2298 if (__screenReaderIsEnabled)
2302 __pTtsPlayer->SetLocale(__pSettingLoader->GetLocale());
2303 __pTtsPlayer->Activate();
2304 RequestAutoReading(_ACCESSIBILITY_AUTO_READING_MODE_FIRST_ITEM);
2309 __pTtsPlayer->Deactivate();
2311 __pTargetContainer = null;
2312 __pTargetElement = null;
2313 __pTitleElement = null;
2314 __candidateList.RemoveAll();
2316 __targetControlHandle = _ControlHandle();
2317 __focusedControlHandle = _ControlHandle();
2318 __readingPopupParentHandle = _ControlHandle();
2323 _AccessibilityManager::IsScreenReaderActivated(void)
2325 __screenReaderIsEnabled = __pSettingLoader->IsScreenReaderActivated();
2326 return __screenReaderIsEnabled;
2329 _AccessibilityManager::GetLargeFontSize(void)
2331 return __pSettingLoader->GetLargeFontSize();
2335 _AccessibilityManager::IsActivated()
2337 return __screenReaderIsEnabled;
2341 _AccessibilityManager::IsContainerValid(_AccessibilityContainer* pContainer)
2343 if (pContainer == null)
2347 if (!(pContainer->IsActivated()))
2351 if (!(pContainer->GetHandle().IsValid()))
2355 if (!(pContainer->GetOwner().GetHandle().IsValid()))
2359 if (!(pContainer->GetOwner().IsVisible()))
2363 if (!IsVisible(pContainer))
2370 _AccessibilityManager::IsTargetContainerValid(void)
2373 if (__pTargetContainer && __targetControlHandle.IsValid() && __pTargetContainer->GetOwner().IsVisible() && __pTargetContainer->GetOwner().GetRootWindow() && IsVisible(__pTargetContainer))
2380 _AccessibilityManager::IsFirstElementGainedFocus(void)
2382 int count = __candidateList.GetCount();
2387 if(__pTargetElement == null)
2391 _AccessibilityElement* pElement = null;
2392 if(__candidateList.GetAt(0, pElement) == E_SUCCESS)
2394 if(pElement == __pTargetElement)
2402 _AccessibilityManager::IsLastElementGainedFocus(void)
2404 int count = __candidateList.GetCount();
2409 if(__pTargetElement == null)
2413 _AccessibilityElement* pElement = null;
2414 if(__candidateList.GetAt(count-1, pElement) == E_SUCCESS)
2416 if(pElement == __pTargetElement)
2424 _AccessibilityManager::IsVisible(_AccessibilityElement* pElement)
2426 return IsVisible(pElement->GetParent());
2429 _AccessibilityManager::IsVisible(_AccessibilityContainer* pContainer)
2431 _ControlManager* pControlManager = _ControlManager::GetInstance();
2432 int count = pControlManager->GetWindowCount();
2437 _Window* pTopWindow = pControlManager->GetWindow(count - 1);
2438 if (pTopWindow != pContainer->GetOwner().GetRootWindow())
2445 _AccessibilityManager::SetGestureMode(GestureMode mode)
2449 _AccessibilityManager::GestureMode
2450 _AccessibilityManager::GetGestureMode(void)
2456 _AccessibilityManager::NeedRefreshItem(void)
2458 __needRefreshItem = true;