From: Richard Huang Date: Fri, 12 Jun 2015 15:48:12 +0000 (+0100) Subject: Add support for new accessibility actions X-Git-Tag: dali_1.0.47~19^2 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=94517504b052e71c97105d13625d7f2ce5933889 Add support for new accessibility actions 1. Rename AccessibilityFocusManager to AccessibilityManager 2. Added support for new accessibility actions Change-Id: If39a4a242c0fe80a3e6fe9a69dfff827d0554aab --- diff --git a/automated-tests/src/dali-toolkit-internal/CMakeLists.txt b/automated-tests/src/dali-toolkit-internal/CMakeLists.txt index c3b14ab..53f4806 100644 --- a/automated-tests/src/dali-toolkit-internal/CMakeLists.txt +++ b/automated-tests/src/dali-toolkit-internal/CMakeLists.txt @@ -15,7 +15,7 @@ SET(TC_SOURCES # Append list of test harness files (Won't get parsed for test cases) LIST(APPEND TC_SOURCES ../dali-toolkit/dali-toolkit-test-utils/test-harness.cpp - ../dali-toolkit/dali-toolkit-test-utils/toolkit-accessibility-manager.cpp + ../dali-toolkit/dali-toolkit-test-utils/toolkit-accessibility-adaptor.cpp ../dali-toolkit/dali-toolkit-test-utils/toolkit-application.cpp ../dali-toolkit/dali-toolkit-test-utils/toolkit-clipboard.cpp ../dali-toolkit/dali-toolkit-test-utils/toolkit-imf-manager.cpp diff --git a/automated-tests/src/dali-toolkit/CMakeLists.txt b/automated-tests/src/dali-toolkit/CMakeLists.txt index bc2bfb0..aeb79d4 100644 --- a/automated-tests/src/dali-toolkit/CMakeLists.txt +++ b/automated-tests/src/dali-toolkit/CMakeLists.txt @@ -44,7 +44,7 @@ SET(TC_SOURCES utc-Dali-ControlImpl.cpp utc-Dali-DefaultControls.cpp utc-Dali-DissolveEffect.cpp - utc-Dali-AccessibilityFocusManager.cpp + utc-Dali-AccessibilityManager.cpp utc-Dali-IrisEffect.cpp utc-Dali-ItemLayout.cpp utc-Dali-ItemView.cpp @@ -65,7 +65,7 @@ SET(TC_SOURCES # Append list of test harness files (Won't get parsed for test cases) LIST(APPEND TC_SOURCES dali-toolkit-test-utils/test-harness.cpp - dali-toolkit-test-utils/toolkit-accessibility-manager.cpp + dali-toolkit-test-utils/toolkit-accessibility-adaptor.cpp dali-toolkit-test-utils/toolkit-application.cpp dali-toolkit-test-utils/toolkit-clipboard.cpp dali-toolkit-test-utils/toolkit-imf-manager.cpp @@ -74,6 +74,7 @@ LIST(APPEND TC_SOURCES dali-toolkit-test-utils/toolkit-singleton-service.cpp dali-toolkit-test-utils/toolkit-timer.cpp dali-toolkit-test-utils/toolkit-clipboard-event-notifier.cpp + dali-toolkit-test-utils/toolkit-tts-player.cpp dali-toolkit-test-utils/dummy-control.cpp dali-toolkit-test-utils/dali-test-suite-utils.cpp dali-toolkit-test-utils/test-application.cpp diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-accessibility-adaptor.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-accessibility-adaptor.cpp new file mode 100644 index 0000000..9ba46ca --- /dev/null +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-accessibility-adaptor.cpp @@ -0,0 +1,283 @@ +/* + * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include "toolkit-accessibility-adaptor.h" + +#include + +namespace Dali +{ + +namespace Internal +{ + +namespace Adaptor +{ + +/** + * Stub for the AccessibilityAdaptor + */ +class AccessibilityAdaptor : public BaseObject +{ +public: // Creation & Destruction + + static Dali::AccessibilityAdaptor Get(); + + AccessibilityAdaptor(); + ~AccessibilityAdaptor(); + +public: + + bool IsEnabled() const; + void SetActionHandler(Dali::AccessibilityActionHandler& handler); + void SetGestureHandler(Dali::AccessibilityGestureHandler& handler); + +public: // Signals + +private: + + bool mIsEnabled; + Dali::AccessibilityActionHandler* mActionHandler; + Dali::AccessibilityGestureHandler* mGestureHandler; + + static Dali::AccessibilityAdaptor mToolkitAccessibilityAdaptor; +}; + +Dali::AccessibilityAdaptor AccessibilityAdaptor::mToolkitAccessibilityAdaptor; + + +Dali::AccessibilityAdaptor AccessibilityAdaptor::Get() +{ + if( ! mToolkitAccessibilityAdaptor ) + { + mToolkitAccessibilityAdaptor = Dali::AccessibilityAdaptor( new Dali::Internal::Adaptor::AccessibilityAdaptor() ); + } + return mToolkitAccessibilityAdaptor; +} + +AccessibilityAdaptor::AccessibilityAdaptor() +: mIsEnabled(false) +{ +} + +AccessibilityAdaptor::~AccessibilityAdaptor() +{ +} + +bool AccessibilityAdaptor::IsEnabled() const +{ + return mIsEnabled; +} + +void AccessibilityAdaptor::SetActionHandler(Dali::AccessibilityActionHandler& handler) +{ + mActionHandler = &handler; +} + +void AccessibilityAdaptor::SetGestureHandler(Dali::AccessibilityGestureHandler& handler) +{ + mGestureHandler = &handler; +} + +static Internal::Adaptor::AccessibilityAdaptor& GetImplementation(Dali::AccessibilityAdaptor& adaptor) +{ + BaseObject& handle = adaptor.GetBaseObject(); + return static_cast(handle); +} + + +} // namespace Adaptor +} // namespace Internal + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +AccessibilityAdaptor::AccessibilityAdaptor() +{ +} + +AccessibilityAdaptor AccessibilityAdaptor::Get() +{ + return Internal::Adaptor::AccessibilityAdaptor::Get(); +} + +AccessibilityAdaptor::~AccessibilityAdaptor() +{ +} + +Vector2 AccessibilityAdaptor::GetReadPosition() const +{ + //return Internal::Adaptor::GetImplementation(*this).GetReadPosition(); + return Vector2::ZERO; +} + +bool AccessibilityAdaptor::IsEnabled() const +{ + //return Internal::Adaptor::GetImplementation(*this).IsEnabled(); + return false; +} + +void AccessibilityAdaptor::SetActionHandler(AccessibilityActionHandler& handler) +{ + Internal::Adaptor::GetImplementation(*this).SetActionHandler(handler); +} + +void AccessibilityAdaptor::SetGestureHandler(AccessibilityGestureHandler& handler) +{ + Internal::Adaptor::GetImplementation(*this).SetGestureHandler(handler); +} + +bool AccessibilityAdaptor::HandleActionNextEvent() +{ + return true; //Internal::Adaptor::GetImplementation(*this).HandleActionNextEvent(); +} + +bool AccessibilityAdaptor::HandleActionPreviousEvent() +{ + return true; //Internal::Adaptor::GetImplementation(*this).HandleActionPreviousEvent(); +} + +bool AccessibilityAdaptor::HandleActionActivateEvent() +{ + return true;//Internal::Adaptor::GetImplementation(*this).HandleActionActivateEvent(); +} + +bool AccessibilityAdaptor::HandleActionReadEvent(unsigned int x, unsigned int y, bool allowReadAgain) +{ + return true;//Internal::Adaptor::GetImplementation(*this).HandleActionReadEvent(x, y, allowReadAgain); +} + +bool AccessibilityAdaptor::HandleActionReadNextEvent() +{ + return true;//Internal::Adaptor::GetImplementation(*this).HandleActionReadNextEvent(); +} + +bool AccessibilityAdaptor::HandleActionReadPreviousEvent() +{ + return true;//Internal::Adaptor::GetImplementation(*this).HandleActionReadPreviousEvent(); +} + +bool AccessibilityAdaptor::HandleActionUpEvent() +{ + return true;//Internal::Adaptor::GetImplementation(*this).HandleActionUpEvent(); +} + +bool AccessibilityAdaptor::HandleActionDownEvent() +{ + return true;//Internal::Adaptor::GetImplementation(*this).HandleActionDownEvent(); +} + +bool AccessibilityAdaptor::HandleActionClearFocusEvent() +{ + return true;//Internal::Adaptor::GetImplementation(*this).HandleActionClearFocusEvent(); +} + +bool AccessibilityAdaptor::HandleActionScrollEvent(TouchPoint& point, unsigned long timeStamp) +{ + return true;//Internal::Adaptor::GetImplementation(*this).HandleActionScrollEvent(point, timeStamp); +} + +bool AccessibilityAdaptor::HandleActionBackEvent() +{ + return true;//Internal::Adaptor::GetImplementation(*this).HandleActionBackEvent(); +} + +void AccessibilityAdaptor::HandleActionEnableEvent() +{ + //Internal::Adaptor::GetImplementation(*this).HandleActionEnableEvent(); +} + +void AccessibilityAdaptor::HandleActionDisableEvent() +{ + //Internal::Adaptor::GetImplementation(*this).HandleActionDisableEvent(); +} + +bool AccessibilityAdaptor::HandleActionScrollUpEvent() +{ + return true;//Internal::Adaptor::GetImplementation(*this).HandleActionScrollUpEvent(); +} + +bool AccessibilityAdaptor::HandleActionScrollDownEvent() +{ + return true;//Internal::Adaptor::GetImplementation(*this).HandleActionScrollDownEvent(); +} + +bool AccessibilityAdaptor::HandleActionPageLeftEvent() +{ + return true;//Internal::Adaptor::GetImplementation(*this).HandleActionPageLeftEvent(); +} + +bool AccessibilityAdaptor::HandleActionPageRightEvent() +{ + return true;//Internal::Adaptor::GetImplementation(*this).HandleActionPageRightEvent(); +} + +bool AccessibilityAdaptor::HandleActionPageUpEvent() +{ + return true;//Internal::Adaptor::GetImplementation(*this).HandleActionPageUpEvent(); +} + +bool AccessibilityAdaptor::HandleActionPageDownEvent() +{ + return true;//Internal::Adaptor::GetImplementation(*this).HandleActionPageDownEvent(); +} + +bool AccessibilityAdaptor::HandleActionMoveToFirstEvent() +{ + return true;//Internal::Adaptor::GetImplementation(*this).HandleActionMoveToFirstEvent(); +} + +bool AccessibilityAdaptor::HandleActionMoveToLastEvent() +{ + return true;//Internal::Adaptor::GetImplementation(*this).HandleActionMoveToLastEvent(); +} + +bool AccessibilityAdaptor::HandleActionReadFromTopEvent() +{ + return true;//Internal::Adaptor::GetImplementation(*this).HandleActionReadFromTopEvent(); +} + +bool AccessibilityAdaptor::HandleActionReadFromNextEvent() +{ + return true;//Internal::Adaptor::GetImplementation(*this).HandleActionReadFromNextEvent(); +} + +bool AccessibilityAdaptor::HandleActionZoomEvent() +{ + return true;//Internal::Adaptor::GetImplementation(*this).HandleActionZoomEvent(); +} + +bool AccessibilityAdaptor::HandleActionReadIndicatorInformationEvent() +{ + return true;//Internal::Adaptor::GetImplementation(*this).HandleActionReadIndicatorInformationEvent(); +} + +bool AccessibilityAdaptor::HandleActionReadPauseResumeEvent() +{ + return true;//Internal::Adaptor::GetImplementation(*this).HandleActionReadPauseResumeEvent(); +} + +bool AccessibilityAdaptor::HandleActionStartStopEvent() +{ + return true;//Internal::Adaptor::GetImplementation(*this).HandleActionStartStopEvent(); +} + +AccessibilityAdaptor::AccessibilityAdaptor( Internal::Adaptor::AccessibilityAdaptor* adaptor ) +: BaseHandle( adaptor ) +{ +} + +} // namespace Dali diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-accessibility-manager.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-accessibility-adaptor.h similarity index 54% rename from automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-accessibility-manager.h rename to automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-accessibility-adaptor.h index 6a4b122..5a00f8c 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-accessibility-manager.h +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-accessibility-adaptor.h @@ -1,11 +1,11 @@ -// Prevent normal accessibility manager declaration from loading -#define __DALI_ACCESSIBILITY_MANAGER_H__ +// Prevent normal accessibility adaptor declaration from loading +#define __DALI_ACCESSIBILITY_ADAPTOR_H__ -#ifndef __DALI_TOOLKIT_ACCESSIBILITY_MANAGER_H__ -#define __DALI_TOOLKIT_ACCESSIBILITY_MANAGER_H__ +#ifndef __DALI_TOOLKIT_ACCESSIBILITY_ADAPTOR_H__ +#define __DALI_TOOLKIT_ACCESSIBILITY_ADAPTOR_H__ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2015 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,7 +24,6 @@ // EXTERNAL INCLUDES #include #include -#include #include namespace Dali @@ -33,7 +32,7 @@ namespace Internal { namespace Adaptor { -class AccessibilityManager; +class AccessibilityAdaptor; } } class AccessibilityActionHandler; @@ -41,19 +40,16 @@ class AccessibilityGestureHandler; class TouchPoint; /** - * This creates a stubbed AccessibilityManager so that internal Toolkit Adaptor calls work. + * This creates a stubbed AccessibilityAdaptor so that internal Toolkit Adaptor calls work. */ -class AccessibilityManager : public BaseHandle +class AccessibilityAdaptor : public BaseHandle { -public: // Typedefs - typedef Signal< bool ( AccessibilityManager& ) > AccessibilityActionSignalType; - public: // Construction & Destruction - AccessibilityManager(); - ~AccessibilityManager(); + AccessibilityAdaptor(); + ~AccessibilityAdaptor(); public: // Getters - static AccessibilityManager Get(); + static AccessibilityAdaptor Get(); Vector2 GetReadPosition() const; bool IsEnabled() const; void SetActionHandler(AccessibilityActionHandler& handler); @@ -71,24 +67,24 @@ public: // Getters bool HandleActionBackEvent(); void HandleActionEnableEvent(); void HandleActionDisableEvent(); + bool HandleActionScrollUpEvent(); + bool HandleActionScrollDownEvent(); + bool HandleActionPageLeftEvent(); + bool HandleActionPageRightEvent(); + bool HandleActionPageUpEvent(); + bool HandleActionPageDownEvent(); + bool HandleActionMoveToFirstEvent(); + bool HandleActionMoveToLastEvent(); + bool HandleActionReadFromTopEvent(); + bool HandleActionReadFromNextEvent(); + bool HandleActionZoomEvent(); + bool HandleActionReadIndicatorInformationEvent(); + bool HandleActionReadPauseResumeEvent(); + bool HandleActionStartStopEvent(); -public: // Signals - AccessibilityActionSignalType& StatusChangedSignal(); - AccessibilityActionSignalType& ActionNextSignal(); - AccessibilityActionSignalType& ActionPreviousSignal(); - AccessibilityActionSignalType& ActionActivateSignal(); - AccessibilityActionSignalType& ActionReadSignal(); - AccessibilityActionSignalType& ActionOverSignal(); - AccessibilityActionSignalType& ActionReadNextSignal(); - AccessibilityActionSignalType& ActionReadPreviousSignal(); - AccessibilityActionSignalType& ActionUpSignal(); - AccessibilityActionSignalType& ActionDownSignal(); - AccessibilityActionSignalType& ActionClearFocusSignal(); - AccessibilityActionSignalType& ActionBackSignal(); - - AccessibilityManager( Internal::Adaptor::AccessibilityManager* manager ); + AccessibilityAdaptor( Internal::Adaptor::AccessibilityAdaptor* adaptor ); }; } // namespace Dali -#endif // __DALI_TOOLKIT_ACCESSIBILITY_MANAGER_H__ +#endif // __DALI_TOOLKIT_ACCESSIBILITY_ADAPTOR_H__ diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-accessibility-manager.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-accessibility-manager.cpp deleted file mode 100644 index 2f58788..0000000 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-accessibility-manager.cpp +++ /dev/null @@ -1,366 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include "toolkit-accessibility-manager.h" - -#include - -namespace Dali -{ - -namespace Internal -{ - -namespace Adaptor -{ - -/** - * Stub for the AccessibilityManager - */ -class AccessibilityManager : public BaseObject -{ -public: // Creation & Destruction - - static Dali::AccessibilityManager Get(); - - AccessibilityManager(); - ~AccessibilityManager(); - -public: - - bool IsEnabled() const; - void SetActionHandler(Dali::AccessibilityActionHandler& handler); - void SetGestureHandler(Dali::AccessibilityGestureHandler& handler); - -public: // Signals - - Dali::AccessibilityManager::AccessibilityActionSignalType& StatusChangedSignal(); - Dali::AccessibilityManager::AccessibilityActionSignalType& ActionNextSignal(); - Dali::AccessibilityManager::AccessibilityActionSignalType& ActionPreviousSignal(); - Dali::AccessibilityManager::AccessibilityActionSignalType& ActionActivateSignal(); - Dali::AccessibilityManager::AccessibilityActionSignalType& ActionReadSignal(); - Dali::AccessibilityManager::AccessibilityActionSignalType& ActionReadNextSignal(); - Dali::AccessibilityManager::AccessibilityActionSignalType& ActionReadPreviousSignal(); - Dali::AccessibilityManager::AccessibilityActionSignalType& ActionOverSignal(); - Dali::AccessibilityManager::AccessibilityActionSignalType& ActionUpSignal(); - Dali::AccessibilityManager::AccessibilityActionSignalType& ActionDownSignal(); - Dali::AccessibilityManager::AccessibilityActionSignalType& ActionClearFocusSignal(); - Dali::AccessibilityManager::AccessibilityActionSignalType& ActionBackSignal(); - Dali::AccessibilityManager::AccessibilityActionSignalType& ActionControlPanelOpenSignal(); - -private: - - Dali::AccessibilityManager::AccessibilityActionSignalType mStatusChangedSignal; - Dali::AccessibilityManager::AccessibilityActionSignalType mActionNextSignal; - Dali::AccessibilityManager::AccessibilityActionSignalType mActionPreviousSignal; - Dali::AccessibilityManager::AccessibilityActionSignalType mActionActivateSignal; - Dali::AccessibilityManager::AccessibilityActionSignalType mActionReadSignal; - Dali::AccessibilityManager::AccessibilityActionSignalType mActionReadNextSignal; - Dali::AccessibilityManager::AccessibilityActionSignalType mActionReadPreviousSignal; - Dali::AccessibilityManager::AccessibilityActionSignalType mActionOverSignal; - Dali::AccessibilityManager::AccessibilityActionSignalType mActionUpSignal; - Dali::AccessibilityManager::AccessibilityActionSignalType mActionDownSignal; - Dali::AccessibilityManager::AccessibilityActionSignalType mActionClearFocusSignal; - Dali::AccessibilityManager::AccessibilityActionSignalType mActionBackSignal; - Dali::AccessibilityManager::AccessibilityActionSignalType mActionControlPanelOpenSignal; - - bool mIsEnabled; - Dali::AccessibilityActionHandler* mActionHandler; - Dali::AccessibilityGestureHandler* mGestureHandler; - - static Dali::AccessibilityManager mToolkitAccessibilityManager; -}; - -Dali::AccessibilityManager AccessibilityManager::mToolkitAccessibilityManager; - - -Dali::AccessibilityManager AccessibilityManager::Get() -{ - if( ! mToolkitAccessibilityManager ) - { - mToolkitAccessibilityManager = Dali::AccessibilityManager( new Dali::Internal::Adaptor::AccessibilityManager() ); - } - return mToolkitAccessibilityManager; -} - -AccessibilityManager::AccessibilityManager() -: mIsEnabled(false) -{ -} - -AccessibilityManager::~AccessibilityManager() -{ -} - -bool AccessibilityManager::IsEnabled() const -{ - return mIsEnabled; -} - -void AccessibilityManager::SetActionHandler(Dali::AccessibilityActionHandler& handler) -{ - mActionHandler = &handler; -} - -void AccessibilityManager::SetGestureHandler(Dali::AccessibilityGestureHandler& handler) -{ - mGestureHandler = &handler; -} - -Dali::AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::StatusChangedSignal() -{ - return mStatusChangedSignal; -} - -Dali::AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionNextSignal() -{ - return mActionNextSignal; -} - -Dali::AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionPreviousSignal() -{ - return mActionPreviousSignal; -} - -Dali::AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionActivateSignal() -{ - return mActionActivateSignal; -} - -Dali::AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionReadSignal() -{ - return mActionReadSignal; -} - -Dali::AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionReadNextSignal() -{ - return mActionReadNextSignal; -} - -Dali::AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionReadPreviousSignal() -{ - return mActionReadPreviousSignal; -} - -Dali::AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionOverSignal() -{ - return mActionOverSignal; -} - -Dali::AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionUpSignal() -{ - return mActionUpSignal; -} - -Dali::AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionDownSignal() -{ - return mActionDownSignal; -} - -Dali::AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionClearFocusSignal() -{ - return mActionClearFocusSignal; -} - -Dali::AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionBackSignal() -{ - return mActionBackSignal; -} - -Dali::AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionControlPanelOpenSignal() -{ - return mActionControlPanelOpenSignal; -} - -static Internal::Adaptor::AccessibilityManager& GetImplementation(Dali::AccessibilityManager& manager) -{ - BaseObject& handle = manager.GetBaseObject(); - return static_cast(handle); -} - - -} // namespace Adaptor -} // namespace Internal - -//////////////////////////////////////////////////////////////////////////////////////////////////// - -AccessibilityManager::AccessibilityManager() -{ -} - -AccessibilityManager AccessibilityManager::Get() -{ - return Internal::Adaptor::AccessibilityManager::Get(); -} - -AccessibilityManager::~AccessibilityManager() -{ -} - -Vector2 AccessibilityManager::GetReadPosition() const -{ - //return Internal::Adaptor::GetImplementation(*this).GetReadPosition(); - return Vector2::ZERO; -} - -bool AccessibilityManager::IsEnabled() const -{ - //return Internal::Adaptor::GetImplementation(*this).IsEnabled(); - return false; -} - -void AccessibilityManager::SetActionHandler(AccessibilityActionHandler& handler) -{ - Internal::Adaptor::GetImplementation(*this).SetActionHandler(handler); -} - -void AccessibilityManager::SetGestureHandler(AccessibilityGestureHandler& handler) -{ - Internal::Adaptor::GetImplementation(*this).SetGestureHandler(handler); -} - -bool AccessibilityManager::HandleActionNextEvent() -{ - return true; //Internal::Adaptor::GetImplementation(*this).HandleActionNextEvent(); -} - -bool AccessibilityManager::HandleActionPreviousEvent() -{ - return true; //Internal::Adaptor::GetImplementation(*this).HandleActionPreviousEvent(); -} - -bool AccessibilityManager::HandleActionActivateEvent() -{ - return true;//Internal::Adaptor::GetImplementation(*this).HandleActionActivateEvent(); -} - -bool AccessibilityManager::HandleActionReadEvent(unsigned int x, unsigned int y, bool allowReadAgain) -{ - return true;//Internal::Adaptor::GetImplementation(*this).HandleActionReadEvent(x, y, allowReadAgain); -} - -bool AccessibilityManager::HandleActionReadNextEvent() -{ - return true;//Internal::Adaptor::GetImplementation(*this).HandleActionReadNextEvent(); -} - -bool AccessibilityManager::HandleActionReadPreviousEvent() -{ - return true;//Internal::Adaptor::GetImplementation(*this).HandleActionReadPreviousEvent(); -} - -bool AccessibilityManager::HandleActionUpEvent() -{ - return true;//Internal::Adaptor::GetImplementation(*this).HandleActionUpEvent(); -} - -bool AccessibilityManager::HandleActionDownEvent() -{ - return true;//Internal::Adaptor::GetImplementation(*this).HandleActionDownEvent(); -} - -bool AccessibilityManager::HandleActionClearFocusEvent() -{ - return true;//Internal::Adaptor::GetImplementation(*this).HandleActionClearFocusEvent(); -} - -bool AccessibilityManager::HandleActionScrollEvent(TouchPoint& point, unsigned long timeStamp) -{ - return true;//Internal::Adaptor::GetImplementation(*this).HandleActionScrollEvent(point, timeStamp); -} - -bool AccessibilityManager::HandleActionBackEvent() -{ - return true;//Internal::Adaptor::GetImplementation(*this).HandleActionBackEvent(); -} - -void AccessibilityManager::HandleActionEnableEvent() -{ - //Internal::Adaptor::GetImplementation(*this).HandleActionEnableEvent(); -} - -void AccessibilityManager::HandleActionDisableEvent() -{ - //Internal::Adaptor::GetImplementation(*this).HandleActionDisableEvent(); -} - -AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::StatusChangedSignal() -{ - return Internal::Adaptor::GetImplementation(*this).StatusChangedSignal(); -} - -AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionNextSignal() -{ - return Internal::Adaptor::GetImplementation(*this).ActionNextSignal(); -} - -AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionPreviousSignal() -{ - return Internal::Adaptor::GetImplementation(*this).ActionPreviousSignal(); -} - -AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionActivateSignal() -{ - return Internal::Adaptor::GetImplementation(*this).ActionActivateSignal(); -} - -AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionOverSignal() -{ - return Internal::Adaptor::GetImplementation(*this).ActionOverSignal(); -} - -AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionReadSignal() -{ - return Internal::Adaptor::GetImplementation(*this).ActionReadSignal(); -} - -AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionReadNextSignal() -{ - return Internal::Adaptor::GetImplementation(*this).ActionReadNextSignal(); -} - -AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionReadPreviousSignal() -{ - return Internal::Adaptor::GetImplementation(*this).ActionReadPreviousSignal(); -} - -AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionUpSignal() -{ - return Internal::Adaptor::GetImplementation(*this).ActionUpSignal(); -} - -AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionDownSignal() -{ - return Internal::Adaptor::GetImplementation(*this).ActionDownSignal(); -} - -AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionClearFocusSignal() -{ - return Internal::Adaptor::GetImplementation(*this).ActionClearFocusSignal(); -} - -AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionBackSignal() -{ - return Internal::Adaptor::GetImplementation(*this).ActionBackSignal(); -} - -AccessibilityManager::AccessibilityManager( Internal::Adaptor::AccessibilityManager* manager ) -: BaseHandle( manager ) -{ -} - -} // namespace Dali diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-tts-player.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-tts-player.cpp new file mode 100644 index 0000000..abd5f1c --- /dev/null +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-tts-player.cpp @@ -0,0 +1,84 @@ +#include "toolkit-tts-player.h" + +/* + * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// EXTERNAL INCLUDES +#include +#include + +namespace Dali +{ + +TtsPlayer::TtsPlayer() +{ +} + +TtsPlayer TtsPlayer::Get(Dali::TtsPlayer::Mode mode) +{ + TtsPlayer ttsPlayer; + + return ttsPlayer; +} + +TtsPlayer::~TtsPlayer() +{ +} + +TtsPlayer::TtsPlayer(const TtsPlayer& handle) +: BaseHandle(handle) +{ +} + +TtsPlayer& TtsPlayer::operator=(const TtsPlayer& rhs) +{ + BaseHandle::operator=(rhs); + return *this; +} + +void TtsPlayer::Play(const std::string& text) +{ + // GetImplementation(*this).Play(text); +} + +void TtsPlayer::Stop() +{ + // GetImplementation(*this).Stop(); +} + +void TtsPlayer::Pause() +{ + // GetImplementation(*this).Pause(); +} + +void TtsPlayer::Resume() +{ + // GetImplementation(*this).Resume(); +} + +TtsPlayer::State TtsPlayer::GetState() +{ + return READY; // GetImplementation(*this).GetState(); +} + +TtsPlayer::StateChangedSignalType& TtsPlayer::StateChangedSignal() +{ + return mStateChangedSignal; // GetImplementation(*this).StateChangedSignal(); +} + + +} // namespace Dali diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-tts-player.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-tts-player.h new file mode 100644 index 0000000..269039e --- /dev/null +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-tts-player.h @@ -0,0 +1,82 @@ +#ifndef __DALI_TOOLKIT_TTS_PLAYER_H__ +#define __DALI_TOOLKIT_TTS_PLAYER_H__ + +/* + * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// EXTERNAL INCLUDES +#include +#include + +namespace Dali +{ + +namespace Internal DALI_INTERNAL +{ +namespace Adaptor +{ +class TtsPlayer; +} +} + +class DALI_IMPORT_API TtsPlayer : public BaseHandle +{ +public: + + enum Mode + { + DEFAULT = 0, ///< Default mode for normal application + NOTIFICATION, ///< Notification mode + SCREEN_READER, ///< Screen reader mode + MODE_NUM + }; + + enum State + { + UNAVAILABLE = 0, ///< Player is not available + READY, ///< Player is ready to play + PLAYING, ///< Player is playing + PAUSED ///< Player is paused + }; + + typedef Signal< void ( const Dali::TtsPlayer::State, const Dali::TtsPlayer::State ) > StateChangedSignalType; + + TtsPlayer(); + static TtsPlayer Get(Dali::TtsPlayer::Mode mode = Dali::TtsPlayer::DEFAULT); + ~TtsPlayer(); + + TtsPlayer(const TtsPlayer& handle); + TtsPlayer& operator=(const TtsPlayer& rhs); + void Play(const std::string& text); + void Stop(); + void Pause(); + void Resume(); + State GetState(); + Dali::TtsPlayer::StateChangedSignalType& StateChangedSignal(); + +public: + + // explicit DALI_INTERNAL TtsPlayer( Internal::Adaptor::TtsPlayer* ttsPlayer ); + +private: + + StateChangedSignalType mStateChangedSignal; +}; + +} // namespace Dali + +#endif // __DALI_TOOLKIT_TTS_PLAYER_H__ diff --git a/automated-tests/src/dali-toolkit/utc-Dali-AccessibilityFocusManager.cpp b/automated-tests/src/dali-toolkit/utc-Dali-AccessibilityManager.cpp similarity index 80% rename from automated-tests/src/dali-toolkit/utc-Dali-AccessibilityFocusManager.cpp rename to automated-tests/src/dali-toolkit/utc-Dali-AccessibilityManager.cpp index 4671606..7dfe82f 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-AccessibilityFocusManager.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-AccessibilityManager.cpp @@ -28,12 +28,12 @@ using namespace Dali; using namespace Toolkit; -void utc_dali_toolkit_accessibility_focus_manager_startup(void) +void utc_dali_toolkit_accessibility_manager_startup(void) { test_return_value = TET_UNDEF; } -void utc_dali_toolkit_accessibility_focus_manager_cleanup(void) +void utc_dali_toolkit_accessibility_manager_cleanup(void) { test_return_value = TET_PASS; } @@ -90,11 +90,11 @@ public: FocusOvershotCallback(bool& signalReceived) : mSignalVerified(signalReceived), mCurrentFocusedActor(), - mFocusOvershotDirection(Toolkit::AccessibilityFocusManager::OVERSHOT_NEXT) + mFocusOvershotDirection(Toolkit::AccessibilityManager::OVERSHOT_NEXT) { } - void Callback(Actor currentFocusedActor, Toolkit::AccessibilityFocusManager::FocusOvershotDirection direction) + void Callback(Actor currentFocusedActor, Toolkit::AccessibilityManager::FocusOvershotDirection direction) { tet_infoline("Verifying FocusOvershotCallback()"); @@ -111,7 +111,7 @@ public: bool& mSignalVerified; Actor mCurrentFocusedActor; - Toolkit::AccessibilityFocusManager::FocusOvershotDirection mFocusOvershotDirection; + Toolkit::AccessibilityManager::FocusOvershotDirection mFocusOvershotDirection; }; // Functor to test whether focused actor activated signal is emitted. @@ -131,13 +131,13 @@ public: } // namespace -int UtcDaliAccessibilityFocusManagerGet(void) +int UtcDaliAccessibilityManagerGet(void) { ToolkitTestApplication application; - tet_infoline(" UtcDaliAccessibilityFocusManagerGet"); + tet_infoline(" UtcDaliAccessibilityManagerGet"); - AccessibilityFocusManager manager; + AccessibilityManager manager; //Ensure object is created by checking if it's registered ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry(); @@ -146,46 +146,46 @@ int UtcDaliAccessibilityFocusManagerGet(void) gObjectCreatedCallBackCalled = false; registry.ObjectCreatedSignal().Connect( &TestCallback ); { - manager = AccessibilityFocusManager::Get(); + manager = AccessibilityManager::Get(); DALI_TEST_CHECK(manager); } DALI_TEST_CHECK( gObjectCreatedCallBackCalled ); - AccessibilityFocusManager newManager = AccessibilityFocusManager::Get(); + AccessibilityManager newManager = AccessibilityManager::Get(); DALI_TEST_CHECK(newManager); - // Check that focus manager is a singleton + // Check that accessibility manager is a singleton DALI_TEST_CHECK(manager == newManager); END_TEST; } -int UtcDaliAccessibilityFocusManagerSetAndGetAccessibilityAttribute(void) +int UtcDaliAccessibilityManagerSetAndGetAccessibilityAttribute(void) { ToolkitTestApplication application; - tet_infoline(" UtcDaliAccessibilityFocusManagerSetAndGetAccessibilityAttribute"); + tet_infoline(" UtcDaliAccessibilityManagerSetAndGetAccessibilityAttribute"); - AccessibilityFocusManager manager = AccessibilityFocusManager::Get(); + AccessibilityManager manager = AccessibilityManager::Get(); DALI_TEST_CHECK(manager); Actor actor = Actor::New(); - DALI_TEST_CHECK(manager.GetAccessibilityAttribute(actor, AccessibilityFocusManager::ACCESSIBILITY_LABEL) == ""); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(actor, AccessibilityManager::ACCESSIBILITY_LABEL) == ""); - manager.SetAccessibilityAttribute(actor, AccessibilityFocusManager::ACCESSIBILITY_LABEL, "Description"); - DALI_TEST_CHECK(manager.GetAccessibilityAttribute(actor, AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "Description"); + manager.SetAccessibilityAttribute(actor, AccessibilityManager::ACCESSIBILITY_LABEL, "Description"); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(actor, AccessibilityManager::ACCESSIBILITY_LABEL) == "Description"); - manager.SetAccessibilityAttribute(actor, AccessibilityFocusManager::ACCESSIBILITY_LABEL, "New description"); - DALI_TEST_CHECK(manager.GetAccessibilityAttribute(actor, AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "New description"); + manager.SetAccessibilityAttribute(actor, AccessibilityManager::ACCESSIBILITY_LABEL, "New description"); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(actor, AccessibilityManager::ACCESSIBILITY_LABEL) == "New description"); END_TEST; } -int UtcDaliAccessibilityFocusManagerSetAndGetFocusOrder(void) +int UtcDaliAccessibilityManagerSetAndGetFocusOrder(void) { ToolkitTestApplication application; - tet_infoline(" UtcDaliAccessibilityFocusManagerSetAndGetFocusOrder"); + tet_infoline(" UtcDaliAccessibilityManagerSetAndGetFocusOrder"); - AccessibilityFocusManager manager = AccessibilityFocusManager::Get(); + AccessibilityManager manager = AccessibilityManager::Get(); DALI_TEST_CHECK(manager); Actor first = Actor::New(); @@ -195,59 +195,59 @@ int UtcDaliAccessibilityFocusManagerSetAndGetFocusOrder(void) // Set the focus order and description for the first actor manager.SetFocusOrder(first, 1); - manager.SetAccessibilityAttribute(first, AccessibilityFocusManager::ACCESSIBILITY_LABEL, "first"); + manager.SetAccessibilityAttribute(first, AccessibilityManager::ACCESSIBILITY_LABEL, "first"); DALI_TEST_CHECK(manager.GetFocusOrder(first) == 1); - DALI_TEST_CHECK(manager.GetAccessibilityAttribute(first, AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "first"); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(first, AccessibilityManager::ACCESSIBILITY_LABEL) == "first"); // Set the focus order and description for the second actor manager.SetFocusOrder(second, 2); - manager.SetAccessibilityAttribute(second, AccessibilityFocusManager::ACCESSIBILITY_LABEL, "second"); + manager.SetAccessibilityAttribute(second, AccessibilityManager::ACCESSIBILITY_LABEL, "second"); DALI_TEST_CHECK(manager.GetFocusOrder(second) == 2); - DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "second"); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, AccessibilityManager::ACCESSIBILITY_LABEL) == "second"); // check that the focus order of the first actor is changed manager.SetFocusOrder(first, 2); DALI_TEST_CHECK(manager.GetFocusOrder(first) == 2); // make sure the change of focus order doesn't affect the actor's description - DALI_TEST_CHECK(manager.GetAccessibilityAttribute(first, AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "first"); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(first, AccessibilityManager::ACCESSIBILITY_LABEL) == "first"); // check that the focus order of the second actor is increased to 3 DALI_TEST_CHECK(manager.GetFocusOrder(second) == 3); // make sure the change of focus order doesn't affect the actor's description - DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "second"); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, AccessibilityManager::ACCESSIBILITY_LABEL) == "second"); // check that the focus order of the second actor is changed to 1 manager.SetFocusOrder(second, 1); DALI_TEST_CHECK(manager.GetFocusOrder(second) == 1); // make sure the change of focus order doesn't affect the actor's description - DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "second"); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, AccessibilityManager::ACCESSIBILITY_LABEL) == "second"); // Set the focus order and description for the third actor Actor third = Actor::New(); manager.SetFocusOrder(third, 1); - manager.SetAccessibilityAttribute(third, AccessibilityFocusManager::ACCESSIBILITY_LABEL, "third"); + manager.SetAccessibilityAttribute(third, AccessibilityManager::ACCESSIBILITY_LABEL, "third"); DALI_TEST_CHECK(manager.GetFocusOrder(third) == 1); - DALI_TEST_CHECK(manager.GetAccessibilityAttribute(third, AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "third"); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(third, AccessibilityManager::ACCESSIBILITY_LABEL) == "third"); // check that the focus order of the second actor is increased to 2. DALI_TEST_CHECK(manager.GetFocusOrder(second) == 2); // make sure the change of focus order doesn't affect the actor's description - DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "second"); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, AccessibilityManager::ACCESSIBILITY_LABEL) == "second"); // check that the focus order of the first actor is increased to 3. DALI_TEST_CHECK(manager.GetFocusOrder(first) == 3); // make sure the change of focus order doesn't affect the actor's description - DALI_TEST_CHECK(manager.GetAccessibilityAttribute(first, AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "first"); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(first, AccessibilityManager::ACCESSIBILITY_LABEL) == "first"); END_TEST; } -int UtcDaliAccessibilityFocusManagerGenerateNewFocusOrder(void) +int UtcDaliAccessibilityManagerGenerateNewFocusOrder(void) { ToolkitTestApplication application; - tet_infoline(" UtcDaliAccessibilityFocusManagerGenerateNewFocusOrder"); + tet_infoline(" UtcDaliAccessibilityManagerGenerateNewFocusOrder"); - AccessibilityFocusManager manager = AccessibilityFocusManager::Get(); + AccessibilityManager manager = AccessibilityManager::Get(); DALI_TEST_CHECK(manager); DALI_TEST_CHECK(1 == manager.GenerateNewFocusOrder()); @@ -258,7 +258,7 @@ int UtcDaliAccessibilityFocusManagerGenerateNewFocusOrder(void) // Set the focus order for the first actor manager.SetFocusOrder(first, 1); - manager.SetAccessibilityAttribute(first, AccessibilityFocusManager::ACCESSIBILITY_LABEL, "first"); + manager.SetAccessibilityAttribute(first, AccessibilityManager::ACCESSIBILITY_LABEL, "first"); DALI_TEST_CHECK(manager.GetFocusOrder(first) == 1); //Test for new focus order @@ -266,18 +266,18 @@ int UtcDaliAccessibilityFocusManagerGenerateNewFocusOrder(void) // Set the focus order for the first actor manager.SetFocusOrder(second, 2); - manager.SetAccessibilityAttribute(second, AccessibilityFocusManager::ACCESSIBILITY_LABEL, "first"); + manager.SetAccessibilityAttribute(second, AccessibilityManager::ACCESSIBILITY_LABEL, "first"); DALI_TEST_CHECK(manager.GetFocusOrder(second) == 2); END_TEST; } -int UtcDaliAccessibilityFocusManagerGetActorByFocusOrder(void) +int UtcDaliAccessibilityManagerGetActorByFocusOrder(void) { ToolkitTestApplication application; - tet_infoline(" UtcDaliAccessibilityFocusManagerGetActorByFocusOrder"); + tet_infoline(" UtcDaliAccessibilityManagerGetActorByFocusOrder"); - AccessibilityFocusManager manager = AccessibilityFocusManager::Get(); + AccessibilityManager manager = AccessibilityManager::Get(); DALI_TEST_CHECK(manager); // Create the actors and set their focus orders @@ -321,13 +321,13 @@ int UtcDaliAccessibilityFocusManagerGetActorByFocusOrder(void) END_TEST; } -int UtcDaliAccessibilityFocusManagerSetAndGetCurrentFocusActor(void) +int UtcDaliAccessibilityManagerSetAndGetCurrentFocusActor(void) { ToolkitTestApplication application; - tet_infoline(" UtcDaliAccessibilityFocusManagerSetAndGetCurrentFocusActor"); + tet_infoline(" UtcDaliAccessibilityManagerSetAndGetCurrentFocusActor"); - AccessibilityFocusManager manager = AccessibilityFocusManager::Get(); + AccessibilityManager manager = AccessibilityManager::Get(); DALI_TEST_CHECK(manager); // Create the first actor and add it to the stage @@ -412,13 +412,13 @@ int UtcDaliAccessibilityFocusManagerSetAndGetCurrentFocusActor(void) END_TEST; } -int UtcDaliAccessibilityFocusManagerGetCurrentFocusGroup(void) +int UtcDaliAccessibilityManagerGetCurrentFocusGroup(void) { ToolkitTestApplication application; - tet_infoline(" UtcDaliAccessibilityFocusManagerGetCurrentFocusGroup"); + tet_infoline(" UtcDaliAccessibilityManagerGetCurrentFocusGroup"); - AccessibilityFocusManager manager = AccessibilityFocusManager::Get(); + AccessibilityManager manager = AccessibilityManager::Get(); DALI_TEST_CHECK(manager); // Create an actor with two child actors and add it to the stage @@ -479,13 +479,13 @@ int UtcDaliAccessibilityFocusManagerGetCurrentFocusGroup(void) END_TEST; } -int UtcDaliAccessibilityFocusManagerGetCurrentFocusOrder(void) +int UtcDaliAccessibilityManagerGetCurrentFocusOrder(void) { ToolkitTestApplication application; - tet_infoline(" UtcDaliAccessibilityFocusManagerGetCurrentFocusOrder"); + tet_infoline(" UtcDaliAccessibilityManagerGetCurrentFocusOrder"); - AccessibilityFocusManager manager = AccessibilityFocusManager::Get(); + AccessibilityManager manager = AccessibilityManager::Get(); DALI_TEST_CHECK(manager); Actor first = Actor::New(); @@ -499,21 +499,21 @@ int UtcDaliAccessibilityFocusManagerGetCurrentFocusOrder(void) // Set the focus order and description for the first actor manager.SetFocusOrder(first, 1); - manager.SetAccessibilityAttribute(first, AccessibilityFocusManager::ACCESSIBILITY_LABEL, "first"); + manager.SetAccessibilityAttribute(first, AccessibilityManager::ACCESSIBILITY_LABEL, "first"); DALI_TEST_CHECK(manager.GetFocusOrder(first) == 1); - DALI_TEST_CHECK(manager.GetAccessibilityAttribute(first, AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "first"); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(first, AccessibilityManager::ACCESSIBILITY_LABEL) == "first"); // Set the focus order and description for the second actor manager.SetFocusOrder(second, 2); - manager.SetAccessibilityAttribute(second, AccessibilityFocusManager::ACCESSIBILITY_LABEL, "second"); + manager.SetAccessibilityAttribute(second, AccessibilityManager::ACCESSIBILITY_LABEL, "second"); DALI_TEST_CHECK(manager.GetFocusOrder(second) == 2); - DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "second"); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, AccessibilityManager::ACCESSIBILITY_LABEL) == "second"); // Set the focus order and description for the second actor manager.SetFocusOrder(third, 3); - manager.SetAccessibilityAttribute(third, AccessibilityFocusManager::ACCESSIBILITY_LABEL, "third"); + manager.SetAccessibilityAttribute(third, AccessibilityManager::ACCESSIBILITY_LABEL, "third"); DALI_TEST_CHECK(manager.GetFocusOrder(third) == 3); - DALI_TEST_CHECK(manager.GetAccessibilityAttribute(third, AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "third"); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(third, AccessibilityManager::ACCESSIBILITY_LABEL) == "third"); // Check that no actor is being focused yet. DALI_TEST_CHECK(manager.GetCurrentFocusOrder() == 0); @@ -536,13 +536,13 @@ int UtcDaliAccessibilityFocusManagerGetCurrentFocusOrder(void) END_TEST; } -int UtcDaliAccessibilityFocusManagerMoveFocusForward(void) +int UtcDaliAccessibilityManagerMoveFocusForward(void) { ToolkitTestApplication application; - tet_infoline(" UtcDaliAccessibilityFocusManagerMoveFocusForward"); + tet_infoline(" UtcDaliAccessibilityManagerMoveFocusForward"); - AccessibilityFocusManager manager = AccessibilityFocusManager::Get(); + AccessibilityManager manager = AccessibilityManager::Get(); DALI_TEST_CHECK(manager); Actor first = Actor::New(); @@ -556,21 +556,21 @@ int UtcDaliAccessibilityFocusManagerMoveFocusForward(void) // Set the focus order and description for the first actor manager.SetFocusOrder(first, 1); - manager.SetAccessibilityAttribute(first, AccessibilityFocusManager::ACCESSIBILITY_LABEL, "first"); + manager.SetAccessibilityAttribute(first, AccessibilityManager::ACCESSIBILITY_LABEL, "first"); DALI_TEST_CHECK(manager.GetFocusOrder(first) == 1); - DALI_TEST_CHECK(manager.GetAccessibilityAttribute(first, AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "first"); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(first, AccessibilityManager::ACCESSIBILITY_LABEL) == "first"); // Set the focus order and description for the second actor manager.SetFocusOrder(second, 2); - manager.SetAccessibilityAttribute(second, AccessibilityFocusManager::ACCESSIBILITY_LABEL, "second"); + manager.SetAccessibilityAttribute(second, AccessibilityManager::ACCESSIBILITY_LABEL, "second"); DALI_TEST_CHECK(manager.GetFocusOrder(second) == 2); - DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "second"); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, AccessibilityManager::ACCESSIBILITY_LABEL) == "second"); // Set the focus order and description for the second actor manager.SetFocusOrder(third, 3); - manager.SetAccessibilityAttribute(third, AccessibilityFocusManager::ACCESSIBILITY_LABEL, "third"); + manager.SetAccessibilityAttribute(third, AccessibilityManager::ACCESSIBILITY_LABEL, "third"); DALI_TEST_CHECK(manager.GetFocusOrder(third) == 3); - DALI_TEST_CHECK(manager.GetAccessibilityAttribute(third, AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "third"); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(third, AccessibilityManager::ACCESSIBILITY_LABEL) == "third"); // Check that no actor is being focused yet. DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor()); @@ -578,7 +578,7 @@ int UtcDaliAccessibilityFocusManagerMoveFocusForward(void) // Set the focus on the first actor DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true); DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first); - DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "first"); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityManager::ACCESSIBILITY_LABEL) == "first"); // Test the non-wrapped move first manager.SetWrapMode(false); @@ -587,19 +587,19 @@ int UtcDaliAccessibilityFocusManagerMoveFocusForward(void) // Move the focus forward to the second actor manager.MoveFocusForward(); DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second); - DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "second"); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityManager::ACCESSIBILITY_LABEL) == "second"); // Move the focus forward to the third actor manager.MoveFocusForward(); DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third); - DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "third"); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityManager::ACCESSIBILITY_LABEL) == "third"); // Check that it will fail to move the focus forward again as the third actor is the last // focusable actor in the focus chain manager.MoveFocusForward(); // The focus should still be set on the third actor DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third); - DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "third"); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityManager::ACCESSIBILITY_LABEL) == "third"); // Now test the wrapped move manager.SetWrapMode(true); @@ -608,7 +608,7 @@ int UtcDaliAccessibilityFocusManagerMoveFocusForward(void) // Move the focus forward recursively and this time the first actor should be focused manager.MoveFocusForward(); DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first); - DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "first"); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityManager::ACCESSIBILITY_LABEL) == "first"); // Make the second actor not focusable Property::Index propertyActorFocusable = second.GetPropertyIndex("focusable"); @@ -621,7 +621,7 @@ int UtcDaliAccessibilityFocusManagerMoveFocusForward(void) // the third actor should be focused now. manager.MoveFocusForward(); DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third); - DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "third"); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityManager::ACCESSIBILITY_LABEL) == "third"); // Make the first actor invisible first.SetVisible(false); @@ -634,7 +634,7 @@ int UtcDaliAccessibilityFocusManagerMoveFocusForward(void) // so the focus will still be on the third actor manager.MoveFocusForward(); DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third); - DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "third"); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityManager::ACCESSIBILITY_LABEL) == "third"); // Make the third actor invisible so that no actor can be focused. third.SetVisible(false); @@ -645,17 +645,17 @@ int UtcDaliAccessibilityFocusManagerMoveFocusForward(void) // Check that the focus move is failed as all the three actors can not be focused manager.MoveFocusForward(); DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third); - DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "third"); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityManager::ACCESSIBILITY_LABEL) == "third"); END_TEST; } -int UtcDaliAccessibilityFocusManagerMoveFocusBackward(void) +int UtcDaliAccessibilityManagerMoveFocusBackward(void) { ToolkitTestApplication application; - tet_infoline(" UtcDaliAccessibilityFocusManagerMoveFocusBackward"); + tet_infoline(" UtcDaliAccessibilityManagerMoveFocusBackward"); - AccessibilityFocusManager manager = AccessibilityFocusManager::Get(); + AccessibilityManager manager = AccessibilityManager::Get(); DALI_TEST_CHECK(manager); Actor first = Actor::New(); @@ -669,21 +669,21 @@ int UtcDaliAccessibilityFocusManagerMoveFocusBackward(void) // Set the focus order and description for the first actor manager.SetFocusOrder(first, 1); - manager.SetAccessibilityAttribute(first, AccessibilityFocusManager::ACCESSIBILITY_LABEL, "first"); + manager.SetAccessibilityAttribute(first, AccessibilityManager::ACCESSIBILITY_LABEL, "first"); DALI_TEST_CHECK(manager.GetFocusOrder(first) == 1); - DALI_TEST_CHECK(manager.GetAccessibilityAttribute(first, AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "first"); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(first, AccessibilityManager::ACCESSIBILITY_LABEL) == "first"); // Set the focus order and description for the second actor manager.SetFocusOrder(second, 2); - manager.SetAccessibilityAttribute(second, AccessibilityFocusManager::ACCESSIBILITY_LABEL, "second"); + manager.SetAccessibilityAttribute(second, AccessibilityManager::ACCESSIBILITY_LABEL, "second"); DALI_TEST_CHECK(manager.GetFocusOrder(second) == 2); - DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "second"); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, AccessibilityManager::ACCESSIBILITY_LABEL) == "second"); // Set the focus order and description for the second actor manager.SetFocusOrder(third, 3); - manager.SetAccessibilityAttribute(third, AccessibilityFocusManager::ACCESSIBILITY_LABEL, "third"); + manager.SetAccessibilityAttribute(third, AccessibilityManager::ACCESSIBILITY_LABEL, "third"); DALI_TEST_CHECK(manager.GetFocusOrder(third) == 3); - DALI_TEST_CHECK(manager.GetAccessibilityAttribute(third, AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "third"); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(third, AccessibilityManager::ACCESSIBILITY_LABEL) == "third"); // Check that no actor is being focused yet. DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor()); @@ -691,7 +691,7 @@ int UtcDaliAccessibilityFocusManagerMoveFocusBackward(void) // Set the focus on the third actor DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == true); DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third); - DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "third"); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityManager::ACCESSIBILITY_LABEL) == "third"); // Test the non-wrapped move first manager.SetWrapMode(false); @@ -700,19 +700,19 @@ int UtcDaliAccessibilityFocusManagerMoveFocusBackward(void) // Move the focus backward to the second actor manager.MoveFocusBackward(); DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second); - DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "second"); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityManager::ACCESSIBILITY_LABEL) == "second"); // Move the focus backward to the first actor manager.MoveFocusBackward(); DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first); - DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "first"); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityManager::ACCESSIBILITY_LABEL) == "first"); // Check that it will fail to move the focus backward again as the first actor is the first // focusable actor in the focus chain manager.MoveFocusBackward(); // The focus should still be set on the first actor DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first); - DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "first"); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityManager::ACCESSIBILITY_LABEL) == "first"); // Now test the wrapped move manager.SetWrapMode(true); @@ -721,7 +721,7 @@ int UtcDaliAccessibilityFocusManagerMoveFocusBackward(void) // Move the focus backward recursively and this time the third actor should be focused manager.MoveFocusBackward(); DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third); - DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "third"); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityManager::ACCESSIBILITY_LABEL) == "third"); // Make the second actor not focusable Property::Index propertyActorFocusable = second.GetPropertyIndex("focusable"); @@ -734,7 +734,7 @@ int UtcDaliAccessibilityFocusManagerMoveFocusBackward(void) // the first actor should be focused now. manager.MoveFocusBackward(); DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first); - DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "first"); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityManager::ACCESSIBILITY_LABEL) == "first"); // Make the third actor invisible third.SetVisible(false); @@ -747,7 +747,7 @@ int UtcDaliAccessibilityFocusManagerMoveFocusBackward(void) // so the focus will still be on the first actor manager.MoveFocusBackward(); DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first); - DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "first"); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityManager::ACCESSIBILITY_LABEL) == "first"); // Make the first actor invisible so that no actor can be focused. first.SetVisible(false); @@ -758,17 +758,17 @@ int UtcDaliAccessibilityFocusManagerMoveFocusBackward(void) // Check that the focus move is failed as all the three actors can not be focused manager.MoveFocusBackward(); DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first); - DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "first"); + DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityManager::ACCESSIBILITY_LABEL) == "first"); END_TEST; } -int UtcDaliAccessibilityFocusManagerClearFocus(void) +int UtcDaliAccessibilityManagerClearFocus(void) { ToolkitTestApplication application; - tet_infoline(" UtcDaliAccessibilityFocusManagerClearFocus"); + tet_infoline(" UtcDaliAccessibilityManagerClearFocus"); - AccessibilityFocusManager manager = AccessibilityFocusManager::Get(); + AccessibilityManager manager = AccessibilityManager::Get(); DALI_TEST_CHECK(manager); // Create the first actor and add it to the stage @@ -800,13 +800,13 @@ int UtcDaliAccessibilityFocusManagerClearFocus(void) END_TEST; } -int UtcDaliAccessibilityFocusManagerReset(void) +int UtcDaliAccessibilityManagerReset(void) { ToolkitTestApplication application; - tet_infoline(" UtcDaliAccessibilityFocusManagerReset"); + tet_infoline(" UtcDaliAccessibilityManagerReset"); - AccessibilityFocusManager manager = AccessibilityFocusManager::Get(); + AccessibilityManager manager = AccessibilityManager::Get(); DALI_TEST_CHECK(manager); // Create the first actor and add it to the stage @@ -840,13 +840,13 @@ int UtcDaliAccessibilityFocusManagerReset(void) END_TEST; } -int UtcDaliAccessibilityFocusManagerFocusGroup(void) +int UtcDaliAccessibilityManagerFocusGroup(void) { ToolkitTestApplication application; - tet_infoline(" UtcDaliAccessibilityFocusManagerFocusGroup"); + tet_infoline(" UtcDaliAccessibilityManagerFocusGroup"); - AccessibilityFocusManager manager = AccessibilityFocusManager::Get(); + AccessibilityManager manager = AccessibilityManager::Get(); DALI_TEST_CHECK(manager); // Create an actor with two child actors and add it to the stage @@ -937,13 +937,13 @@ int UtcDaliAccessibilityFocusManagerFocusGroup(void) END_TEST; } -int UtcDaliAccessibilityFocusManagerSetAndGetFocusIndicator(void) +int UtcDaliAccessibilityManagerSetAndGetFocusIndicator(void) { ToolkitTestApplication application; - tet_infoline(" UtcDaliAccessibilityFocusManagerSetAndGetFocusIndicator"); + tet_infoline(" UtcDaliAccessibilityManagerSetAndGetFocusIndicator"); - AccessibilityFocusManager manager = AccessibilityFocusManager::Get(); + AccessibilityManager manager = AccessibilityManager::Get(); DALI_TEST_CHECK(manager); Actor defaultFocusIndicatorActor = manager.GetFocusIndicatorActor(); @@ -955,13 +955,13 @@ int UtcDaliAccessibilityFocusManagerSetAndGetFocusIndicator(void) END_TEST; } -int UtcDaliAccessibilityFocusManagerSignalFocusChanged(void) +int UtcDaliAccessibilityManagerSignalFocusChanged(void) { ToolkitTestApplication application; - tet_infoline(" UtcDaliAccessibilityFocusManagerSignalFocusChanged"); + tet_infoline(" UtcDaliAccessibilityManagerSignalFocusChanged"); - AccessibilityFocusManager manager = AccessibilityFocusManager::Get(); + AccessibilityManager manager = AccessibilityManager::Get(); DALI_TEST_CHECK(manager); bool signalVerified = false; @@ -1002,13 +1002,13 @@ int UtcDaliAccessibilityFocusManagerSignalFocusChanged(void) END_TEST; } -int UtcDaliAccessibilityFocusManagerSignalFocusOvershot(void) +int UtcDaliAccessibilityManagerSignalFocusOvershot(void) { ToolkitTestApplication application; - tet_infoline(" UtcDaliAccessibilityFocusManagerSignalFocusOvershot"); + tet_infoline(" UtcDaliAccessibilityManagerSignalFocusOvershot"); - AccessibilityFocusManager manager = AccessibilityFocusManager::Get(); + AccessibilityManager manager = AccessibilityManager::Get(); DALI_TEST_CHECK(manager); bool signalVerified = false; @@ -1038,7 +1038,7 @@ int UtcDaliAccessibilityFocusManagerSignalFocusOvershot(void) // Check that the forward focus movement is overshot. callback.mCurrentFocusedActor = second; - callback.mFocusOvershotDirection = Toolkit::AccessibilityFocusManager::OVERSHOT_NEXT; + callback.mFocusOvershotDirection = Toolkit::AccessibilityManager::OVERSHOT_NEXT; DALI_TEST_CHECK(manager.MoveFocusForward() == false); DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second); DALI_TEST_CHECK(signalVerified); @@ -1059,20 +1059,20 @@ int UtcDaliAccessibilityFocusManagerSignalFocusOvershot(void) // Check that the backward focus movement is overshot. callback.mCurrentFocusedActor = first; - callback.mFocusOvershotDirection = Toolkit::AccessibilityFocusManager::OVERSHOT_PREVIOUS; + callback.mFocusOvershotDirection = Toolkit::AccessibilityManager::OVERSHOT_PREVIOUS; DALI_TEST_CHECK(manager.MoveFocusBackward() == false); DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first); DALI_TEST_CHECK(signalVerified); END_TEST; } -int UtcDaliAccessibilityFocusManagerSignalFocusedActorActivated(void) +int UtcDaliAccessibilityManagerSignalFocusedActorActivated(void) { ToolkitTestApplication application; - tet_infoline(" UtcDaliAccessibilityFocusManagerSignalFocusedActorActivated"); + tet_infoline(" UtcDaliAccessibilityManagerSignalFocusedActorActivated"); - AccessibilityFocusManager manager = AccessibilityFocusManager::Get(); + AccessibilityManager manager = AccessibilityManager::Get(); DALI_TEST_CHECK(manager); FocusedActorActivatedCallback callback; diff --git a/build/tizen/dali-toolkit/Makefile.am b/build/tizen/dali-toolkit/Makefile.am index 0319ac1..b1a389f 100644 --- a/build/tizen/dali-toolkit/Makefile.am +++ b/build/tizen/dali-toolkit/Makefile.am @@ -124,34 +124,36 @@ develapitransitioneffects_HEADERS = $(devel_api_transition_effects_header_files) develapitextselectionpopup_HEADERS = $(devel_api_text_selection_popup_header_files) # public api source -publicapidir = $(topleveldir)/public-api -publicapicontrolsdir = $(publicapidir)/controls -publicapialignmentdir = $(publicapicontrolsdir)/alignment -publicapibuttonsdir = $(publicapicontrolsdir)/buttons -publicapidefaultcontrolsdir = $(publicapicontrolsdir)/default-controls -publicapigaussianblurviewdir = $(publicapicontrolsdir)/gaussian-blur-view -publicapiscrollbardir = $(publicapicontrolsdir)/scroll-bar -publicapiscrollabledir = $(publicapicontrolsdir)/scrollable -publicapiscrollviewdir = $(publicapicontrolsdir)/scrollable/scroll-view -publicapiitemviewdir = $(publicapicontrolsdir)/scrollable/item-view -publicapitableviewdir = $(publicapicontrolsdir)/table-view -publicapitextcontrolsdir = $(publicapicontrolsdir)/text-controls -publicapifocusmanagerdir = $(publicapidir)/focus-manager -publicapirenderingbackenddir = $(publicapidir)/text +publicapidir = $(topleveldir)/public-api +publicapicontrolsdir = $(publicapidir)/controls +develapiaccessibilitymanagerdir = $(publicapidir)/accessibility-manager +publicapialignmentdir = $(publicapicontrolsdir)/alignment +publicapibuttonsdir = $(publicapicontrolsdir)/buttons +publicapidefaultcontrolsdir = $(publicapicontrolsdir)/default-controls +publicapigaussianblurviewdir = $(publicapicontrolsdir)/gaussian-blur-view +publicapiscrollbardir = $(publicapicontrolsdir)/scroll-bar +publicapiscrollabledir = $(publicapicontrolsdir)/scrollable +publicapiscrollviewdir = $(publicapicontrolsdir)/scrollable/scroll-view +publicapiitemviewdir = $(publicapicontrolsdir)/scrollable/item-view +publicapitableviewdir = $(publicapicontrolsdir)/table-view +publicapitextcontrolsdir = $(publicapicontrolsdir)/text-controls +publicapifocusmanagerdir = $(publicapidir)/focus-manager +publicapirenderingbackenddir = $(publicapidir)/text # public api headers -publicapi_HEADERS = $(public_api_header_files) -publicapicontrols_HEADERS = $(public_api_controls_header_files) -publicapialignment_HEADERS = $(public_api_alignment_header_files) -publicapibuttons_HEADERS = $(public_api_buttons_header_files) -publicapidefaultcontrols_HEADERS = $(public_api_default_controls_header_files) -publicapigaussianblurview_HEADERS = $(public_api_gaussian_blur_view_header_files) -publicapiitemview_HEADERS = $(public_api_item_view_header_files) -publicapiscrollbar_HEADERS = $(public_api_scroll_bar_header_files) -publicapiscrollable_HEADERS = $(public_api_scrollable_header_files) -publicapiscrollview_HEADERS = $(public_api_scroll_view_header_files) -publicapitableview_HEADERS = $(public_api_table_view_header_files) -publicapitextcontrols_HEADERS = $(public_api_text_controls_header_files) -publicapifocusmanager_HEADERS = $(public_api_focus_manager_header_files) -publicapirenderingbackend_HEADERS = $(public_api_rendering_backend_header_files) +publicapi_HEADERS = $(public_api_header_files) +publicapicontrols_HEADERS = $(public_api_controls_header_files) +develapiaccessibilitymanager_HEADERS = $(public_api_accessibility_manager_header_files) +publicapialignment_HEADERS = $(public_api_alignment_header_files) +publicapibuttons_HEADERS = $(public_api_buttons_header_files) +publicapidefaultcontrols_HEADERS = $(public_api_default_controls_header_files) +publicapigaussianblurview_HEADERS = $(public_api_gaussian_blur_view_header_files) +publicapiitemview_HEADERS = $(public_api_item_view_header_files) +publicapiscrollbar_HEADERS = $(public_api_scroll_bar_header_files) +publicapiscrollable_HEADERS = $(public_api_scrollable_header_files) +publicapiscrollview_HEADERS = $(public_api_scroll_view_header_files) +publicapitableview_HEADERS = $(public_api_table_view_header_files) +publicapitextcontrols_HEADERS = $(public_api_text_controls_header_files) +publicapifocusmanager_HEADERS = $(public_api_focus_manager_header_files) +publicapirenderingbackend_HEADERS = $(public_api_rendering_backend_header_files) diff --git a/dali-toolkit/dali-toolkit.h b/dali-toolkit/dali-toolkit.h index 9fdece3..74229e8 100644 --- a/dali-toolkit/dali-toolkit.h +++ b/dali-toolkit/dali-toolkit.h @@ -43,7 +43,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/dali-toolkit/internal/focus-manager/accessibility-focus-manager-impl.cpp b/dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.cpp similarity index 61% rename from dali-toolkit/internal/focus-manager/accessibility-focus-manager-impl.cpp rename to dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.cpp index 447a73b..16e0c64 100644 --- a/dali-toolkit/internal/focus-manager/accessibility-focus-manager-impl.cpp +++ b/dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.cpp @@ -16,14 +16,13 @@ */ // CLASS HEADER -#include "accessibility-focus-manager-impl.h" +#include "accessibility-manager-impl.h" // EXTERNAL INCLUDES #include // for strcmp #include -#include +#include #include -#include #include #include #include @@ -107,31 +106,37 @@ bool IsActorFocusableFunction(Actor actor, Dali::HitTestAlgorithm::TraverseType } -AccessibilityFocusManager::AccessibilityFocusManager() -: mIsWrapped(false), +AccessibilityManager::AccessibilityManager() +: mCurrentFocusActor(FocusIDPair(0, 0)), + mFocusIndicatorActor(Actor()), + mRecursiveFocusMoveCounter(0), + mIsWrapped(false), mIsFocusWithinGroup(false), mIsEndcapFeedbackEnabled(false), mIsEndcapFeedbackPlayed(false), - mCurrentFocusActor(FocusIDPair(0, 0)), - mFocusIndicatorActor(Actor()), - mRecursiveFocusMoveCounter(0), mIsAccessibilityTtsEnabled(false), - mIsFocusIndicatorEnabled(false) + mTtsCreated(false), + mIsFocusIndicatorEnabled(false), + mContinuousPlayMode(false) { - CreateDefaultFocusIndicatorActor(); - - AccessibilityManager manager = AccessibilityManager::Get(); - manager.SetActionHandler(*this); - manager.SetGestureHandler(*this); +} - ChangeAccessibilityStatus(); +AccessibilityManager::~AccessibilityManager() +{ } -AccessibilityFocusManager::~AccessibilityFocusManager() +void AccessibilityManager::Initialise() { + CreateDefaultFocusIndicatorActor(); + + AccessibilityAdaptor adaptor = AccessibilityAdaptor::Get(); + adaptor.SetActionHandler(*this); + adaptor.SetGestureHandler(*this); + + ChangeAccessibilityStatus(); } -AccessibilityFocusManager::ActorAdditionalInfo AccessibilityFocusManager::GetActorAdditionalInfo(const unsigned int actorID) const +AccessibilityManager::ActorAdditionalInfo AccessibilityManager::GetActorAdditionalInfo(const unsigned int actorID) const { ActorAdditionalInfo data; IDAdditionalInfoConstIter iter = mIDAdditionalInfoContainer.find(actorID); @@ -143,7 +148,7 @@ AccessibilityFocusManager::ActorAdditionalInfo AccessibilityFocusManager::GetAct return data; } -void AccessibilityFocusManager::SynchronizeActorAdditionalInfo(const unsigned int actorID, const unsigned int order) +void AccessibilityManager::SynchronizeActorAdditionalInfo(const unsigned int actorID, const unsigned int order) { ActorAdditionalInfo actorInfo = GetActorAdditionalInfo(actorID); actorInfo.mFocusOrder = order; @@ -151,7 +156,7 @@ void AccessibilityFocusManager::SynchronizeActorAdditionalInfo(const unsigned in mIDAdditionalInfoContainer.insert(IDAdditionalInfoPair(actorID, actorInfo)); } -void AccessibilityFocusManager::SetAccessibilityAttribute(Actor actor, Toolkit::AccessibilityFocusManager::AccessibilityAttribute type, const std::string& text) +void AccessibilityManager::SetAccessibilityAttribute(Actor actor, Toolkit::AccessibilityManager::AccessibilityAttribute type, const std::string& text) { if(actor) { @@ -165,7 +170,7 @@ void AccessibilityFocusManager::SetAccessibilityAttribute(Actor actor, Toolkit:: } } -std::string AccessibilityFocusManager::GetAccessibilityAttribute(Actor actor, Toolkit::AccessibilityFocusManager::AccessibilityAttribute type) const +std::string AccessibilityManager::GetAccessibilityAttribute(Actor actor, Toolkit::AccessibilityManager::AccessibilityAttribute type) const { std::string text; @@ -178,7 +183,7 @@ std::string AccessibilityFocusManager::GetAccessibilityAttribute(Actor actor, To return text; } -void AccessibilityFocusManager::SetFocusOrder(Actor actor, const unsigned int order) +void AccessibilityManager::SetFocusOrder(Actor actor, const unsigned int order) { // Do nothing if the focus order of the actor is not changed. if(actor && GetFocusOrder(actor) != order) @@ -245,7 +250,7 @@ void AccessibilityFocusManager::SetFocusOrder(Actor actor, const unsigned int or } } -unsigned int AccessibilityFocusManager::GetFocusOrder(Actor actor) const +unsigned int AccessibilityManager::GetFocusOrder(Actor actor) const { unsigned int focusOrder = 0; @@ -258,7 +263,7 @@ unsigned int AccessibilityFocusManager::GetFocusOrder(Actor actor) const return focusOrder; } -unsigned int AccessibilityFocusManager::GenerateNewFocusOrder() const +unsigned int AccessibilityManager::GenerateNewFocusOrder() const { unsigned int order = 1; FocusIDContainer::const_reverse_iterator iter = mFocusIDContainer.rbegin(); @@ -271,7 +276,7 @@ unsigned int AccessibilityFocusManager::GenerateNewFocusOrder() const return order; } -Actor AccessibilityFocusManager::GetActorByFocusOrder(const unsigned int order) +Actor AccessibilityManager::GetActorByFocusOrder(const unsigned int order) { Actor actor = Actor(); @@ -285,7 +290,7 @@ Actor AccessibilityFocusManager::GetActorByFocusOrder(const unsigned int order) return actor; } -bool AccessibilityFocusManager::SetCurrentFocusActor(Actor actor) +bool AccessibilityManager::SetCurrentFocusActor(Actor actor) { if(actor) { @@ -295,7 +300,7 @@ bool AccessibilityFocusManager::SetCurrentFocusActor(Actor actor) return false; } -bool AccessibilityFocusManager::DoSetCurrentFocusActor(const unsigned int actorID) +bool AccessibilityManager::DoSetCurrentFocusActor(const unsigned int actorID) { Actor rootActor = Stage::GetCurrent().GetRootLayer(); @@ -364,7 +369,7 @@ bool AccessibilityFocusManager::DoSetCurrentFocusActor(const unsigned int actorI // Combine attribute texts to one text std::string informationText; - for(int i = 0; i < Toolkit::AccessibilityFocusManager::ACCESSIBILITY_ATTRIBUTE_NUM; i++) + for(int i = 0; i < Toolkit::AccessibilityManager::ACCESSIBILITY_ATTRIBUTE_NUM; i++) { if(!GetActorAdditionalInfo(actorID).mAccessibilityAttributes[i].empty()) { @@ -386,23 +391,23 @@ bool AccessibilityFocusManager::DoSetCurrentFocusActor(const unsigned int actorI return false; } -Actor AccessibilityFocusManager::GetCurrentFocusActor() +Actor AccessibilityManager::GetCurrentFocusActor() { Actor rootActor = Stage::GetCurrent().GetRootLayer(); return rootActor.FindChildById(mCurrentFocusActor.second); } -Actor AccessibilityFocusManager::GetCurrentFocusGroup() +Actor AccessibilityManager::GetCurrentFocusGroup() { return GetFocusGroup(GetCurrentFocusActor()); } -unsigned int AccessibilityFocusManager::GetCurrentFocusOrder() +unsigned int AccessibilityManager::GetCurrentFocusOrder() { return mCurrentFocusActor.first; } -bool AccessibilityFocusManager::MoveFocusForward() +bool AccessibilityManager::MoveFocusForward() { bool ret = false; mRecursiveFocusMoveCounter = 0; @@ -430,7 +435,7 @@ bool AccessibilityFocusManager::MoveFocusForward() return ret; } -bool AccessibilityFocusManager::MoveFocusBackward() +bool AccessibilityManager::MoveFocusBackward() { bool ret = false; mRecursiveFocusMoveCounter = 0; @@ -459,7 +464,7 @@ bool AccessibilityFocusManager::MoveFocusBackward() return ret; } -void AccessibilityFocusManager::DoActivate(Actor actor) +void AccessibilityManager::DoActivate(Actor actor) { if(actor) { @@ -475,7 +480,7 @@ void AccessibilityFocusManager::DoActivate(Actor actor) } } -void AccessibilityFocusManager::ClearFocus() +void AccessibilityManager::ClearFocus() { Actor actor = GetCurrentFocusActor(); if(actor) @@ -496,14 +501,14 @@ void AccessibilityFocusManager::ClearFocus() } } -void AccessibilityFocusManager::Reset() +void AccessibilityManager::Reset() { ClearFocus(); mFocusIDContainer.clear(); mIDAdditionalInfoContainer.clear(); } -void AccessibilityFocusManager::SetFocusGroup(Actor actor, bool isFocusGroup) +void AccessibilityManager::SetFocusGroup(Actor actor, bool isFocusGroup) { if(actor) { @@ -520,7 +525,7 @@ void AccessibilityFocusManager::SetFocusGroup(Actor actor, bool isFocusGroup) } } -bool AccessibilityFocusManager::IsFocusGroup(Actor actor) const +bool AccessibilityManager::IsFocusGroup(Actor actor) const { // Check whether the actor is a focus group bool isFocusGroup = false; @@ -537,7 +542,7 @@ bool AccessibilityFocusManager::IsFocusGroup(Actor actor) const return isFocusGroup; } -Actor AccessibilityFocusManager::GetFocusGroup(Actor actor) +Actor AccessibilityManager::GetFocusGroup(Actor actor) { // Go through the actor's hierarchy to check which focus group the actor belongs to while (actor && !IsFocusGroup(actor)) @@ -548,37 +553,37 @@ Actor AccessibilityFocusManager::GetFocusGroup(Actor actor) return actor; } -void AccessibilityFocusManager::SetGroupMode(bool enabled) +void AccessibilityManager::SetGroupMode(bool enabled) { mIsFocusWithinGroup = enabled; } -bool AccessibilityFocusManager::GetGroupMode() const +bool AccessibilityManager::GetGroupMode() const { return mIsFocusWithinGroup; } -void AccessibilityFocusManager::SetWrapMode(bool wrapped) +void AccessibilityManager::SetWrapMode(bool wrapped) { mIsWrapped = wrapped; } -bool AccessibilityFocusManager::GetWrapMode() const +bool AccessibilityManager::GetWrapMode() const { return mIsWrapped; } -void AccessibilityFocusManager::SetFocusIndicatorActor(Actor indicator) +void AccessibilityManager::SetFocusIndicatorActor(Actor indicator) { mFocusIndicatorActor = indicator; } -Actor AccessibilityFocusManager::GetFocusIndicatorActor() +Actor AccessibilityManager::GetFocusIndicatorActor() { return mFocusIndicatorActor; } -bool AccessibilityFocusManager::DoMoveFocus(FocusIDIter focusIDIter, bool forward, bool wrapped) +bool AccessibilityManager::DoMoveFocus(FocusIDIter focusIDIter, bool forward, bool wrapped) { DALI_LOG_INFO( gLogFilter, Debug::General, "[%s:%d] %d focusable actors\n", __FUNCTION__, __LINE__, mFocusIDContainer.size()); DALI_LOG_INFO( gLogFilter, Debug::General, "[%s:%d] focus order : %d\n", __FUNCTION__, __LINE__, (*focusIDIter).first); @@ -619,20 +624,26 @@ bool AccessibilityFocusManager::DoMoveFocus(FocusIDIter focusIDIter, bool forwar { DALI_LOG_INFO( gLogFilter, Debug::General, "[%s:%d] Overshot\n", __FUNCTION__, __LINE__); // Send notification for handling overshooted situation - mFocusOvershotSignal.Emit(GetCurrentFocusActor(), forward ? Toolkit::AccessibilityFocusManager::OVERSHOT_NEXT : Toolkit::AccessibilityFocusManager::OVERSHOT_PREVIOUS); + mFocusOvershotSignal.Emit(GetCurrentFocusActor(), forward ? Toolkit::AccessibilityManager::OVERSHOT_NEXT : Toolkit::AccessibilityManager::OVERSHOT_PREVIOUS); return false; // Try to move the focus out of the scope } } - if((focusIDIter != mFocusIDContainer.end()) && !DoSetCurrentFocusActor((*focusIDIter).second)) + // Invalid focus. + if( focusIDIter == mFocusIDContainer.end() ) + { + return false; + } + + // Note: This function performs the focus change. + if( !DoSetCurrentFocusActor( (*focusIDIter).second ) ) { mRecursiveFocusMoveCounter++; if(mRecursiveFocusMoveCounter > mFocusIDContainer.size()) { // We've attempted to focus all the actors in the whole focus chain and no actor // can be focused successfully. - DALI_LOG_WARNING("[%s] There is no more focusable actor in %d focus chains\n", __FUNCTION__, mRecursiveFocusMoveCounter); return false; @@ -646,7 +657,7 @@ bool AccessibilityFocusManager::DoMoveFocus(FocusIDIter focusIDIter, bool forwar return true; } -void AccessibilityFocusManager::SetFocusable(Actor actor, bool focusable) +void AccessibilityManager::SetFocusable(Actor actor, bool focusable) { if(actor) { @@ -663,7 +674,7 @@ void AccessibilityFocusManager::SetFocusable(Actor actor, bool focusable) } } -void AccessibilityFocusManager::CreateDefaultFocusIndicatorActor() +void AccessibilityManager::CreateDefaultFocusIndicatorActor() { // Create a focus indicator actor shared by all the focusable actors Image borderImage = ResourceImage::New(FOCUS_BORDER_IMAGE_PATH); @@ -680,10 +691,11 @@ void AccessibilityFocusManager::CreateDefaultFocusIndicatorActor() SetFocusIndicatorActor(focusIndicator); } -bool AccessibilityFocusManager::ChangeAccessibilityStatus() +bool AccessibilityManager::ChangeAccessibilityStatus() { - AccessibilityManager manager = AccessibilityManager::Get(); - mIsAccessibilityTtsEnabled = manager.IsEnabled(); + AccessibilityAdaptor adaptor = AccessibilityAdaptor::Get(); + mIsAccessibilityTtsEnabled = adaptor.IsEnabled(); + Dali::Toolkit::AccessibilityManager handle( this ); if(mIsAccessibilityTtsEnabled) { @@ -697,6 +709,11 @@ bool AccessibilityFocusManager::ChangeAccessibilityStatus() } } mIsFocusIndicatorEnabled = true; + + // Connect a signal to the TTS player to implement continuous reading mode. + Dali::TtsPlayer player = Dali::TtsPlayer::Get( Dali::TtsPlayer::SCREEN_READER ); + player.StateChangedSignal().Connect( this, &AccessibilityManager::TtsStateChanged ); + mTtsCreated = true; } else { @@ -707,13 +724,29 @@ bool AccessibilityFocusManager::ChangeAccessibilityStatus() actor.Remove(mFocusIndicatorActor); } mIsFocusIndicatorEnabled = false; + + if( mTtsCreated ) + { + // Disconnect the TTS state change signal. + Dali::TtsPlayer player = Dali::TtsPlayer::Get( Dali::TtsPlayer::SCREEN_READER ); + player.StateChangedSignal().Disconnect( this, &AccessibilityManager::TtsStateChanged ); + mTtsCreated = true; + } } + mStatusChangedSignal.Emit( handle ); + return true; } -bool AccessibilityFocusManager::AccessibilityActionNext(bool allowEndFeedback) +bool AccessibilityManager::AccessibilityActionNext(bool allowEndFeedback) { + Dali::Toolkit::AccessibilityManager handle( this ); + if( !mActionNextSignal.Empty() ) + { + mActionNextSignal.Emit( handle ); + } + if(mIsAccessibilityTtsEnabled) { mIsEndcapFeedbackEnabled = allowEndFeedback; @@ -725,8 +758,14 @@ bool AccessibilityFocusManager::AccessibilityActionNext(bool allowEndFeedback) } } -bool AccessibilityFocusManager::AccessibilityActionPrevious(bool allowEndFeedback) +bool AccessibilityManager::AccessibilityActionPrevious(bool allowEndFeedback) { + Dali::Toolkit::AccessibilityManager handle( this ); + if( !mActionPreviousSignal.Empty() ) + { + mActionPreviousSignal.Emit( handle ); + } + if(mIsAccessibilityTtsEnabled) { mIsEndcapFeedbackEnabled = allowEndFeedback; @@ -738,8 +777,14 @@ bool AccessibilityFocusManager::AccessibilityActionPrevious(bool allowEndFeedbac } } -bool AccessibilityFocusManager::AccessibilityActionActivate() +bool AccessibilityManager::AccessibilityActionActivate() { + Dali::Toolkit::AccessibilityManager handle( this ); + if( !mActionActivateSignal.Empty() ) + { + mActionActivateSignal.Emit( handle ); + } + bool ret = false; Actor actor = GetCurrentFocusActor(); @@ -752,16 +797,33 @@ bool AccessibilityFocusManager::AccessibilityActionActivate() return ret; } -bool AccessibilityFocusManager::AccessibilityActionRead(bool allowReadAgain) +bool AccessibilityManager::AccessibilityActionRead(bool allowReadAgain) { + Dali::Toolkit::AccessibilityManager handle( this ); + + if( allowReadAgain ) + { + if ( !mActionReadSignal.Empty() ) + { + mActionReadSignal.Emit( handle ); + } + } + else + { + if ( !mActionOverSignal.Empty() ) + { + mActionOverSignal.Emit( handle ); + } + } + bool ret = false; if(mIsAccessibilityTtsEnabled) { // Find the focusable actor at the read position - AccessibilityManager manager = AccessibilityManager::Get(); + AccessibilityAdaptor adaptor = AccessibilityAdaptor::Get(); Dali::HitTestAlgorithm::Results results; - Dali::HitTestAlgorithm::HitTest( Stage::GetCurrent(), manager.GetReadPosition(), results, IsActorFocusableFunction ); + Dali::HitTestAlgorithm::HitTest( Stage::GetCurrent(), adaptor.GetReadPosition(), results, IsActorFocusableFunction ); FocusIDIter focusIDIter = mFocusIDContainer.find(GetFocusOrder(results.actor)); if(focusIDIter != mFocusIDContainer.end()) @@ -778,8 +840,14 @@ bool AccessibilityFocusManager::AccessibilityActionRead(bool allowReadAgain) return ret; } -bool AccessibilityFocusManager::AccessibilityActionReadNext(bool allowEndFeedback) +bool AccessibilityManager::AccessibilityActionReadNext(bool allowEndFeedback) { + Dali::Toolkit::AccessibilityManager handle( this ); + if( !mActionReadNextSignal.Empty() ) + { + mActionReadNextSignal.Emit( handle ); + } + if(mIsAccessibilityTtsEnabled) { return MoveFocusForward(); @@ -790,8 +858,14 @@ bool AccessibilityFocusManager::AccessibilityActionReadNext(bool allowEndFeedbac } } -bool AccessibilityFocusManager::AccessibilityActionReadPrevious(bool allowEndFeedback) +bool AccessibilityManager::AccessibilityActionReadPrevious(bool allowEndFeedback) { + Dali::Toolkit::AccessibilityManager handle( this ); + if( !mActionReadPreviousSignal.Empty() ) + { + mActionReadPreviousSignal.Emit( handle ); + } + if(mIsAccessibilityTtsEnabled) { return MoveFocusBackward(); @@ -802,8 +876,14 @@ bool AccessibilityFocusManager::AccessibilityActionReadPrevious(bool allowEndFee } } -bool AccessibilityFocusManager::AccessibilityActionUp() +bool AccessibilityManager::AccessibilityActionUp() { + Dali::Toolkit::AccessibilityManager handle( this ); + if( !mActionUpSignal.Empty() ) + { + mActionUpSignal.Emit( handle ); + } + bool ret = false; if(mIsAccessibilityTtsEnabled) @@ -823,8 +903,14 @@ bool AccessibilityFocusManager::AccessibilityActionUp() return ret; } -bool AccessibilityFocusManager::AccessibilityActionDown() +bool AccessibilityManager::AccessibilityActionDown() { + Dali::Toolkit::AccessibilityManager handle( this ); + if( !mActionDownSignal.Empty() ) + { + mActionDownSignal.Emit( handle ); + } + bool ret = false; if(mIsAccessibilityTtsEnabled) @@ -844,8 +930,14 @@ bool AccessibilityFocusManager::AccessibilityActionDown() return ret; } -bool AccessibilityFocusManager::ClearAccessibilityFocus() +bool AccessibilityManager::ClearAccessibilityFocus() { + Dali::Toolkit::AccessibilityManager handle( this ); + if( !mActionClearFocusSignal.Empty() ) + { + mActionClearFocusSignal.Emit( handle ); + } + if(mIsAccessibilityTtsEnabled) { ClearFocus(); @@ -857,14 +949,359 @@ bool AccessibilityFocusManager::ClearAccessibilityFocus() } } -bool AccessibilityFocusManager::AccessibilityActionBack() +bool AccessibilityManager::AccessibilityActionScroll( Dali::TouchEvent& touchEvent ) { + Dali::Toolkit::AccessibilityManager handle( this ); + if( !mActionScrollSignal.Empty() ) + { + mActionScrollSignal.Emit( handle, touchEvent ); + } + + return true; +} + +bool AccessibilityManager::AccessibilityActionBack() +{ + Dali::Toolkit::AccessibilityManager handle( this ); + if( !mActionBackSignal.Empty() ) + { + mActionBackSignal.Emit( handle ); + } + // TODO: Back to previous view return mIsAccessibilityTtsEnabled; } -bool AccessibilityFocusManager::AccessibilityActionTouch(const TouchEvent& touchEvent) +bool AccessibilityManager::AccessibilityActionScrollUp() +{ + Dali::Toolkit::AccessibilityManager handle( this ); + if( !mActionScrollUpSignal.Empty() ) + { + mActionScrollUpSignal.Emit( handle ); + } + + bool ret = false; + + if(mIsAccessibilityTtsEnabled) + { + Actor actor = GetCurrentFocusActor(); + if(actor) + { + Dali::Toolkit::Control control = Dali::Toolkit::Control::DownCast(actor); + if(control) + { + // TODO: Notify the control to scroll up. Should control handle this? +// ret = GetImplementation( control ).OnAccessibilityScroll(Direction::UP); + } + } + } + + return ret; +} + +bool AccessibilityManager::AccessibilityActionScrollDown() +{ + Dali::Toolkit::AccessibilityManager handle( this ); + if( !mActionScrollDownSignal.Empty() ) + { + mActionScrollDownSignal.Emit( handle ); + } + + bool ret = false; + + if(mIsAccessibilityTtsEnabled) + { + Actor actor = GetCurrentFocusActor(); + if(actor) + { + Dali::Toolkit::Control control = Dali::Toolkit::Control::DownCast(actor); + if(control) + { + // TODO: Notify the control to scroll down. Should control handle this? +// ret = GetImplementation( control ).OnAccessibilityScrollDown(Direction::DOWN); + } + } + } + + return ret; +} + +bool AccessibilityManager::AccessibilityActionPageLeft() +{ + Dali::Toolkit::AccessibilityManager handle( this ); + if( !mActionPageLeftSignal.Empty() ) + { + mActionPageLeftSignal.Emit( handle ); + } + + bool ret = false; + + if(mIsAccessibilityTtsEnabled) + { + Actor actor = GetCurrentFocusActor(); + if(actor) + { + Dali::Toolkit::Control control = Dali::Toolkit::Control::DownCast(actor); + if(control) + { + // TODO: Notify the control to scroll left to the previous page. Should control handle this? +// ret = GetImplementation( control ).OnAccessibilityScrollToPage(Direction::LEFT); + } + } + } + + return ret; +} + +bool AccessibilityManager::AccessibilityActionPageRight() +{ + Dali::Toolkit::AccessibilityManager handle( this ); + if( !mActionPageRightSignal.Empty() ) + { + mActionPageRightSignal.Emit( handle ); + } + + bool ret = false; + + if(mIsAccessibilityTtsEnabled) + { + Actor actor = GetCurrentFocusActor(); + if(actor) + { + Dali::Toolkit::Control control = Dali::Toolkit::Control::DownCast(actor); + if(control) + { + // TODO: Notify the control to scroll right to the next page. Should control handle this? +// ret = GetImplementation( control ).OnAccessibilityScrollToPage(Direction::RIGHT); + } + } + } + + return ret; +} + +bool AccessibilityManager::AccessibilityActionPageUp() +{ + Dali::Toolkit::AccessibilityManager handle( this ); + if( !mActionPageUpSignal.Empty() ) + { + mActionPageUpSignal.Emit( handle ); + } + + bool ret = false; + + if(mIsAccessibilityTtsEnabled) + { + Actor actor = GetCurrentFocusActor(); + if(actor) + { + Dali::Toolkit::Control control = Dali::Toolkit::Control::DownCast(actor); + if(control) + { + // TODO: Notify the control to scroll up to the previous page. Should control handle this? +// ret = GetImplementation( control ).OnAccessibilityScrollToPage(Direction::UP); + } + } + } + + return ret; +} + +bool AccessibilityManager::AccessibilityActionPageDown() +{ + Dali::Toolkit::AccessibilityManager handle( this ); + if( !mActionPageDownSignal.Empty() ) + { + mActionPageDownSignal.Emit( handle ); + } + + bool ret = false; + + if(mIsAccessibilityTtsEnabled) + { + Actor actor = GetCurrentFocusActor(); + if(actor) + { + Dali::Toolkit::Control control = Dali::Toolkit::Control::DownCast(actor); + if(control) + { + // TODO: Notify the control to scroll down to the next page. Should control handle this? +// ret = GetImplementation( control ).OnAccessibilityScrollToPage(Direction::DOWN); + } + } + } + + return ret; +} + +bool AccessibilityManager::AccessibilityActionMoveToFirst() +{ + Dali::Toolkit::AccessibilityManager handle( this ); + if( !mActionMoveToFirstSignal.Empty() ) + { + mActionMoveToFirstSignal.Emit( handle ); + } + + // TODO: Move to the first item on screen + + return mIsAccessibilityTtsEnabled; +} + +bool AccessibilityManager::AccessibilityActionMoveToLast() +{ + Dali::Toolkit::AccessibilityManager handle( this ); + if( !mActionMoveToLastSignal.Empty() ) + { + mActionMoveToLastSignal.Emit( handle ); + } + + // TODO: Move to the last item on screen + + return mIsAccessibilityTtsEnabled; +} + +bool AccessibilityManager::AccessibilityActionReadFromTop() +{ + Dali::Toolkit::AccessibilityManager handle( this ); + if( !mActionReadFromTopSignal.Empty() ) + { + mActionReadFromTopSignal.Emit( handle ); + } + + // TODO: Move to the top item on screen and read from the item continuously + + return mIsAccessibilityTtsEnabled; +} + +bool AccessibilityManager::AccessibilityActionReadFromNext() +{ + Dali::Toolkit::AccessibilityManager handle( this ); + + if( !mActionReadFromNextSignal.Empty() ) + { + mActionReadFromNextSignal.Emit( handle ); + } + + if( mIsAccessibilityTtsEnabled ) + { + // Mark that we are in continuous play mode, so TTS signals can move focus. + mContinuousPlayMode = true; + + // Attempt to move to the next item and read from the item continuously. + MoveFocusForward(); + } + + return mIsAccessibilityTtsEnabled; +} + +void AccessibilityManager::TtsStateChanged( const Dali::TtsPlayer::State previousState, const Dali::TtsPlayer::State currentState ) +{ + if( mContinuousPlayMode ) + { + // If we were playing and now we have stopped, attempt to play the next item. + if( ( previousState == Dali::TtsPlayer::PLAYING ) && ( currentState == Dali::TtsPlayer::READY ) ) + { + // Attempt to move the focus forward and play. + // If we can't cancel continuous play mode. + if( !MoveFocusForward() ) + { + // We are done, exit continuous play mode. + mContinuousPlayMode = false; + } + } + else + { + // Unexpected play state change, exit continuous play mode. + mContinuousPlayMode = false; + } + } +} + +bool AccessibilityManager::AccessibilityActionZoom() +{ + Dali::Toolkit::AccessibilityManager handle( this ); + if( !mActionZoomSignal.Empty() ) + { + mActionZoomSignal.Emit( handle ); + } + + bool ret = false; + + if(mIsAccessibilityTtsEnabled) + { + Actor actor = GetCurrentFocusActor(); + if(actor) + { + Dali::Toolkit::Control control = Dali::Toolkit::Control::DownCast(actor); + if(control) + { + // Notify the control to zoom + ret = GetImplementation( control ).OnAccessibilityZoom(); + } + } + } + + return ret; +} + +bool AccessibilityManager::AccessibilityActionReadIndicatorInformation() +{ + Dali::Toolkit::AccessibilityManager handle( this ); + if( !mActionReadIndicatorInformationSignal.Empty() ) + { + mActionReadIndicatorInformationSignal.Emit( handle ); + } + + // TODO: Read the information in the indicator + + return mIsAccessibilityTtsEnabled; +} + +bool AccessibilityManager::AccessibilityActionReadPauseResume() +{ + Dali::Toolkit::AccessibilityManager handle( this ); + if( !mActionReadPauseResumeSignal.Empty() ) + { + mActionReadPauseResumeSignal.Emit( handle ); + } + + bool ret = false; + + if(mIsAccessibilityTtsEnabled) + { + // Pause or resume the TTS player + Dali::TtsPlayer player = Dali::TtsPlayer::Get(Dali::TtsPlayer::SCREEN_READER); + Dali::TtsPlayer::State state = player.GetState(); + if(state == Dali::TtsPlayer::PLAYING) + { + player.Pause(); + ret = true; + } + else if(state == Dali::TtsPlayer::PAUSED) + { + player.Resume(); + ret = true; + } + } + + return ret; +} + +bool AccessibilityManager::AccessibilityActionStartStop() +{ + Dali::Toolkit::AccessibilityManager handle( this ); + if( !mActionStartStopSignal.Empty() ) + { + mActionStartStopSignal.Emit( handle ); + } + + // TODO: Start/stop the current action + + return mIsAccessibilityTtsEnabled; +} + +bool AccessibilityManager::AccessibilityActionTouch(const TouchEvent& touchEvent) { bool handled = false; @@ -879,7 +1316,7 @@ bool AccessibilityFocusManager::AccessibilityActionTouch(const TouchEvent& touch return handled; } -bool AccessibilityFocusManager::HandlePanGesture(const Integration::PanGestureEvent& panEvent) +bool AccessibilityManager::HandlePanGesture(const Integration::PanGestureEvent& panEvent) { bool handled = false; @@ -887,7 +1324,7 @@ bool AccessibilityFocusManager::HandlePanGesture(const Integration::PanGestureEv { // Find the focusable actor at the event position Dali::HitTestAlgorithm::Results results; - AccessibilityManager manager = AccessibilityManager::Get(); + AccessibilityAdaptor adaptor = AccessibilityAdaptor::Get(); Dali::HitTestAlgorithm::HitTest( Stage::GetCurrent(), panEvent.currentPosition, results, IsActorFocusableFunction ); mCurrentGesturedActor = results.actor; @@ -956,27 +1393,27 @@ bool AccessibilityFocusManager::HandlePanGesture(const Integration::PanGestureEv return handled; } -Toolkit::AccessibilityFocusManager::FocusChangedSignalType& AccessibilityFocusManager::FocusChangedSignal() +Toolkit::AccessibilityManager::FocusChangedSignalType& AccessibilityManager::FocusChangedSignal() { return mFocusChangedSignal; } -Toolkit::AccessibilityFocusManager::FocusOvershotSignalType& AccessibilityFocusManager::FocusOvershotSignal() +Toolkit::AccessibilityManager::FocusOvershotSignalType& AccessibilityManager::FocusOvershotSignal() { return mFocusOvershotSignal; } -Toolkit::AccessibilityFocusManager::FocusedActorActivatedSignalType& AccessibilityFocusManager::FocusedActorActivatedSignal() +Toolkit::AccessibilityManager::FocusedActorActivatedSignalType& AccessibilityManager::FocusedActorActivatedSignal() { return mFocusedActorActivatedSignal; } -bool AccessibilityFocusManager::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor ) +bool AccessibilityManager::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor ) { Dali::BaseHandle handle( object ); bool connected( true ); - AccessibilityFocusManager* manager = dynamic_cast( object ); + AccessibilityManager* manager = dynamic_cast( object ); if( 0 == strcmp( signalName.c_str(), SIGNAL_FOCUS_CHANGED ) ) { diff --git a/dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.h b/dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.h new file mode 100644 index 0000000..b2428d9 --- /dev/null +++ b/dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.h @@ -0,0 +1,785 @@ +#ifndef __DALI_TOOLKIT_INTERNAL_ACCESSIBILITY_MANAGER_H__ +#define __DALI_TOOLKIT_INTERNAL_ACCESSIBILITY_MANAGER_H__ + +/* + * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// EXTERNAL INCLUDES +#include +#include +#include +#include +#include +#include + +// INTERNAL INCLUDES +#include +#include + +namespace Dali +{ + +namespace Toolkit +{ + +namespace Internal +{ + +class AccessibilityManager; + +/** + * @copydoc Toolkit::AccessibilityManager + */ +class AccessibilityManager : public Dali::BaseObject, Dali::AccessibilityActionHandler, Dali::AccessibilityGestureHandler, public Dali::ConnectionTracker +{ +public: + + typedef Dali::Toolkit::AccessibilityManager::AccessibilityActionSignalType AccessibilityActionSignalType; + typedef Dali::Toolkit::AccessibilityManager::AccessibilityActionScrollSignalType AccessibilityActionScrollSignalType; + + struct ActorAdditionalInfo + { + ActorAdditionalInfo() + : mFocusOrder(0) + { + } + + unsigned int mFocusOrder; ///< The focus order of the actor. It is undefined by default. + + std::string mAccessibilityAttributes[Toolkit::AccessibilityManager::ACCESSIBILITY_ATTRIBUTE_NUM]; ///< The array of attribute texts + }; + + typedef std::pair FocusIDPair; + typedef std::map FocusIDContainer; + typedef FocusIDContainer::iterator FocusIDIter; + typedef FocusIDContainer::const_iterator FocusIDConstIter; + + typedef std::pair IDAdditionalInfoPair; + typedef std::map IDAdditionalInfoContainer; + typedef IDAdditionalInfoContainer::iterator IDAdditionalInfoIter; + typedef IDAdditionalInfoContainer::const_iterator IDAdditionalInfoConstIter; + + /** + * Construct a new AccessibilityManager. + */ + AccessibilityManager(); + + /** + * Initialise the AccessibilityManager + */ + void Initialise(); + + /** + * @copydoc Toolkit::AccessibilityManager::SetAccessibilityAttribute + */ + void SetAccessibilityAttribute(Actor actor, Toolkit::AccessibilityManager::AccessibilityAttribute type, const std::string& text); + + /** + * @copydoc Toolkit::AccessibilityManager::GetAccessibilityAttribute + */ + std::string GetAccessibilityAttribute(Actor actor, Toolkit::AccessibilityManager::AccessibilityAttribute type) const; + + /** + * @copydoc Toolkit::AccessibilityManager::SetFocusOrder + */ + void SetFocusOrder(Actor actor, const unsigned int order); + + /** + * @copydoc Toolkit::AccessibilityManager::GetFocusOrder + */ + unsigned int GetFocusOrder(Actor actor) const; + + /** + * @copydoc Toolkit::AccessibilityManager::GenerateNewFocusOrder + */ + unsigned int GenerateNewFocusOrder() const; + + /** + * @copydoc Toolkit::AccessibilityManager::GetActorByFocusOrder + */ + Actor GetActorByFocusOrder(const unsigned int order); + + /** + * @copydoc Toolkit::AccessibilityManager::SetCurrentFocusActor + */ + bool SetCurrentFocusActor(Actor actor); + + /** + * @copydoc Toolkit::AccessibilityManager::GetCurrentFocusActor + */ + Actor GetCurrentFocusActor(); + + /** + * @copydoc Toolkit::AccessibilityManager::GetCurrentFocusGroup + */ + Actor GetCurrentFocusGroup(); + + /** + * @copydoc Toolkit::AccessibilityManager::GetCurrentFocusOrder + */ + unsigned int GetCurrentFocusOrder(); + + /** + * @copydoc Toolkit::AccessibilityManager::MoveFocusForward + */ + bool MoveFocusForward(); + + /** + * @copydoc Toolkit::AccessibilityManager::MoveFocusBackward + */ + bool MoveFocusBackward(); + + /** + * @copydoc Toolkit::AccessibilityManager::ClearFocus + */ + void ClearFocus(); + + /** + * @copydoc Toolkit::AccessibilityManager::Reset + */ + void Reset(); + + /** + * @copydoc Toolkit::AccessibilityManager::SetFocusGroup + */ + void SetFocusGroup(Actor actor, bool isFocusGroup); + + /** + * @copydoc Toolkit::AccessibilityManager::IsFocusGroup + */ + bool IsFocusGroup(Actor actor) const; + + /** + * @copydoc Toolkit::AccessibilityManager::SetGroupMode + */ + void SetGroupMode(bool enabled); + + /** + * @copydoc Toolkit::AccessibilityManager::GetGroupMode + */ + bool GetGroupMode() const; + + /** + * @copydoc Toolkit::AccessibilityManager::SetWrapMode + */ + void SetWrapMode(bool wrapped); + + /** + * @copydoc Toolkit::AccessibilityManager::GetWrapMode + */ + bool GetWrapMode() const; + + /** + * @copydoc Toolkit::AccessibilityManager::SetFocusIndicatorActor + */ + void SetFocusIndicatorActor(Actor indicator); + + /** + * @copydoc Toolkit::AccessibilityManager::GetFocusIndicatorActor + */ + Actor GetFocusIndicatorActor(); + + /** + * @copydoc Toolkit::AccessibilityManager::GetFocusGroup + */ + Actor GetFocusGroup(Actor actor); + +public: + + /** + * @copydoc Toolkit::AccessibilityManager::FocusChangedSignal() + */ + Toolkit::AccessibilityManager::FocusChangedSignalType& FocusChangedSignal(); + + /** + * @copydoc Toolkit::AccessibilityManager::FocusOvershotSignal() + */ + Toolkit::AccessibilityManager::FocusOvershotSignalType& FocusOvershotSignal(); + + /** + * @copydoc Toolkit::AccessibilityManager::FocusedActorActivatedSignal() + */ + Toolkit::AccessibilityManager::FocusedActorActivatedSignalType& FocusedActorActivatedSignal(); + + /** + * Connects a callback function with the object's signals. + * @param[in] object The object providing the signal. + * @param[in] tracker Used to disconnect the signal. + * @param[in] signalName The signal to connect to. + * @param[in] functor A newly allocated FunctorDelegate. + * @return True if the signal was connected. + * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor. + */ + static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor ); + +public: // Signals + + /** + * @copydoc Dali::Toolkit::AccessibilityManager::StatusChangedSignal + */ + AccessibilityActionSignalType& StatusChangedSignal() + { + return mStatusChangedSignal; + } + + /** + * @copydoc Dali::Toolkit::AccessibilityManager::AccessibilityAdaptor::ActionNextSignal + */ + AccessibilityActionSignalType& ActionNextSignal() + { + return mActionNextSignal; + } + + /** + * @copydoc Dali::Toolkit::AccessibilityManager::ActionPreviousSignal + */ + AccessibilityActionSignalType& ActionPreviousSignal() + { + return mActionPreviousSignal; + } + + /** + * @copydoc Dali::Toolkit::AccessibilityManager::ActionActivateSignal + */ + AccessibilityActionSignalType& ActionActivateSignal() + { + return mActionActivateSignal; + } + + /** + * @copydoc Dali::Toolkit::AccessibilityManager::ActionOverSignal + */ + AccessibilityActionSignalType& ActionOverSignal() + { + return mActionOverSignal; + } + + /** + * @copydoc Dali::Toolkit::AccessibilityManager::ActionReadSignal + */ + AccessibilityActionSignalType& ActionReadSignal() + { + return mActionReadSignal; + } + + /** + * @copydoc Dali::Toolkit::AccessibilityManager::ActionReadNextSignal + */ + AccessibilityActionSignalType& ActionReadNextSignal() + { + return mActionReadNextSignal; + } + + /** + * @copydoc Dali::Toolkit::AccessibilityManager::ActionReadPreviousSignal + */ + AccessibilityActionSignalType& ActionReadPreviousSignal() + { + return mActionReadPreviousSignal; + } + + /** + * @copydoc Dali::Toolkit::AccessibilityManager::ActionUpSignal + */ + AccessibilityActionSignalType& ActionUpSignal() + { + return mActionUpSignal; + } + + /** + * @copydoc Dali::Toolkit::AccessibilityManager::ActionDownSignal + */ + AccessibilityActionSignalType& ActionDownSignal() + { + return mActionDownSignal; + } + + /** + * @copydoc Dali::Toolkit::AccessibilityManager::ActionClearFocusSignal + */ + AccessibilityActionSignalType& ActionClearFocusSignal() + { + return mActionClearFocusSignal; + } + + /** + * @copydoc Dali::Toolkit::AccessibilityManager::ActionBackSignal + */ + AccessibilityActionSignalType& ActionBackSignal() + { + return mActionBackSignal; + } + + /** + * @copydoc Dali::Toolkit::AccessibilityManager::ActionScrollUpSignal + */ + AccessibilityActionSignalType& ActionScrollUpSignal() + { + return mActionScrollUpSignal; + } + + /** + * @copydoc Dali::Toolkit::AccessibilityManager::ActionScrollDownSignal + */ + AccessibilityActionSignalType& ActionScrollDownSignal() + { + return mActionScrollDownSignal; + } + + /** + * @copydoc Dali::Toolkit::AccessibilityManager::ActionPageLeftSignal + */ + AccessibilityActionSignalType& ActionPageLeftSignal() + { + return mActionPageLeftSignal; + } + + /** + * @copydoc Dali::Toolkit::AccessibilityManager::ActionPageRightSignal + */ + AccessibilityActionSignalType& ActionPageRightSignal() + { + return mActionPageRightSignal; + } + + /** + * @copydoc Dali::Toolkit::AccessibilityManager::ActionPageUpSignal + */ + AccessibilityActionSignalType& ActionPageUpSignal() + { + return mActionPageUpSignal; + } + + /** + * @copydoc Dali::Toolkit::AccessibilityManager::ActionPageDownSignal + */ + AccessibilityActionSignalType& ActionPageDownSignal() + { + return mActionPageDownSignal; + } + + /** + * @copydoc Dali::Toolkit::AccessibilityManager::ActionMoveToFirstSignal + */ + AccessibilityActionSignalType& ActionMoveToFirstSignal() + { + return mActionMoveToFirstSignal; + } + + /** + * @copydoc Dali::Toolkit::AccessibilityManager::ActionMoveToLastSignal + */ + AccessibilityActionSignalType& ActionMoveToLastSignal() + { + return mActionMoveToLastSignal; + } + + /** + * @copydoc Dali::Toolkit::AccessibilityManager::ActionReadFromTopSignal + */ + AccessibilityActionSignalType& ActionReadFromTopSignal() + { + return mActionReadFromTopSignal; + } + + /** + * @copydoc Dali::Toolkit::AccessibilityManager::ActionReadFromNextSignal + */ + AccessibilityActionSignalType& ActionReadFromNextSignal() + { + return mActionReadFromNextSignal; + } + + /** + * @copydoc Dali::Toolkit::AccessibilityManager::ActionZoomSignal + */ + AccessibilityActionSignalType& ActionZoomSignal() + { + return mActionZoomSignal; + } + + /** + * @copydoc Dali::Toolkit::AccessibilityManager::ActionReadIndicatorInformationSignal + */ + AccessibilityActionSignalType& ActionReadIndicatorInformationSignal() + { + return mActionReadIndicatorInformationSignal; + } + + /** + * @copydoc Dali::Toolkit::AccessibilityManager::ActionReadPauseResumeSignal + */ + AccessibilityActionSignalType& ActionReadPauseResumeSignal() + { + return mActionReadPauseResumeSignal; + } + + /** + * @copydoc Dali::Toolkit::AccessibilityManager::ActionStartStopSignal + */ + AccessibilityActionSignalType& ActionStartStopSignal() + { + return mActionStartStopSignal; + } + + /** + * @copydoc Dali::Toolkit::AccessibilityManager::ActionScrollSignal + */ + AccessibilityActionScrollSignalType& ActionScrollSignal() + { + return mActionScrollSignal; + } + +protected: + + /** + * Destructor + */ + virtual ~AccessibilityManager(); + +private: + + /** + * Get the additional information (e.g. focus order and description) of the given actor. + * @param actorID The ID of the actor to be queried + * @return The additional information of the actor + */ + ActorAdditionalInfo GetActorAdditionalInfo(const unsigned int actorID) const; + + /** + * Synchronize the actor's additional information to reflect its latest focus order + * @param actorID The ID of the actor + * @param order The focus order of the actor + * @return The additional information of the actor + */ + void SynchronizeActorAdditionalInfo(const unsigned int actorID, const unsigned int order); + + /** + * Move the focus to the specified actor and send notification for the focus change. + * @param actorID The ID of the actor to be queried + * @return Whether the focus is successful or not + */ + bool DoSetCurrentFocusActor(const unsigned int actorID); + + /** + * Move the focus to the next actor in the focus chain towards the specified direction. + * @param focusIDIter The iterator pointing to the current focused actor + * @param forward Whether the focus movement is forward or not. The focus movement will be backward if this is false. + * @param wrapped Whether the focus shoule be moved wrapped around or not + * @return Whether the focus is successful or not + */ + bool DoMoveFocus(FocusIDIter focusIDIter, bool forward, bool wrapped); + + /** + * Activate the actor. If the actor is control, call OnActivated virtual function. + * This function will emit FocusedActorActivatedSignal. + * @param actor The actor to activate + */ + void DoActivate(Actor actor); + + /** + * Create the default indicator actor to highlight the focused actor. + */ + void CreateDefaultFocusIndicatorActor(); + + /** + * Set whether the actor is focusable or not. A focusable property will be registered for + * the actor if not yet. + * @param actor The actor to be focused + * @param focusable Whether the actor is focusable or not + */ + void SetFocusable(Actor actor, bool focusable); + + /** + * Handle the accessibility pan gesture. + * @param[in] panEvent The pan event to be handled. + * @return whether the gesture is handled successfully or not. + */ + virtual bool HandlePanGesture(const Integration::PanGestureEvent& panEvent); + + /** + * Change the accessibility status when Accessibility feature(screen-reader) turned on or off. + * @return whether the status is changed or not. + */ + virtual bool ChangeAccessibilityStatus(); + + /** + * Clear the accessibility focus from the current focused actor. + * @return whether the focus is cleared or not. + */ + virtual bool ClearAccessibilityFocus(); + + /** + * Perform the accessibility action associated with a scroll event. + * @param touchEvent The touch point (and time) of the event. + * @return whether the focus is cleared or not. + */ + virtual bool AccessibilityActionScroll( Dali::TouchEvent& touchEvent ); + + /** + * Perform the accessibility action to move focus to the previous focusable actor (by one finger flick up). + * @param allowEndFeedback true if end of list feedback should be played when the focus is alread reached to the end + * @return whether the accessibility action is performed or not. + */ + virtual bool AccessibilityActionPrevious(bool allowEndFeedback); + + /** + * Perform the accessibility action to move focus to the next focusable actor (by one finger flick down). + * @param allowEndFeedback true if end of list feedback should be played when the focus is alread reached to the end + * @return whether the accessibility action is performed or not. + */ + virtual bool AccessibilityActionNext(bool allowEndFeedback); + + /** + * Perform the accessibility action to move focus to the previous focusable actor (by one finger flick left). + * @param allowEndFeedback true if end of list feedback should be played when the focus is alread reached to the end + * @return whether the accessibility action is performed or not. + */ + virtual bool AccessibilityActionReadPrevious(bool allowEndFeedback); + + /** + * Perform the accessibility action to move focus to the next focusable actor (by one finger flick right). + * @param allowEndFeedback true if end of list feedback should be played when the focus is alread reached to the end + * @return whether the accessibility action is performed or not. + */ + virtual bool AccessibilityActionReadNext(bool allowEndFeedback); + + /** + * Perform the accessibility action to focus and read the actor (by one finger tap or move). + * @param allowReadAgain true if the action read again the same object (i.e. read action) + * false if the action just read when the focus object is changed (i.e. over action) + * @return whether the accessibility action is performed or not. + */ + virtual bool AccessibilityActionRead(bool allowReadAgain); + + /** + * Perform the accessibility action to activate the current focused actor (by one finger double tap). + * @return whether the accessibility action is performed or not. + */ + virtual bool AccessibilityActionActivate(); + + /** + * Perform the accessibility action to change the value when the current focused actor is a slider + * (by double finger down and move up and right). + * @return whether the accessibility action is performed or not. + */ + virtual bool AccessibilityActionUp(); + + /** + * Perform the accessibility action to change the value when the current focused actor is a slider + * (by double finger down and move down and left). + * @return whether the accessibility action is performed or not. + */ + virtual bool AccessibilityActionDown(); + + /** + * Perform the accessibility action to navigate back (by two fingers circle draw). + * @return whether the accessibility action is performed or not. + */ + virtual bool AccessibilityActionBack(); + + /** + * Perform the accessibility action to scroll up the list and focus on the first item on the list + * after the scrolling and read the item (by two finger swipe up). + * @return whether the accessibility action is performed or not. + */ + virtual bool AccessibilityActionScrollUp(); + + /** + * Perform the accessibility action to scroll down the list and focus on the first item on the list + * after the scrolling and read the item (by two finger swipe down). + * @return whether the accessibility action is performed or not. + */ + virtual bool AccessibilityActionScrollDown(); + + /** + * Perform the accessibility action to scroll left to the previous page (by two finger swipe left). + * @return whether the accessibility action is performed or not. + */ + virtual bool AccessibilityActionPageLeft(); + + /** + * Perform the accessibility action to scroll right to the next page (by two finger swipe right). + * @return whether the accessibility action is performed or not. + */ + virtual bool AccessibilityActionPageRight(); + + /** + * Perform the accessibility action to scroll up to the previous page (by one finger swipe left and right). + * @return whether the accessibility action is performed or not. + */ + virtual bool AccessibilityActionPageUp(); + + /** + * Perform the accessibility action to scroll down to the next page (by one finger swipe right and left). + * @return whether the accessibility action is performed or not. + */ + virtual bool AccessibilityActionPageDown(); + + /** + * Perform the accessibility action to move the focus to the first item on the screen + * (by one finger swipe up and down). + * @return whether the accessibility action is performed or not. + */ + virtual bool AccessibilityActionMoveToFirst(); + + /** + * Perform the accessibility action to move the focus to the last item on the screen + * (by one finger swipe down and up). + * @return whether the accessibility action is performed or not. + */ + virtual bool AccessibilityActionMoveToLast(); + + /** + * Perform the accessibility action to move the focus to the first item on the top + * and read from the top item continously (by three fingers single tap). + * @return whether the accessibility action is performed or not. + */ + virtual bool AccessibilityActionReadFromTop(); + + /** + * Perform the accessibility action to move the focus to and read from the next item + * continously (by three fingers double tap). + * @return whether the accessibility action is performed or not. + */ + virtual bool AccessibilityActionReadFromNext(); + + /** + * Perform the accessibility action to move the focus to do the zooming (by one finger triple tap). + * @return whether the accessibility action is performed or not. + */ + virtual bool AccessibilityActionZoom(); + + /** + * Perform the accessibility action to read the information in the indicator (by two fingers triple tap). + * @return whether the accessibility action is performed or not. + */ + virtual bool AccessibilityActionReadIndicatorInformation(); + + /** + * Perform the accessibility action to pause/resume the current read out (by two fingers single tap). + * @return whether the accessibility action is performed or not. + */ + virtual bool AccessibilityActionReadPauseResume(); + + /** + * Perform the accessibility action to start/stop the current action (by two fingers double tap). + * @return whether the accessibility action is performed or not. + */ + virtual bool AccessibilityActionStartStop(); + + /** + * Perform the accessibility action to mouse move (by one finger tap & hold and move). + * @param touchEvent touch event structure + * @return whether the accessibility action is performed or not. + */ + virtual bool AccessibilityActionTouch(const TouchEvent& touchEvent); + + /** + * This function is connected to the TtsPlayer StateChangeSignal. + * It is called when the TTS players state changes. + * @param previousState The previous state of the TTS player (for comparison) + * @param currentState The current state of the TTS player + */ + void TtsStateChanged( const Dali::TtsPlayer::State previousState, const Dali::TtsPlayer::State currentState ); + +private: + + // Undefined + AccessibilityManager(const AccessibilityManager&); + + AccessibilityManager& operator=(const AccessibilityManager& rhs); + +private: + + Toolkit::AccessibilityManager::FocusChangedSignalType mFocusChangedSignal; ///< The signal to notify the focus change + Toolkit::AccessibilityManager::FocusOvershotSignalType mFocusOvershotSignal; ///< The signal to notify the focus overshooted + Toolkit::AccessibilityManager::FocusedActorActivatedSignalType mFocusedActorActivatedSignal; ///< The signal to notify the activation of focused actor + + // Action signals. + AccessibilityActionSignalType mStatusChangedSignal; + AccessibilityActionSignalType mActionNextSignal; + AccessibilityActionSignalType mActionPreviousSignal; + AccessibilityActionSignalType mActionActivateSignal; + AccessibilityActionSignalType mActionOverSignal; + AccessibilityActionSignalType mActionReadSignal; + AccessibilityActionSignalType mActionReadNextSignal; + AccessibilityActionSignalType mActionReadPreviousSignal; + AccessibilityActionSignalType mActionUpSignal; + AccessibilityActionSignalType mActionDownSignal; + AccessibilityActionSignalType mActionClearFocusSignal; + AccessibilityActionSignalType mActionBackSignal; + AccessibilityActionSignalType mActionScrollUpSignal; + AccessibilityActionSignalType mActionScrollDownSignal; + AccessibilityActionSignalType mActionPageLeftSignal; + AccessibilityActionSignalType mActionPageRightSignal; + AccessibilityActionSignalType mActionPageUpSignal; + AccessibilityActionSignalType mActionPageDownSignal; + AccessibilityActionSignalType mActionMoveToFirstSignal; + AccessibilityActionSignalType mActionMoveToLastSignal; + AccessibilityActionSignalType mActionReadFromTopSignal; + AccessibilityActionSignalType mActionReadFromNextSignal; + AccessibilityActionSignalType mActionZoomSignal; + AccessibilityActionSignalType mActionReadIndicatorInformationSignal; + AccessibilityActionSignalType mActionReadPauseResumeSignal; + AccessibilityActionSignalType mActionStartStopSignal; + AccessibilityActionScrollSignalType mActionScrollSignal; + + FocusIDContainer mFocusIDContainer; ///< The container to look up actor ID by focus order + IDAdditionalInfoContainer mIDAdditionalInfoContainer; ///< The container to look up additional information by actor ID + FocusIDPair mCurrentFocusActor; ///< The focus order and actor ID of current focused actor + Actor mCurrentGesturedActor; ///< The actor that will handle the gesture + Actor mFocusIndicatorActor; ///< The focus indicator actor shared by all the focusable actors for highlight + Vector2 mPreviousPosition; ///< The previous pan position; useful for calculating velocity for Gesture::Finished events + unsigned int mRecursiveFocusMoveCounter; ///< The counter to count the number of recursive focus movement attempted before the focus movement is successful. + + bool mIsWrapped:1; ///< Whether the focus movement is wrapped around or not + bool mIsFocusWithinGroup:1; ///< Whether the focus movement is limited to the current focus group or not + bool mIsEndcapFeedbackEnabled:1; ///< Whether the endcap feedback need to be played when the focus leaves the end or vice versa + bool mIsEndcapFeedbackPlayed:1; ///< Whether the endcap feedback was played or not + bool mIsAccessibilityTtsEnabled:1; ///< Whether accessibility feature(screen-reader) turned on/off + bool mTtsCreated:1; ///< Whether the TTS Player has been accessed + bool mIsFocusIndicatorEnabled:1; ///< Whether indicator should be shown / hidden. It could be enabled when TTS enabled or 'Tab' key operated. + bool mContinuousPlayMode:1; ///< Keeps track of whether or not we are in continuous play mode + +}; + +} // namespace Internal + +inline Internal::AccessibilityManager& GetImpl(Dali::Toolkit::AccessibilityManager& obj) +{ + DALI_ASSERT_ALWAYS(obj); + + Dali::BaseObject& handle = obj.GetBaseObject(); + + return static_cast(handle); +} + +inline const Internal::AccessibilityManager& GetImpl(const Dali::Toolkit::AccessibilityManager& obj) +{ + DALI_ASSERT_ALWAYS(obj); + + const Dali::BaseObject& handle = obj.GetBaseObject(); + + return static_cast(handle); +} + +} // namespace Toolkit + +} // namespace Dali + +#endif // __DALI_TOOLKIT_INTERNAL_ACCESSIBILITY_MANAGER_H__ diff --git a/dali-toolkit/internal/controls/popup/popup-impl.cpp b/dali-toolkit/internal/controls/popup/popup-impl.cpp index 7577220..f7c4188 100755 --- a/dali-toolkit/internal/controls/popup/popup-impl.cpp +++ b/dali-toolkit/internal/controls/popup/popup-impl.cpp @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include #include diff --git a/dali-toolkit/internal/file.list b/dali-toolkit/internal/file.list index f5a9b35..0135074 100644 --- a/dali-toolkit/internal/file.list +++ b/dali-toolkit/internal/file.list @@ -48,7 +48,7 @@ toolkit_src_files = \ $(toolkit_src_dir)/controls/text-controls/text-selection-popup-impl.cpp \ $(toolkit_src_dir)/controls/text-controls/text-selection-toolbar-impl.cpp \ $(toolkit_src_dir)/controls/tool-bar/tool-bar-impl.cpp \ - $(toolkit_src_dir)/focus-manager/accessibility-focus-manager-impl.cpp \ + $(toolkit_src_dir)/accessibility-manager/accessibility-manager-impl.cpp \ $(toolkit_src_dir)/focus-manager/keyboard-focus-manager-impl.cpp \ $(toolkit_src_dir)/focus-manager/keyinput-focus-manager-impl.cpp \ $(toolkit_src_dir)/filters/blur-two-pass-filter.cpp \ diff --git a/dali-toolkit/internal/focus-manager/accessibility-focus-manager-impl.h b/dali-toolkit/internal/focus-manager/accessibility-focus-manager-impl.h deleted file mode 100644 index fc2b114..0000000 --- a/dali-toolkit/internal/focus-manager/accessibility-focus-manager-impl.h +++ /dev/null @@ -1,428 +0,0 @@ -#ifndef __DALI_TOOLKIT_INTERNAL_ACCESSIBILITY_FOCUS_MANAGER_H__ -#define __DALI_TOOLKIT_INTERNAL_ACCESSIBILITY_FOCUS_MANAGER_H__ - -/* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// EXTERNAL INCLUDES -#include -#include -#include -#include -#include -#include - -// INTERNAL INCLUDES -#include - -namespace Dali -{ - -namespace Toolkit -{ - -namespace Internal -{ - -class AccessibilityFocusManager; - -/** - * @copydoc Toolkit::AccessibilityFocusManager - */ -class AccessibilityFocusManager : public Dali::BaseObject, Dali::AccessibilityActionHandler, Dali::AccessibilityGestureHandler -{ -public: - - struct ActorAdditionalInfo - { - ActorAdditionalInfo() - : mFocusOrder(0) - { - } - - unsigned int mFocusOrder; ///< The focus order of the actor. It is undefined by default. - - std::string mAccessibilityAttributes[Toolkit::AccessibilityFocusManager::ACCESSIBILITY_ATTRIBUTE_NUM]; ///< The array of attribute texts - }; - - typedef std::pair FocusIDPair; - typedef std::map FocusIDContainer; - typedef FocusIDContainer::iterator FocusIDIter; - typedef FocusIDContainer::const_iterator FocusIDConstIter; - - typedef std::pair IDAdditionalInfoPair; - typedef std::map IDAdditionalInfoContainer; - typedef IDAdditionalInfoContainer::iterator IDAdditionalInfoIter; - typedef IDAdditionalInfoContainer::const_iterator IDAdditionalInfoConstIter; - - /** - * Construct a new AccessibilityFocusManager. - */ - AccessibilityFocusManager(); - - /** - * @copydoc Toolkit::AccessibilityFocusManager::SetAccessibilityAttribute - */ - void SetAccessibilityAttribute(Actor actor, Toolkit::AccessibilityFocusManager::AccessibilityAttribute type, const std::string& text); - - /** - * @copydoc Toolkit::AccessibilityFocusManager::GetAccessibilityAttribute - */ - std::string GetAccessibilityAttribute(Actor actor, Toolkit::AccessibilityFocusManager::AccessibilityAttribute type) const; - - /** - * @copydoc Toolkit::AccessibilityFocusManager::SetFocusOrder - */ - void SetFocusOrder(Actor actor, const unsigned int order); - - /** - * @copydoc Toolkit::AccessibilityFocusManager::GetFocusOrder - */ - unsigned int GetFocusOrder(Actor actor) const; - - /** - * @copydoc Toolkit::AccessibilityFocusManager::GenerateNewFocusOrder - */ - unsigned int GenerateNewFocusOrder() const; - - /** - * @copydoc Toolkit::AccessibilityFocusManager::GetActorByFocusOrder - */ - Actor GetActorByFocusOrder(const unsigned int order); - - /** - * @copydoc Toolkit::AccessibilityFocusManager::SetCurrentFocusActor - */ - bool SetCurrentFocusActor(Actor actor); - - /** - * @copydoc Toolkit::AccessibilityFocusManager::GetCurrentFocusActor - */ - Actor GetCurrentFocusActor(); - - /** - * @copydoc Toolkit::AccessibilityFocusManager::GetCurrentFocusGroup - */ - Actor GetCurrentFocusGroup(); - - /** - * @copydoc Toolkit::AccessibilityFocusManager::GetCurrentFocusOrder - */ - unsigned int GetCurrentFocusOrder(); - - /** - * @copydoc Toolkit::AccessibilityFocusManager::MoveFocusForward - */ - bool MoveFocusForward(); - - /** - * @copydoc Toolkit::AccessibilityFocusManager::MoveFocusBackward - */ - bool MoveFocusBackward(); - - /** - * @copydoc Toolkit::AccessibilityFocusManager::ClearFocus - */ - void ClearFocus(); - - /** - * @copydoc Toolkit::AccessibilityFocusManager::Reset - */ - void Reset(); - - /** - * @copydoc Toolkit::AccessibilityFocusManager::SetFocusGroup - */ - void SetFocusGroup(Actor actor, bool isFocusGroup); - - /** - * @copydoc Toolkit::AccessibilityFocusManager::IsFocusGroup - */ - bool IsFocusGroup(Actor actor) const; - - /** - * @copydoc Toolkit::AccessibilityFocusManager::SetGroupMode - */ - void SetGroupMode(bool enabled); - - /** - * @copydoc Toolkit::AccessibilityFocusManager::GetGroupMode - */ - bool GetGroupMode() const; - - /** - * @copydoc Toolkit::AccessibilityFocusManager::SetWrapMode - */ - void SetWrapMode(bool wrapped); - - /** - * @copydoc Toolkit::AccessibilityFocusManager::GetWrapMode - */ - bool GetWrapMode() const; - - /** - * @copydoc Toolkit::AccessibilityFocusManager::SetFocusIndicatorActor - */ - void SetFocusIndicatorActor(Actor indicator); - - /** - * @copydoc Toolkit::AccessibilityFocusManager::GetFocusIndicatorActor - */ - Actor GetFocusIndicatorActor(); - - /** - * @copydoc Toolkit::AccessibilityFocusManager::GetFocusGroup - */ - Actor GetFocusGroup(Actor actor); - -public: - - /** - * @copydoc Toolkit::AccessibilityFocusManager::FocusChangedSignal() - */ - Toolkit::AccessibilityFocusManager::FocusChangedSignalType& FocusChangedSignal(); - - /** - * @copydoc Toolkit::AccessibilityFocusManager::FocusOvershotSignal() - */ - Toolkit::AccessibilityFocusManager::FocusOvershotSignalType& FocusOvershotSignal(); - - /** - * @copydoc Toolkit::AccessibilityFocusManager::FocusedActorActivatedSignal() - */ - Toolkit::AccessibilityFocusManager::FocusedActorActivatedSignalType& FocusedActorActivatedSignal(); - - /** - * Connects a callback function with the object's signals. - * @param[in] object The object providing the signal. - * @param[in] tracker Used to disconnect the signal. - * @param[in] signalName The signal to connect to. - * @param[in] functor A newly allocated FunctorDelegate. - * @return True if the signal was connected. - * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor. - */ - static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor ); - -protected: - - /** - * Destructor - */ - virtual ~AccessibilityFocusManager(); - -private: - - /** - * Get the additional information (e.g. focus order and description) of the given actor. - * @param actorID The ID of the actor to be queried - * @return The additional information of the actor - */ - ActorAdditionalInfo GetActorAdditionalInfo(const unsigned int actorID) const; - - /** - * Synchronize the actor's additional information to reflect its latest focus order - * @param actorID The ID of the actor - * @param order The focus order of the actor - * @return The additional information of the actor - */ - void SynchronizeActorAdditionalInfo(const unsigned int actorID, const unsigned int order); - - /** - * Move the focus to the specified actor and send notification for the focus change. - * @param actorID The ID of the actor to be queried - * @return Whether the focus is successful or not - */ - bool DoSetCurrentFocusActor(const unsigned int actorID); - - /** - * Move the focus to the next actor in the focus chain towards the specified direction. - * @param focusIDIter The iterator pointing to the current focused actor - * @param forward Whether the focus movement is forward or not. The focus movement will be backward if this is false. - * @param wrapped Whether the focus shoule be moved wrapped around or not - * @return Whether the focus is successful or not - */ - bool DoMoveFocus(FocusIDIter focusIDIter, bool forward, bool wrapped); - - /** - * Activate the actor. If the actor is control, call OnActivated virtual function. - * This function will emit FocusedActorActivatedSignal. - * @param actor The actor to activate - */ - void DoActivate(Actor actor); - - /** - * Create the default indicator actor to highlight the focused actor. - */ - void CreateDefaultFocusIndicatorActor(); - - /** - * Set whether the actor is focusable or not. A focusable property will be registered for - * the actor if not yet. - * @param actor The actor to be focused - * @param focusable Whether the actor is focusable or not - */ - void SetFocusable(Actor actor, bool focusable); - - /** - * Handle the accessibility pan gesture. - * @param[in] panEvent The pan event to be handled. - * @return whether the gesture is handled successfully or not. - */ - virtual bool HandlePanGesture(const Integration::PanGestureEvent& panEvent); - - /** - * Change the accessibility status when Accessibility feature(screen-reader) turned on or off. - * @return whether the status is changed or not. - */ - virtual bool ChangeAccessibilityStatus(); - - /** - * Clear the accessibility focus from the current focused actor. - * @return whether the focus is cleared or not. - */ - virtual bool ClearAccessibilityFocus(); - - /** - * Perform the accessibility action to move focus to the previous focusable actor (by one finger flick up). - * @param allowEndFeedback true if end of list feedback should be played when the focus is alread reached to the end - * @return whether the accessibility action is performed or not. - */ - virtual bool AccessibilityActionPrevious(bool allowEndFeedback); - - /** - * Perform the accessibility action to move focus to the next focusable actor (by one finger flick down). - * @param allowEndFeedback true if end of list feedback should be played when the focus is alread reached to the end - * @return whether the accessibility action is performed or not. - */ - virtual bool AccessibilityActionNext(bool allowEndFeedback); - - /** - * Perform the accessibility action to move focus to the previous focusable actor (by one finger flick left). - * @param allowEndFeedback true if end of list feedback should be played when the focus is alread reached to the end - * @return whether the accessibility action is performed or not. - */ - virtual bool AccessibilityActionReadPrevious(bool allowEndFeedback); - - /** - * Perform the accessibility action to move focus to the next focusable actor (by one finger flick right). - * @param allowEndFeedback true if end of list feedback should be played when the focus is alread reached to the end - * @return whether the accessibility action is performed or not. - */ - virtual bool AccessibilityActionReadNext(bool allowEndFeedback); - - /** - * Perform the accessibility action to focus and read the actor (by one finger tap or move). - * @param allowReadAgain true if the action read again the same object (i.e. read action) - * false if the action just read when the focus object is changed (i.e. over action) - * @return whether the accessibility action is performed or not. - */ - virtual bool AccessibilityActionRead(bool allowReadAgain); - - /** - * Perform the accessibility action to activate the current focused actor (by one finger double tap). - * @return whether the accessibility action is performed or not. - */ - virtual bool AccessibilityActionActivate(); - - /** - * Perform the accessibility action to change the value when the current focused actor is a slider - * (by double finger down and move up and right). - * @return whether the accessibility action is performed or not. - */ - virtual bool AccessibilityActionUp(); - - /** - * Perform the accessibility action to change the value when the current focused actor is a slider - * (by double finger down and move down and left). - * @return whether the accessibility action is performed or not. - */ - virtual bool AccessibilityActionDown(); - - /** - * Perform the accessibility action to navigate back (by two fingers circle draw). - * @return whether the accessibility action is performed or not. - */ - virtual bool AccessibilityActionBack(); - - /** - * Perform the accessibility action to mouse move (by one finger tap & hold and move). - * @param touchEvent touch event structure - * @return whether the accessibility action is performed or not. - */ - virtual bool AccessibilityActionTouch(const TouchEvent& touchEvent); - -private: - - // Undefined - AccessibilityFocusManager(const AccessibilityFocusManager&); - - AccessibilityFocusManager& operator=(const AccessibilityFocusManager& rhs); - -private: - - Toolkit::AccessibilityFocusManager::FocusChangedSignalType mFocusChangedSignal; ///< The signal to notify the focus change - Toolkit::AccessibilityFocusManager::FocusOvershotSignalType mFocusOvershotSignal; ///< The signal to notify the focus overshooted - Toolkit::AccessibilityFocusManager::FocusedActorActivatedSignalType mFocusedActorActivatedSignal; ///< The signal to notify the activation of focused actor - - bool mIsWrapped; ///< Whether the focus movement is wrapped around or not - bool mIsFocusWithinGroup; ///< Whether the focus movement is limited to the current focus group or not - - bool mIsEndcapFeedbackEnabled; ///< Whether the endcap feedback need to be played when the focus leaves the end or vice versa - bool mIsEndcapFeedbackPlayed; ///< Whether the endcap feedback was played or not - - FocusIDContainer mFocusIDContainer; ///< The container to look up actor ID by focus order - IDAdditionalInfoContainer mIDAdditionalInfoContainer; ///< The container to look up additional information by actor ID - - FocusIDPair mCurrentFocusActor; ///< The focus order and actor ID of current focused actor - Actor mCurrentGesturedActor; ///< The actor that will handle the gesture - - Actor mFocusIndicatorActor; ///< The focus indicator actor shared by all the focusable actors for highlight - - Vector2 mPreviousPosition; ///< The previous pan position; useful for calculating velocity for Gesture::Finished events - - unsigned int mRecursiveFocusMoveCounter; ///< The counter to count the number of recursive focus movement attempted before the focus movement is successful. - - bool mIsAccessibilityTtsEnabled; ///< Whether accessibility feature(screen-reader) turned on/off - - bool mIsFocusIndicatorEnabled; ///< Whether indicator should be shown / hidden. It could be enabled when TTS enabled or 'Tab' key operated. -}; - -} // namespace Internal - -inline Internal::AccessibilityFocusManager& GetImpl(Dali::Toolkit::AccessibilityFocusManager& obj) -{ - DALI_ASSERT_ALWAYS(obj); - - Dali::BaseObject& handle = obj.GetBaseObject(); - - return static_cast(handle); -} - -inline const Internal::AccessibilityFocusManager& GetImpl(const Dali::Toolkit::AccessibilityFocusManager& obj) -{ - DALI_ASSERT_ALWAYS(obj); - - const Dali::BaseObject& handle = obj.GetBaseObject(); - - return static_cast(handle); -} - -} // namespace Toolkit - -} // namespace Dali - -#endif // __DALI_TOOLKIT_INTERNAL_ACCESSIBILITY_FOCUS_MANAGER_H__ diff --git a/dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp b/dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp index 5be38ac..e1693ad 100644 --- a/dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp +++ b/dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp @@ -21,7 +21,7 @@ // EXTERNAL INCLUDES #include // for strcmp #include -#include +#include #include #include #include @@ -34,7 +34,7 @@ // INTERNAL INCLUDES #include #include -#include +#include #include namespace Dali @@ -515,10 +515,10 @@ void KeyboardFocusManager::OnKeyEvent(const KeyEvent& event) return; } - AccessibilityManager accessibilityManager = AccessibilityManager::Get(); - bool isAccessibilityEnabled = accessibilityManager.IsEnabled(); + AccessibilityAdaptor accessibilityAdaptor = AccessibilityAdaptor::Get(); + bool isAccessibilityEnabled = accessibilityAdaptor.IsEnabled(); - Toolkit::AccessibilityFocusManager accessibilityFocusManager = Toolkit::AccessibilityFocusManager::Get(); + Toolkit::AccessibilityManager accessibilityManager = Toolkit::AccessibilityManager::Get(); std::string keyName = event.keyPressedName; @@ -546,7 +546,7 @@ void KeyboardFocusManager::OnKeyEvent(const KeyEvent& event) else { // Move the accessibility focus backward - accessibilityFocusManager.MoveFocusBackward(); + accessibilityManager.MoveFocusBackward(); } } else if (keyName == "Right") @@ -567,7 +567,7 @@ void KeyboardFocusManager::OnKeyEvent(const KeyEvent& event) else { // Move the accessibility focus forward - accessibilityFocusManager.MoveFocusForward(); + accessibilityManager.MoveFocusForward(); } isFocusStartableKey = true; @@ -663,7 +663,7 @@ void KeyboardFocusManager::OnKeyEvent(const KeyEvent& event) } else { - actor = accessibilityFocusManager.GetCurrentFocusActor(); + actor = accessibilityManager.GetCurrentFocusActor(); } if(actor) diff --git a/dali-toolkit/public-api/accessibility-manager/accessibility-manager.cpp b/dali-toolkit/public-api/accessibility-manager/accessibility-manager.cpp new file mode 100644 index 0000000..0110ef7 --- /dev/null +++ b/dali-toolkit/public-api/accessibility-manager/accessibility-manager.cpp @@ -0,0 +1,341 @@ +/* + * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// CLASS HEADER +#include + +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES +#include + +namespace Dali +{ + +namespace Toolkit +{ + +AccessibilityManager::AccessibilityManager() +{ +} + +AccessibilityManager::~AccessibilityManager() +{ +} + +AccessibilityManager AccessibilityManager::Get() +{ + AccessibilityManager manager; + + // Check whether the accessibility manager is already created + SingletonService singletonService( SingletonService::Get() ); + if ( singletonService ) + { + Dali::BaseHandle handle = singletonService.GetSingleton(typeid(AccessibilityManager)); + if(handle) + { + // If so, downcast the handle of singleton to focus manager + manager = AccessibilityManager(dynamic_cast(handle.GetObjectPtr())); + } + + if(!manager) + { + // If not, create the accessibility manager and register it as a singleton + Internal::AccessibilityManager* internalManager = new Internal::AccessibilityManager(); + manager = AccessibilityManager( internalManager ); + internalManager->Initialise(); + singletonService.Register( typeid(manager), manager ); + } + } + + return manager; +} + +AccessibilityManager::AccessibilityManager(Internal::AccessibilityManager *impl) + : BaseHandle(impl) +{ +} + +void AccessibilityManager::SetAccessibilityAttribute(Actor actor, AccessibilityAttribute type, const std::string& text) +{ + GetImpl(*this).SetAccessibilityAttribute(actor, type, text); +} + +std::string AccessibilityManager::GetAccessibilityAttribute(Actor actor, AccessibilityAttribute type) const +{ + return GetImpl(*this).GetAccessibilityAttribute(actor, type); +} + +void AccessibilityManager::SetFocusOrder(Actor actor, const unsigned int order) +{ + GetImpl(*this).SetFocusOrder(actor, order); +} + +unsigned int AccessibilityManager::GetFocusOrder(Actor actor) const +{ + return GetImpl(*this).GetFocusOrder(actor); +} + +unsigned int AccessibilityManager::GenerateNewFocusOrder() const +{ + return GetImpl(*this).GenerateNewFocusOrder(); +} + +Actor AccessibilityManager::GetActorByFocusOrder(const unsigned int order) +{ + return GetImpl(*this).GetActorByFocusOrder(order); +} + +bool AccessibilityManager::SetCurrentFocusActor(Actor actor) +{ + return GetImpl(*this).SetCurrentFocusActor(actor); +} + +Actor AccessibilityManager::GetCurrentFocusActor() +{ + return GetImpl(*this).GetCurrentFocusActor(); +} + +Actor AccessibilityManager::GetCurrentFocusGroup() +{ + return GetImpl(*this).GetCurrentFocusGroup(); +} + +unsigned int AccessibilityManager::GetCurrentFocusOrder() +{ + return GetImpl(*this).GetCurrentFocusOrder(); +} + +bool AccessibilityManager::MoveFocusForward() +{ + return GetImpl(*this).MoveFocusForward(); +} + +bool AccessibilityManager::MoveFocusBackward() +{ + return GetImpl(*this).MoveFocusBackward(); +} + +void AccessibilityManager::ClearFocus() +{ + GetImpl(*this).ClearFocus(); +} + +void AccessibilityManager::Reset() +{ + GetImpl(*this).Reset(); +} + +void AccessibilityManager::SetFocusGroup(Actor actor, bool isFocusGroup) +{ + GetImpl(*this).SetFocusGroup(actor, isFocusGroup); +} + +bool AccessibilityManager::IsFocusGroup(Actor actor) const +{ + return GetImpl(*this).IsFocusGroup(actor); +} + +void AccessibilityManager::SetGroupMode(bool enabled) +{ + GetImpl(*this).SetGroupMode(enabled); +} + +bool AccessibilityManager::GetGroupMode() const +{ + return GetImpl(*this).GetGroupMode(); +} + +void AccessibilityManager::SetWrapMode(bool wrapped) +{ + GetImpl(*this).SetWrapMode(wrapped); +} + +bool AccessibilityManager::GetWrapMode() const +{ + return GetImpl(*this).GetWrapMode(); +} + +void AccessibilityManager::SetFocusIndicatorActor(Actor indicator) +{ + GetImpl(*this).SetFocusIndicatorActor(indicator); +} + +Actor AccessibilityManager::GetFocusIndicatorActor() +{ + return GetImpl(*this).GetFocusIndicatorActor(); +} + +Actor AccessibilityManager::GetFocusGroup(Actor actor) +{ + return GetImpl(*this).GetFocusGroup(actor); +} + +AccessibilityManager::FocusChangedSignalType& AccessibilityManager::FocusChangedSignal() +{ + return GetImpl(*this).FocusChangedSignal(); +} + +AccessibilityManager::FocusOvershotSignalType& AccessibilityManager::FocusOvershotSignal() +{ + return GetImpl(*this).FocusOvershotSignal(); +} + +AccessibilityManager::FocusedActorActivatedSignalType& AccessibilityManager::FocusedActorActivatedSignal() +{ + return GetImpl(*this).FocusedActorActivatedSignal(); +} + +AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::StatusChangedSignal() +{ + return GetImpl(*this).StatusChangedSignal(); +} + +AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionNextSignal() +{ + return GetImpl(*this).ActionNextSignal(); +} + +AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionPreviousSignal() +{ + return GetImpl(*this).ActionPreviousSignal(); +} + +AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionActivateSignal() +{ + return GetImpl(*this).ActionActivateSignal(); +} + +AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionOverSignal() +{ + return GetImpl(*this).ActionOverSignal(); +} + +AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionReadSignal() +{ + return GetImpl(*this).ActionReadSignal(); +} + +AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionReadNextSignal() +{ + return GetImpl(*this).ActionReadNextSignal(); +} + +AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionReadPreviousSignal() +{ + return GetImpl(*this).ActionReadPreviousSignal(); +} + +AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionUpSignal() +{ + return GetImpl(*this).ActionUpSignal(); +} + +AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionDownSignal() +{ + return GetImpl(*this).ActionDownSignal(); +} + +AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionClearFocusSignal() +{ + return GetImpl(*this).ActionClearFocusSignal(); +} + +AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionBackSignal() +{ + return GetImpl(*this).ActionBackSignal(); +} + +AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionScrollUpSignal() +{ + return GetImpl(*this).ActionScrollUpSignal(); +} + +AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionScrollDownSignal() +{ + return GetImpl(*this).ActionScrollDownSignal(); +} + +AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionPageLeftSignal() +{ + return GetImpl(*this).ActionPageLeftSignal(); +} + +AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionPageRightSignal() +{ + return GetImpl(*this).ActionPageRightSignal(); +} + +AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionPageUpSignal() +{ + return GetImpl(*this).ActionPageUpSignal(); +} + +AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionPageDownSignal() +{ + return GetImpl(*this).ActionPageDownSignal(); +} + +AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionMoveToFirstSignal() +{ + return GetImpl(*this).ActionMoveToFirstSignal(); +} + +AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionMoveToLastSignal() +{ + return GetImpl(*this).ActionMoveToLastSignal(); +} + +AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionReadFromTopSignal() +{ + return GetImpl(*this).ActionReadFromTopSignal(); +} + +AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionReadFromNextSignal() +{ + return GetImpl(*this).ActionReadFromNextSignal(); +} + +AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionZoomSignal() +{ + return GetImpl(*this).ActionZoomSignal(); +} + +AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionReadIndicatorInformationSignal() +{ + return GetImpl(*this).ActionReadIndicatorInformationSignal(); +} + +AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionReadPauseResumeSignal() +{ + return GetImpl(*this).ActionReadPauseResumeSignal(); +} + +AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionStartStopSignal() +{ + return GetImpl(*this).ActionStartStopSignal(); +} + +AccessibilityManager::AccessibilityActionScrollSignalType& AccessibilityManager::ActionScrollSignal() +{ + return GetImpl(*this).ActionScrollSignal(); +} + +} // namespace Toolkit + +} // namespace Dali diff --git a/dali-toolkit/public-api/accessibility-manager/accessibility-manager.h b/dali-toolkit/public-api/accessibility-manager/accessibility-manager.h new file mode 100644 index 0000000..703d414 --- /dev/null +++ b/dali-toolkit/public-api/accessibility-manager/accessibility-manager.h @@ -0,0 +1,751 @@ +#ifndef __DALI_TOOLKIT_ACCESSIBILITY_MANAGER_H__ +#define __DALI_TOOLKIT_ACCESSIBILITY_MANAGER_H__ + +/* + * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// EXTERNAL INCLUDES +#include +#include + +namespace Dali +{ + +namespace Toolkit +{ + +namespace Internal DALI_INTERNAL +{ +class AccessibilityManager; +} + +/** + * @brief Manages registration of actors in a accessibility focus chain and changing the + * focused actor within that chain. + * + * This class provides the functionality of registering the focus order and description + * of actors and maintaining the focus chain. + * + * It provides functionality of setting the + * focus and moving the focus forward and backward. It also draws a highlight for the + * focused actor and emits a signal when the focus is changed. + * + * Signals + * | %Signal Name | Method | + * |-------------------------|------------------------------------| + * | focus-changed | @ref FocusChangedSignal() | + * | focus-overshot | @ref FocusOvershotSignal() | + * | focused-actor-activated | @ref FocusedActorActivatedSignal() | + */ +class DALI_IMPORT_API AccessibilityManager : public BaseHandle +{ +public: + + // Typedefs + + /** + * @brief Accessibility Action Signal. + * + * The connected signal callback should return true if handled. + */ + typedef Signal< bool ( AccessibilityManager& ) > AccessibilityActionSignalType; ///< Generic signal type + typedef Signal< bool ( AccessibilityManager&, const Dali::TouchEvent& )> AccessibilityActionScrollSignalType; ///< Scroll signal type + + /** + * @brief Accessibility needs four information which will be read by screen-reader. + * + * Reading order : Label -> Trait -> Optional (Value and Hint) + */ + enum AccessibilityAttribute + { + ACCESSIBILITY_LABEL = 0, ///< Simple text which contained in ui-control + ACCESSIBILITY_TRAIT, ///< Description of ui-control trait + ACCESSIBILITY_VALUE, ///< Current value of ui-control (Optional) + ACCESSIBILITY_HINT, ///< Hint for action (Optional) + ACCESSIBILITY_ATTRIBUTE_NUM ///< Number of attributes + }; + + /** + * @brief Overshoot direction. + */ + enum FocusOvershotDirection + { + OVERSHOT_PREVIOUS = -1, ///< Try to move previous of the first actor + OVERSHOT_NEXT = 1, ///< Try to move next of the last actor + }; + + public: + + /// @brief Focus changed signal + typedef Signal< void ( Actor, Actor ) > FocusChangedSignalType; + + /// @brief Focus overshooted signal + typedef Signal< void ( Actor, FocusOvershotDirection ) > FocusOvershotSignalType; + + /// @brief Focused actor activated signal + typedef Signal< void ( Actor ) > FocusedActorActivatedSignalType; + + /** + * @brief Create a AccessibilityManager handle; this can be initialised with AccessibilityManager::New(). + * + * Calling member functions with an uninitialised handle is not allowed. + */ + AccessibilityManager(); + + /** + * @brief Destructor + * + * This is non-virtual since derived Handle types must not contain data or virtual methods. + */ + ~AccessibilityManager(); + + /** + * @brief Get the singleton of AccessibilityManager object. + * + * @return A handle to the AccessibilityManager control. + */ + static AccessibilityManager Get(); + + /** + * @brief Set the information of the specified actor's accessibility attribute. + * + * @pre The AccessibilityManager has been initialized. + * @pre The Actor has been initialized. + * @param actor The actor the text to be set with + * @param type The attribute type the text to be set with + * @param text The text for the actor's accessibility information + */ + void SetAccessibilityAttribute(Actor actor, AccessibilityAttribute type, const std::string& text); + + /** + * @brief Get the text of the specified actor's accessibility attribute. + * + * @pre The AccessibilityManager has been initialized. + * @pre The Actor has been initialized. + * @param actor The actor to be queried + * @param type The attribute type to be queried + * @return The text of the actor's accessibility information + */ + std::string GetAccessibilityAttribute(Actor actor, AccessibilityAttribute type) const; + + /** + * @brief Set the focus order of the actor. + * + * The focus order of each actor in the focus chain is unique. If + * there is another actor assigned with the same focus order + * already, the new actor will be inserted to the focus chain with + * that focus order, and the focus order of the original actor and + * all the actors followed in the focus chain will be increased + * accordingly. If the focus order assigned to the actor is 0, it + * means that actor's focus order is undefined (e.g. the actor has a + * description but with no focus order being set yet) and therefore + * that actor is not focusable. + * + * @pre The AccessibilityManager has been initialized. + * @pre The Actor has been initialized. + * @param actor The actor the focus order to be set with + * @param order The focus order of the actor + */ + void SetFocusOrder(Actor actor, const unsigned int order); + + /** + * @brief Get the focus order of the actor. + * + * When the focus order is 0, it means the focus order of the actor + * is undefined. + * + * @pre The AccessibilityManager has been initialized. + * @pre The Actor has been initialized. + * @param actor The actor to be queried + * @return The focus order of the actor + */ + unsigned int GetFocusOrder(Actor actor) const; + + /** + * @brief Generates a new focus order number which can be used to + * assign to actors which need to be appended to the end of the + * current focus order chain. + * + * The new number will be an increment over the very last focus + * order number in the focus chain. If the focus chain is empty then + * the function returns 1, else the number returned will be FOLast + + * 1 where FOLast is the focus order of the very last control in the + * focus chain. + * + * @pre The AccessibilityManager has been initialized. + * @return The focus order of the actor + */ + unsigned int GenerateNewFocusOrder() const; + + /** + * @brief Get the actor that has the specified focus order. + * + * It will return an empty handle if the actor is not in the stage + * or has a focus order of 0. + * + * @pre The AccessibilityManager has been initialized. + * @param order The focus order of the actor + * + * @return The actor that has the specified focus order or an empty + * handle if no actor in the stage has the specified focus order. + */ + Actor GetActorByFocusOrder(const unsigned int order); + + /** + * @brief Move the focus to the specified actor. + * + * Only one actor can be focused at the same time. The actor must + * have a defined focus order and must be focusable, visible and in + * the stage. + * + * @pre The AccessibilityManager has been initialized. + * @pre The Actor has been initialized. + * @param actor The actor to be focused + * @return Whether the focus is successful or not + */ + bool SetCurrentFocusActor(Actor actor); + + /** + * @brief Get the current focused actor. + * + * @pre The AccessibilityManager has been initialized. + * @return A handle to the current focused actor or an empty handle if no actor is focused. + */ + Actor GetCurrentFocusActor(); + + /** + * @brief Get the focus group of current focused actor. + * + * @pre The AccessibilityManager has been initialized. + * + * @return A handle to the immediate parent of the current focused + * actor which is also a focus group, or an empty handle if no actor + * is focused. + */ + Actor GetCurrentFocusGroup(); + + /** + * @brief Get the focus order of currently focused actor. + * @pre The AccessibilityManager has been initialized. + * + * @return The focus order of the currently focused actor or 0 if no + * actor is in focus. + */ + unsigned int GetCurrentFocusOrder(); + + /** + * @brief Move the focus to the next focusable actor in the focus + * chain (according to the focus traversal order). + * + * When the focus movement is wrapped around, the focus will be moved + * to the first focusable actor when it reaches the end of the focus chain. + * + * @pre The AccessibilityManager has been initialized. + * @return true if the moving was successful + */ + bool MoveFocusForward(); + + /** + * @brief Move the focus to the previous focusable actor in the + * focus chain (according to the focus traversal order). + * + * When the focus movement is wrapped around, the focus will be + * moved to the last focusable actor when it reaches the beginning + * of the focus chain. + * + * @pre The AccessibilityManager has been initialized. + * @return true if the moving was successful + */ + bool MoveFocusBackward(); + + /** + * @brief Clear the focus from the current focused actor if any, so + * that no actor is focused in the focus chain. + * + * It will emit focus changed signal without current focused actor + * @pre The AccessibilityManager has been initialized. + */ + void ClearFocus(); + + /** + * @brief Clear the every registered focusable actor from focus-manager. + * @pre The AccessibilityManager has been initialized. + */ + void Reset(); + + /** + * @brief Set whether an actor is a focus group that can limit the + * scope of focus movement to its child actors in the focus chain. + * + * @pre The AccessibilityManager has been initialized. + * @pre The Actor has been initialized. + * @param actor The actor to be set as a focus group. + * @param isFocusGroup Whether to set the actor to be a focus group or not. + */ + void SetFocusGroup(Actor actor, bool isFocusGroup); + + /** + * @brief Check whether the actor is set as a focus group or not. + * + * @pre The AccessibilityManager has been initialized. + * @pre The Actor has been initialized. + * @param actor The actor to be checked. + * @return Whether the actor is set as a focus group. + */ + bool IsFocusGroup(Actor actor) const; + + /** + * @brief Set whether the group mode is enabled or not. + * + * When the group mode is enabled, the focus movement will be limited to the child actors + * of the current focus group including the current focus group itself. The current focus + * group is the closest ancestor of the current focused actor that set as a focus group. + * @pre The AccessibilityManager has been initialized. + * @param enabled Whether the group mode is enabled or not + */ + void SetGroupMode(bool enabled); + + /** + * @brief Get whether the group mode is enabled or not. + * + * @pre The AccessibilityManager has been initialized. + * @return Whether the group mode is enabled or not. + */ + bool GetGroupMode() const; + + /** + * @brief Set whether focus will be moved to the beginning of the + * focus chain when it reaches the end or vice versa. + * + * When both the wrap mode and the group mode are enabled, focus will be + * wrapped within the current focus group. Focus will not be wrapped in default. + * @pre The AccessibilityManager has been initialized. + * @param wrapped Whether the focus movement is wrapped around or not + */ + void SetWrapMode(bool wrapped); + + /** + * @brief Get whether the wrap mode is enabled or not. + * + * @pre The AccessibilityManager has been initialized. + * @return Whether the wrap mode is enabled or not. + */ + bool GetWrapMode() const; + + /** + * @brief Set the focus indicator actor. + * + * This will replace the default focus indicator actor in + * AccessibilityManager and will be added to the focused actor as a + * highlight. + * + * @pre The AccessibilityManager has been initialized. + * @pre The indicator actor has been initialized. + * @param indicator The indicator actor to be added + */ + void SetFocusIndicatorActor(Actor indicator); + + /** + * @brief Get the focus indicator actor. + * + * @pre The AccessibilityManager has been initialized. + * @return A handle to the focus indicator actor + */ + Actor GetFocusIndicatorActor(); + + /** + * @brief Returns the closest ancestor of the given actor that is a focus group. + * + * @param actor The actor to be checked for its focus group + * @return The focus group the given actor belongs to or an empty handle if the given actor doesn't belong to any focus group + */ + Actor GetFocusGroup(Actor actor); + + public: // Signals + + /** + * @brief This signal is emitted when the current focused actor is changed. + * + * A callback of the following type may be connected: + * @code + * void YourCallbackName(Actor originalFocusedActor, Actor currentFocusedActor); + * @endcode + * @pre The Object has been initialized. + * @return The signal to connect to. + */ + FocusChangedSignalType& FocusChangedSignal(); + + /** + * @brief This signal is emitted when there is no way to move focus further. + * + * A callback of the following type may be connected: + * @code + * void YourCallbackName(Actor currentFocusedActor, FocusOvershotDirection direction); + * @endcode + * @pre The Object has been initialized. + * @return The signal to connect to. + */ + FocusOvershotSignalType& FocusOvershotSignal(); + + /** + * @brief This signal is emitted when the current focused actor is activated. + * + * A callback of the following type may be connected: + * @code + * void YourCallbackName(Actor activatedActor); + * @endcode + * @pre The Object has been initialized. + * @return The signal to connect to. + */ + FocusedActorActivatedSignalType& FocusedActorActivatedSignal(); + + public: // Accessibility action signals. + + /** + * @brief This is emitted when accessibility(screen-reader) feature turned on or off. + * + * A callback of the following type may be connected: + * @code + * bool YourCallback( AccessibilityManager& manager ); + * @endcode + * @return The signal to connect to. + */ + AccessibilityActionSignalType& StatusChangedSignal(); + + /** + * @brief This is emitted when accessibility action is received to move focus to the next + * focusable actor (by one finger flick down). + * + * A callback of the following type may be connected: + * @code + * bool YourCallback( AccessibilityManager& manager ); + * @endcode + * @return The signal to connect to. + */ + AccessibilityActionSignalType& ActionNextSignal(); + + /** + * @brief This is emitted when accessibility action is received to move focus to the previous + * focusable actor (by one finger flick up). + * + * A callback of the following type may be connected: + * @code + * bool YourCallback( AccessibilityManager& manager ); + * @endcode + * @return The signal to connect to. + */ + AccessibilityActionSignalType& ActionPreviousSignal(); + + /** + * @brief This is emitted when accessibility action is received to activate the current focused + * actor (by one finger double tap). + * + * A callback of the following type may be connected: + * @code + * bool YourCallback( AccessibilityManager& manager ); + * @endcode + * @return The signal to connect to. + */ + AccessibilityActionSignalType& ActionActivateSignal(); + + /** + * @brief This is emitted when accessibility action is received to focus and read the actor + * (by one finger tap). + * + * A callback of the following type may be connected: + * @code + * bool YourCallback( AccessibilityManager& manager ); + * @endcode + * @return The signal to connect to. + */ + AccessibilityActionSignalType& ActionReadSignal(); + + /** + * @brief This is emitted when accessibility action is received to focus and read the actor + * (by one finger move). + * + * A callback of the following type may be connected: + * @code + * bool YourCallback( AccessibilityManager& manager ); + * @endcode + * @return The signal to connect to. + */ + AccessibilityActionSignalType& ActionOverSignal(); + + /** + * @brief This is emitted when accessibility action is received to move focus to the next + * focusable actor (by one finger flick right). + * + * A callback of the following type may be connected: + * @code + * bool YourCallback( AccessibilityManager& manager ); + * @endcode + * @return The signal to connect to. + */ + AccessibilityActionSignalType& ActionReadNextSignal(); + + /** + * @brief This is emitted when accessibility action is received to move focus to the previous + * focusable actor (by one finger flick left). + * + * A callback of the following type may be connected: + * @code + * bool YourCallback( AccessibilityManager& manager ); + * @endcode + * @return The signal to connect to. + */ + AccessibilityActionSignalType& ActionReadPreviousSignal(); + + /** + * @brief This is emitted when accessibility action is received to change the value when the + * current focused actor is a slider (by double finger down and move up and right). + * + * A callback of the following type may be connected: + * @code + * bool YourCallback( AccessibilityManager& manager ); + * @endcode + * @return The signal to connect to. + */ + AccessibilityActionSignalType& ActionUpSignal(); + + /** + * @brief This is emitted when accessibility action is received to change the value when the + * current focused actor is a slider (by double finger down and move down and left). + * + * A callback of the following type may be connected: + * @code + * bool YourCallback( AccessibilityManager& manager ); + * @endcode + * @return The signal to connect to. + */ + AccessibilityActionSignalType& ActionDownSignal(); + + /** + * @brief This is emitted when accessibility action is received to clear the focus from the + * current focused actor if any, so that no actor is focused in the focus chain. + * + * A callback of the following type may be connected: + * @code + * bool YourCallback( AccessibilityManager& manager ); + * @endcode + * @return The signal to connect to. + */ + AccessibilityActionSignalType& ActionClearFocusSignal(); + + /** + * @brief This is emitted when accessibility action is received to navigate back (by two + * fingers circle draw). + * + * A callback of the following type may be connected: + * @code + * bool YourCallback( AccessibilityManager& manager ); + * @endcode + * @return The signal to connect to. + */ + AccessibilityActionSignalType& ActionBackSignal(); + + /** + * @brief This is emitted when accessibility action is received to scroll up the list + * (by two finger swipe up). + * + * A callback of the following type may be connected: + * @code + * bool YourCallback( AccessibilityManager& manager ); + * @endcode + * @return The signal to connect to. + */ + AccessibilityActionSignalType& ActionScrollUpSignal(); + + /** + * @brief This is emitted when accessibility action is received to scroll down the list + * (by two finger swipe down). + * + * A callback of the following type may be connected: + * @code + * bool YourCallback( AccessibilityManager& manager ); + * @endcode + * @return The signal to connect to. + */ + AccessibilityActionSignalType& ActionScrollDownSignal(); + + /** + * @brief This is emitted when accessibility action is received to scroll left to the + * previous page (by two finger swipe left) + * + * A callback of the following type may be connected: + * @code + * bool YourCallback( AccessibilityManager& manager ); + * @endcode + * @return The signal to connect to. + */ + AccessibilityActionSignalType& ActionPageLeftSignal(); + + /** + * @brief This is emitted when accessibility action is received to scroll right to the + * next page (by two finger swipe right) + * + * A callback of the following type may be connected: + * @code + * bool YourCallback( AccessibilityManager& manager ); + * @endcode + * @return The signal to connect to. + */ + AccessibilityActionSignalType& ActionPageRightSignal(); + + /** + * @brief This is emitted when accessibility action is received to scroll up to the + * previous page (by one finger swipe left and right) + * + * A callback of the following type may be connected: + * @code + * bool YourCallback( AccessibilityManager& manager ); + * @endcode + * @return The signal to connect to. + */ + AccessibilityActionSignalType& ActionPageUpSignal(); + + /** + * @brief This is emitted when accessibility action is received to scroll down to the + * next page (by one finger swipe right and left) + * + * A callback of the following type may be connected: + * @code + * bool YourCallback( AccessibilityManager& manager ); + * @endcode + * @return The signal to connect to. + */ + AccessibilityActionSignalType& ActionPageDownSignal(); + + /** + * @brief This is emitted when accessibility action is received to move the focus to + * the first item on the screen (by one finger swipe up and down) + * + * A callback of the following type may be connected: + * @code + * bool YourCallback( AccessibilityManager& manager ); + * @endcode + * @return The signal to connect to. + */ + AccessibilityActionSignalType& ActionMoveToFirstSignal(); + + /** + * @brief This is emitted when accessibility action is received to move the focus to + * the last item on the screen (by one finger swipe down and up) + * + * A callback of the following type may be connected: + * @code + * bool YourCallback( AccessibilityManager& manager ); + * @endcode + * @return The signal to connect to. + */ + AccessibilityActionSignalType& ActionMoveToLastSignal(); + + /** + * @brief This is emitted when accessibility action is received to focus and read from the + * first item on the top continously (by three fingers single tap) + * + * A callback of the following type may be connected: + * @code + * bool YourCallback( AccessibilityManager& manager ); + * @endcode + * @return The signal to connect to. + */ + AccessibilityActionSignalType& ActionReadFromTopSignal(); + + /** + * @brief This is emitted when accessibility action is received to move the focus to and + * read from the next item continously (by three fingers double tap) + * + * A callback of the following type may be connected: + * @code + * bool YourCallback( AccessibilityManager& manager ); + * @endcode + * @return The signal to connect to. + */ + AccessibilityActionSignalType& ActionReadFromNextSignal(); + + /** + * @brief This is emitted when accessibility action is received to zoom (by one finger + * triple tap) + * + * A callback of the following type may be connected: + * @code + * bool YourCallback( AccessibilityManager& manager ); + * @endcode + * @return The signal to connect to. + */ + AccessibilityActionSignalType& ActionZoomSignal(); + + /** + * @brief This is emitted when accessibility action is received to read the information + * in the indicator (by two fingers triple tap). + * + * A callback of the following type may be connected: + * @code + * bool YourCallback( AccessibilityManager& manager ); + * @endcode + * @return The signal to connect to. + */ + AccessibilityActionSignalType& ActionReadIndicatorInformationSignal(); + + /** + * @brief This is emitted when accessibility action is received to pause/resume the + * current speech (by two fingers single tap). + * + * A callback of the following type may be connected: + * @code + * bool YourCallback( AccessibilityManager& manager ); + * @endcode + * @return The signal to connect to. + */ + AccessibilityActionSignalType& ActionReadPauseResumeSignal(); + + /** + * @brief This is emitted when accessibility action is received to start/stop the + * current action (by two fingers double tap). + * + * A callback of the following type may be connected: + * @code + * bool YourCallback( AccessibilityManager& manager ); + * @endcode + * @return The signal to connect to. + */ + AccessibilityActionSignalType& ActionStartStopSignal(); + + /** + * @brief This is emitted when accessibility action is received to handle scroll event (by two + * fingers drag). + * + * A callback of the following type may be connected: + * @code + * bool YourCallback( AccessibilityManager& manager, const TouchEvent& event ); + * @endcode + * @return The signal to connect to. + */ + AccessibilityActionScrollSignalType& ActionScrollSignal(); + +public: + + explicit DALI_INTERNAL AccessibilityManager( Internal::AccessibilityManager *impl ); + +}; // class AccessibilityManager + +} // namespace Toolkit + +} // namespace Dali + +#endif // __DALI_TOOLKIT_ACCESSIBILITY_MANAGER_H__ diff --git a/dali-toolkit/public-api/controls/control-impl.cpp b/dali-toolkit/public-api/controls/control-impl.cpp index ee5d0fd..87f1461 100644 --- a/dali-toolkit/public-api/controls/control-impl.cpp +++ b/dali-toolkit/public-api/controls/control-impl.cpp @@ -735,6 +735,11 @@ bool Control::OnAccessibilityValueChange(bool isIncrease) return false; // Accessibility value change action is not handled by default } +bool Control::OnAccessibilityZoom() +{ + return false; // Accessibility zoom action is not handled by default +} + Actor Control::GetNextKeyboardFocusableActor(Actor currentFocusedActor, Toolkit::Control::KeyboardFocus::Direction direction, bool loopEnabled) { return Actor(); diff --git a/dali-toolkit/public-api/controls/control-impl.h b/dali-toolkit/public-api/controls/control-impl.h index 63ea4e9..ea14dbc 100644 --- a/dali-toolkit/public-api/controls/control-impl.h +++ b/dali-toolkit/public-api/controls/control-impl.h @@ -465,6 +465,14 @@ public: // API for derived classes to override */ virtual bool OnAccessibilityValueChange( bool isIncrease ); + /** + * @brief This method should be overridden by deriving classes when they wish to respond + * the accessibility zoom action + * + * @return true if the zoom action has been consumed by this control + */ + virtual bool OnAccessibilityZoom(); + // Keyboard focus /** diff --git a/dali-toolkit/public-api/file.list b/dali-toolkit/public-api/file.list index 76c306d..0109380 100755 --- a/dali-toolkit/public-api/file.list +++ b/dali-toolkit/public-api/file.list @@ -22,7 +22,7 @@ public_api_src_files = \ $(public_api_src_dir)/controls/text-controls/text-label.cpp \ $(public_api_src_dir)/controls/text-controls/text-field.cpp \ $(public_api_src_dir)/controls/gaussian-blur-view/gaussian-blur-view.cpp \ - $(public_api_src_dir)/focus-manager/accessibility-focus-manager.cpp \ + $(public_api_src_dir)/accessibility-manager/accessibility-manager.cpp \ $(public_api_src_dir)/focus-manager/keyboard-focus-manager.cpp \ $(public_api_src_dir)/dali-toolkit-version.cpp \ $(public_api_src_dir)/enums.cpp @@ -78,8 +78,10 @@ public_api_text_controls_header_files = \ $(public_api_src_dir)/controls/text-controls/text-label.h \ $(public_api_src_dir)/controls/text-controls/text-field.h +public_api_accessibility_manager_header_files = \ + $(public_api_src_dir)/accessibility-manager/accessibility-manager.h + public_api_focus_manager_header_files = \ - $(public_api_src_dir)/focus-manager/accessibility-focus-manager.h \ $(public_api_src_dir)/focus-manager/keyboard-focus-manager.h public_api_rendering_backend_header_files = \ diff --git a/dali-toolkit/public-api/focus-manager/accessibility-focus-manager.cpp b/dali-toolkit/public-api/focus-manager/accessibility-focus-manager.cpp deleted file mode 100644 index 83af89d..0000000 --- a/dali-toolkit/public-api/focus-manager/accessibility-focus-manager.cpp +++ /dev/null @@ -1,204 +0,0 @@ -/* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADER -#include - -// EXTERNAL INCLUDES -#include - -// INTERNAL INCLUDES -#include - -namespace Dali -{ - -namespace Toolkit -{ - -AccessibilityFocusManager::AccessibilityFocusManager() -{ -} - -AccessibilityFocusManager::~AccessibilityFocusManager() -{ -} - -AccessibilityFocusManager AccessibilityFocusManager::Get() -{ - AccessibilityFocusManager manager; - - // Check whether the accessibility focus manager is already created - SingletonService singletonService( SingletonService::Get() ); - if ( singletonService ) - { - Dali::BaseHandle handle = singletonService.GetSingleton(typeid(AccessibilityFocusManager)); - if(handle) - { - // If so, downcast the handle of singleton to focus manager - manager = AccessibilityFocusManager(dynamic_cast(handle.GetObjectPtr())); - } - - if(!manager) - { - // If not, create the accessibility focus manager and register it as a singleton - manager = AccessibilityFocusManager(new Internal::AccessibilityFocusManager()); - singletonService.Register(typeid(manager), manager); - } - } - - return manager; -} - -AccessibilityFocusManager::AccessibilityFocusManager(Internal::AccessibilityFocusManager *impl) - : BaseHandle(impl) -{ -} - -void AccessibilityFocusManager::SetAccessibilityAttribute(Actor actor, AccessibilityAttribute type, const std::string& text) -{ - GetImpl(*this).SetAccessibilityAttribute(actor, type, text); -} - -std::string AccessibilityFocusManager::GetAccessibilityAttribute(Actor actor, AccessibilityAttribute type) const -{ - return GetImpl(*this).GetAccessibilityAttribute(actor, type); -} - -void AccessibilityFocusManager::SetFocusOrder(Actor actor, const unsigned int order) -{ - GetImpl(*this).SetFocusOrder(actor, order); -} - -unsigned int AccessibilityFocusManager::GetFocusOrder(Actor actor) const -{ - return GetImpl(*this).GetFocusOrder(actor); -} - -unsigned int AccessibilityFocusManager::GenerateNewFocusOrder() const -{ - return GetImpl(*this).GenerateNewFocusOrder(); -} - -Actor AccessibilityFocusManager::GetActorByFocusOrder(const unsigned int order) -{ - return GetImpl(*this).GetActorByFocusOrder(order); -} - -bool AccessibilityFocusManager::SetCurrentFocusActor(Actor actor) -{ - return GetImpl(*this).SetCurrentFocusActor(actor); -} - -Actor AccessibilityFocusManager::GetCurrentFocusActor() -{ - return GetImpl(*this).GetCurrentFocusActor(); -} - -Actor AccessibilityFocusManager::GetCurrentFocusGroup() -{ - return GetImpl(*this).GetCurrentFocusGroup(); -} - -unsigned int AccessibilityFocusManager::GetCurrentFocusOrder() -{ - return GetImpl(*this).GetCurrentFocusOrder(); -} - -bool AccessibilityFocusManager::MoveFocusForward() -{ - return GetImpl(*this).MoveFocusForward(); -} - -bool AccessibilityFocusManager::MoveFocusBackward() -{ - return GetImpl(*this).MoveFocusBackward(); -} - -void AccessibilityFocusManager::ClearFocus() -{ - GetImpl(*this).ClearFocus(); -} - -void AccessibilityFocusManager::Reset() -{ - GetImpl(*this).Reset(); -} - -void AccessibilityFocusManager::SetFocusGroup(Actor actor, bool isFocusGroup) -{ - GetImpl(*this).SetFocusGroup(actor, isFocusGroup); -} - -bool AccessibilityFocusManager::IsFocusGroup(Actor actor) const -{ - return GetImpl(*this).IsFocusGroup(actor); -} - -void AccessibilityFocusManager::SetGroupMode(bool enabled) -{ - GetImpl(*this).SetGroupMode(enabled); -} - -bool AccessibilityFocusManager::GetGroupMode() const -{ - return GetImpl(*this).GetGroupMode(); -} - -void AccessibilityFocusManager::SetWrapMode(bool wrapped) -{ - GetImpl(*this).SetWrapMode(wrapped); -} - -bool AccessibilityFocusManager::GetWrapMode() const -{ - return GetImpl(*this).GetWrapMode(); -} - -void AccessibilityFocusManager::SetFocusIndicatorActor(Actor indicator) -{ - GetImpl(*this).SetFocusIndicatorActor(indicator); -} - -Actor AccessibilityFocusManager::GetFocusIndicatorActor() -{ - return GetImpl(*this).GetFocusIndicatorActor(); -} - -Actor AccessibilityFocusManager::GetFocusGroup(Actor actor) -{ - return GetImpl(*this).GetFocusGroup(actor); -} - -AccessibilityFocusManager::FocusChangedSignalType& AccessibilityFocusManager::FocusChangedSignal() -{ - return GetImpl(*this).FocusChangedSignal(); -} - -AccessibilityFocusManager::FocusOvershotSignalType& AccessibilityFocusManager::FocusOvershotSignal() -{ - return GetImpl(*this).FocusOvershotSignal(); -} - -AccessibilityFocusManager::FocusedActorActivatedSignalType& AccessibilityFocusManager::FocusedActorActivatedSignal() -{ - return GetImpl(*this).FocusedActorActivatedSignal(); -} - -} // namespace Toolkit - -} // namespace Dali diff --git a/dali-toolkit/public-api/focus-manager/accessibility-focus-manager.h b/dali-toolkit/public-api/focus-manager/accessibility-focus-manager.h deleted file mode 100644 index 25e054e..0000000 --- a/dali-toolkit/public-api/focus-manager/accessibility-focus-manager.h +++ /dev/null @@ -1,416 +0,0 @@ -#ifndef __DALI_TOOLKIT_ACCESSIBILITY_FOCUS_MANAGER_H__ -#define __DALI_TOOLKIT_ACCESSIBILITY_FOCUS_MANAGER_H__ - -/* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// EXTERNAL INCLUDES -#include -#include - -namespace Dali -{ - -namespace Toolkit -{ - -namespace Internal DALI_INTERNAL -{ -class AccessibilityFocusManager; -} - -/** - * @brief Manages registration of actors in a accessibility focus chain and changing the - * focused actor within that chain. - * - * This class provides the functionality of registering the focus order and description - * of actors and maintaining the focus chain. - * - * It provides functionality of setting the - * focus and moving the focus forward and backward. It also draws a highlight for the - * focused actor and emits a signal when the focus is changed. - * - * Signals - * | %Signal Name | Method | - * |-------------------------|------------------------------------| - * | focus-changed | @ref FocusChangedSignal() | - * | focus-overshot | @ref FocusOvershotSignal() | - * | focused-actor-activated | @ref FocusedActorActivatedSignal() | - */ -class DALI_IMPORT_API AccessibilityFocusManager : public BaseHandle -{ -public: - - /** - * @brief Accessibility needs four information which will be read by screen-reader. - * - * Reading order : Label -> Trait -> Optional (Value and Hint) - */ - enum AccessibilityAttribute - { - ACCESSIBILITY_LABEL = 0, ///< Simple text which contained in ui-control - ACCESSIBILITY_TRAIT, ///< Description of ui-control trait - ACCESSIBILITY_VALUE, ///< Current value of ui-control (Optional) - ACCESSIBILITY_HINT, ///< Hint for action (Optional) - ACCESSIBILITY_ATTRIBUTE_NUM ///< Number of attributes - }; - - /** - * @brief Overshoot direction. - */ - enum FocusOvershotDirection - { - OVERSHOT_PREVIOUS = -1, ///< Try to move previous of the first actor - OVERSHOT_NEXT = 1, ///< Try to move next of the last actor - }; - - public: - - /// @brief Focus changed signal - typedef Signal< void ( Actor, Actor ) > FocusChangedSignalType; - - /// @brief Focus overshooted signal - typedef Signal< void ( Actor, FocusOvershotDirection ) > FocusOvershotSignalType; - - /// @brief Focused actor activated signal - typedef Signal< void ( Actor ) > FocusedActorActivatedSignalType; - - /** - * @brief Create a AccessibilityFocusManager handle; this can be initialised with AccessibilityFocusManager::New(). - * - * Calling member functions with an uninitialised handle is not allowed. - */ - AccessibilityFocusManager(); - - /** - * @brief Destructor - * - * This is non-virtual since derived Handle types must not contain data or virtual methods. - */ - ~AccessibilityFocusManager(); - - /** - * @brief Get the singleton of AccessibilityFocusManager object. - * - * @return A handle to the AccessibilityFocusManager control. - */ - static AccessibilityFocusManager Get(); - - /** - * @brief Set the information of the specified actor's accessibility attribute. - * - * @pre The AccessibilityFocusManager has been initialized. - * @pre The Actor has been initialized. - * @param actor The actor the text to be set with - * @param type The attribute type the text to be set with - * @param text The text for the actor's accessibility information - */ - void SetAccessibilityAttribute(Actor actor, AccessibilityAttribute type, const std::string& text); - - /** - * @brief Get the text of the specified actor's accessibility attribute. - * - * @pre The AccessibilityFocusManager has been initialized. - * @pre The Actor has been initialized. - * @param actor The actor to be queried - * @param type The attribute type to be queried - * @return The text of the actor's accessibility information - */ - std::string GetAccessibilityAttribute(Actor actor, AccessibilityAttribute type) const; - - /** - * @brief Set the focus order of the actor. - * - * The focus order of each actor in the focus chain is unique. If - * there is another actor assigned with the same focus order - * already, the new actor will be inserted to the focus chain with - * that focus order, and the focus order of the original actor and - * all the actors followed in the focus chain will be increased - * accordingly. If the focus order assigned to the actor is 0, it - * means that actor's focus order is undefined (e.g. the actor has a - * description but with no focus order being set yet) and therefore - * that actor is not focusable. - * - * @pre The AccessibilityFocusManager has been initialized. - * @pre The Actor has been initialized. - * @param actor The actor the focus order to be set with - * @param order The focus order of the actor - */ - void SetFocusOrder(Actor actor, const unsigned int order); - - /** - * @brief Get the focus order of the actor. - * - * When the focus order is 0, it means the focus order of the actor - * is undefined. - * - * @pre The AccessibilityFocusManager has been initialized. - * @pre The Actor has been initialized. - * @param actor The actor to be queried - * @return The focus order of the actor - */ - unsigned int GetFocusOrder(Actor actor) const; - - /** - * @brief Generates a new focus order number which can be used to - * assign to actors which need to be appended to the end of the - * current focus order chain. - * - * The new number will be an increment over the very last focus - * order number in the focus chain. If the focus chain is empty then - * the function returns 1, else the number returned will be FOLast + - * 1 where FOLast is the focus order of the very last control in the - * focus chain. - * - * @pre The AccessibilityFocusManager has been initialized. - * @return The focus order of the actor - */ - unsigned int GenerateNewFocusOrder() const; - - /** - * @brief Get the actor that has the specified focus order. - * - * It will return an empty handle if the actor is not in the stage - * or has a focus order of 0. - * - * @pre The AccessibilityFocusManager has been initialized. - * @param order The focus order of the actor - * - * @return The actor that has the specified focus order or an empty - * handle if no actor in the stage has the specified focus order. - */ - Actor GetActorByFocusOrder(const unsigned int order); - - /** - * @brief Move the focus to the specified actor. - * - * Only one actor can be focused at the same time. The actor must - * have a defined focus order and must be focusable, visible and in - * the stage. - * - * @pre The AccessibilityFocusManager has been initialized. - * @pre The Actor has been initialized. - * @param actor The actor to be focused - * @return Whether the focus is successful or not - */ - bool SetCurrentFocusActor(Actor actor); - - /** - * @brief Get the current focused actor. - * - * @pre The AccessibilityFocusManager has been initialized. - * @return A handle to the current focused actor or an empty handle if no actor is focused. - */ - Actor GetCurrentFocusActor(); - - /** - * @brief Get the focus group of current focused actor. - * - * @pre The AccessibilityFocusManager has been initialized. - * - * @return A handle to the immediate parent of the current focused - * actor which is also a focus group, or an empty handle if no actor - * is focused. - */ - Actor GetCurrentFocusGroup(); - - /** - * @brief Get the focus order of currently focused actor. - * @pre The AccessibilityFocusManager has been initialized. - * - * @return The focus order of the currently focused actor or 0 if no - * actor is in focus. - */ - unsigned int GetCurrentFocusOrder(); - - /** - * @brief Move the focus to the next focusable actor in the focus - * chain (according to the focus traversal order). - * - * When the focus movement is wrapped around, the focus will be moved - * to the first focusable actor when it reaches the end of the focus chain. - * - * @pre The AccessibilityFocusManager has been initialized. - * @return true if the moving was successful - */ - bool MoveFocusForward(); - - /** - * @brief Move the focus to the previous focusable actor in the - * focus chain (according to the focus traversal order). - * - * When the focus movement is wrapped around, the focus will be - * moved to the last focusable actor when it reaches the beginning - * of the focus chain. - * - * @pre The AccessibilityFocusManager has been initialized. - * @return true if the moving was successful - */ - bool MoveFocusBackward(); - - /** - * @brief Clear the focus from the current focused actor if any, so - * that no actor is focused in the focus chain. - * - * It will emit focus changed signal without current focused actor - * @pre The AccessibilityFocusManager has been initialized. - */ - void ClearFocus(); - - /** - * @brief Clear the every registered focusable actor from focus-manager. - * @pre The AccessibilityFocusManager has been initialized. - */ - void Reset(); - - /** - * @brief Set whether an actor is a focus group that can limit the - * scope of focus movement to its child actors in the focus chain. - * - * @pre The AccessibilityFocusManager has been initialized. - * @pre The Actor has been initialized. - * @param actor The actor to be set as a focus group. - * @param isFocusGroup Whether to set the actor to be a focus group or not. - */ - void SetFocusGroup(Actor actor, bool isFocusGroup); - - /** - * @brief Check whether the actor is set as a focus group or not. - * - * @pre The AccessibilityFocusManager has been initialized. - * @pre The Actor has been initialized. - * @param actor The actor to be checked. - * @return Whether the actor is set as a focus group. - */ - bool IsFocusGroup(Actor actor) const; - - /** - * @brief Set whether the group mode is enabled or not. - * - * When the group mode is enabled, the focus movement will be limited to the child actors - * of the current focus group including the current focus group itself. The current focus - * group is the closest ancestor of the current focused actor that set as a focus group. - * @pre The AccessibilityFocusManager has been initialized. - * @param enabled Whether the group mode is enabled or not - */ - void SetGroupMode(bool enabled); - - /** - * @brief Get whether the group mode is enabled or not. - * - * @pre The AccessibilityFocusManager has been initialized. - * @return Whether the group mode is enabled or not. - */ - bool GetGroupMode() const; - - /** - * @brief Set whether focus will be moved to the beginning of the - * focus chain when it reaches the end or vice versa. - * - * When both the wrap mode and the group mode are enabled, focus will be - * wrapped within the current focus group. Focus will not be wrapped in default. - * @pre The AccessibilityFocusManager has been initialized. - * @param wrapped Whether the focus movement is wrapped around or not - */ - void SetWrapMode(bool wrapped); - - /** - * @brief Get whether the wrap mode is enabled or not. - * - * @pre The AccessibilityFocusManager has been initialized. - * @return Whether the wrap mode is enabled or not. - */ - bool GetWrapMode() const; - - /** - * @brief Set the focus indicator actor. - * - * This will replace the default focus indicator actor in - * AccessibilityFocusManager and will be added to the focused actor as a - * highlight. - * - * @pre The AccessibilityFocusManager has been initialized. - * @pre The indicator actor has been initialized. - * @param indicator The indicator actor to be added - */ - void SetFocusIndicatorActor(Actor indicator); - - /** - * @brief Get the focus indicator actor. - * - * @pre The AccessibilityFocusManager has been initialized. - * @return A handle to the focus indicator actor - */ - Actor GetFocusIndicatorActor(); - - /** - * @brief Returns the closest ancestor of the given actor that is a focus group. - * - * @param actor The actor to be checked for its focus group - * @return The focus group the given actor belongs to or an empty handle if the given actor doesn't belong to any focus group - */ - Actor GetFocusGroup(Actor actor); - - public: // Signals - - /** - * @brief This signal is emitted when the current focused actor is changed. - * - * A callback of the following type may be connected: - * @code - * void YourCallbackName(Actor originalFocusedActor, Actor currentFocusedActor); - * @endcode - * @pre The Object has been initialized. - * @return The signal to connect to. - */ - FocusChangedSignalType& FocusChangedSignal(); - - /** - * @brief This signal is emitted when there is no way to move focus further. - * - * A callback of the following type may be connected: - * @code - * void YourCallbackName(Actor currentFocusedActor, FocusOvershotDirection direction); - * @endcode - * @pre The Object has been initialized. - * @return The signal to connect to. - */ - FocusOvershotSignalType& FocusOvershotSignal(); - - /** - * @brief This signal is emitted when the current focused actor is activated. - * - * A callback of the following type may be connected: - * @code - * void YourCallbackName(Actor activatedActor); - * @endcode - * @pre The Object has been initialized. - * @return The signal to connect to. - */ - FocusedActorActivatedSignalType& FocusedActorActivatedSignal(); - -private: - - explicit DALI_INTERNAL AccessibilityFocusManager(Internal::AccessibilityFocusManager *impl); - -}; // class AccessibilityFocusManager - -} // namespace Toolkit - -} // namespace Dali - -#endif // __DALI_TOOLKIT_FOCUS_MANAGER_H__