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 for (int i = 0 ; i < count ; i++)
1499 r = __candidateList.GetAt(i, pElement);
1504 if (pElement->GetName() == "HeaderTitleText")
1506 __candidateList.Remove(pElement);
1507 __candidateList.InsertAt(pElement, 0);
1513 _AccessibilityManager::MakeList(_AccessibilityContainer* pContainer)
1515 if (pContainer->GetOwner().IsVisible() && pContainer->IsActivated())
1517 pContainer->GetElements(__candidateList);
1519 _Control* pControl = &(pContainer->GetOwner());
1520 int count = pControl->GetChildCount();
1521 for (int i = 0 ; i<count;i++)
1523 _Control* pChildControl = pControl->GetChild(i);
1526 MakeList(pChildControl->GetAccessibilityContainer());
1532 _AccessibilityManager::MoveFocus(_AccessibilityFocusDirection direction)
1534 if (direction == _ACCESSIBILITY_FOCUS_DIRECTION_PREVIOUS
1535 || direction == _ACCESSIBILITY_FOCUS_DIRECTION_NEXT)
1544 int count = __candidateList.GetCount();
1549 SysLog(NID_UI, "count ", count);
1550 result r = E_SUCCESS;
1552 _AccessibilityElement* pElement = null;
1553 _AccessibilityContainer* pContainer = null;
1554 bool focusManaged = false;
1555 if (IsContainerValid(__pTargetContainer))
1557 r = __candidateList.IndexOf(__pTargetElement, 0, index);
1561 __pTargetElement = null;
1562 __pTargetContainer = null;
1566 if ((__pTargetContainer->MoveFocus(direction)))
1568 pElement = __pTargetContainer->GetCurrentFocusedElement();
1569 focusManaged = true;
1578 if (index > count - 1)
1582 __candidateList.GetAt(index, pElement);
1583 if (pElement->GetParent()->IsFocusManaged())
1585 if ((pElement->GetParent()->MoveFocus(direction)))
1587 focusManaged = true;
1595 SysTryReturn(NID_UI, __candidateList.GetAt(0, pElement) == E_SUCCESS, false, E_SUCCESS, "[E_SUCCESS] Candidates are not exist.");
1599 pContainer = pElement->GetParent();
1600 IListT<_IAccessibilityListener*>* pListenerList = pContainer->GetListenerListN();
1603 int listenerCount = pListenerList->GetCount();
1604 if (listenerCount > 0)
1606 for (int i = 0;i<listenerCount;i++)
1608 _IAccessibilityListener* pListener = null;
1609 if (pListenerList->GetAt(i, pListener) == E_SUCCESS)
1611 if (pListener->OnAccessibilityItemRefreshed(*pContainer, *pElement, direction) == true)
1613 return MoveFocus(direction);
1618 delete pListenerList;
1619 pListenerList = null;
1622 if (__pTargetContainer)
1624 pListenerList = __pTargetContainer->GetListenerListN();
1627 int listenerCount = pListenerList->GetCount();
1628 if (listenerCount > 0)
1630 for (int i = 0;i<listenerCount;i++)
1632 _IAccessibilityListener* pListener = null;
1633 if (pListenerList->GetAt(i, pListener) == E_SUCCESS)
1635 pListener->OnAccessibilityFocusOut(*__pTargetContainer, *__pTargetElement);
1639 delete pListenerList;
1640 pListenerList = null;
1643 if(__pTargetContainer)
1645 __pTargetContainer->SetCurrentFocusedElement(null);
1649 __pTargetElement = pElement;
1650 __pTargetContainer = pContainer;
1651 __targetControlHandle = pContainer->GetOwner().GetHandle();
1657 __pTargetElement = pElement;
1658 __pTargetContainer = pContainer;
1659 __targetControlHandle = pContainer->GetOwner().GetHandle();
1660 pListenerList = __pTargetContainer->GetListenerListN();
1663 int listenerCount = pListenerList->GetCount();
1664 if (listenerCount > 0)
1666 for (int i = 0;i<listenerCount;i++)
1668 _IAccessibilityListener* pListener = null;
1669 if (pListenerList->GetAt(i, pListener) == E_SUCCESS)
1671 pListener->OnAccessibilityFocusIn(*__pTargetContainer, *__pTargetElement);
1672 DrawFocusUi(*__pTargetElement);
1673 if (direction == _ACCESSIBILITY_FOCUS_DIRECTION_PREVIOUS)
1675 pListener->OnAccessibilityFocusMovedPrevious(*__pTargetContainer, *__pTargetElement);
1677 else if (direction == _ACCESSIBILITY_FOCUS_DIRECTION_NEXT)
1679 pListener->OnAccessibilityFocusMovedNext(*__pTargetContainer, *__pTargetElement);
1687 DrawFocusUi(*__pTargetElement);
1689 delete pListenerList;
1690 pListenerList = null;
1691 ReadElement(*pElement);
1698 _AccessibilityManager::RequestToDrawFocusUi()
1700 if (__pTargetContainer)
1703 DrawFocusUi(*__pTargetElement);
1708 _AccessibilityManager::RequestAutoReading(_AccessibilityAutoReadingMode mode)
1710 if(__screenReaderIsEnabled)
1712 if (mode == _ACCESSIBILITY_AUTO_READING_MODE_RESET)
1714 __pTitleElement = null;
1717 pAutoReadingTimer->Start(mode);
1722 _AccessibilityManager::SetTtsMode(_AccessibilityTtsMode mode)
1726 //__pTtsPlayer->SetMode(mode);
1731 _AccessibilityManager::SetGlobalFocusedElement(_AccessibilityElement& element)
1733 _AccessibilityElement* pElement = &element;
1734 if (!IsContainerValid(pElement->GetParent()))
1738 __pTargetContainer = pElement->GetParent();
1739 __pTargetElement = pElement;
1740 RequestAutoReading(_ACCESSIBILITY_AUTO_READING_MODE_CURRENT_FOCUS);
1744 _AccessibilityManager::EraseFocusUi(void)
1746 if (__focusedControlHandle.IsValid())
1750 __pFocusVe->Destroy();
1760 _AccessibilityManager::DrawFocusUi(const _AccessibilityElement& element)
1762 FloatRectangle rectangle = element.GetBounds();
1763 Canvas* pCanvas = null;
1765 _AccessibilityContainer* pContainer = element.GetParent();
1767 if (__focusedControlHandle.IsValid())
1771 __pFocusVe->Destroy();
1780 result r = E_SUCCESS;
1781 _Control* pControl = &const_cast<_Control&>(pContainer->GetOwner());
1782 _VisualElement* pControlVe = pControl->GetVisualElement();
1784 __pFocusVe = new (std::nothrow) VisualElement();
1785 SysTryCatch(NID_UI, __pFocusVe != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
1786 r = __pFocusVe->Construct();
1787 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] System error");
1789 __pFocusVe->SetName("Accessibility focus ui");
1790 __pFocusVe->SetImplicitAnimationEnabled(false);
1791 __focusedControlHandle = pControl->GetHandle();
1792 pControlVe->AttachChild(*__pFocusVe);
1796 __pFocusVe->SetBounds(FloatRectangle(rectangle.x, rectangle.y, rectangle.width, rectangle.height));
1797 pCanvas = __pFocusVe->GetCanvasN();
1798 SysTryCatch(NID_UI, pCanvas, , E_SYSTEM, "[E_SYSTEM] System error");
1799 pCanvas->SetBackgroundColor(0x00000000);
1801 Bitmap* pBitmap = null;
1802 result r = GET_BITMAP_CONFIG_N(ACCESSIBILITY::FOCUS, BITMAP_PIXEL_FORMAT_ARGB8888, pBitmap);
1805 if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*pBitmap))
1807 r = pCanvas->DrawNinePatchedBitmap(Rectangle(0, 0, rectangle.width, rectangle.height), *pBitmap);
1808 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] System error");
1812 r = pCanvas->DrawBitmap(Rectangle(0, 0, rectangle.width, rectangle.height), *pBitmap);
1813 SysTryCatch(NID_UI, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] System error");
1817 __pFocusVe->SetShowState(true);
1820 pContainer ->SetCurrentFocusedElement(const_cast<_AccessibilityElement*>(&element));
1824 if (__focusedControlHandle.IsValid())
1828 __pFocusVe->Destroy();
1839 _AccessibilityManager::ProcessGesture(_AccessibilityGestureType type, const FloatPoint& point)
1843 case _ACCESSIBILITY_GESTURE_TYPE_FLICK_UP:
1844 case _ACCESSIBILITY_GESTURE_TYPE_FLICK_LEFT:
1845 if (MoveFocus(_ACCESSIBILITY_FOCUS_DIRECTION_PREVIOUS))
1847 SetGestureMode(MODE_FOCUS_MOVE);
1850 case _ACCESSIBILITY_GESTURE_TYPE_FLICK_DOWN:
1851 case _ACCESSIBILITY_GESTURE_TYPE_FLICK_RIGHT:
1852 if (MoveFocus(_ACCESSIBILITY_FOCUS_DIRECTION_NEXT))
1854 SetGestureMode(MODE_FOCUS_MOVE);
1857 case _ACCESSIBILITY_GESTURE_TYPE_ONE_FINGER_ONE_TAP:
1859 if (GetGestureMode() == MODE_FOCUS_MOVE)
1861 SetGestureMode(MODE_TAP);
1862 __candidateList.RemoveAll();
1864 _Control* pControl = null;
1865 Point pt((int)point.x, (int)point.y);
1866 _Window* pWindow = _ControlManager::GetInstance()->GetTopVisibleWindow();
1867 if (!(pWindow->IsLayoutChangable()))
1869 Rectangle topWindowAbsBounds = pWindow->GetAbsoluteBounds();
1870 pt.x = pt.x + topWindowAbsBounds.x;
1871 pt.y = pt.y + topWindowAbsBounds.y;
1873 pControl = _ControlManager::GetInstance()->GetTopmostTouchedControl(pt);
1874 if (pControl == null || !(pControl->GetAbsoluteBounds().Contains(pt)))
1878 _AccessibilityContainer* pAccContainer = pControl->GetAccessibilityContainer();
1879 while(!(pAccContainer->IsActivated()))
1881 _Control* _pControl = pAccContainer->GetOwner().GetParent();
1882 if (_pControl == null)
1886 pAccContainer = _pControl->GetAccessibilityContainer();
1887 if (pAccContainer == null)
1892 _AccessibilityElement* pElement = pAccContainer->Hit(pt);
1893 if (pElement == null)
1898 if (__pTargetElement == pElement)
1902 AccessibilityScreenReaderStatus status = __pTtsPlayer->GetStatus();
1903 if (status == ACCESSIBILITY_SCREEN_READER_STATUS_PLAYING)
1910 if (!(pAccContainer->MoveFocus(pt)))
1914 LinkedListT<_IAccessibilityListener*>* pList = null;
1915 if (IsContainerValid(__pTargetContainer))
1917 __pTargetContainer->ResetFocus();
1918 __pTargetContainer->GetOwner().Invalidate();
1919 pList = static_cast<LinkedListT<_IAccessibilityListener*>*>(__pTargetContainer->GetListenerListN());
1922 int count = pList->GetCount();
1923 for (int i = 0;i<count;i++)
1925 _IAccessibilityListener* pListener = null;
1926 if (pList->GetAt(i, pListener) == E_SUCCESS)
1928 pListener->OnAccessibilityFocusOut(*__pTargetContainer, *__pTargetElement);
1934 if(__pTargetContainer)
1936 __pTargetContainer->SetCurrentFocusedElement(null);
1938 if (pAccContainer->IsFocusManaged())
1940 __pTargetContainer = pAccContainer;
1941 __targetControlHandle = pAccContainer->GetOwner().GetHandle();
1942 __pTargetElement = pElement;
1947 __pTargetContainer = pAccContainer;
1948 __targetControlHandle = pAccContainer->GetOwner().GetHandle();
1949 __pTargetElement = pElement;
1950 pList = static_cast<LinkedListT<_IAccessibilityListener*>*>(__pTargetContainer->GetListenerListN());
1953 int count = pList->GetCount();
1954 for (int i = 0;i<count;i++)
1956 _IAccessibilityListener* pListener = null;
1957 if (pList->GetAt(i, pListener) == E_SUCCESS)
1959 pListener->OnAccessibilityFocusIn(*__pTargetContainer, *__pTargetElement);
1964 DrawFocusUi(*pElement);
1965 ReadElement(*pElement);
1969 case _ACCESSIBILITY_GESTURE_TYPE_ONE_FINGER_DOUBLE_TAP:
1971 if (GetGestureMode() == MODE_FOCUS_MOVE)
1973 SetGestureMode(MODE_TAP);
1974 __candidateList.RemoveAll();
1976 if (__pTargetElement == null)
1980 _TouchManager* pTouchMgr = _TouchManager::GetInstance();
1981 _Control* _pControl = null;
1982 if (pTouchMgr == null)
1986 if (IsContainerValid(__pTargetContainer))
1988 _pControl = &(__pTargetContainer->GetOwner());
1994 if (_pControl == null)
1998 if (_pControl->GetEnableState() == false)
2000 ReadContent(L"Unavailable");
2003 if (__pTargetElement->GetSupportOperatingGesture())
2006 if (_SystemTimeImpl::GetTicks(tick) != E_SUCCESS)
2010 FloatRectangle rect = __pTargetElement->GetAbsoluteBounds();
2011 Point _point((int)(rect.x + rect.width/2), (int)(rect.y + rect.height/2));
2012 _UiTouchEvent pressedEvent(_pControl->GetHandle(), _TouchInfo(0, _TOUCH_PRESSED, _point, false, tick));
2013 _UiTouchEvent releasedEvent(_pControl->GetHandle(), _TouchInfo(0, _TOUCH_RELEASED, _point, false, tick+1));
2014 pressedEvent.SetAccessibilityEvent(true);
2015 releasedEvent.SetAccessibilityEvent(true);
2017 unsigned int pointId = 0;
2018 pointId = pTouchMgr->GeneratePointId(0);
2019 SysLog(NID_UI, "Accessibility manager generated touch pressed event. id: %d", pointId);
2020 _UiEventManager::GetInstance()->SendEvent(pressedEvent);
2021 pointId = pTouchMgr->GetPointId(0);
2022 SysLog(NID_UI, "Accessibility manager generated touch released event. id: %d", pointId);
2023 _UiEventManager::GetInstance()->SendEvent(releasedEvent);
2024 if (!IsContainerValid(__pTargetContainer))
2029 LinkedListT<_IAccessibilityListener*>* pList = static_cast<LinkedListT<_IAccessibilityListener*>*>(__pTargetContainer->GetListenerListN());
2032 int count = pList->GetCount();
2033 SysLog(NID_UI, "Accessibility manager called listeners. count : %d", count);
2034 for (int i = 0;i<count;i++)
2036 _IAccessibilityListener* pListener = null;
2037 if (pList->GetAt(i, pListener) == E_SUCCESS)
2039 pListener->OnAccessibilityActionPerformed(*__pTargetContainer, *__pTargetElement);
2047 case _ACCESSIBILITY_GESTURE_TYPE_ONE_FINGER_LONGPRESS:
2049 case _ACCESSIBILITY_GESTURE_TYPE_ONE_FINGER_PANNING_STARTED:
2050 case _ACCESSIBILITY_GESTURE_TYPE_ONE_FINGER_PANNING_CHANGED:
2051 case _ACCESSIBILITY_GESTURE_TYPE_ONE_FINGER_PANNING_FINISHED:
2053 case _ACCESSIBILITY_GESTURE_TYPE_VALUE_INCREASED:
2055 if (!IsContainerValid(__pTargetContainer))
2060 _Control* pControl = &(__pTargetContainer->GetOwner());
2061 if (pControl->GetEnableState() == false)
2063 ReadContent(L"Unavailable");
2067 LinkedListT<_IAccessibilityListener*>* pList = static_cast<LinkedListT<_IAccessibilityListener*>*>(__pTargetContainer->GetListenerListN());
2070 int count = pList->GetCount();
2071 for (int i = 0;i<count;i++)
2073 _IAccessibilityListener* pListener = null;
2074 if (pList->GetAt(i, pListener) == E_SUCCESS)
2076 pListener->OnAccessibilityValueIncreased(*__pTargetContainer, *__pTargetElement);
2083 case _ACCESSIBILITY_GESTURE_TYPE_VALUE_DECREASED:
2085 if (!IsContainerValid(__pTargetContainer))
2090 _Control* pControl = &(__pTargetContainer->GetOwner());
2091 if (pControl->GetEnableState() == false)
2093 ReadContent(L"Unavailable");
2097 LinkedListT<_IAccessibilityListener*>* pList = static_cast<LinkedListT<_IAccessibilityListener*>*>(__pTargetContainer->GetListenerListN());
2100 int count = pList->GetCount();
2101 for (int i = 0;i<count;i++)
2103 _IAccessibilityListener* pListener = null;
2104 if (pList->GetAt(i, pListener) == E_SUCCESS)
2106 pListener->OnAccessibilityValueDecreased(*__pTargetContainer, *__pTargetElement);
2113 case _ACCESSIBILITY_GESTURE_TYPE_TWO_FINGER_PANNING_STARTED:
2115 Point pt((int)point.x, (int)point.y);
2116 _Control* pControl = _ControlManager::GetInstance()->GetTopmostTouchedControl(pt);
2117 if (pControl == null)
2119 SysLog(NID_UI, "Two finger panning is started. but control is null");
2123 if (_SystemTimeImpl::GetTicks(tick) != E_SUCCESS)
2127 _UiTouchEvent pressedEvent(pControl->GetHandle(), _TouchInfo(0, _TOUCH_PRESSED, pt, false, tick));
2128 unsigned int pointId = 0;
2129 pointId = _TouchManager::GetInstance()->GeneratePointId(0);
2130 _UiEventManager::GetInstance()->SendEvent(pressedEvent);
2131 __pPanningControl = pControl;
2132 SetGestureMode(MODE_PANNING);
2133 SysLog(NID_UI, "Two finger panning is started. x:%d, y:%d", pt.x, pt.y);
2136 case _ACCESSIBILITY_GESTURE_TYPE_TWO_FINGER_PANNING_CHANGED:
2138 if (__pPanningControl == null || GetGestureMode() != MODE_PANNING)
2140 SetGestureMode(MODE_TAP);
2141 SysLog(NID_UI, "Two finger panning is started. but control is null");
2145 if (_SystemTimeImpl::GetTicks(tick) != E_SUCCESS)
2149 Point pt((int)point.x, (int)point.y);
2150 _UiTouchEvent movedEvent(__pPanningControl->GetHandle(), _TouchInfo(0, _TOUCH_MOVED, pt, false, tick));
2151 unsigned int pointId = 0;
2152 pointId = _TouchManager::GetInstance()->GetPointId(0);
2153 _UiEventManager::GetInstance()->SendEvent(movedEvent);
2154 SysLog(NID_UI, "Two finger panning is moved. x:%d, y:%d", pt.x, pt.y);
2157 case _ACCESSIBILITY_GESTURE_TYPE_TWO_FINGER_PANNING_FINISHED:
2159 if (__pPanningControl == null || GetGestureMode() != MODE_PANNING)
2161 SetGestureMode(MODE_TAP);
2162 SysLog(NID_UI, "Two finger panning is started. but control is null");
2166 if (_SystemTimeImpl::GetTicks(tick) != E_SUCCESS)
2170 Point pt((int)point.x, (int)point.y);
2171 _UiTouchEvent releasedEvent(__pPanningControl->GetHandle(), _TouchInfo(0, _TOUCH_RELEASED, pt, false, tick));
2172 unsigned int pointId = 0;
2173 pointId = _TouchManager::GetInstance()->GetPointId(0);
2174 _UiEventManager::GetInstance()->SendEvent(releasedEvent);
2175 __pPanningControl = null;
2176 SetGestureMode(MODE_TAP);
2177 SysLog(NID_UI, "Two finger panning is finished. x:%d, y:%d", pt.x, pt.y);
2186 Tizen::Base::_HandleT<_AccessibilityContainer>
2187 _AccessibilityManager::Register(_AccessibilityContainer* pObject)
2189 if (pObject == null)
2191 return Tizen::Base::_HandleT<_AccessibilityContainer>();
2194 return __objectManager.Register(*pObject);
2197 _AccessibilityManager::Unregister(Tizen::Base::_HandleT <_AccessibilityContainer> handle)
2199 __objectManager.Unregister(handle);
2204 _AccessibilityManager::OnChangedLocale(void)
2206 if (__pTtsPlayer && __pSettingLoader)
2208 __pTtsPlayer->SetLocale(__pSettingLoader->GetLocale());
2213 _AccessibilityManager::OnAccessibilityScreenReaderIsActivated(bool set)
2215 SysLog(NID_UI, "Screen reader status is changed. %d", set);
2216 if (__screenReaderIsEnabled == set)
2222 __screenReaderIsEnabled = set;
2223 if (__screenReaderIsEnabled)
2227 __pTtsPlayer->SetLocale(__pSettingLoader->GetLocale());
2228 __pTtsPlayer->Activate();
2229 RequestAutoReading(_ACCESSIBILITY_AUTO_READING_MODE_FIRST_ITEM);
2234 __pTtsPlayer->Deactivate();
2236 __pTargetContainer = null;
2237 __pTargetElement = null;
2238 __pTitleElement = null;
2239 __candidateList.RemoveAll();
2241 __targetControlHandle = _ControlHandle();
2242 __focusedControlHandle = _ControlHandle();
2243 __readingPopupParentHandle = _ControlHandle();
2248 _AccessibilityManager::IsScreenReaderActivated(void)
2250 __screenReaderIsEnabled = __pSettingLoader->IsScreenReaderActivated();
2251 return __screenReaderIsEnabled;
2254 _AccessibilityManager::GetLargeFontSize(void)
2256 return __pSettingLoader->GetLargeFontSize();
2260 _AccessibilityManager::IsActivated()
2262 return __screenReaderIsEnabled;
2266 _AccessibilityManager::IsContainerValid(_AccessibilityContainer* pContainer)
2268 if (pContainer == null)
2272 if (!(pContainer->IsActivated()))
2276 if (!(pContainer->GetHandle().IsValid()))
2280 if (!(pContainer->GetOwner().GetHandle().IsValid()))
2284 if (!(pContainer->GetOwner().IsVisible()))
2288 if (!IsVisible(pContainer))
2295 _AccessibilityManager::IsTargetContainerValid(void)
2298 if (__pTargetContainer && __targetControlHandle.IsValid() && __pTargetContainer->GetOwner().IsVisible() && __pTargetContainer->GetOwner().GetRootWindow() && IsVisible(__pTargetContainer))
2305 _AccessibilityManager::IsFirstElementGainedFocus(void)
2307 int count = __candidateList.GetCount();
2312 if(__pTargetElement == null)
2316 _AccessibilityElement* pElement = null;
2317 if(__candidateList.GetAt(0, pElement) == E_SUCCESS)
2319 if(pElement == __pTargetElement)
2327 _AccessibilityManager::IsLastElementGainedFocus(void)
2329 int count = __candidateList.GetCount();
2334 if(__pTargetElement == null)
2338 _AccessibilityElement* pElement = null;
2339 if(__candidateList.GetAt(count-1, pElement) == E_SUCCESS)
2341 if(pElement == __pTargetElement)
2349 _AccessibilityManager::IsVisible(_AccessibilityElement* pElement)
2351 return IsVisible(pElement->GetParent());
2354 _AccessibilityManager::IsVisible(_AccessibilityContainer* pContainer)
2356 _ControlManager* pControlManager = _ControlManager::GetInstance();
2357 int count = pControlManager->GetWindowCount();
2362 _Window* pTopWindow = pControlManager->GetWindow(count - 1);
2363 if (pTopWindow != pContainer->GetOwner().GetRootWindow())
2370 _AccessibilityManager::SetGestureMode(GestureMode mode)
2374 _AccessibilityManager::GestureMode
2375 _AccessibilityManager::GetGestureMode(void)
2381 _AccessibilityManager::NeedRefreshItem(void)
2383 __needRefreshItem = true;