namespace Tizen { namespace Ui { namespace Controls
{
+
+class _FastScrollAccessibilityListener
+ : public _IAccessibilityListener
+{
+public:
+ _FastScrollAccessibilityListener(_FastScroll* pFastScroll)
+ : __pFastScroll(pFastScroll)
+ , __onAccessibility(false)
+ {
+ }
+
+ virtual bool OnAccessibilityFocusMovedNext(const _AccessibilityContainer& control, const _AccessibilityElement& element){return true;}
+ virtual bool OnAccessibilityFocusMovedPrevious(const _AccessibilityContainer& control, const _AccessibilityElement& element){return true;}
+ virtual bool OnAccessibilityReadingElement(const _AccessibilityContainer& control, const _AccessibilityElement& element){return true;}
+ virtual bool OnAccessibilityReadElement(const _AccessibilityContainer& control, const _AccessibilityElement& element){return true;}
+ virtual bool OnAccessibilityFocusIn(const _AccessibilityContainer& control, const _AccessibilityElement& element){return true;}
+ virtual bool OnAccessibilityFocusOut(const _AccessibilityContainer& control, const _AccessibilityElement& element){return true;}
+ virtual bool OnAccessibilityValueIncreased(const _AccessibilityContainer& control, const _AccessibilityElement& element){return true;}
+ virtual bool OnAccessibilityValueDecreased(const _AccessibilityContainer& control, const _AccessibilityElement& element){return true;}
+ virtual bool OnAccessibilityActionPerformed(const _AccessibilityContainer& control, const _AccessibilityElement& element)
+ {
+ if (__onAccessibility)
+ {
+ __onAccessibility = false;
+ __pFastScroll->ReleaseTouchCapture();
+ }
+ else
+ {
+ __onAccessibility = true;
+ __pFastScroll->SetTouchCapture(true, false);
+ }
+
+ _AccessibilityContainer* pAccessibilityContainer = __pFastScroll->GetAccessibilityContainer();
+ __pFastScroll->AddAccessibilityElement(*pAccessibilityContainer, __onAccessibility);
+
+ return true;
+ }
+
+ _FastScroll* __pFastScroll;
+ bool __onAccessibility;
+};
+
_FastScroll::_FastScroll(void)
: __pPresenter(null)
+ , __pAccessibilityListener(null)
{
}
_FastScroll::~_FastScroll(void)
{
+ _AccessibilityContainer* pAccessibilityContainer = GetAccessibilityContainer();
+ if (pAccessibilityContainer && pAccessibilityContainer->IsActivated())
+ {
+ pAccessibilityContainer->RemoveAllElement();
+ }
+
delete __pPresenter;
__pPresenter = null;
+
+ delete __pAccessibilityListener;
+ __pAccessibilityListener = null;
}
_FastScroll*
result
_FastScroll::UpdateIndex(void)
{
+ _AccessibilityContainer* pAccessibilityContainer = GetAccessibilityContainer();
+ if (pAccessibilityContainer && pAccessibilityContainer->IsActivated())
+ {
+ GetPresenter().AddAccessibilityElement(*pAccessibilityContainer, false);
+ }
return GetPresenter().UpdateIndex();
}
GetPresenter().CancelFadeEffect();
}
+result
+_FastScroll::InitializeAccessibility(void)
+{
+ if (unlikely(!(_AccessibilityManager::IsActivated())))
+ {
+ return E_SUCCESS;
+ }
+
+ _AccessibilityContainer* pAccessibilityContainer = GetAccessibilityContainer();
+ if (pAccessibilityContainer)
+ {
+ pAccessibilityContainer->Activate(true);
+ __pAccessibilityListener = new (std::nothrow) _FastScrollAccessibilityListener(this);
+ SysTryReturnResult(NID_UI_CTRL, __pAccessibilityListener, E_OUT_OF_MEMORY, "Memory allocation failed.");
+
+ pAccessibilityContainer->AddListener(*__pAccessibilityListener);
+ }
+ return E_SUCCESS;
+}
+
+result
+_FastScroll::AddAccessibilityElement(const _AccessibilityContainer& control, bool onAccessibility)
+{
+ return GetPresenter().AddAccessibilityElement(control, onAccessibility);
+}
+
void
_FastScroll::AddFastScrollEventListener(const Tizen::Ui::Controls::_IUiFastScrollListener& listener)
{
GetPresenter().RemoveFastScrollEventListener(listener);
}
+result
+_FastScroll::OnAttachedToMainTree(void)
+{
+ return InitializeAccessibility();
+}
+
void
_FastScroll::OnParentBoundsChanged(void)
{
}
void
+_FastScroll::OnAncestorVisibleStateChanged(const _Control& control)
+{
+ GetPresenter().OnAncestorVisibleStateChanged(control);
+}
+
+void
+_FastScroll::OnAncestorEnableStateChanged(const _Control& control)
+{
+ GetPresenter().OnAncestorEnableStateChanged(control);
+}
+
+void
+_FastScroll::OnAncestorInputEnableStateChanged(const _Control& control)
+{
+ GetPresenter().OnAncestorInputEnableStateChanged(control);
+}
+
+void
_FastScroll::OnFontChanged(Font* pFont)
{
GetPresenter().OnFontChanged(pFont);
result
+_FastScrollIndexView::AddAccessibilityElement(const _AccessibilityContainer& control)
+{
+ SysTryReturnResult(NID_UI_CTRL, __pBaseIndex, E_INVALID_STATE, "[E_INVALID_STATE] __pBaseIndex must not be null.");
+
+ int omittedChildCount = __pBaseIndex->GetChildCount(__pBaseIndex->GetIndexType());
+ SysTryReturnResult(NID_UI_CTRL, omittedChildCount > 0, E_INVALID_STATE, "The index have no children.");
+
+ FloatRectangle bounds = __pBaseIndexVe->GetBounds();
+ float indexHeight = GetIndexHeight();
+ FloatRectangle indexRect(bounds.x, __viewConfig.__indexMarginTop, bounds.width, indexHeight);
+ int nonOmittedIndex = 0;
+
+ _AccessibilityElement* pAccessibilityElement = null;
+ result r = E_SUCCESS;
+ for (int i = 0; i < omittedChildCount; )
+ {
+ _FastScrollIndex* pChildIndex = __pBaseIndex->GetChildIndex(i, true);
+ SysTryReturnResult(NID_UI_CTRL, pChildIndex, GetLastResult(), "Failed to get the child index.");
+
+ int omittedCount = 0;
+ if (pChildIndex->GetOmitted())
+ {
+ omittedCount = pChildIndex->GetChildCount();
+ pChildIndex = __pBaseIndex->GetChildIndex(nonOmittedIndex, false);
+ SysTryReturnResult(NID_UI_CTRL, pChildIndex, GetLastResult(), "Failed to get the child index.");
+ }
+
+ Bitmap* pChildIndexImage = pChildIndex->GetIndexImage();
+ if (pChildIndexImage == null)
+ {
+ String* pChildIndexText = pChildIndex->GetIndexText();
+ SysTryReturnResult(NID_UI_CTRL, pChildIndexText, E_INVALID_STATE, "pChildIndexText must not be null.");
+
+ _AccessibilityContainer* pAccessibilityContainer = const_cast <_AccessibilityContainer*>(&control);
+ pAccessibilityElement = new (std::nothrow) _AccessibilityElement(true);
+ SysTryReturnResult(NID_UI_CTRL, pAccessibilityElement, E_OUT_OF_MEMORY, "Memory allocation failed.");
+ pAccessibilityElement->SetBounds(indexRect);
+ pAccessibilityElement->SetLabel(*pChildIndexText);
+ pAccessibilityElement->SetName(L"FastScrollIndex");
+ pAccessibilityElement->SetHint(L"double tap to move ," + *pChildIndexText + L", list");
+ r = pAccessibilityContainer->AddElement(*pAccessibilityElement);
+ SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed to add accessibility element.", GetErrorMessage(r));
+ }
+
+ if (omittedCount > 1)
+ {
+ omittedCount--;
+ }
+ else
+ {
+ indexRect.y += indexHeight;
+ i++;
+ }
+
+ nonOmittedIndex++;
+ }
+
+ return E_SUCCESS;
+
+CATCH:
+ delete pAccessibilityElement;
+ return r;
+}
+
+result
_FastScrollIndexView::UpdateIndex(bool bNeedUpdateBaseIndex)
{
result r = E_SUCCESS;
SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
}
+result
+_FastScrollPresenter::AddAccessibilityElement(const _AccessibilityContainer& control, bool onAccessibility)
+{
+ _FastScrollIndexView* pIndexView = GetIndexView(0);
+ SysTryReturnResult(NID_UI_CTRL, pIndexView, GetLastResult(), "Failed to get fastscroll indexview.",
+ GetErrorMessage(GetLastResult()));
+
+ _AccessibilityContainer* pAccessibilityContainer = const_cast <_AccessibilityContainer*>(&control);
+ result r = pAccessibilityContainer->RemoveAllElement();
+ SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to remove accessibility elements.");
+ _AccessibilityElement* pAccessibilityElement = null;
+
+ if (onAccessibility)
+ {
+ r = pIndexView->AddAccessibilityElement(control);
+ SysTryReturnResult(NID_UI_CTRL, r = E_SUCCESS, r, "Failed to Add accessibility element.");
+ }
+ else
+ {
+ pAccessibilityElement = new (std::nothrow) _AccessibilityElement(true);
+ SysTryReturnResult(NID_UI_CTRL, pAccessibilityElement, E_OUT_OF_MEMORY, "Memory allocation failed.");
+
+ pAccessibilityElement->SetBounds(pIndexView->GetIndexBounds());
+ pAccessibilityElement->SetTrait(L"Fast scroll bar");
+ pAccessibilityElement->SetName(L"FastScroll");
+ pAccessibilityElement->SetHint(L"double tap to enter fast scroll mode");
+ r = pAccessibilityContainer->AddElement(*pAccessibilityElement);
+ SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed to Add accessibility element.", GetErrorMessage(r));
+ }
+ return E_SUCCESS;
+
+CATCH:
+ delete pAccessibilityElement;
+ return r;
+}
+
void
_FastScrollPresenter::OnParentBoundsChanged(void)
{
}
void
+_FastScrollPresenter::OnAncestorVisibleStateChanged(const _Control& control)
+{
+ OnTouchReleasedAndCanceled();
+}
+
+void
+_FastScrollPresenter::OnAncestorEnableStateChanged(const _Control& control)
+{
+ OnTouchReleasedAndCanceled();
+}
+
+void
+_FastScrollPresenter::OnAncestorInputEnableStateChanged(const _Control& control)
+{
+ OnTouchReleasedAndCanceled();
+}
+
+void
_FastScrollPresenter::OnFontChanged(Font* pFont)
{
__pViewConfig->__pFont = pFont;
_FastScrollPresenter::OnTouchPressedAndMoved(const FloatPoint& point, bool animation)
{
result r = E_SUCCESS;
- if (__scrollVisibility == false)
- {
- r = SetScrollVisibility(true);
- SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, true, r, "[%s] Failed to fade out fastscroll.", GetErrorMessage(r));
- }
_FastScrollIndex* pSelectedIndex = SelectOnIndexViews(point, animation);
if (pSelectedIndex && (__pSelectedIndex != pSelectedIndex))
SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, true, r, "[%s] Failed to clear the popup index.", GetErrorMessage(r));
__pSelectedIndex = null;
- if (__scrollVisibility == true)
- {
- r = SetScrollVisibility(false);
- SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, true, r, "[%s] Failed to fade out fastscroll.", GetErrorMessage(r));
- }
return true;
}
#include "FUiCtrl_IFastScrollListener.h"
#include "FUiCtrl_FastScrollPresenter.h"
#include "FUiCtrl_FastScrollIndex.h"
+#include "FUi_IAccessibilityListener.h"
+#include "FUi_AccessibilityContainer.h"
+#include "FUi_AccessibilityElement.h"
+#include "FUi_AccessibilityManager.h"
namespace Tizen { namespace Ui { namespace Controls
{
result SetScrollVisibility(bool visibility);
bool GetScrollVisibility(void) const;
void CancelFadeEffect(void);
+ result InitializeAccessibility(void);
+ result AddAccessibilityElement(const Tizen::Ui::_AccessibilityContainer& control, bool onAccessibility);
void AddFastScrollEventListener(const Tizen::Ui::Controls::_IUiFastScrollListener& listener);
void RemoveFastScrollEventListener(const Tizen::Ui::Controls::_IUiFastScrollListener& listener);
void OnParentBoundsChanged(void);
+ virtual result OnAttachedToMainTree(void);
virtual void OnDraw(void);
virtual bool OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo);
virtual bool OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo);
virtual bool OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo);
virtual bool OnTouchCanceled(const _Control& source, const _TouchInfo& touchinfo);
+ virtual void OnAncestorVisibleStateChanged(const _Control& control);
+ virtual void OnAncestorEnableStateChanged(const _Control& control);
+ virtual void OnAncestorInputEnableStateChanged(const _Control& control);
virtual void OnFontChanged(Tizen::Graphics::Font* pFont);
virtual void OnFontInfoRequested(unsigned long& style, float& size);
virtual Tizen::Ui::Animations::HitTestResult HitTest(const Tizen::Graphics::FloatPoint& point);
private:
_FastScrollPresenter* __pPresenter;
+ Tizen::Ui::_IAccessibilityListener* __pAccessibilityListener;
};
}}} // Tizen::Ui::Controls
bool GetIndexVisibility(void) const;
result SetSelectedIndexVisibility(bool visibility, bool bAnimation);
bool GetSelectedIndexVisibility(void) const;
+ result AddAccessibilityElement(const Tizen::Ui::_AccessibilityContainer& control);
result UpdateIndex(bool bNeedUpdateBaseIndex);
void AddFastScrollEventListener(const Tizen::Ui::Controls::_IUiFastScrollListener& listener);
void RemoveFastScrollEventListener(const Tizen::Ui::Controls::_IUiFastScrollListener& listener);
+ result AddAccessibilityElement(const Tizen::Ui::_AccessibilityContainer& control, bool onAccessibility);
void OnParentBoundsChanged(void);
bool OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo);
bool OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo);
bool OnTouchCanceled(const _Control& source, const _TouchInfo& touchinfo);
+ void OnAncestorVisibleStateChanged(const _Control& control);
+ void OnAncestorEnableStateChanged(const _Control& control);
+ void OnAncestorInputEnableStateChanged(const _Control& control);
void OnFontChanged(Tizen::Graphics::Font* pFont);
void OnFontInfoRequested(unsigned long& style, float& size);
result SetFontInfo(unsigned long style, float size);