# 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
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
# 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
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
--- /dev/null
+/*
+ * 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 <dali/public-api/object/base-object.h>
+
+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<Internal::Adaptor::AccessibilityAdaptor&>(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
--- /dev/null
+// Prevent normal accessibility adaptor declaration from loading
+#define __DALI_ACCESSIBILITY_ADAPTOR_H__
+
+#ifndef __DALI_TOOLKIT_ACCESSIBILITY_ADAPTOR_H__
+#define __DALI_TOOLKIT_ACCESSIBILITY_ADAPTOR_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 <string>
+#include <dali/public-api/object/base-handle.h>
+#include <dali/public-api/events/touch-point.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+class AccessibilityAdaptor;
+}
+}
+class AccessibilityActionHandler;
+class AccessibilityGestureHandler;
+class TouchPoint;
+
+/**
+ * This creates a stubbed AccessibilityAdaptor so that internal Toolkit Adaptor calls work.
+ */
+class AccessibilityAdaptor : public BaseHandle
+{
+public: // Construction & Destruction
+ AccessibilityAdaptor();
+ ~AccessibilityAdaptor();
+
+public: // Getters
+ static AccessibilityAdaptor Get();
+ Vector2 GetReadPosition() const;
+ bool IsEnabled() const;
+ void SetActionHandler(AccessibilityActionHandler& handler);
+ void SetGestureHandler(AccessibilityGestureHandler& handler);
+ bool HandleActionNextEvent();
+ bool HandleActionPreviousEvent();
+ bool HandleActionActivateEvent();
+ bool HandleActionReadEvent(unsigned int x, unsigned int y, bool allowReadAgain);
+ bool HandleActionReadNextEvent();
+ bool HandleActionReadPreviousEvent();
+ bool HandleActionUpEvent();
+ bool HandleActionDownEvent();
+ bool HandleActionClearFocusEvent();
+ bool HandleActionScrollEvent(TouchPoint& point, unsigned long timeStamp);
+ 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();
+
+ AccessibilityAdaptor( Internal::Adaptor::AccessibilityAdaptor* adaptor );
+};
+
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_ACCESSIBILITY_ADAPTOR_H__
+++ /dev/null
-/*
- * 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 <dali/public-api/object/base-object.h>
-
-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<Internal::Adaptor::AccessibilityManager&>(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
+++ /dev/null
-// Prevent normal accessibility manager declaration from loading
-#define __DALI_ACCESSIBILITY_MANAGER_H__
-
-#ifndef __DALI_TOOLKIT_ACCESSIBILITY_MANAGER_H__
-#define __DALI_TOOLKIT_ACCESSIBILITY_MANAGER_H__
-
-/*
- * 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.
- *
- */
-
-// EXTERNAL INCLUDES
-#include <string>
-#include <dali/public-api/object/base-handle.h>
-#include <dali/public-api/signals/dali-signal.h>
-#include <dali/public-api/events/touch-point.h>
-
-namespace Dali
-{
-namespace Internal
-{
-namespace Adaptor
-{
-class AccessibilityManager;
-}
-}
-class AccessibilityActionHandler;
-class AccessibilityGestureHandler;
-class TouchPoint;
-
-/**
- * This creates a stubbed AccessibilityManager so that internal Toolkit Adaptor calls work.
- */
-class AccessibilityManager : public BaseHandle
-{
-public: // Typedefs
- typedef Signal< bool ( AccessibilityManager& ) > AccessibilityActionSignalType;
-
-public: // Construction & Destruction
- AccessibilityManager();
- ~AccessibilityManager();
-
-public: // Getters
- static AccessibilityManager Get();
- Vector2 GetReadPosition() const;
- bool IsEnabled() const;
- void SetActionHandler(AccessibilityActionHandler& handler);
- void SetGestureHandler(AccessibilityGestureHandler& handler);
- bool HandleActionNextEvent();
- bool HandleActionPreviousEvent();
- bool HandleActionActivateEvent();
- bool HandleActionReadEvent(unsigned int x, unsigned int y, bool allowReadAgain);
- bool HandleActionReadNextEvent();
- bool HandleActionReadPreviousEvent();
- bool HandleActionUpEvent();
- bool HandleActionDownEvent();
- bool HandleActionClearFocusEvent();
- bool HandleActionScrollEvent(TouchPoint& point, unsigned long timeStamp);
- bool HandleActionBackEvent();
- void HandleActionEnableEvent();
- void HandleActionDisableEvent();
-
-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 );
-};
-
-} // namespace Dali
-
-#endif // __DALI_TOOLKIT_ACCESSIBILITY_MANAGER_H__
--- /dev/null
+#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 <dali/public-api/object/base-handle.h>
+#include <dali/public-api/signals/dali-signal.h>
+
+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
--- /dev/null
+#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 <dali/public-api/object/base-handle.h>
+#include <dali/public-api/signals/dali-signal.h>
+
+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__
+++ /dev/null
-/*
- * 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 <iostream>
-#include <stdlib.h>
-
-// Need to override adaptor classes for toolkit test harness, so include
-// test harness headers before dali headers.
-#include <dali-toolkit-test-suite-utils.h>
-
-#include <dali-toolkit/dali-toolkit.h>
-
-using namespace Dali;
-using namespace Toolkit;
-
-
-void utc_dali_toolkit_accessibility_focus_manager_startup(void)
-{
- test_return_value = TET_UNDEF;
-}
-
-void utc_dali_toolkit_accessibility_focus_manager_cleanup(void)
-{
- test_return_value = TET_PASS;
-}
-
-
-namespace
-{
-
-static bool gObjectCreatedCallBackCalled;
-
-static void TestCallback(BaseHandle handle)
-{
- gObjectCreatedCallBackCalled = true;
-}
-
-// Functors to test whether focus changed signal is emitted when the focus is changed
-class FocusChangedCallback : public Dali::ConnectionTracker
-{
-public:
- FocusChangedCallback(bool& signalReceived)
- : mSignalVerified(signalReceived),
- mOriginalFocusedActor(),
- mCurrentFocusedActor()
- {
- }
-
- void Callback(Actor originalFocusedActor, Actor currentFocusedActor)
- {
- tet_infoline("Verifying FocusChangedCallback()");
-
- if(originalFocusedActor == mCurrentFocusedActor)
- {
- mSignalVerified = true;
- }
-
- mOriginalFocusedActor = originalFocusedActor;
- mCurrentFocusedActor = currentFocusedActor;
- }
-
- void Reset()
- {
- mSignalVerified = false;
- }
-
- bool& mSignalVerified;
- Actor mOriginalFocusedActor;
- Actor mCurrentFocusedActor;
-};
-
-// Functors to test whether focus overshot signal is emitted when there is no way to move focus further.
-class FocusOvershotCallback : public Dali::ConnectionTracker
-{
-public:
- FocusOvershotCallback(bool& signalReceived)
- : mSignalVerified(signalReceived),
- mCurrentFocusedActor(),
- mFocusOvershotDirection(Toolkit::AccessibilityFocusManager::OVERSHOT_NEXT)
- {
- }
-
- void Callback(Actor currentFocusedActor, Toolkit::AccessibilityFocusManager::FocusOvershotDirection direction)
- {
- tet_infoline("Verifying FocusOvershotCallback()");
-
- if(currentFocusedActor == mCurrentFocusedActor && direction == mFocusOvershotDirection)
- {
- mSignalVerified = true;
- }
- }
-
- void Reset()
- {
- mSignalVerified = false;
- }
-
- bool& mSignalVerified;
- Actor mCurrentFocusedActor;
- Toolkit::AccessibilityFocusManager::FocusOvershotDirection mFocusOvershotDirection;
-};
-
-// Functor to test whether focused actor activated signal is emitted.
-class FocusedActorActivatedCallback : public Dali::ConnectionTracker
-{
-public:
- FocusedActorActivatedCallback()
- {
- }
-
- void Callback(Actor activatedActor)
- {
- tet_infoline("Verifying FocusedActorActivatedCallback()");
- }
-};
-
-} // namespace
-
-
-int UtcDaliAccessibilityFocusManagerGet(void)
-{
- ToolkitTestApplication application;
-
- tet_infoline(" UtcDaliAccessibilityFocusManagerGet");
-
- AccessibilityFocusManager manager;
-
- //Ensure object is created by checking if it's registered
- ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry();
- DALI_TEST_CHECK(registry);
-
- gObjectCreatedCallBackCalled = false;
- registry.ObjectCreatedSignal().Connect( &TestCallback );
- {
- manager = AccessibilityFocusManager::Get();
- DALI_TEST_CHECK(manager);
- }
- DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
-
- AccessibilityFocusManager newManager = AccessibilityFocusManager::Get();
- DALI_TEST_CHECK(newManager);
-
- // Check that focus manager is a singleton
- DALI_TEST_CHECK(manager == newManager);
- END_TEST;
-}
-
-int UtcDaliAccessibilityFocusManagerSetAndGetAccessibilityAttribute(void)
-{
- ToolkitTestApplication application;
-
- tet_infoline(" UtcDaliAccessibilityFocusManagerSetAndGetAccessibilityAttribute");
-
- AccessibilityFocusManager manager = AccessibilityFocusManager::Get();
- DALI_TEST_CHECK(manager);
-
- Actor actor = Actor::New();
- DALI_TEST_CHECK(manager.GetAccessibilityAttribute(actor, AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "");
-
- manager.SetAccessibilityAttribute(actor, AccessibilityFocusManager::ACCESSIBILITY_LABEL, "Description");
- DALI_TEST_CHECK(manager.GetAccessibilityAttribute(actor, AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "Description");
-
- manager.SetAccessibilityAttribute(actor, AccessibilityFocusManager::ACCESSIBILITY_LABEL, "New description");
- DALI_TEST_CHECK(manager.GetAccessibilityAttribute(actor, AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "New description");
- END_TEST;
-}
-
-int UtcDaliAccessibilityFocusManagerSetAndGetFocusOrder(void)
-{
- ToolkitTestApplication application;
-
- tet_infoline(" UtcDaliAccessibilityFocusManagerSetAndGetFocusOrder");
-
- AccessibilityFocusManager manager = AccessibilityFocusManager::Get();
- DALI_TEST_CHECK(manager);
-
- Actor first = Actor::New();
- Actor second = Actor::New();
- DALI_TEST_CHECK(manager.GetFocusOrder(first) == 0);
- DALI_TEST_CHECK(manager.GetFocusOrder(second) == 0);
-
- // Set the focus order and description for the first actor
- manager.SetFocusOrder(first, 1);
- manager.SetAccessibilityAttribute(first, AccessibilityFocusManager::ACCESSIBILITY_LABEL, "first");
- DALI_TEST_CHECK(manager.GetFocusOrder(first) == 1);
- DALI_TEST_CHECK(manager.GetAccessibilityAttribute(first, AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "first");
-
- // Set the focus order and description for the second actor
- manager.SetFocusOrder(second, 2);
- manager.SetAccessibilityAttribute(second, AccessibilityFocusManager::ACCESSIBILITY_LABEL, "second");
- DALI_TEST_CHECK(manager.GetFocusOrder(second) == 2);
- DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, AccessibilityFocusManager::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");
-
- // 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");
-
- // 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");
-
- // 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");
- DALI_TEST_CHECK(manager.GetFocusOrder(third) == 1);
- DALI_TEST_CHECK(manager.GetAccessibilityAttribute(third, AccessibilityFocusManager::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");
-
- // 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");
- END_TEST;
-}
-
-int UtcDaliAccessibilityFocusManagerGenerateNewFocusOrder(void)
-{
- ToolkitTestApplication application;
-
- tet_infoline(" UtcDaliAccessibilityFocusManagerGenerateNewFocusOrder");
-
- AccessibilityFocusManager manager = AccessibilityFocusManager::Get();
- DALI_TEST_CHECK(manager);
-
- DALI_TEST_CHECK(1 == manager.GenerateNewFocusOrder());
- DALI_TEST_CHECK(1 == manager.GenerateNewFocusOrder());
-
- Actor first = Actor::New();
- Actor second = Actor::New();
-
- // Set the focus order for the first actor
- manager.SetFocusOrder(first, 1);
- manager.SetAccessibilityAttribute(first, AccessibilityFocusManager::ACCESSIBILITY_LABEL, "first");
- DALI_TEST_CHECK(manager.GetFocusOrder(first) == 1);
-
- //Test for new focus order
- DALI_TEST_CHECK(2 == manager.GenerateNewFocusOrder());
-
- // Set the focus order for the first actor
- manager.SetFocusOrder(second, 2);
- manager.SetAccessibilityAttribute(second, AccessibilityFocusManager::ACCESSIBILITY_LABEL, "first");
- DALI_TEST_CHECK(manager.GetFocusOrder(second) == 2);
- END_TEST;
-}
-
-int UtcDaliAccessibilityFocusManagerGetActorByFocusOrder(void)
-{
- ToolkitTestApplication application;
-
- tet_infoline(" UtcDaliAccessibilityFocusManagerGetActorByFocusOrder");
-
- AccessibilityFocusManager manager = AccessibilityFocusManager::Get();
- DALI_TEST_CHECK(manager);
-
- // Create the actors and set their focus orders
- Actor first = Actor::New();
- manager.SetFocusOrder(first, 1);
-
- Actor second = Actor::New();
- manager.SetFocusOrder(second, 2);
-
- Actor third = Actor::New();
- manager.SetFocusOrder(third, 3);
-
- // Check that we get an empty handle as no actor is added to the stage yet.
- DALI_TEST_CHECK(manager.GetActorByFocusOrder(1) == Actor());
- DALI_TEST_CHECK(manager.GetActorByFocusOrder(2) == Actor());
- DALI_TEST_CHECK(manager.GetActorByFocusOrder(3) == Actor());
-
- // Add the actors to the stage
- Stage::GetCurrent().Add(first);
- Stage::GetCurrent().Add(second);
- Stage::GetCurrent().Add(third);
-
- // Check that we get an empty handle because focus order 0 means undefined.
- DALI_TEST_CHECK(manager.GetActorByFocusOrder(0) == Actor());
-
- // Check that we get correct actors for the specified focus orders
- DALI_TEST_CHECK(manager.GetActorByFocusOrder(1) == first);
- DALI_TEST_CHECK(manager.GetActorByFocusOrder(2) == second);
- DALI_TEST_CHECK(manager.GetActorByFocusOrder(3) == third);
-
- // Change the focus order of the third actor to 1
- manager.SetFocusOrder(third, 1);
-
- // Check that we still get correct actors after changing their focus orders
- DALI_TEST_CHECK(manager.GetActorByFocusOrder(1) == third);
- DALI_TEST_CHECK(manager.GetActorByFocusOrder(2) == first);
- DALI_TEST_CHECK(manager.GetActorByFocusOrder(3) == second);
-
- // Check that we get an empty handle because no actor has a focus order of 4
- DALI_TEST_CHECK(manager.GetActorByFocusOrder(4) == Actor());
- END_TEST;
-}
-
-int UtcDaliAccessibilityFocusManagerSetAndGetCurrentFocusActor(void)
-{
- ToolkitTestApplication application;
-
- tet_infoline(" UtcDaliAccessibilityFocusManagerSetAndGetCurrentFocusActor");
-
- AccessibilityFocusManager manager = AccessibilityFocusManager::Get();
- DALI_TEST_CHECK(manager);
-
- // Create the first actor and add it to the stage
- Actor first = Actor::New();
- manager.SetFocusOrder(first, 1);
- Stage::GetCurrent().Add(first);
-
- // Create the second actor and add it to the stage
- Actor second = Actor::New();
- manager.SetFocusOrder(second, 2);
- Stage::GetCurrent().Add(second);
-
- // Create the third actor but don't add it to the stage
- Actor third = Actor::New();
- manager.SetFocusOrder(third, 3);
-
- // Check that no actor is being focused yet.
- DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
-
- // Check that it will fail to set focus on an invalid actor
- DALI_TEST_CHECK(manager.SetCurrentFocusActor(Actor()) == false);
-
- // Check that the focus is set on the first actor
- DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
- DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
-
- // Check that the focus is set on the second actor
- DALI_TEST_CHECK(manager.SetCurrentFocusActor(second) == true);
- DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
-
- // Check that it will fail to set focus on the third actor as it's not in the stage
- DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == false);
-
- // Add the third actor to the stage
- Stage::GetCurrent().Add(third);
-
- // make the third actor invisible
- third.SetVisible(false);
- // flush the queue and render once
- application.SendNotification();
- application.Render();
-
- // Check that it will fail to set focus on the third actor as it's invisible
- DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == false);
-
- // Make the third actor visible
- third.SetVisible(true);
- // flush the queue and render once
- application.SendNotification();
- application.Render();
-
- // Make the third actor not focusable
- Property::Index propertyActorFocusable = third.GetPropertyIndex("focusable");
- third.SetProperty(propertyActorFocusable, false);
- // flush the queue and render once
- application.SendNotification();
- application.Render();
-
- // Check that it will fail to set focus on the third actor as it's not focusable
- DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == false);
-
- // Make the third actor focusable
- third.SetProperty(propertyActorFocusable, true);
- // flush the queue and render once
- application.SendNotification();
- application.Render();
-
- // Check that the focus is successfully moved to the third actor
- DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == true);
-
- // Make the current focused actor to be not focusable by setting its focus order to be 0
- manager.SetFocusOrder(third, 0);
-
- // Check that the focus is automatically cleared
- DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
-
- // Set the focus order of the third actor again
- manager.SetFocusOrder(third, 3);
-
- // Check that the third actor can be focused successfully now
- DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == true);
- END_TEST;
-}
-
-int UtcDaliAccessibilityFocusManagerGetCurrentFocusGroup(void)
-{
- ToolkitTestApplication application;
-
- tet_infoline(" UtcDaliAccessibilityFocusManagerGetCurrentFocusGroup");
-
- AccessibilityFocusManager manager = AccessibilityFocusManager::Get();
- DALI_TEST_CHECK(manager);
-
- // Create an actor with two child actors and add it to the stage
- Actor parent = Actor::New();
- Actor firstChild = Actor::New();
- Actor secondChild = Actor::New();
- parent.Add(firstChild);
- parent.Add(secondChild);
- Stage::GetCurrent().Add(parent);
-
- // Create three actors and add them as the children of the first child actor
- Actor firstGrandChild = Actor::New();
- Actor secondGrandChild = Actor::New();
- Actor thirdGrandChild = Actor::New();
- firstChild.Add(firstGrandChild);
- firstChild.Add(secondGrandChild);
- firstChild.Add(thirdGrandChild);
-
- // Set focus order to the actors
- manager.SetFocusOrder(parent, 1);
- manager.SetFocusOrder(firstChild, 2);
- manager.SetFocusOrder(firstGrandChild, 3);
- manager.SetFocusOrder(secondGrandChild, 4);
- manager.SetFocusOrder(thirdGrandChild, 5);
- manager.SetFocusOrder(secondChild, 6);
-
- // Set the parent and the first child actor as focus groups
- manager.SetFocusGroup(parent, true);
- DALI_TEST_CHECK(manager.IsFocusGroup(parent) == true);
-
- // Set focus to the first grand child actor
- DALI_TEST_CHECK(manager.SetCurrentFocusActor(firstGrandChild) == true);
- DALI_TEST_CHECK(manager.GetCurrentFocusActor() == firstGrandChild);
-
- // The current focus group should be the parent, As it is the immediate parent which is also a focus group.
- DALI_TEST_CHECK(manager.GetCurrentFocusGroup() == parent);
-
- manager.SetFocusGroup(firstChild, true);
- DALI_TEST_CHECK(manager.IsFocusGroup(firstChild) == true);
-
- // The current focus group should be the firstChild, As it is the immediate parent which is also a focus group.
- DALI_TEST_CHECK(manager.GetCurrentFocusGroup() == firstChild);
-
- manager.SetFocusGroup(firstGrandChild, true);
- DALI_TEST_CHECK(manager.IsFocusGroup(firstGrandChild) == true);
-
- // The current focus group should be itself, As it is also a focus group.
- DALI_TEST_CHECK(manager.GetCurrentFocusGroup() == firstGrandChild);
-
- // Set focus to the second grand child actor
- DALI_TEST_CHECK(manager.SetCurrentFocusActor(secondGrandChild) == true);
- DALI_TEST_CHECK(manager.GetCurrentFocusActor() == secondGrandChild);
-
- // The current focus group should be the firstChild, As it is the immediate parent which is also a
- // focus group for the current focus actor.
- DALI_TEST_CHECK(manager.GetCurrentFocusGroup() == firstChild);
-
- END_TEST;
-}
-
-int UtcDaliAccessibilityFocusManagerGetCurrentFocusOrder(void)
-{
- ToolkitTestApplication application;
-
- tet_infoline(" UtcDaliAccessibilityFocusManagerGetCurrentFocusOrder");
-
- AccessibilityFocusManager manager = AccessibilityFocusManager::Get();
- DALI_TEST_CHECK(manager);
-
- Actor first = Actor::New();
- Stage::GetCurrent().Add(first);
-
- Actor second = Actor::New();
- Stage::GetCurrent().Add(second);
-
- Actor third = Actor::New();
- Stage::GetCurrent().Add(third);
-
- // Set the focus order and description for the first actor
- manager.SetFocusOrder(first, 1);
- manager.SetAccessibilityAttribute(first, AccessibilityFocusManager::ACCESSIBILITY_LABEL, "first");
- DALI_TEST_CHECK(manager.GetFocusOrder(first) == 1);
- DALI_TEST_CHECK(manager.GetAccessibilityAttribute(first, AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "first");
-
- // Set the focus order and description for the second actor
- manager.SetFocusOrder(second, 2);
- manager.SetAccessibilityAttribute(second, AccessibilityFocusManager::ACCESSIBILITY_LABEL, "second");
- DALI_TEST_CHECK(manager.GetFocusOrder(second) == 2);
- DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "second");
-
- // Set the focus order and description for the second actor
- manager.SetFocusOrder(third, 3);
- manager.SetAccessibilityAttribute(third, AccessibilityFocusManager::ACCESSIBILITY_LABEL, "third");
- DALI_TEST_CHECK(manager.GetFocusOrder(third) == 3);
- DALI_TEST_CHECK(manager.GetAccessibilityAttribute(third, AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "third");
-
- // Check that no actor is being focused yet.
- DALI_TEST_CHECK(manager.GetCurrentFocusOrder() == 0);
-
- // Set the focus on the first actor and test
- DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
- DALI_TEST_CHECK(manager.GetCurrentFocusOrder() == 1);
-
- // Move the focus forward to the second actor and test
- manager.MoveFocusForward();
- DALI_TEST_CHECK(manager.GetCurrentFocusOrder() == 2);
-
- // Move the focus forward to the third actor and test
- manager.MoveFocusForward();
- DALI_TEST_CHECK(manager.GetCurrentFocusOrder() == 3);
-
- // Clear focus and test
- manager.ClearFocus();
- DALI_TEST_CHECK(manager.GetCurrentFocusOrder() == 0);
- END_TEST;
-}
-
-int UtcDaliAccessibilityFocusManagerMoveFocusForward(void)
-{
- ToolkitTestApplication application;
-
- tet_infoline(" UtcDaliAccessibilityFocusManagerMoveFocusForward");
-
- AccessibilityFocusManager manager = AccessibilityFocusManager::Get();
- DALI_TEST_CHECK(manager);
-
- Actor first = Actor::New();
- Stage::GetCurrent().Add(first);
-
- Actor second = Actor::New();
- Stage::GetCurrent().Add(second);
-
- Actor third = Actor::New();
- Stage::GetCurrent().Add(third);
-
- // Set the focus order and description for the first actor
- manager.SetFocusOrder(first, 1);
- manager.SetAccessibilityAttribute(first, AccessibilityFocusManager::ACCESSIBILITY_LABEL, "first");
- DALI_TEST_CHECK(manager.GetFocusOrder(first) == 1);
- DALI_TEST_CHECK(manager.GetAccessibilityAttribute(first, AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "first");
-
- // Set the focus order and description for the second actor
- manager.SetFocusOrder(second, 2);
- manager.SetAccessibilityAttribute(second, AccessibilityFocusManager::ACCESSIBILITY_LABEL, "second");
- DALI_TEST_CHECK(manager.GetFocusOrder(second) == 2);
- DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "second");
-
- // Set the focus order and description for the second actor
- manager.SetFocusOrder(third, 3);
- manager.SetAccessibilityAttribute(third, AccessibilityFocusManager::ACCESSIBILITY_LABEL, "third");
- DALI_TEST_CHECK(manager.GetFocusOrder(third) == 3);
- DALI_TEST_CHECK(manager.GetAccessibilityAttribute(third, AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "third");
-
- // Check that no actor is being focused yet.
- DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
-
- // 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");
-
- // Test the non-wrapped move first
- manager.SetWrapMode(false);
- DALI_TEST_CHECK(manager.GetWrapMode() == false);
-
- // 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");
-
- // 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");
-
- // 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");
-
- // Now test the wrapped move
- manager.SetWrapMode(true);
- DALI_TEST_CHECK(manager.GetWrapMode() == true);
-
- // 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");
-
- // Make the second actor not focusable
- Property::Index propertyActorFocusable = second.GetPropertyIndex("focusable");
- second.SetProperty(propertyActorFocusable, false);
- // flush the queue and render once
- application.SendNotification();
- application.Render();
-
- // Move the focus forward and check that the second actor should be skipped and
- // 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");
-
- // Make the first actor invisible
- first.SetVisible(false);
- // flush the queue and render once
- application.SendNotification();
- application.Render();
-
- // Move the focus forward and check that the first actor should be skipped as it's
- // invisible and the second actor should also be skipped as it's not focusable,
- // 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");
-
- // Make the third actor invisible so that no actor can be focused.
- third.SetVisible(false);
- // flush the queue and render once
- application.SendNotification();
- application.Render();
-
- // 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");
- END_TEST;
-}
-
-int UtcDaliAccessibilityFocusManagerMoveFocusBackward(void)
-{
- ToolkitTestApplication application;
-
- tet_infoline(" UtcDaliAccessibilityFocusManagerMoveFocusBackward");
-
- AccessibilityFocusManager manager = AccessibilityFocusManager::Get();
- DALI_TEST_CHECK(manager);
-
- Actor first = Actor::New();
- Stage::GetCurrent().Add(first);
-
- Actor second = Actor::New();
- Stage::GetCurrent().Add(second);
-
- Actor third = Actor::New();
- Stage::GetCurrent().Add(third);
-
- // Set the focus order and description for the first actor
- manager.SetFocusOrder(first, 1);
- manager.SetAccessibilityAttribute(first, AccessibilityFocusManager::ACCESSIBILITY_LABEL, "first");
- DALI_TEST_CHECK(manager.GetFocusOrder(first) == 1);
- DALI_TEST_CHECK(manager.GetAccessibilityAttribute(first, AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "first");
-
- // Set the focus order and description for the second actor
- manager.SetFocusOrder(second, 2);
- manager.SetAccessibilityAttribute(second, AccessibilityFocusManager::ACCESSIBILITY_LABEL, "second");
- DALI_TEST_CHECK(manager.GetFocusOrder(second) == 2);
- DALI_TEST_CHECK(manager.GetAccessibilityAttribute(second, AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "second");
-
- // Set the focus order and description for the second actor
- manager.SetFocusOrder(third, 3);
- manager.SetAccessibilityAttribute(third, AccessibilityFocusManager::ACCESSIBILITY_LABEL, "third");
- DALI_TEST_CHECK(manager.GetFocusOrder(third) == 3);
- DALI_TEST_CHECK(manager.GetAccessibilityAttribute(third, AccessibilityFocusManager::ACCESSIBILITY_LABEL) == "third");
-
- // Check that no actor is being focused yet.
- DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
-
- // 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");
-
- // Test the non-wrapped move first
- manager.SetWrapMode(false);
- DALI_TEST_CHECK(manager.GetWrapMode() == false);
-
- // 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");
-
- // 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");
-
- // 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");
-
- // Now test the wrapped move
- manager.SetWrapMode(true);
- DALI_TEST_CHECK(manager.GetWrapMode() == true);
-
- // 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");
-
- // Make the second actor not focusable
- Property::Index propertyActorFocusable = second.GetPropertyIndex("focusable");
- second.SetProperty(propertyActorFocusable, false);
- // flush the queue and render once
- application.SendNotification();
- application.Render();
-
- // Move the focus backward and check that the second actor should be skipped and
- // 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");
-
- // Make the third actor invisible
- third.SetVisible(false);
- // flush the queue and render once
- application.SendNotification();
- application.Render();
-
- // Move the focus backward and check that the third actor should be skipped as it's
- // invisible and the second actor should also be skipped as it's not focusable,
- // 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");
-
- // Make the first actor invisible so that no actor can be focused.
- first.SetVisible(false);
- // flush the queue and render once
- application.SendNotification();
- application.Render();
-
- // 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");
- END_TEST;
-}
-
-int UtcDaliAccessibilityFocusManagerClearFocus(void)
-{
- ToolkitTestApplication application;
-
- tet_infoline(" UtcDaliAccessibilityFocusManagerClearFocus");
-
- AccessibilityFocusManager manager = AccessibilityFocusManager::Get();
- DALI_TEST_CHECK(manager);
-
- // Create the first actor and add it to the stage
- Actor first = Actor::New();
- manager.SetFocusOrder(first, 1);
- Stage::GetCurrent().Add(first);
-
- // Create the second actor and add it to the stage
- Actor second = Actor::New();
- manager.SetFocusOrder(second, 2);
- Stage::GetCurrent().Add(second);
-
- // Check that no actor is being focused yet.
- DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
-
- // Check that the focus is set on the first actor
- DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
- DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
-
- // Check that the focus is set on the second actor
- DALI_TEST_CHECK(manager.SetCurrentFocusActor(second) == true);
- DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
-
- // Clear the focus
- manager.ClearFocus();
-
- // Check that no actor is being focused now.
- DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
- END_TEST;
-}
-
-int UtcDaliAccessibilityFocusManagerReset(void)
-{
- ToolkitTestApplication application;
-
- tet_infoline(" UtcDaliAccessibilityFocusManagerReset");
-
- AccessibilityFocusManager manager = AccessibilityFocusManager::Get();
- DALI_TEST_CHECK(manager);
-
- // Create the first actor and add it to the stage
- Actor first = Actor::New();
- manager.SetFocusOrder(first, 1);
- Stage::GetCurrent().Add(first);
-
- // Create the second actor and add it to the stage
- Actor second = Actor::New();
- manager.SetFocusOrder(second, 2);
- Stage::GetCurrent().Add(second);
-
- // Check that no actor is being focused yet.
- DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
-
- // Check that the focus is set on the first actor
- DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
- DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
-
- // Check that the focus is set on the second actor
- DALI_TEST_CHECK(manager.SetCurrentFocusActor(second) == true);
- DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
-
- // Clear the focus
- manager.Reset();
-
- // Check that no actor is being focused now and the focus order of actors have been cleared
- DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
- DALI_TEST_CHECK(manager.GetFocusOrder(first) == 0);
- DALI_TEST_CHECK(manager.GetFocusOrder(first) == 0);
- END_TEST;
-}
-
-int UtcDaliAccessibilityFocusManagerFocusGroup(void)
-{
- ToolkitTestApplication application;
-
- tet_infoline(" UtcDaliAccessibilityFocusManagerFocusGroup");
-
- AccessibilityFocusManager manager = AccessibilityFocusManager::Get();
- DALI_TEST_CHECK(manager);
-
- // Create an actor with two child actors and add it to the stage
- Actor parent = Actor::New();
- Actor firstChild = Actor::New();
- Actor secondChild = Actor::New();
- parent.Add(firstChild);
- parent.Add(secondChild);
- Stage::GetCurrent().Add(parent);
-
- // Create three actors and add them as the children of the first child actor
- Actor firstGrandChild = Actor::New();
- Actor secondGrandChild = Actor::New();
- Actor thirdGrandChild = Actor::New();
- firstChild.Add(firstGrandChild);
- firstChild.Add(secondGrandChild);
- firstChild.Add(thirdGrandChild);
-
- // Set focus order to the actors
- manager.SetFocusOrder(parent, 1);
- manager.SetFocusOrder(firstChild, 2);
- manager.SetFocusOrder(firstGrandChild, 3);
- manager.SetFocusOrder(secondGrandChild, 4);
- manager.SetFocusOrder(thirdGrandChild, 5);
- manager.SetFocusOrder(secondChild, 6);
-
- // Set the parent and the first child actor as focus groups
- manager.SetFocusGroup(parent, true);
- DALI_TEST_CHECK(manager.IsFocusGroup(parent) == true);
-
- // The focus group of the parent should be itself, as it is set to be a focus group.
- DALI_TEST_CHECK(manager.GetFocusGroup(parent) == parent);
-
- // The focus group of the firstChild should be its parent, as it is the immediate parent which is also a group.
- DALI_TEST_CHECK(manager.GetFocusGroup(firstChild) == parent);
-
- manager.SetFocusGroup(firstChild, true);
- DALI_TEST_CHECK(manager.IsFocusGroup(firstChild) == true);
-
- // The focus group of the firstChild should be itself, as it is set to be a focus group now.
- DALI_TEST_CHECK(manager.GetFocusGroup(firstChild) == firstChild);
-
- // Enable wrap mode for focus movement.
- manager.SetWrapMode(true);
- DALI_TEST_CHECK(manager.GetWrapMode() == true);
-
- // Check that no actor is being focused yet.
- DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
-
- // Check that the focus is set on the parent actor.
- DALI_TEST_CHECK(manager.SetCurrentFocusActor(parent) == true);
- DALI_TEST_CHECK(manager.GetCurrentFocusActor() == parent);
-
- // Check that group mode is disabled.
- DALI_TEST_CHECK(manager.GetGroupMode() == false);
-
- // Check that the focus movement is wrapped as normal.
- DALI_TEST_CHECK(manager.MoveFocusForward() == true);
- DALI_TEST_CHECK(manager.GetCurrentFocusActor() == firstChild);
- DALI_TEST_CHECK(manager.MoveFocusForward() == true);
- DALI_TEST_CHECK(manager.GetCurrentFocusActor() == firstGrandChild);
- DALI_TEST_CHECK(manager.MoveFocusForward() == true);
- DALI_TEST_CHECK(manager.GetCurrentFocusActor() == secondGrandChild);
- DALI_TEST_CHECK(manager.MoveFocusForward() == true);
- DALI_TEST_CHECK(manager.GetCurrentFocusActor() == thirdGrandChild);
- DALI_TEST_CHECK(manager.MoveFocusForward() == true);
- DALI_TEST_CHECK(manager.GetCurrentFocusActor() == secondChild);
- DALI_TEST_CHECK(manager.MoveFocusForward() == true);
- DALI_TEST_CHECK(manager.GetCurrentFocusActor() == parent);
- DALI_TEST_CHECK(manager.MoveFocusForward() == true);
- DALI_TEST_CHECK(manager.GetCurrentFocusActor() == firstChild);
- DALI_TEST_CHECK(manager.MoveFocusForward() == true);
- DALI_TEST_CHECK(manager.GetCurrentFocusActor() == firstGrandChild);
-
- // Enable the group mode.
- manager.SetGroupMode(true);
- DALI_TEST_CHECK(manager.GetGroupMode() == true);
-
- // Check that the focus movement is now limited to the current focus group.
- DALI_TEST_CHECK(manager.MoveFocusForward() == true);
- DALI_TEST_CHECK(manager.GetCurrentFocusActor() == secondGrandChild);
- DALI_TEST_CHECK(manager.MoveFocusForward() == true);
- DALI_TEST_CHECK(manager.GetCurrentFocusActor() == thirdGrandChild);
- DALI_TEST_CHECK(manager.MoveFocusForward() == true);
- DALI_TEST_CHECK(manager.GetCurrentFocusActor() == firstChild);
- DALI_TEST_CHECK(manager.MoveFocusForward() == true);
- DALI_TEST_CHECK(manager.GetCurrentFocusActor() == firstGrandChild);
- END_TEST;
-}
-
-int UtcDaliAccessibilityFocusManagerSetAndGetFocusIndicator(void)
-{
- ToolkitTestApplication application;
-
- tet_infoline(" UtcDaliAccessibilityFocusManagerSetAndGetFocusIndicator");
-
- AccessibilityFocusManager manager = AccessibilityFocusManager::Get();
- DALI_TEST_CHECK(manager);
-
- Actor defaultFocusIndicatorActor = manager.GetFocusIndicatorActor();
- DALI_TEST_CHECK(defaultFocusIndicatorActor);
-
- Actor newFocusIndicatorActor = Actor::New();
- manager.SetFocusIndicatorActor(newFocusIndicatorActor);
- DALI_TEST_CHECK(manager.GetFocusIndicatorActor() == newFocusIndicatorActor);
- END_TEST;
-}
-
-int UtcDaliAccessibilityFocusManagerSignalFocusChanged(void)
-{
- ToolkitTestApplication application;
-
- tet_infoline(" UtcDaliAccessibilityFocusManagerSignalFocusChanged");
-
- AccessibilityFocusManager manager = AccessibilityFocusManager::Get();
- DALI_TEST_CHECK(manager);
-
- bool signalVerified = false;
- FocusChangedCallback callback(signalVerified);
- manager.FocusChangedSignal().Connect( &callback, &FocusChangedCallback::Callback );
-
- // Create the first actor and add it to the stage
- Actor first = Actor::New();
- manager.SetFocusOrder(first, 1);
- Stage::GetCurrent().Add(first);
-
- // Create the second actor and add it to the stage
- Actor second = Actor::New();
- manager.SetFocusOrder(second, 2);
- Stage::GetCurrent().Add(second);
-
- // Check that no actor is being focused yet.
- DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
-
- // Check that the focus is set on the first actor
- DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
- DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
- DALI_TEST_CHECK(callback.mSignalVerified);
- callback.Reset();
-
- // Check that the focus is set on the second actor
- DALI_TEST_CHECK(manager.SetCurrentFocusActor(second) == true);
- DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
- DALI_TEST_CHECK(callback.mSignalVerified);
- callback.Reset();
-
- // Clear the focus
- manager.ClearFocus();
-
- // Check that no actor is being focused now.
- DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
- DALI_TEST_CHECK(callback.mSignalVerified);
- END_TEST;
-}
-
-int UtcDaliAccessibilityFocusManagerSignalFocusOvershot(void)
-{
- ToolkitTestApplication application;
-
- tet_infoline(" UtcDaliAccessibilityFocusManagerSignalFocusOvershot");
-
- AccessibilityFocusManager manager = AccessibilityFocusManager::Get();
- DALI_TEST_CHECK(manager);
-
- bool signalVerified = false;
- FocusOvershotCallback callback(signalVerified);
- manager.FocusOvershotSignal().Connect(&callback, &FocusOvershotCallback::Callback);
-
- // Create the first actor and add it to the stage
- Actor first = Actor::New();
- manager.SetFocusOrder(first, 1);
- Stage::GetCurrent().Add(first);
-
- // Create the second actor and add it to the stage
- Actor second = Actor::New();
- manager.SetFocusOrder(second, 2);
- Stage::GetCurrent().Add(second);
-
- // Check that the wrap mode is disabled
- DALI_TEST_CHECK(manager.GetWrapMode() == false);
-
- // Check that the focus is set on the first actor
- DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
- DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
-
- // Check that the focus is moved to the second actor successfully.
- DALI_TEST_CHECK(manager.MoveFocusForward() == true);
- DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
-
- // Check that the forward focus movement is overshot.
- callback.mCurrentFocusedActor = second;
- callback.mFocusOvershotDirection = Toolkit::AccessibilityFocusManager::OVERSHOT_NEXT;
- DALI_TEST_CHECK(manager.MoveFocusForward() == false);
- DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
- DALI_TEST_CHECK(signalVerified);
- callback.Reset();
-
- // Enable the wrap mode
- manager.SetWrapMode(true);
- DALI_TEST_CHECK(manager.GetWrapMode() == true);
-
- // Check that the forward focus movement is wrapped and no overshot happens.
- DALI_TEST_CHECK(manager.MoveFocusForward() == true);
- DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
- DALI_TEST_CHECK(signalVerified == false);
-
- // Disable the wrap mode
- manager.SetWrapMode(false);
- DALI_TEST_CHECK(manager.GetWrapMode() == false);
-
- // Check that the backward focus movement is overshot.
- callback.mCurrentFocusedActor = first;
- callback.mFocusOvershotDirection = Toolkit::AccessibilityFocusManager::OVERSHOT_PREVIOUS;
- DALI_TEST_CHECK(manager.MoveFocusBackward() == false);
- DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
- DALI_TEST_CHECK(signalVerified);
- END_TEST;
-}
-
-int UtcDaliAccessibilityFocusManagerSignalFocusedActorActivated(void)
-{
- ToolkitTestApplication application;
-
- tet_infoline(" UtcDaliAccessibilityFocusManagerSignalFocusedActorActivated");
-
- AccessibilityFocusManager manager = AccessibilityFocusManager::Get();
- DALI_TEST_CHECK(manager);
-
- FocusedActorActivatedCallback callback;
- manager.FocusedActorActivatedSignal().Connect(&callback, &FocusedActorActivatedCallback::Callback);
- DALI_TEST_CHECK(true);
-
- END_TEST;
-}
--- /dev/null
+/*
+ * 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 <iostream>
+#include <stdlib.h>
+
+// Need to override adaptor classes for toolkit test harness, so include
+// test harness headers before dali headers.
+#include <dali-toolkit-test-suite-utils.h>
+
+#include <dali-toolkit/dali-toolkit.h>
+
+using namespace Dali;
+using namespace Toolkit;
+
+
+void utc_dali_toolkit_accessibility_manager_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void utc_dali_toolkit_accessibility_manager_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+
+namespace
+{
+
+static bool gObjectCreatedCallBackCalled;
+
+static void TestCallback(BaseHandle handle)
+{
+ gObjectCreatedCallBackCalled = true;
+}
+
+// Functors to test whether focus changed signal is emitted when the focus is changed
+class FocusChangedCallback : public Dali::ConnectionTracker
+{
+public:
+ FocusChangedCallback(bool& signalReceived)
+ : mSignalVerified(signalReceived),
+ mOriginalFocusedActor(),
+ mCurrentFocusedActor()
+ {
+ }
+
+ void Callback(Actor originalFocusedActor, Actor currentFocusedActor)
+ {
+ tet_infoline("Verifying FocusChangedCallback()");
+
+ if(originalFocusedActor == mCurrentFocusedActor)
+ {
+ mSignalVerified = true;
+ }
+
+ mOriginalFocusedActor = originalFocusedActor;
+ mCurrentFocusedActor = currentFocusedActor;
+ }
+
+ void Reset()
+ {
+ mSignalVerified = false;
+ }
+
+ bool& mSignalVerified;
+ Actor mOriginalFocusedActor;
+ Actor mCurrentFocusedActor;
+};
+
+// Functors to test whether focus overshot signal is emitted when there is no way to move focus further.
+class FocusOvershotCallback : public Dali::ConnectionTracker
+{
+public:
+ FocusOvershotCallback(bool& signalReceived)
+ : mSignalVerified(signalReceived),
+ mCurrentFocusedActor(),
+ mFocusOvershotDirection(Toolkit::AccessibilityManager::OVERSHOT_NEXT)
+ {
+ }
+
+ void Callback(Actor currentFocusedActor, Toolkit::AccessibilityManager::FocusOvershotDirection direction)
+ {
+ tet_infoline("Verifying FocusOvershotCallback()");
+
+ if(currentFocusedActor == mCurrentFocusedActor && direction == mFocusOvershotDirection)
+ {
+ mSignalVerified = true;
+ }
+ }
+
+ void Reset()
+ {
+ mSignalVerified = false;
+ }
+
+ bool& mSignalVerified;
+ Actor mCurrentFocusedActor;
+ Toolkit::AccessibilityManager::FocusOvershotDirection mFocusOvershotDirection;
+};
+
+// Functor to test whether focused actor activated signal is emitted.
+class FocusedActorActivatedCallback : public Dali::ConnectionTracker
+{
+public:
+ FocusedActorActivatedCallback()
+ {
+ }
+
+ void Callback(Actor activatedActor)
+ {
+ tet_infoline("Verifying FocusedActorActivatedCallback()");
+ }
+};
+
+} // namespace
+
+
+int UtcDaliAccessibilityManagerGet(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliAccessibilityManagerGet");
+
+ AccessibilityManager manager;
+
+ //Ensure object is created by checking if it's registered
+ ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry();
+ DALI_TEST_CHECK(registry);
+
+ gObjectCreatedCallBackCalled = false;
+ registry.ObjectCreatedSignal().Connect( &TestCallback );
+ {
+ manager = AccessibilityManager::Get();
+ DALI_TEST_CHECK(manager);
+ }
+ DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
+
+ AccessibilityManager newManager = AccessibilityManager::Get();
+ DALI_TEST_CHECK(newManager);
+
+ // Check that accessibility manager is a singleton
+ DALI_TEST_CHECK(manager == newManager);
+ END_TEST;
+}
+
+int UtcDaliAccessibilityManagerSetAndGetAccessibilityAttribute(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliAccessibilityManagerSetAndGetAccessibilityAttribute");
+
+ AccessibilityManager manager = AccessibilityManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ Actor actor = Actor::New();
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(actor, AccessibilityManager::ACCESSIBILITY_LABEL) == "");
+
+ manager.SetAccessibilityAttribute(actor, AccessibilityManager::ACCESSIBILITY_LABEL, "Description");
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(actor, AccessibilityManager::ACCESSIBILITY_LABEL) == "Description");
+
+ manager.SetAccessibilityAttribute(actor, AccessibilityManager::ACCESSIBILITY_LABEL, "New description");
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(actor, AccessibilityManager::ACCESSIBILITY_LABEL) == "New description");
+ END_TEST;
+}
+
+int UtcDaliAccessibilityManagerSetAndGetFocusOrder(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliAccessibilityManagerSetAndGetFocusOrder");
+
+ AccessibilityManager manager = AccessibilityManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ Actor first = Actor::New();
+ Actor second = Actor::New();
+ DALI_TEST_CHECK(manager.GetFocusOrder(first) == 0);
+ DALI_TEST_CHECK(manager.GetFocusOrder(second) == 0);
+
+ // Set the focus order and description for the first actor
+ manager.SetFocusOrder(first, 1);
+ manager.SetAccessibilityAttribute(first, AccessibilityManager::ACCESSIBILITY_LABEL, "first");
+ DALI_TEST_CHECK(manager.GetFocusOrder(first) == 1);
+ 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, AccessibilityManager::ACCESSIBILITY_LABEL, "second");
+ DALI_TEST_CHECK(manager.GetFocusOrder(second) == 2);
+ 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, 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, 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, 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, AccessibilityManager::ACCESSIBILITY_LABEL, "third");
+ DALI_TEST_CHECK(manager.GetFocusOrder(third) == 1);
+ 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, 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, AccessibilityManager::ACCESSIBILITY_LABEL) == "first");
+ END_TEST;
+}
+
+int UtcDaliAccessibilityManagerGenerateNewFocusOrder(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliAccessibilityManagerGenerateNewFocusOrder");
+
+ AccessibilityManager manager = AccessibilityManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ DALI_TEST_CHECK(1 == manager.GenerateNewFocusOrder());
+ DALI_TEST_CHECK(1 == manager.GenerateNewFocusOrder());
+
+ Actor first = Actor::New();
+ Actor second = Actor::New();
+
+ // Set the focus order for the first actor
+ manager.SetFocusOrder(first, 1);
+ manager.SetAccessibilityAttribute(first, AccessibilityManager::ACCESSIBILITY_LABEL, "first");
+ DALI_TEST_CHECK(manager.GetFocusOrder(first) == 1);
+
+ //Test for new focus order
+ DALI_TEST_CHECK(2 == manager.GenerateNewFocusOrder());
+
+ // Set the focus order for the first actor
+ manager.SetFocusOrder(second, 2);
+ manager.SetAccessibilityAttribute(second, AccessibilityManager::ACCESSIBILITY_LABEL, "first");
+ DALI_TEST_CHECK(manager.GetFocusOrder(second) == 2);
+ END_TEST;
+}
+
+int UtcDaliAccessibilityManagerGetActorByFocusOrder(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliAccessibilityManagerGetActorByFocusOrder");
+
+ AccessibilityManager manager = AccessibilityManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ // Create the actors and set their focus orders
+ Actor first = Actor::New();
+ manager.SetFocusOrder(first, 1);
+
+ Actor second = Actor::New();
+ manager.SetFocusOrder(second, 2);
+
+ Actor third = Actor::New();
+ manager.SetFocusOrder(third, 3);
+
+ // Check that we get an empty handle as no actor is added to the stage yet.
+ DALI_TEST_CHECK(manager.GetActorByFocusOrder(1) == Actor());
+ DALI_TEST_CHECK(manager.GetActorByFocusOrder(2) == Actor());
+ DALI_TEST_CHECK(manager.GetActorByFocusOrder(3) == Actor());
+
+ // Add the actors to the stage
+ Stage::GetCurrent().Add(first);
+ Stage::GetCurrent().Add(second);
+ Stage::GetCurrent().Add(third);
+
+ // Check that we get an empty handle because focus order 0 means undefined.
+ DALI_TEST_CHECK(manager.GetActorByFocusOrder(0) == Actor());
+
+ // Check that we get correct actors for the specified focus orders
+ DALI_TEST_CHECK(manager.GetActorByFocusOrder(1) == first);
+ DALI_TEST_CHECK(manager.GetActorByFocusOrder(2) == second);
+ DALI_TEST_CHECK(manager.GetActorByFocusOrder(3) == third);
+
+ // Change the focus order of the third actor to 1
+ manager.SetFocusOrder(third, 1);
+
+ // Check that we still get correct actors after changing their focus orders
+ DALI_TEST_CHECK(manager.GetActorByFocusOrder(1) == third);
+ DALI_TEST_CHECK(manager.GetActorByFocusOrder(2) == first);
+ DALI_TEST_CHECK(manager.GetActorByFocusOrder(3) == second);
+
+ // Check that we get an empty handle because no actor has a focus order of 4
+ DALI_TEST_CHECK(manager.GetActorByFocusOrder(4) == Actor());
+ END_TEST;
+}
+
+int UtcDaliAccessibilityManagerSetAndGetCurrentFocusActor(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliAccessibilityManagerSetAndGetCurrentFocusActor");
+
+ AccessibilityManager manager = AccessibilityManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ // Create the first actor and add it to the stage
+ Actor first = Actor::New();
+ manager.SetFocusOrder(first, 1);
+ Stage::GetCurrent().Add(first);
+
+ // Create the second actor and add it to the stage
+ Actor second = Actor::New();
+ manager.SetFocusOrder(second, 2);
+ Stage::GetCurrent().Add(second);
+
+ // Create the third actor but don't add it to the stage
+ Actor third = Actor::New();
+ manager.SetFocusOrder(third, 3);
+
+ // Check that no actor is being focused yet.
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
+
+ // Check that it will fail to set focus on an invalid actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(Actor()) == false);
+
+ // Check that the focus is set on the first actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
+
+ // Check that the focus is set on the second actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(second) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
+
+ // Check that it will fail to set focus on the third actor as it's not in the stage
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == false);
+
+ // Add the third actor to the stage
+ Stage::GetCurrent().Add(third);
+
+ // make the third actor invisible
+ third.SetVisible(false);
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ // Check that it will fail to set focus on the third actor as it's invisible
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == false);
+
+ // Make the third actor visible
+ third.SetVisible(true);
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ // Make the third actor not focusable
+ Property::Index propertyActorFocusable = third.GetPropertyIndex("focusable");
+ third.SetProperty(propertyActorFocusable, false);
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ // Check that it will fail to set focus on the third actor as it's not focusable
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == false);
+
+ // Make the third actor focusable
+ third.SetProperty(propertyActorFocusable, true);
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ // Check that the focus is successfully moved to the third actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == true);
+
+ // Make the current focused actor to be not focusable by setting its focus order to be 0
+ manager.SetFocusOrder(third, 0);
+
+ // Check that the focus is automatically cleared
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
+
+ // Set the focus order of the third actor again
+ manager.SetFocusOrder(third, 3);
+
+ // Check that the third actor can be focused successfully now
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == true);
+ END_TEST;
+}
+
+int UtcDaliAccessibilityManagerGetCurrentFocusGroup(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliAccessibilityManagerGetCurrentFocusGroup");
+
+ AccessibilityManager manager = AccessibilityManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ // Create an actor with two child actors and add it to the stage
+ Actor parent = Actor::New();
+ Actor firstChild = Actor::New();
+ Actor secondChild = Actor::New();
+ parent.Add(firstChild);
+ parent.Add(secondChild);
+ Stage::GetCurrent().Add(parent);
+
+ // Create three actors and add them as the children of the first child actor
+ Actor firstGrandChild = Actor::New();
+ Actor secondGrandChild = Actor::New();
+ Actor thirdGrandChild = Actor::New();
+ firstChild.Add(firstGrandChild);
+ firstChild.Add(secondGrandChild);
+ firstChild.Add(thirdGrandChild);
+
+ // Set focus order to the actors
+ manager.SetFocusOrder(parent, 1);
+ manager.SetFocusOrder(firstChild, 2);
+ manager.SetFocusOrder(firstGrandChild, 3);
+ manager.SetFocusOrder(secondGrandChild, 4);
+ manager.SetFocusOrder(thirdGrandChild, 5);
+ manager.SetFocusOrder(secondChild, 6);
+
+ // Set the parent and the first child actor as focus groups
+ manager.SetFocusGroup(parent, true);
+ DALI_TEST_CHECK(manager.IsFocusGroup(parent) == true);
+
+ // Set focus to the first grand child actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(firstGrandChild) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == firstGrandChild);
+
+ // The current focus group should be the parent, As it is the immediate parent which is also a focus group.
+ DALI_TEST_CHECK(manager.GetCurrentFocusGroup() == parent);
+
+ manager.SetFocusGroup(firstChild, true);
+ DALI_TEST_CHECK(manager.IsFocusGroup(firstChild) == true);
+
+ // The current focus group should be the firstChild, As it is the immediate parent which is also a focus group.
+ DALI_TEST_CHECK(manager.GetCurrentFocusGroup() == firstChild);
+
+ manager.SetFocusGroup(firstGrandChild, true);
+ DALI_TEST_CHECK(manager.IsFocusGroup(firstGrandChild) == true);
+
+ // The current focus group should be itself, As it is also a focus group.
+ DALI_TEST_CHECK(manager.GetCurrentFocusGroup() == firstGrandChild);
+
+ // Set focus to the second grand child actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(secondGrandChild) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == secondGrandChild);
+
+ // The current focus group should be the firstChild, As it is the immediate parent which is also a
+ // focus group for the current focus actor.
+ DALI_TEST_CHECK(manager.GetCurrentFocusGroup() == firstChild);
+
+ END_TEST;
+}
+
+int UtcDaliAccessibilityManagerGetCurrentFocusOrder(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliAccessibilityManagerGetCurrentFocusOrder");
+
+ AccessibilityManager manager = AccessibilityManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ Actor first = Actor::New();
+ Stage::GetCurrent().Add(first);
+
+ Actor second = Actor::New();
+ Stage::GetCurrent().Add(second);
+
+ Actor third = Actor::New();
+ Stage::GetCurrent().Add(third);
+
+ // Set the focus order and description for the first actor
+ manager.SetFocusOrder(first, 1);
+ manager.SetAccessibilityAttribute(first, AccessibilityManager::ACCESSIBILITY_LABEL, "first");
+ DALI_TEST_CHECK(manager.GetFocusOrder(first) == 1);
+ 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, AccessibilityManager::ACCESSIBILITY_LABEL, "second");
+ DALI_TEST_CHECK(manager.GetFocusOrder(second) == 2);
+ 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, AccessibilityManager::ACCESSIBILITY_LABEL, "third");
+ DALI_TEST_CHECK(manager.GetFocusOrder(third) == 3);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(third, AccessibilityManager::ACCESSIBILITY_LABEL) == "third");
+
+ // Check that no actor is being focused yet.
+ DALI_TEST_CHECK(manager.GetCurrentFocusOrder() == 0);
+
+ // Set the focus on the first actor and test
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusOrder() == 1);
+
+ // Move the focus forward to the second actor and test
+ manager.MoveFocusForward();
+ DALI_TEST_CHECK(manager.GetCurrentFocusOrder() == 2);
+
+ // Move the focus forward to the third actor and test
+ manager.MoveFocusForward();
+ DALI_TEST_CHECK(manager.GetCurrentFocusOrder() == 3);
+
+ // Clear focus and test
+ manager.ClearFocus();
+ DALI_TEST_CHECK(manager.GetCurrentFocusOrder() == 0);
+ END_TEST;
+}
+
+int UtcDaliAccessibilityManagerMoveFocusForward(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliAccessibilityManagerMoveFocusForward");
+
+ AccessibilityManager manager = AccessibilityManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ Actor first = Actor::New();
+ Stage::GetCurrent().Add(first);
+
+ Actor second = Actor::New();
+ Stage::GetCurrent().Add(second);
+
+ Actor third = Actor::New();
+ Stage::GetCurrent().Add(third);
+
+ // Set the focus order and description for the first actor
+ manager.SetFocusOrder(first, 1);
+ manager.SetAccessibilityAttribute(first, AccessibilityManager::ACCESSIBILITY_LABEL, "first");
+ DALI_TEST_CHECK(manager.GetFocusOrder(first) == 1);
+ 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, AccessibilityManager::ACCESSIBILITY_LABEL, "second");
+ DALI_TEST_CHECK(manager.GetFocusOrder(second) == 2);
+ 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, AccessibilityManager::ACCESSIBILITY_LABEL, "third");
+ DALI_TEST_CHECK(manager.GetFocusOrder(third) == 3);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(third, AccessibilityManager::ACCESSIBILITY_LABEL) == "third");
+
+ // Check that no actor is being focused yet.
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
+
+ // 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(), AccessibilityManager::ACCESSIBILITY_LABEL) == "first");
+
+ // Test the non-wrapped move first
+ manager.SetWrapMode(false);
+ DALI_TEST_CHECK(manager.GetWrapMode() == false);
+
+ // Move the focus forward to the second actor
+ manager.MoveFocusForward();
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == 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(), 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(), AccessibilityManager::ACCESSIBILITY_LABEL) == "third");
+
+ // Now test the wrapped move
+ manager.SetWrapMode(true);
+ DALI_TEST_CHECK(manager.GetWrapMode() == true);
+
+ // 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(), AccessibilityManager::ACCESSIBILITY_LABEL) == "first");
+
+ // Make the second actor not focusable
+ Property::Index propertyActorFocusable = second.GetPropertyIndex("focusable");
+ second.SetProperty(propertyActorFocusable, false);
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ // Move the focus forward and check that the second actor should be skipped and
+ // the third actor should be focused now.
+ manager.MoveFocusForward();
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityManager::ACCESSIBILITY_LABEL) == "third");
+
+ // Make the first actor invisible
+ first.SetVisible(false);
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ // Move the focus forward and check that the first actor should be skipped as it's
+ // invisible and the second actor should also be skipped as it's not focusable,
+ // 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(), AccessibilityManager::ACCESSIBILITY_LABEL) == "third");
+
+ // Make the third actor invisible so that no actor can be focused.
+ third.SetVisible(false);
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ // 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(), AccessibilityManager::ACCESSIBILITY_LABEL) == "third");
+ END_TEST;
+}
+
+int UtcDaliAccessibilityManagerMoveFocusBackward(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliAccessibilityManagerMoveFocusBackward");
+
+ AccessibilityManager manager = AccessibilityManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ Actor first = Actor::New();
+ Stage::GetCurrent().Add(first);
+
+ Actor second = Actor::New();
+ Stage::GetCurrent().Add(second);
+
+ Actor third = Actor::New();
+ Stage::GetCurrent().Add(third);
+
+ // Set the focus order and description for the first actor
+ manager.SetFocusOrder(first, 1);
+ manager.SetAccessibilityAttribute(first, AccessibilityManager::ACCESSIBILITY_LABEL, "first");
+ DALI_TEST_CHECK(manager.GetFocusOrder(first) == 1);
+ 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, AccessibilityManager::ACCESSIBILITY_LABEL, "second");
+ DALI_TEST_CHECK(manager.GetFocusOrder(second) == 2);
+ 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, AccessibilityManager::ACCESSIBILITY_LABEL, "third");
+ DALI_TEST_CHECK(manager.GetFocusOrder(third) == 3);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(third, AccessibilityManager::ACCESSIBILITY_LABEL) == "third");
+
+ // Check that no actor is being focused yet.
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
+
+ // 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(), AccessibilityManager::ACCESSIBILITY_LABEL) == "third");
+
+ // Test the non-wrapped move first
+ manager.SetWrapMode(false);
+ DALI_TEST_CHECK(manager.GetWrapMode() == false);
+
+ // Move the focus backward to the second actor
+ manager.MoveFocusBackward();
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == 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(), 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(), AccessibilityManager::ACCESSIBILITY_LABEL) == "first");
+
+ // Now test the wrapped move
+ manager.SetWrapMode(true);
+ DALI_TEST_CHECK(manager.GetWrapMode() == true);
+
+ // 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(), AccessibilityManager::ACCESSIBILITY_LABEL) == "third");
+
+ // Make the second actor not focusable
+ Property::Index propertyActorFocusable = second.GetPropertyIndex("focusable");
+ second.SetProperty(propertyActorFocusable, false);
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ // Move the focus backward and check that the second actor should be skipped and
+ // the first actor should be focused now.
+ manager.MoveFocusBackward();
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
+ DALI_TEST_CHECK(manager.GetAccessibilityAttribute(manager.GetCurrentFocusActor(), AccessibilityManager::ACCESSIBILITY_LABEL) == "first");
+
+ // Make the third actor invisible
+ third.SetVisible(false);
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ // Move the focus backward and check that the third actor should be skipped as it's
+ // invisible and the second actor should also be skipped as it's not focusable,
+ // 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(), AccessibilityManager::ACCESSIBILITY_LABEL) == "first");
+
+ // Make the first actor invisible so that no actor can be focused.
+ first.SetVisible(false);
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ // 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(), AccessibilityManager::ACCESSIBILITY_LABEL) == "first");
+ END_TEST;
+}
+
+int UtcDaliAccessibilityManagerClearFocus(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliAccessibilityManagerClearFocus");
+
+ AccessibilityManager manager = AccessibilityManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ // Create the first actor and add it to the stage
+ Actor first = Actor::New();
+ manager.SetFocusOrder(first, 1);
+ Stage::GetCurrent().Add(first);
+
+ // Create the second actor and add it to the stage
+ Actor second = Actor::New();
+ manager.SetFocusOrder(second, 2);
+ Stage::GetCurrent().Add(second);
+
+ // Check that no actor is being focused yet.
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
+
+ // Check that the focus is set on the first actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
+
+ // Check that the focus is set on the second actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(second) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
+
+ // Clear the focus
+ manager.ClearFocus();
+
+ // Check that no actor is being focused now.
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
+ END_TEST;
+}
+
+int UtcDaliAccessibilityManagerReset(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliAccessibilityManagerReset");
+
+ AccessibilityManager manager = AccessibilityManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ // Create the first actor and add it to the stage
+ Actor first = Actor::New();
+ manager.SetFocusOrder(first, 1);
+ Stage::GetCurrent().Add(first);
+
+ // Create the second actor and add it to the stage
+ Actor second = Actor::New();
+ manager.SetFocusOrder(second, 2);
+ Stage::GetCurrent().Add(second);
+
+ // Check that no actor is being focused yet.
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
+
+ // Check that the focus is set on the first actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
+
+ // Check that the focus is set on the second actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(second) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
+
+ // Clear the focus
+ manager.Reset();
+
+ // Check that no actor is being focused now and the focus order of actors have been cleared
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
+ DALI_TEST_CHECK(manager.GetFocusOrder(first) == 0);
+ DALI_TEST_CHECK(manager.GetFocusOrder(first) == 0);
+ END_TEST;
+}
+
+int UtcDaliAccessibilityManagerFocusGroup(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliAccessibilityManagerFocusGroup");
+
+ AccessibilityManager manager = AccessibilityManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ // Create an actor with two child actors and add it to the stage
+ Actor parent = Actor::New();
+ Actor firstChild = Actor::New();
+ Actor secondChild = Actor::New();
+ parent.Add(firstChild);
+ parent.Add(secondChild);
+ Stage::GetCurrent().Add(parent);
+
+ // Create three actors and add them as the children of the first child actor
+ Actor firstGrandChild = Actor::New();
+ Actor secondGrandChild = Actor::New();
+ Actor thirdGrandChild = Actor::New();
+ firstChild.Add(firstGrandChild);
+ firstChild.Add(secondGrandChild);
+ firstChild.Add(thirdGrandChild);
+
+ // Set focus order to the actors
+ manager.SetFocusOrder(parent, 1);
+ manager.SetFocusOrder(firstChild, 2);
+ manager.SetFocusOrder(firstGrandChild, 3);
+ manager.SetFocusOrder(secondGrandChild, 4);
+ manager.SetFocusOrder(thirdGrandChild, 5);
+ manager.SetFocusOrder(secondChild, 6);
+
+ // Set the parent and the first child actor as focus groups
+ manager.SetFocusGroup(parent, true);
+ DALI_TEST_CHECK(manager.IsFocusGroup(parent) == true);
+
+ // The focus group of the parent should be itself, as it is set to be a focus group.
+ DALI_TEST_CHECK(manager.GetFocusGroup(parent) == parent);
+
+ // The focus group of the firstChild should be its parent, as it is the immediate parent which is also a group.
+ DALI_TEST_CHECK(manager.GetFocusGroup(firstChild) == parent);
+
+ manager.SetFocusGroup(firstChild, true);
+ DALI_TEST_CHECK(manager.IsFocusGroup(firstChild) == true);
+
+ // The focus group of the firstChild should be itself, as it is set to be a focus group now.
+ DALI_TEST_CHECK(manager.GetFocusGroup(firstChild) == firstChild);
+
+ // Enable wrap mode for focus movement.
+ manager.SetWrapMode(true);
+ DALI_TEST_CHECK(manager.GetWrapMode() == true);
+
+ // Check that no actor is being focused yet.
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
+
+ // Check that the focus is set on the parent actor.
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(parent) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == parent);
+
+ // Check that group mode is disabled.
+ DALI_TEST_CHECK(manager.GetGroupMode() == false);
+
+ // Check that the focus movement is wrapped as normal.
+ DALI_TEST_CHECK(manager.MoveFocusForward() == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == firstChild);
+ DALI_TEST_CHECK(manager.MoveFocusForward() == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == firstGrandChild);
+ DALI_TEST_CHECK(manager.MoveFocusForward() == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == secondGrandChild);
+ DALI_TEST_CHECK(manager.MoveFocusForward() == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == thirdGrandChild);
+ DALI_TEST_CHECK(manager.MoveFocusForward() == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == secondChild);
+ DALI_TEST_CHECK(manager.MoveFocusForward() == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == parent);
+ DALI_TEST_CHECK(manager.MoveFocusForward() == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == firstChild);
+ DALI_TEST_CHECK(manager.MoveFocusForward() == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == firstGrandChild);
+
+ // Enable the group mode.
+ manager.SetGroupMode(true);
+ DALI_TEST_CHECK(manager.GetGroupMode() == true);
+
+ // Check that the focus movement is now limited to the current focus group.
+ DALI_TEST_CHECK(manager.MoveFocusForward() == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == secondGrandChild);
+ DALI_TEST_CHECK(manager.MoveFocusForward() == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == thirdGrandChild);
+ DALI_TEST_CHECK(manager.MoveFocusForward() == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == firstChild);
+ DALI_TEST_CHECK(manager.MoveFocusForward() == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == firstGrandChild);
+ END_TEST;
+}
+
+int UtcDaliAccessibilityManagerSetAndGetFocusIndicator(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliAccessibilityManagerSetAndGetFocusIndicator");
+
+ AccessibilityManager manager = AccessibilityManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ Actor defaultFocusIndicatorActor = manager.GetFocusIndicatorActor();
+ DALI_TEST_CHECK(defaultFocusIndicatorActor);
+
+ Actor newFocusIndicatorActor = Actor::New();
+ manager.SetFocusIndicatorActor(newFocusIndicatorActor);
+ DALI_TEST_CHECK(manager.GetFocusIndicatorActor() == newFocusIndicatorActor);
+ END_TEST;
+}
+
+int UtcDaliAccessibilityManagerSignalFocusChanged(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliAccessibilityManagerSignalFocusChanged");
+
+ AccessibilityManager manager = AccessibilityManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ bool signalVerified = false;
+ FocusChangedCallback callback(signalVerified);
+ manager.FocusChangedSignal().Connect( &callback, &FocusChangedCallback::Callback );
+
+ // Create the first actor and add it to the stage
+ Actor first = Actor::New();
+ manager.SetFocusOrder(first, 1);
+ Stage::GetCurrent().Add(first);
+
+ // Create the second actor and add it to the stage
+ Actor second = Actor::New();
+ manager.SetFocusOrder(second, 2);
+ Stage::GetCurrent().Add(second);
+
+ // Check that no actor is being focused yet.
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
+
+ // Check that the focus is set on the first actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
+ DALI_TEST_CHECK(callback.mSignalVerified);
+ callback.Reset();
+
+ // Check that the focus is set on the second actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(second) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
+ DALI_TEST_CHECK(callback.mSignalVerified);
+ callback.Reset();
+
+ // Clear the focus
+ manager.ClearFocus();
+
+ // Check that no actor is being focused now.
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
+ DALI_TEST_CHECK(callback.mSignalVerified);
+ END_TEST;
+}
+
+int UtcDaliAccessibilityManagerSignalFocusOvershot(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliAccessibilityManagerSignalFocusOvershot");
+
+ AccessibilityManager manager = AccessibilityManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ bool signalVerified = false;
+ FocusOvershotCallback callback(signalVerified);
+ manager.FocusOvershotSignal().Connect(&callback, &FocusOvershotCallback::Callback);
+
+ // Create the first actor and add it to the stage
+ Actor first = Actor::New();
+ manager.SetFocusOrder(first, 1);
+ Stage::GetCurrent().Add(first);
+
+ // Create the second actor and add it to the stage
+ Actor second = Actor::New();
+ manager.SetFocusOrder(second, 2);
+ Stage::GetCurrent().Add(second);
+
+ // Check that the wrap mode is disabled
+ DALI_TEST_CHECK(manager.GetWrapMode() == false);
+
+ // Check that the focus is set on the first actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
+
+ // Check that the focus is moved to the second actor successfully.
+ DALI_TEST_CHECK(manager.MoveFocusForward() == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
+
+ // Check that the forward focus movement is overshot.
+ callback.mCurrentFocusedActor = second;
+ callback.mFocusOvershotDirection = Toolkit::AccessibilityManager::OVERSHOT_NEXT;
+ DALI_TEST_CHECK(manager.MoveFocusForward() == false);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
+ DALI_TEST_CHECK(signalVerified);
+ callback.Reset();
+
+ // Enable the wrap mode
+ manager.SetWrapMode(true);
+ DALI_TEST_CHECK(manager.GetWrapMode() == true);
+
+ // Check that the forward focus movement is wrapped and no overshot happens.
+ DALI_TEST_CHECK(manager.MoveFocusForward() == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
+ DALI_TEST_CHECK(signalVerified == false);
+
+ // Disable the wrap mode
+ manager.SetWrapMode(false);
+ DALI_TEST_CHECK(manager.GetWrapMode() == false);
+
+ // Check that the backward focus movement is overshot.
+ callback.mCurrentFocusedActor = first;
+ 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 UtcDaliAccessibilityManagerSignalFocusedActorActivated(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliAccessibilityManagerSignalFocusedActorActivated");
+
+ AccessibilityManager manager = AccessibilityManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ FocusedActorActivatedCallback callback;
+ manager.FocusedActorActivatedSignal().Connect(&callback, &FocusedActorActivatedCallback::Callback);
+ DALI_TEST_CHECK(true);
+
+ END_TEST;
+}
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)
#include <dali-toolkit/public-api/controls/table-view/table-view.h>
#include <dali-toolkit/public-api/controls/text-controls/text-field.h>
#include <dali-toolkit/public-api/controls/text-controls/text-label.h>
-#include <dali-toolkit/public-api/focus-manager/accessibility-focus-manager.h>
+#include <dali-toolkit/public-api/accessibility-manager/accessibility-manager.h>
#include <dali-toolkit/public-api/focus-manager/keyboard-focus-manager.h>
#include <dali-toolkit/public-api/text/rendering-backend.h>
#include <dali-toolkit/public-api/dali-toolkit-version.h>
--- /dev/null
+/*
+ * 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 "accessibility-manager-impl.h"
+
+// EXTERNAL INCLUDES
+#include <cstring> // for strcmp
+#include <dali/public-api/actors/layer.h>
+#include <dali/devel-api/adaptor-framework/accessibility-adaptor.h>
+#include <dali/devel-api/adaptor-framework/sound-player.h>
+#include <dali/public-api/animation/constraints.h>
+#include <dali/devel-api/events/hit-test-algorithm.h>
+#include <dali/public-api/images/resource-image.h>
+#include <dali/integration-api/debug.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/controls/control.h>
+#include <dali-toolkit/public-api/controls/control-impl.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Internal
+{
+
+namespace // unnamed namespace
+{
+
+// Signals
+
+const char* const SIGNAL_FOCUS_CHANGED = "focus-changed";
+const char* const SIGNAL_FOCUS_OVERSHOT = "focus-overshot";
+const char* const SIGNAL_FOCUSED_ACTOR_ACTIVATED = "focused-actor-activated";
+
+#if defined(DEBUG_ENABLED)
+Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_FOCUS_MANAGER");
+#endif
+
+const char* const ACTOR_FOCUSABLE("focusable");
+const char* const IS_FOCUS_GROUP("is-focus-group");
+
+const char* FOCUS_BORDER_IMAGE_PATH = DALI_IMAGE_DIR "B16-8_TTS_focus.png";
+const Vector4 FOCUS_BORDER_IMAGE_BORDER = Vector4(7.0f, 7.0f, 7.0f, 7.0f);
+
+const char* FOCUS_SOUND_FILE = DALI_SOUND_DIR "Focus.ogg";
+const char* FOCUS_CHAIN_END_SOUND_FILE = DALI_SOUND_DIR "End_of_List.ogg";
+
+/**
+ * The function to be used in the hit-test algorithm to check whether the actor is hittable.
+ */
+bool IsActorFocusableFunction(Actor actor, Dali::HitTestAlgorithm::TraverseType type)
+{
+ bool hittable = false;
+
+ switch (type)
+ {
+ case Dali::HitTestAlgorithm::CHECK_ACTOR:
+ {
+ // Check whether the actor is visible and not fully transparent.
+ if( actor.IsVisible()
+ && actor.GetCurrentWorldColor().a > 0.01f) // not FULLY_TRANSPARENT
+ {
+ // Check whether the actor is focusable
+ Property::Index propertyActorFocusable = actor.GetPropertyIndex(ACTOR_FOCUSABLE);
+ if(propertyActorFocusable != Property::INVALID_INDEX)
+ {
+ hittable = actor.GetProperty<bool>(propertyActorFocusable);
+ }
+ }
+ break;
+ }
+ case Dali::HitTestAlgorithm::DESCEND_ACTOR_TREE:
+ {
+ if( actor.IsVisible() ) // Actor is visible, if not visible then none of its children are visible.
+ {
+ hittable = true;
+ }
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+
+ return hittable;
+};
+
+}
+
+AccessibilityManager::AccessibilityManager()
+: mCurrentFocusActor(FocusIDPair(0, 0)),
+ mFocusIndicatorActor(Actor()),
+ mRecursiveFocusMoveCounter(0),
+ mIsWrapped(false),
+ mIsFocusWithinGroup(false),
+ mIsEndcapFeedbackEnabled(false),
+ mIsEndcapFeedbackPlayed(false),
+ mIsAccessibilityTtsEnabled(false),
+ mTtsCreated(false),
+ mIsFocusIndicatorEnabled(false),
+ mContinuousPlayMode(false)
+{
+}
+
+AccessibilityManager::~AccessibilityManager()
+{
+}
+
+void AccessibilityManager::Initialise()
+{
+ CreateDefaultFocusIndicatorActor();
+
+ AccessibilityAdaptor adaptor = AccessibilityAdaptor::Get();
+ adaptor.SetActionHandler(*this);
+ adaptor.SetGestureHandler(*this);
+
+ ChangeAccessibilityStatus();
+}
+
+AccessibilityManager::ActorAdditionalInfo AccessibilityManager::GetActorAdditionalInfo(const unsigned int actorID) const
+{
+ ActorAdditionalInfo data;
+ IDAdditionalInfoConstIter iter = mIDAdditionalInfoContainer.find(actorID);
+ if(iter != mIDAdditionalInfoContainer.end())
+ {
+ data = (*iter).second;
+ }
+
+ return data;
+}
+
+void AccessibilityManager::SynchronizeActorAdditionalInfo(const unsigned int actorID, const unsigned int order)
+{
+ ActorAdditionalInfo actorInfo = GetActorAdditionalInfo(actorID);
+ actorInfo.mFocusOrder = order;
+ mIDAdditionalInfoContainer.erase(actorID);
+ mIDAdditionalInfoContainer.insert(IDAdditionalInfoPair(actorID, actorInfo));
+}
+
+void AccessibilityManager::SetAccessibilityAttribute(Actor actor, Toolkit::AccessibilityManager::AccessibilityAttribute type, const std::string& text)
+{
+ if(actor)
+ {
+ unsigned int actorID = actor.GetId();
+
+ ActorAdditionalInfo info = GetActorAdditionalInfo(actorID);
+ info.mAccessibilityAttributes[type] = text;
+
+ mIDAdditionalInfoContainer.erase(actorID);
+ mIDAdditionalInfoContainer.insert(IDAdditionalInfoPair(actorID, info));
+ }
+}
+
+std::string AccessibilityManager::GetAccessibilityAttribute(Actor actor, Toolkit::AccessibilityManager::AccessibilityAttribute type) const
+{
+ std::string text;
+
+ if(actor)
+ {
+ ActorAdditionalInfo data = GetActorAdditionalInfo(actor.GetId());
+ text = data.mAccessibilityAttributes[type];
+ }
+
+ return text;
+}
+
+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)
+ {
+ // Firstly delete the actor from the focus chain if it's already there with a different focus order.
+ mFocusIDContainer.erase(GetFocusOrder(actor));
+
+ // Create actor focusable property if not already created.
+ Property::Index propertyActorFocusable = actor.GetPropertyIndex(ACTOR_FOCUSABLE);
+ if(propertyActorFocusable == Property::INVALID_INDEX)
+ {
+ propertyActorFocusable = actor.RegisterProperty( ACTOR_FOCUSABLE, true, Property::READ_WRITE );
+ }
+
+ if(order == 0)
+ {
+ // The actor is not focusable without a defined focus order.
+ actor.SetProperty(propertyActorFocusable, false);
+
+ // If the actor is currently being focused, it should clear the focus
+ if(actor == GetCurrentFocusActor())
+ {
+ ClearFocus();
+ }
+ }
+ else // Insert the actor to the focus chain
+ {
+ // Check whether there is another actor in the focus chain with the same focus order already.
+ FocusIDIter focusIDIter = mFocusIDContainer.find(order);
+ if(focusIDIter != mFocusIDContainer.end())
+ {
+ // We need to increase the focus order of that actor and all the actors followed it
+ // in the focus chain.
+ FocusIDIter lastIter = mFocusIDContainer.end();
+ --lastIter;//We want forward iterator to the last element here
+ mFocusIDContainer.insert(FocusIDPair((*lastIter).first + 1, (*lastIter).second));
+
+ // Update the actor's focus order in its additional data
+ SynchronizeActorAdditionalInfo((*lastIter).second, (*lastIter).first + 1);
+
+ for(FocusIDIter iter = lastIter; iter != focusIDIter; iter--)
+ {
+ FocusIDIter previousIter = iter;
+ --previousIter;//We want forward iterator to the previous element here
+ unsigned int actorID = (*previousIter).second;
+ (*iter).second = actorID;
+
+ // Update the actor's focus order in its additional data
+ SynchronizeActorAdditionalInfo(actorID, (*iter).first);
+ }
+
+ mFocusIDContainer.erase(order);
+ }
+
+ // The actor is focusable
+ actor.SetProperty(propertyActorFocusable, true);
+
+ // Now we insert the actor into the focus chain with the specified focus order
+ mFocusIDContainer.insert(FocusIDPair(order, actor.GetId()));
+ }
+
+ // Update the actor's focus order in its additional data
+ SynchronizeActorAdditionalInfo(actor.GetId(), order);
+ }
+}
+
+unsigned int AccessibilityManager::GetFocusOrder(Actor actor) const
+{
+ unsigned int focusOrder = 0;
+
+ if(actor)
+ {
+ ActorAdditionalInfo data = GetActorAdditionalInfo(actor.GetId());
+ focusOrder = data.mFocusOrder;
+ }
+
+ return focusOrder;
+}
+
+unsigned int AccessibilityManager::GenerateNewFocusOrder() const
+{
+ unsigned int order = 1;
+ FocusIDContainer::const_reverse_iterator iter = mFocusIDContainer.rbegin();
+
+ if(iter != mFocusIDContainer.rend())
+ {
+ order = (*iter).first + 1;
+ }
+
+ return order;
+}
+
+Actor AccessibilityManager::GetActorByFocusOrder(const unsigned int order)
+{
+ Actor actor = Actor();
+
+ FocusIDIter focusIDIter = mFocusIDContainer.find(order);
+ if(focusIDIter != mFocusIDContainer.end())
+ {
+ Actor rootActor = Stage::GetCurrent().GetRootLayer();
+ actor = rootActor.FindChildById(mFocusIDContainer[order]);
+ }
+
+ return actor;
+}
+
+bool AccessibilityManager::SetCurrentFocusActor(Actor actor)
+{
+ if(actor)
+ {
+ return DoSetCurrentFocusActor(actor.GetId());
+ }
+
+ return false;
+}
+
+bool AccessibilityManager::DoSetCurrentFocusActor(const unsigned int actorID)
+{
+ Actor rootActor = Stage::GetCurrent().GetRootLayer();
+
+ // If the group mode is enabled, check which focus group the current focused actor belongs to
+ Actor focusGroup;
+ if(mIsFocusWithinGroup)
+ {
+ focusGroup = GetFocusGroup(GetCurrentFocusActor());
+ }
+
+ if(!focusGroup)
+ {
+ focusGroup = rootActor;
+ }
+
+ Actor actor = focusGroup.FindChildById(actorID);
+
+ // Check whether the actor is in the stage
+ if(actor)
+ {
+ // Check whether the actor is focusable
+ bool actorFocusable = false;
+ Property::Index propertyActorFocusable = actor.GetPropertyIndex(ACTOR_FOCUSABLE);
+ if(propertyActorFocusable != Property::INVALID_INDEX)
+ {
+ actorFocusable = actor.GetProperty<bool>(propertyActorFocusable);
+ }
+
+ // Go through the actor's hierarchy to check whether the actor is visible
+ bool actorVisible = actor.IsVisible();
+ Actor parent = actor.GetParent();
+ while (actorVisible && parent && parent != rootActor)
+ {
+ actorVisible = parent.IsVisible();
+ parent = parent.GetParent();
+ }
+
+ // Check whether the actor is fully transparent
+ bool actorOpaque = actor.GetCurrentWorldColor().a > 0.01f;
+
+ // Set the focus only when the actor is focusable and visible and not fully transparent
+ if(actorVisible && actorFocusable && actorOpaque)
+ {
+ // Draw the focus indicator upon the focused actor
+ if(mIsFocusIndicatorEnabled && mFocusIndicatorActor)
+ {
+ actor.Add(mFocusIndicatorActor);
+ }
+
+ // Send notification for the change of focus actor
+ mFocusChangedSignal.Emit( GetCurrentFocusActor(), actor );
+
+ // Save the current focused actor
+ mCurrentFocusActor = FocusIDPair(GetFocusOrder(actor), actorID);
+
+ if(mIsAccessibilityTtsEnabled)
+ {
+ Dali::SoundPlayer soundPlayer = Dali::SoundPlayer::Get();
+ if(soundPlayer)
+ {
+ soundPlayer.PlaySound(FOCUS_SOUND_FILE);
+ }
+
+ // Play the accessibility attributes with the TTS player.
+ Dali::TtsPlayer player = Dali::TtsPlayer::Get(Dali::TtsPlayer::SCREEN_READER);
+
+ // Combine attribute texts to one text
+ std::string informationText;
+ for(int i = 0; i < Toolkit::AccessibilityManager::ACCESSIBILITY_ATTRIBUTE_NUM; i++)
+ {
+ if(!GetActorAdditionalInfo(actorID).mAccessibilityAttributes[i].empty())
+ {
+ if( i > 0 )
+ {
+ informationText += ", "; // for space time between each information
+ }
+ informationText += GetActorAdditionalInfo(actorID).mAccessibilityAttributes[i];
+ }
+ }
+ player.Play(informationText);
+ }
+
+ return true;
+ }
+ }
+
+ DALI_LOG_WARNING("[%s:%d] FAILED\n", __FUNCTION__, __LINE__);
+ return false;
+}
+
+Actor AccessibilityManager::GetCurrentFocusActor()
+{
+ Actor rootActor = Stage::GetCurrent().GetRootLayer();
+ return rootActor.FindChildById(mCurrentFocusActor.second);
+}
+
+Actor AccessibilityManager::GetCurrentFocusGroup()
+{
+ return GetFocusGroup(GetCurrentFocusActor());
+}
+
+unsigned int AccessibilityManager::GetCurrentFocusOrder()
+{
+ return mCurrentFocusActor.first;
+}
+
+bool AccessibilityManager::MoveFocusForward()
+{
+ bool ret = false;
+ mRecursiveFocusMoveCounter = 0;
+
+ FocusIDIter focusIDIter = mFocusIDContainer.find(mCurrentFocusActor.first);
+ if(focusIDIter != mFocusIDContainer.end())
+ {
+ DALI_LOG_INFO( gLogFilter, Debug::General, "[%s:%d] focus order : %d\n", __FUNCTION__, __LINE__, (*focusIDIter).first);
+ ret = DoMoveFocus(focusIDIter, true, mIsWrapped);
+ }
+ else
+ {
+ // TODO: if there is not focused actor, move first actor
+ if(!mFocusIDContainer.empty())
+ {
+ //if there is not focused actor, move 1st actor
+ focusIDIter = mFocusIDContainer.begin(); // TODO: I'm not sure it was sorted.
+ DALI_LOG_INFO( gLogFilter, Debug::General, "[%s:%d] focus order : %d\n", __FUNCTION__, __LINE__, (*focusIDIter).first);
+ ret = DoSetCurrentFocusActor((*focusIDIter).second);
+ }
+ }
+
+ DALI_LOG_INFO( gLogFilter, Debug::General, "[%s] %s\n", __FUNCTION__, ret?"SUCCEED!!!":"FAILED!!!");
+
+ return ret;
+}
+
+bool AccessibilityManager::MoveFocusBackward()
+{
+ bool ret = false;
+ mRecursiveFocusMoveCounter = 0;
+
+ FocusIDIter focusIDIter = mFocusIDContainer.find(mCurrentFocusActor.first);
+ if(focusIDIter != mFocusIDContainer.end())
+ {
+ DALI_LOG_INFO( gLogFilter, Debug::General, "[%s:%d] focus order : %d\n", __FUNCTION__, __LINE__, (*focusIDIter).first);
+ ret = DoMoveFocus(focusIDIter, false, mIsWrapped);
+ }
+ else
+ {
+ // TODO: if there is not focused actor, move last actor
+ if(!mFocusIDContainer.empty())
+ {
+ //if there is not focused actor, move last actor
+ focusIDIter = mFocusIDContainer.end();
+ --focusIDIter;//We want forward iterator to the last element here
+ DALI_LOG_INFO( gLogFilter, Debug::General, "[%s:%d] focus order : %d\n", __FUNCTION__, __LINE__, (*focusIDIter).first);
+ ret = DoSetCurrentFocusActor((*focusIDIter).second);
+ }
+ }
+
+ DALI_LOG_INFO( gLogFilter, Debug::General, "[%s] %s\n", __FUNCTION__, ret?"SUCCEED!!!":"FAILED!!!");
+
+ return ret;
+}
+
+void AccessibilityManager::DoActivate(Actor actor)
+{
+ if(actor)
+ {
+ Dali::Toolkit::Control control = Dali::Toolkit::Control::DownCast(actor);
+ if(control)
+ {
+ // Notify the control that it is activated
+ GetImplementation( control ).AccessibilityActivate();
+ }
+
+ // Send notification for the activation of focused actor
+ mFocusedActorActivatedSignal.Emit(actor);
+ }
+}
+
+void AccessibilityManager::ClearFocus()
+{
+ Actor actor = GetCurrentFocusActor();
+ if(actor)
+ {
+ actor.Remove(mFocusIndicatorActor);
+ }
+
+ mCurrentFocusActor = FocusIDPair(0, 0);
+
+ // Send notification for the change of focus actor
+ mFocusChangedSignal.Emit(actor, Actor());
+
+ if(mIsAccessibilityTtsEnabled)
+ {
+ // Stop the TTS playing if any
+ Dali::TtsPlayer player = Dali::TtsPlayer::Get(Dali::TtsPlayer::SCREEN_READER);
+ player.Stop();
+ }
+}
+
+void AccessibilityManager::Reset()
+{
+ ClearFocus();
+ mFocusIDContainer.clear();
+ mIDAdditionalInfoContainer.clear();
+}
+
+void AccessibilityManager::SetFocusGroup(Actor actor, bool isFocusGroup)
+{
+ if(actor)
+ {
+ // Create focus group property if not already created.
+ Property::Index propertyIsFocusGroup = actor.GetPropertyIndex(IS_FOCUS_GROUP);
+ if(propertyIsFocusGroup == Property::INVALID_INDEX)
+ {
+ actor.RegisterProperty( IS_FOCUS_GROUP, isFocusGroup, Property::READ_WRITE );
+ }
+ else
+ {
+ actor.SetProperty(propertyIsFocusGroup, isFocusGroup);
+ }
+ }
+}
+
+bool AccessibilityManager::IsFocusGroup(Actor actor) const
+{
+ // Check whether the actor is a focus group
+ bool isFocusGroup = false;
+
+ if(actor)
+ {
+ Property::Index propertyIsFocusGroup = actor.GetPropertyIndex(IS_FOCUS_GROUP);
+ if(propertyIsFocusGroup != Property::INVALID_INDEX)
+ {
+ isFocusGroup = actor.GetProperty<bool>(propertyIsFocusGroup);
+ }
+ }
+
+ return isFocusGroup;
+}
+
+Actor AccessibilityManager::GetFocusGroup(Actor actor)
+{
+ // Go through the actor's hierarchy to check which focus group the actor belongs to
+ while (actor && !IsFocusGroup(actor))
+ {
+ actor = actor.GetParent();
+ }
+
+ return actor;
+}
+
+void AccessibilityManager::SetGroupMode(bool enabled)
+{
+ mIsFocusWithinGroup = enabled;
+}
+
+bool AccessibilityManager::GetGroupMode() const
+{
+ return mIsFocusWithinGroup;
+}
+
+void AccessibilityManager::SetWrapMode(bool wrapped)
+{
+ mIsWrapped = wrapped;
+}
+
+bool AccessibilityManager::GetWrapMode() const
+{
+ return mIsWrapped;
+}
+
+void AccessibilityManager::SetFocusIndicatorActor(Actor indicator)
+{
+ mFocusIndicatorActor = indicator;
+}
+
+Actor AccessibilityManager::GetFocusIndicatorActor()
+{
+ return mFocusIndicatorActor;
+}
+
+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);
+
+ if( (forward && ++focusIDIter == mFocusIDContainer.end())
+ || (!forward && focusIDIter-- == mFocusIDContainer.begin()) )
+ {
+ if(mIsEndcapFeedbackEnabled)
+ {
+ if(mIsEndcapFeedbackPlayed == false)
+ {
+ // play sound & skip moving once
+ Dali::SoundPlayer soundPlayer = Dali::SoundPlayer::Get();
+ if(soundPlayer)
+ {
+ soundPlayer.PlaySound(FOCUS_CHAIN_END_SOUND_FILE);
+ }
+
+ mIsEndcapFeedbackPlayed = true;
+ return true;
+ }
+ mIsEndcapFeedbackPlayed = false;
+ }
+
+ if(wrapped)
+ {
+ if(forward)
+ {
+ focusIDIter = mFocusIDContainer.begin();
+ }
+ else
+ {
+ focusIDIter = mFocusIDContainer.end();
+ --focusIDIter;//We want forward iterator to the last element here
+ }
+ }
+ else
+ {
+ DALI_LOG_INFO( gLogFilter, Debug::General, "[%s:%d] Overshot\n", __FUNCTION__, __LINE__);
+ // Send notification for handling overshooted situation
+ mFocusOvershotSignal.Emit(GetCurrentFocusActor(), forward ? Toolkit::AccessibilityManager::OVERSHOT_NEXT : Toolkit::AccessibilityManager::OVERSHOT_PREVIOUS);
+
+ return false; // Try to move the focus out of the scope
+ }
+ }
+
+ // 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;
+ }
+ else
+ {
+ return DoMoveFocus(focusIDIter, forward, wrapped);
+ }
+ }
+
+ return true;
+}
+
+void AccessibilityManager::SetFocusable(Actor actor, bool focusable)
+{
+ if(actor)
+ {
+ // Create actor focusable property if not already created.
+ Property::Index propertyActorFocusable = actor.GetPropertyIndex(ACTOR_FOCUSABLE);
+ if(propertyActorFocusable == Property::INVALID_INDEX)
+ {
+ actor.RegisterProperty( ACTOR_FOCUSABLE, focusable, Property::READ_WRITE );
+ }
+ else
+ {
+ actor.SetProperty(propertyActorFocusable, focusable);
+ }
+ }
+}
+
+void AccessibilityManager::CreateDefaultFocusIndicatorActor()
+{
+ // Create a focus indicator actor shared by all the focusable actors
+ Image borderImage = ResourceImage::New(FOCUS_BORDER_IMAGE_PATH);
+
+ ImageActor focusIndicator = ImageActor::New(borderImage);
+ focusIndicator.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION_PLUS_LOCAL_POSITION );
+ focusIndicator.SetStyle( ImageActor::STYLE_NINE_PATCH );
+ focusIndicator.SetNinePatchBorder(FOCUS_BORDER_IMAGE_BORDER);
+ focusIndicator.SetPosition(Vector3(0.0f, 0.0f, 1.0f));
+
+ // Apply size constraint to the focus indicator
+ focusIndicator.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
+
+ SetFocusIndicatorActor(focusIndicator);
+}
+
+bool AccessibilityManager::ChangeAccessibilityStatus()
+{
+ AccessibilityAdaptor adaptor = AccessibilityAdaptor::Get();
+ mIsAccessibilityTtsEnabled = adaptor.IsEnabled();
+ Dali::Toolkit::AccessibilityManager handle( this );
+
+ if(mIsAccessibilityTtsEnabled)
+ {
+ // Show indicator when tts turned on if there is focused actor.
+ Actor actor = GetCurrentFocusActor();
+ if(actor)
+ {
+ if(mFocusIndicatorActor)
+ {
+ actor.Add(mFocusIndicatorActor);
+ }
+ }
+ 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
+ {
+ // Hide indicator when tts turned off
+ Actor actor = GetCurrentFocusActor();
+ if(actor)
+ {
+ 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 AccessibilityManager::AccessibilityActionNext(bool allowEndFeedback)
+{
+ Dali::Toolkit::AccessibilityManager handle( this );
+ if( !mActionNextSignal.Empty() )
+ {
+ mActionNextSignal.Emit( handle );
+ }
+
+ if(mIsAccessibilityTtsEnabled)
+ {
+ mIsEndcapFeedbackEnabled = allowEndFeedback;
+ return MoveFocusForward();
+ }
+ else
+ {
+ return false;
+ }
+}
+
+bool AccessibilityManager::AccessibilityActionPrevious(bool allowEndFeedback)
+{
+ Dali::Toolkit::AccessibilityManager handle( this );
+ if( !mActionPreviousSignal.Empty() )
+ {
+ mActionPreviousSignal.Emit( handle );
+ }
+
+ if(mIsAccessibilityTtsEnabled)
+ {
+ mIsEndcapFeedbackEnabled = allowEndFeedback;
+ return MoveFocusBackward();
+ }
+ else
+ {
+ return false;
+ }
+}
+
+bool AccessibilityManager::AccessibilityActionActivate()
+{
+ Dali::Toolkit::AccessibilityManager handle( this );
+ if( !mActionActivateSignal.Empty() )
+ {
+ mActionActivateSignal.Emit( handle );
+ }
+
+ bool ret = false;
+
+ Actor actor = GetCurrentFocusActor();
+ if(actor)
+ {
+ DoActivate(actor);
+ ret = true;
+ }
+
+ return ret;
+}
+
+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
+ AccessibilityAdaptor adaptor = AccessibilityAdaptor::Get();
+ Dali::HitTestAlgorithm::Results results;
+ Dali::HitTestAlgorithm::HitTest( Stage::GetCurrent(), adaptor.GetReadPosition(), results, IsActorFocusableFunction );
+
+ FocusIDIter focusIDIter = mFocusIDContainer.find(GetFocusOrder(results.actor));
+ if(focusIDIter != mFocusIDContainer.end())
+ {
+ if( allowReadAgain || (results.actor != GetCurrentFocusActor()) )
+ {
+ // Move the focus to the actor
+ ret = SetCurrentFocusActor(results.actor);
+ DALI_LOG_INFO( gLogFilter, Debug::General, "[%s:%d] SetCurrentFocusActor returns %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE");
+ }
+ }
+ }
+
+ return ret;
+}
+
+bool AccessibilityManager::AccessibilityActionReadNext(bool allowEndFeedback)
+{
+ Dali::Toolkit::AccessibilityManager handle( this );
+ if( !mActionReadNextSignal.Empty() )
+ {
+ mActionReadNextSignal.Emit( handle );
+ }
+
+ if(mIsAccessibilityTtsEnabled)
+ {
+ return MoveFocusForward();
+ }
+ else
+ {
+ return false;
+ }
+}
+
+bool AccessibilityManager::AccessibilityActionReadPrevious(bool allowEndFeedback)
+{
+ Dali::Toolkit::AccessibilityManager handle( this );
+ if( !mActionReadPreviousSignal.Empty() )
+ {
+ mActionReadPreviousSignal.Emit( handle );
+ }
+
+ if(mIsAccessibilityTtsEnabled)
+ {
+ return MoveFocusBackward();
+ }
+ else
+ {
+ return false;
+ }
+}
+
+bool AccessibilityManager::AccessibilityActionUp()
+{
+ Dali::Toolkit::AccessibilityManager handle( this );
+ if( !mActionUpSignal.Empty() )
+ {
+ mActionUpSignal.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 that it is activated
+ ret = GetImplementation( control ).OnAccessibilityValueChange(true);
+ }
+ }
+ }
+
+ return ret;
+}
+
+bool AccessibilityManager::AccessibilityActionDown()
+{
+ Dali::Toolkit::AccessibilityManager handle( this );
+ if( !mActionDownSignal.Empty() )
+ {
+ mActionDownSignal.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 that it is activated
+ ret = GetImplementation( control ).OnAccessibilityValueChange(false);
+ }
+ }
+ }
+
+ return ret;
+}
+
+bool AccessibilityManager::ClearAccessibilityFocus()
+{
+ Dali::Toolkit::AccessibilityManager handle( this );
+ if( !mActionClearFocusSignal.Empty() )
+ {
+ mActionClearFocusSignal.Emit( handle );
+ }
+
+ if(mIsAccessibilityTtsEnabled)
+ {
+ ClearFocus();
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+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 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;
+
+ // TODO: Need to convert the touchevent for the focused actor?
+
+ Dali::Toolkit::Control control = Dali::Toolkit::Control::DownCast(GetCurrentFocusActor());
+ if(control)
+ {
+ handled = GetImplementation( control ).OnAccessibilityTouch(touchEvent);
+ }
+
+ return handled;
+}
+
+bool AccessibilityManager::HandlePanGesture(const Integration::PanGestureEvent& panEvent)
+{
+ bool handled = false;
+
+ if( panEvent.state == Gesture::Started )
+ {
+ // Find the focusable actor at the event position
+ Dali::HitTestAlgorithm::Results results;
+ AccessibilityAdaptor adaptor = AccessibilityAdaptor::Get();
+
+ Dali::HitTestAlgorithm::HitTest( Stage::GetCurrent(), panEvent.currentPosition, results, IsActorFocusableFunction );
+ mCurrentGesturedActor = results.actor;
+
+ if(!mCurrentGesturedActor)
+ {
+ DALI_LOG_ERROR("Gesture detected, but no hit actor");
+ }
+ }
+
+ // Gesture::Finished (Up) events are delivered with previous (Motion) event position
+ // Use the real previous position; otherwise we may incorrectly get a ZERO velocity
+ if ( Gesture::Finished != panEvent.state )
+ {
+ // Store the previous position for next Gesture::Finished iteration.
+ mPreviousPosition = panEvent.previousPosition;
+ }
+
+ Actor rootActor = Stage::GetCurrent().GetRootLayer();
+
+ Dali::PanGesture pan(panEvent.state);
+ pan.time = panEvent.time;
+ pan.numberOfTouches = panEvent.numberOfTouches;
+ pan.screenPosition = panEvent.currentPosition;
+ pan.screenDisplacement = mPreviousPosition - panEvent.currentPosition;
+ pan.screenVelocity.x = pan.screenDisplacement.x / panEvent.timeDelta;
+ pan.screenVelocity.y = pan.screenDisplacement.y / panEvent.timeDelta;
+
+ // Only handle the pan gesture when the current focused actor is scrollable or within a scrollable actor
+ while(mCurrentGesturedActor && mCurrentGesturedActor != rootActor && !handled)
+ {
+ Dali::Toolkit::Control control = Dali::Toolkit::Control::DownCast(mCurrentGesturedActor);
+ if(control)
+ {
+ Vector2 localCurrent;
+ control.ScreenToLocal( localCurrent.x, localCurrent.y, panEvent.currentPosition.x, panEvent.currentPosition.y );
+ pan.position = localCurrent;
+
+ Vector2 localPrevious;
+ control.ScreenToLocal( localPrevious.x, localPrevious.y, mPreviousPosition.x, mPreviousPosition.y );
+
+ pan.displacement = localCurrent - localPrevious;
+ pan.velocity.x = pan.displacement.x / panEvent.timeDelta;
+ pan.velocity.y = pan.displacement.y / panEvent.timeDelta;
+
+ handled = GetImplementation( control ).OnAccessibilityPan(pan);
+ }
+
+ // If the gesture is not handled by the control, check its parent
+ if(!handled)
+ {
+ mCurrentGesturedActor = mCurrentGesturedActor.GetParent();
+
+ if(!mCurrentGesturedActor)
+ {
+ DALI_LOG_ERROR("no more gestured actor");
+ }
+ }
+ else
+ {
+ // If handled, then update the pan gesture properties
+ PanGestureDetector::SetPanGestureProperties( pan );
+ }
+ }
+
+ return handled;
+}
+
+Toolkit::AccessibilityManager::FocusChangedSignalType& AccessibilityManager::FocusChangedSignal()
+{
+ return mFocusChangedSignal;
+}
+
+Toolkit::AccessibilityManager::FocusOvershotSignalType& AccessibilityManager::FocusOvershotSignal()
+{
+ return mFocusOvershotSignal;
+}
+
+Toolkit::AccessibilityManager::FocusedActorActivatedSignalType& AccessibilityManager::FocusedActorActivatedSignal()
+{
+ return mFocusedActorActivatedSignal;
+}
+
+bool AccessibilityManager::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
+{
+ Dali::BaseHandle handle( object );
+
+ bool connected( true );
+ AccessibilityManager* manager = dynamic_cast<AccessibilityManager*>( object );
+
+ if( 0 == strcmp( signalName.c_str(), SIGNAL_FOCUS_CHANGED ) )
+ {
+ manager->FocusChangedSignal().Connect( tracker, functor );
+ }
+ else if( 0 == strcmp( signalName.c_str(), SIGNAL_FOCUS_OVERSHOT ) )
+ {
+ manager->FocusOvershotSignal().Connect( tracker, functor );
+ }
+ else if( 0 == strcmp( signalName.c_str(), SIGNAL_FOCUSED_ACTOR_ACTIVATED ) )
+ {
+ manager->FocusedActorActivatedSignal().Connect( tracker, functor );
+ }
+ else
+ {
+ // signalName does not match any signal
+ connected = false;
+ }
+
+ return connected;
+}
+
+} // namespace Internal
+
+} // namespace Toolkit
+
+} // namespace Dali
--- /dev/null
+#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 <string>
+#include <dali/devel-api/common/map-wrapper.h>
+#include <dali/devel-api/adaptor-framework/accessibility-action-handler.h>
+#include <dali/devel-api/adaptor-framework/accessibility-gesture-handler.h>
+#include <dali/public-api/object/base-object.h>
+#include <dali/integration-api/events/pan-gesture-event.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/accessibility-manager/accessibility-manager.h>
+#include <dali/public-api/adaptor-framework/tts-player.h>
+
+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<unsigned int, unsigned int> FocusIDPair;
+ typedef std::map<unsigned int, unsigned int> FocusIDContainer;
+ typedef FocusIDContainer::iterator FocusIDIter;
+ typedef FocusIDContainer::const_iterator FocusIDConstIter;
+
+ typedef std::pair<unsigned int, ActorAdditionalInfo> IDAdditionalInfoPair;
+ typedef std::map<unsigned int, ActorAdditionalInfo> 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<Internal::AccessibilityManager&>(handle);
+}
+
+inline const Internal::AccessibilityManager& GetImpl(const Dali::Toolkit::AccessibilityManager& obj)
+{
+ DALI_ASSERT_ALWAYS(obj);
+
+ const Dali::BaseObject& handle = obj.GetBaseObject();
+
+ return static_cast<const Internal::AccessibilityManager&>(handle);
+}
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_INTERNAL_ACCESSIBILITY_MANAGER_H__
#include <dali-toolkit/public-api/controls/buttons/button.h>
#include <dali-toolkit/public-api/controls/control-impl.h>
#include <dali-toolkit/public-api/controls/default-controls/solid-color-actor.h>
-#include <dali-toolkit/public-api/focus-manager/accessibility-focus-manager.h>
+#include <dali-toolkit/public-api/accessibility-manager/accessibility-manager.h>
#include <dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.h>
#include <dali-toolkit/internal/controls/buttons/button-impl.h>
$(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 \
+++ /dev/null
-/*
- * 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 "accessibility-focus-manager-impl.h"
-
-// EXTERNAL INCLUDES
-#include <cstring> // for strcmp
-#include <dali/public-api/actors/layer.h>
-#include <dali/devel-api/adaptor-framework/accessibility-manager.h>
-#include <dali/devel-api/adaptor-framework/sound-player.h>
-#include <dali/public-api/adaptor-framework/tts-player.h>
-#include <dali/public-api/animation/constraints.h>
-#include <dali/devel-api/events/hit-test-algorithm.h>
-#include <dali/public-api/images/resource-image.h>
-#include <dali/integration-api/debug.h>
-
-// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/controls/control.h>
-#include <dali-toolkit/public-api/controls/control-impl.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace Internal
-{
-
-namespace // unnamed namespace
-{
-
-// Signals
-
-const char* const SIGNAL_FOCUS_CHANGED = "focus-changed";
-const char* const SIGNAL_FOCUS_OVERSHOT = "focus-overshot";
-const char* const SIGNAL_FOCUSED_ACTOR_ACTIVATED = "focused-actor-activated";
-
-#if defined(DEBUG_ENABLED)
-Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_FOCUS_MANAGER");
-#endif
-
-const char* const ACTOR_FOCUSABLE("focusable");
-const char* const IS_FOCUS_GROUP("is-focus-group");
-
-const char* FOCUS_BORDER_IMAGE_PATH = DALI_IMAGE_DIR "B16-8_TTS_focus.png";
-const Vector4 FOCUS_BORDER_IMAGE_BORDER = Vector4(7.0f, 7.0f, 7.0f, 7.0f);
-
-const char* FOCUS_SOUND_FILE = DALI_SOUND_DIR "Focus.ogg";
-const char* FOCUS_CHAIN_END_SOUND_FILE = DALI_SOUND_DIR "End_of_List.ogg";
-
-/**
- * The function to be used in the hit-test algorithm to check whether the actor is hittable.
- */
-bool IsActorFocusableFunction(Actor actor, Dali::HitTestAlgorithm::TraverseType type)
-{
- bool hittable = false;
-
- switch (type)
- {
- case Dali::HitTestAlgorithm::CHECK_ACTOR:
- {
- // Check whether the actor is visible and not fully transparent.
- if( actor.IsVisible()
- && actor.GetCurrentWorldColor().a > 0.01f) // not FULLY_TRANSPARENT
- {
- // Check whether the actor is focusable
- Property::Index propertyActorFocusable = actor.GetPropertyIndex(ACTOR_FOCUSABLE);
- if(propertyActorFocusable != Property::INVALID_INDEX)
- {
- hittable = actor.GetProperty<bool>(propertyActorFocusable);
- }
- }
- break;
- }
- case Dali::HitTestAlgorithm::DESCEND_ACTOR_TREE:
- {
- if( actor.IsVisible() ) // Actor is visible, if not visible then none of its children are visible.
- {
- hittable = true;
- }
- break;
- }
- default:
- {
- break;
- }
- }
-
- return hittable;
-};
-
-}
-
-AccessibilityFocusManager::AccessibilityFocusManager()
-: mIsWrapped(false),
- mIsFocusWithinGroup(false),
- mIsEndcapFeedbackEnabled(false),
- mIsEndcapFeedbackPlayed(false),
- mCurrentFocusActor(FocusIDPair(0, 0)),
- mFocusIndicatorActor(Actor()),
- mRecursiveFocusMoveCounter(0),
- mIsAccessibilityTtsEnabled(false),
- mIsFocusIndicatorEnabled(false)
-{
- CreateDefaultFocusIndicatorActor();
-
- AccessibilityManager manager = AccessibilityManager::Get();
- manager.SetActionHandler(*this);
- manager.SetGestureHandler(*this);
-
- ChangeAccessibilityStatus();
-}
-
-AccessibilityFocusManager::~AccessibilityFocusManager()
-{
-}
-
-AccessibilityFocusManager::ActorAdditionalInfo AccessibilityFocusManager::GetActorAdditionalInfo(const unsigned int actorID) const
-{
- ActorAdditionalInfo data;
- IDAdditionalInfoConstIter iter = mIDAdditionalInfoContainer.find(actorID);
- if(iter != mIDAdditionalInfoContainer.end())
- {
- data = (*iter).second;
- }
-
- return data;
-}
-
-void AccessibilityFocusManager::SynchronizeActorAdditionalInfo(const unsigned int actorID, const unsigned int order)
-{
- ActorAdditionalInfo actorInfo = GetActorAdditionalInfo(actorID);
- actorInfo.mFocusOrder = order;
- mIDAdditionalInfoContainer.erase(actorID);
- mIDAdditionalInfoContainer.insert(IDAdditionalInfoPair(actorID, actorInfo));
-}
-
-void AccessibilityFocusManager::SetAccessibilityAttribute(Actor actor, Toolkit::AccessibilityFocusManager::AccessibilityAttribute type, const std::string& text)
-{
- if(actor)
- {
- unsigned int actorID = actor.GetId();
-
- ActorAdditionalInfo info = GetActorAdditionalInfo(actorID);
- info.mAccessibilityAttributes[type] = text;
-
- mIDAdditionalInfoContainer.erase(actorID);
- mIDAdditionalInfoContainer.insert(IDAdditionalInfoPair(actorID, info));
- }
-}
-
-std::string AccessibilityFocusManager::GetAccessibilityAttribute(Actor actor, Toolkit::AccessibilityFocusManager::AccessibilityAttribute type) const
-{
- std::string text;
-
- if(actor)
- {
- ActorAdditionalInfo data = GetActorAdditionalInfo(actor.GetId());
- text = data.mAccessibilityAttributes[type];
- }
-
- return text;
-}
-
-void AccessibilityFocusManager::SetFocusOrder(Actor actor, const unsigned int order)
-{
- // Do nothing if the focus order of the actor is not changed.
- if(actor && GetFocusOrder(actor) != order)
- {
- // Firstly delete the actor from the focus chain if it's already there with a different focus order.
- mFocusIDContainer.erase(GetFocusOrder(actor));
-
- // Create actor focusable property if not already created.
- Property::Index propertyActorFocusable = actor.GetPropertyIndex(ACTOR_FOCUSABLE);
- if(propertyActorFocusable == Property::INVALID_INDEX)
- {
- propertyActorFocusable = actor.RegisterProperty( ACTOR_FOCUSABLE, true, Property::READ_WRITE );
- }
-
- if(order == 0)
- {
- // The actor is not focusable without a defined focus order.
- actor.SetProperty(propertyActorFocusable, false);
-
- // If the actor is currently being focused, it should clear the focus
- if(actor == GetCurrentFocusActor())
- {
- ClearFocus();
- }
- }
- else // Insert the actor to the focus chain
- {
- // Check whether there is another actor in the focus chain with the same focus order already.
- FocusIDIter focusIDIter = mFocusIDContainer.find(order);
- if(focusIDIter != mFocusIDContainer.end())
- {
- // We need to increase the focus order of that actor and all the actors followed it
- // in the focus chain.
- FocusIDIter lastIter = mFocusIDContainer.end();
- --lastIter;//We want forward iterator to the last element here
- mFocusIDContainer.insert(FocusIDPair((*lastIter).first + 1, (*lastIter).second));
-
- // Update the actor's focus order in its additional data
- SynchronizeActorAdditionalInfo((*lastIter).second, (*lastIter).first + 1);
-
- for(FocusIDIter iter = lastIter; iter != focusIDIter; iter--)
- {
- FocusIDIter previousIter = iter;
- --previousIter;//We want forward iterator to the previous element here
- unsigned int actorID = (*previousIter).second;
- (*iter).second = actorID;
-
- // Update the actor's focus order in its additional data
- SynchronizeActorAdditionalInfo(actorID, (*iter).first);
- }
-
- mFocusIDContainer.erase(order);
- }
-
- // The actor is focusable
- actor.SetProperty(propertyActorFocusable, true);
-
- // Now we insert the actor into the focus chain with the specified focus order
- mFocusIDContainer.insert(FocusIDPair(order, actor.GetId()));
- }
-
- // Update the actor's focus order in its additional data
- SynchronizeActorAdditionalInfo(actor.GetId(), order);
- }
-}
-
-unsigned int AccessibilityFocusManager::GetFocusOrder(Actor actor) const
-{
- unsigned int focusOrder = 0;
-
- if(actor)
- {
- ActorAdditionalInfo data = GetActorAdditionalInfo(actor.GetId());
- focusOrder = data.mFocusOrder;
- }
-
- return focusOrder;
-}
-
-unsigned int AccessibilityFocusManager::GenerateNewFocusOrder() const
-{
- unsigned int order = 1;
- FocusIDContainer::const_reverse_iterator iter = mFocusIDContainer.rbegin();
-
- if(iter != mFocusIDContainer.rend())
- {
- order = (*iter).first + 1;
- }
-
- return order;
-}
-
-Actor AccessibilityFocusManager::GetActorByFocusOrder(const unsigned int order)
-{
- Actor actor = Actor();
-
- FocusIDIter focusIDIter = mFocusIDContainer.find(order);
- if(focusIDIter != mFocusIDContainer.end())
- {
- Actor rootActor = Stage::GetCurrent().GetRootLayer();
- actor = rootActor.FindChildById(mFocusIDContainer[order]);
- }
-
- return actor;
-}
-
-bool AccessibilityFocusManager::SetCurrentFocusActor(Actor actor)
-{
- if(actor)
- {
- return DoSetCurrentFocusActor(actor.GetId());
- }
-
- return false;
-}
-
-bool AccessibilityFocusManager::DoSetCurrentFocusActor(const unsigned int actorID)
-{
- Actor rootActor = Stage::GetCurrent().GetRootLayer();
-
- // If the group mode is enabled, check which focus group the current focused actor belongs to
- Actor focusGroup;
- if(mIsFocusWithinGroup)
- {
- focusGroup = GetFocusGroup(GetCurrentFocusActor());
- }
-
- if(!focusGroup)
- {
- focusGroup = rootActor;
- }
-
- Actor actor = focusGroup.FindChildById(actorID);
-
- // Check whether the actor is in the stage
- if(actor)
- {
- // Check whether the actor is focusable
- bool actorFocusable = false;
- Property::Index propertyActorFocusable = actor.GetPropertyIndex(ACTOR_FOCUSABLE);
- if(propertyActorFocusable != Property::INVALID_INDEX)
- {
- actorFocusable = actor.GetProperty<bool>(propertyActorFocusable);
- }
-
- // Go through the actor's hierarchy to check whether the actor is visible
- bool actorVisible = actor.IsVisible();
- Actor parent = actor.GetParent();
- while (actorVisible && parent && parent != rootActor)
- {
- actorVisible = parent.IsVisible();
- parent = parent.GetParent();
- }
-
- // Check whether the actor is fully transparent
- bool actorOpaque = actor.GetCurrentWorldColor().a > 0.01f;
-
- // Set the focus only when the actor is focusable and visible and not fully transparent
- if(actorVisible && actorFocusable && actorOpaque)
- {
- // Draw the focus indicator upon the focused actor
- if(mIsFocusIndicatorEnabled && mFocusIndicatorActor)
- {
- actor.Add(mFocusIndicatorActor);
- }
-
- // Send notification for the change of focus actor
- mFocusChangedSignal.Emit( GetCurrentFocusActor(), actor );
-
- // Save the current focused actor
- mCurrentFocusActor = FocusIDPair(GetFocusOrder(actor), actorID);
-
- if(mIsAccessibilityTtsEnabled)
- {
- Dali::SoundPlayer soundPlayer = Dali::SoundPlayer::Get();
- if(soundPlayer)
- {
- soundPlayer.PlaySound(FOCUS_SOUND_FILE);
- }
-
- // Play the accessibility attributes with the TTS player.
- Dali::TtsPlayer player = Dali::TtsPlayer::Get(Dali::TtsPlayer::SCREEN_READER);
-
- // Combine attribute texts to one text
- std::string informationText;
- for(int i = 0; i < Toolkit::AccessibilityFocusManager::ACCESSIBILITY_ATTRIBUTE_NUM; i++)
- {
- if(!GetActorAdditionalInfo(actorID).mAccessibilityAttributes[i].empty())
- {
- if( i > 0 )
- {
- informationText += ", "; // for space time between each information
- }
- informationText += GetActorAdditionalInfo(actorID).mAccessibilityAttributes[i];
- }
- }
- player.Play(informationText);
- }
-
- return true;
- }
- }
-
- DALI_LOG_WARNING("[%s:%d] FAILED\n", __FUNCTION__, __LINE__);
- return false;
-}
-
-Actor AccessibilityFocusManager::GetCurrentFocusActor()
-{
- Actor rootActor = Stage::GetCurrent().GetRootLayer();
- return rootActor.FindChildById(mCurrentFocusActor.second);
-}
-
-Actor AccessibilityFocusManager::GetCurrentFocusGroup()
-{
- return GetFocusGroup(GetCurrentFocusActor());
-}
-
-unsigned int AccessibilityFocusManager::GetCurrentFocusOrder()
-{
- return mCurrentFocusActor.first;
-}
-
-bool AccessibilityFocusManager::MoveFocusForward()
-{
- bool ret = false;
- mRecursiveFocusMoveCounter = 0;
-
- FocusIDIter focusIDIter = mFocusIDContainer.find(mCurrentFocusActor.first);
- if(focusIDIter != mFocusIDContainer.end())
- {
- DALI_LOG_INFO( gLogFilter, Debug::General, "[%s:%d] focus order : %d\n", __FUNCTION__, __LINE__, (*focusIDIter).first);
- ret = DoMoveFocus(focusIDIter, true, mIsWrapped);
- }
- else
- {
- // TODO: if there is not focused actor, move first actor
- if(!mFocusIDContainer.empty())
- {
- //if there is not focused actor, move 1st actor
- focusIDIter = mFocusIDContainer.begin(); // TODO: I'm not sure it was sorted.
- DALI_LOG_INFO( gLogFilter, Debug::General, "[%s:%d] focus order : %d\n", __FUNCTION__, __LINE__, (*focusIDIter).first);
- ret = DoSetCurrentFocusActor((*focusIDIter).second);
- }
- }
-
- DALI_LOG_INFO( gLogFilter, Debug::General, "[%s] %s\n", __FUNCTION__, ret?"SUCCEED!!!":"FAILED!!!");
-
- return ret;
-}
-
-bool AccessibilityFocusManager::MoveFocusBackward()
-{
- bool ret = false;
- mRecursiveFocusMoveCounter = 0;
-
- FocusIDIter focusIDIter = mFocusIDContainer.find(mCurrentFocusActor.first);
- if(focusIDIter != mFocusIDContainer.end())
- {
- DALI_LOG_INFO( gLogFilter, Debug::General, "[%s:%d] focus order : %d\n", __FUNCTION__, __LINE__, (*focusIDIter).first);
- ret = DoMoveFocus(focusIDIter, false, mIsWrapped);
- }
- else
- {
- // TODO: if there is not focused actor, move last actor
- if(!mFocusIDContainer.empty())
- {
- //if there is not focused actor, move last actor
- focusIDIter = mFocusIDContainer.end();
- --focusIDIter;//We want forward iterator to the last element here
- DALI_LOG_INFO( gLogFilter, Debug::General, "[%s:%d] focus order : %d\n", __FUNCTION__, __LINE__, (*focusIDIter).first);
- ret = DoSetCurrentFocusActor((*focusIDIter).second);
- }
- }
-
- DALI_LOG_INFO( gLogFilter, Debug::General, "[%s] %s\n", __FUNCTION__, ret?"SUCCEED!!!":"FAILED!!!");
-
- return ret;
-}
-
-void AccessibilityFocusManager::DoActivate(Actor actor)
-{
- if(actor)
- {
- Dali::Toolkit::Control control = Dali::Toolkit::Control::DownCast(actor);
- if(control)
- {
- // Notify the control that it is activated
- GetImplementation( control ).AccessibilityActivate();
- }
-
- // Send notification for the activation of focused actor
- mFocusedActorActivatedSignal.Emit(actor);
- }
-}
-
-void AccessibilityFocusManager::ClearFocus()
-{
- Actor actor = GetCurrentFocusActor();
- if(actor)
- {
- actor.Remove(mFocusIndicatorActor);
- }
-
- mCurrentFocusActor = FocusIDPair(0, 0);
-
- // Send notification for the change of focus actor
- mFocusChangedSignal.Emit(actor, Actor());
-
- if(mIsAccessibilityTtsEnabled)
- {
- // Stop the TTS playing if any
- Dali::TtsPlayer player = Dali::TtsPlayer::Get(Dali::TtsPlayer::SCREEN_READER);
- player.Stop();
- }
-}
-
-void AccessibilityFocusManager::Reset()
-{
- ClearFocus();
- mFocusIDContainer.clear();
- mIDAdditionalInfoContainer.clear();
-}
-
-void AccessibilityFocusManager::SetFocusGroup(Actor actor, bool isFocusGroup)
-{
- if(actor)
- {
- // Create focus group property if not already created.
- Property::Index propertyIsFocusGroup = actor.GetPropertyIndex(IS_FOCUS_GROUP);
- if(propertyIsFocusGroup == Property::INVALID_INDEX)
- {
- actor.RegisterProperty( IS_FOCUS_GROUP, isFocusGroup, Property::READ_WRITE );
- }
- else
- {
- actor.SetProperty(propertyIsFocusGroup, isFocusGroup);
- }
- }
-}
-
-bool AccessibilityFocusManager::IsFocusGroup(Actor actor) const
-{
- // Check whether the actor is a focus group
- bool isFocusGroup = false;
-
- if(actor)
- {
- Property::Index propertyIsFocusGroup = actor.GetPropertyIndex(IS_FOCUS_GROUP);
- if(propertyIsFocusGroup != Property::INVALID_INDEX)
- {
- isFocusGroup = actor.GetProperty<bool>(propertyIsFocusGroup);
- }
- }
-
- return isFocusGroup;
-}
-
-Actor AccessibilityFocusManager::GetFocusGroup(Actor actor)
-{
- // Go through the actor's hierarchy to check which focus group the actor belongs to
- while (actor && !IsFocusGroup(actor))
- {
- actor = actor.GetParent();
- }
-
- return actor;
-}
-
-void AccessibilityFocusManager::SetGroupMode(bool enabled)
-{
- mIsFocusWithinGroup = enabled;
-}
-
-bool AccessibilityFocusManager::GetGroupMode() const
-{
- return mIsFocusWithinGroup;
-}
-
-void AccessibilityFocusManager::SetWrapMode(bool wrapped)
-{
- mIsWrapped = wrapped;
-}
-
-bool AccessibilityFocusManager::GetWrapMode() const
-{
- return mIsWrapped;
-}
-
-void AccessibilityFocusManager::SetFocusIndicatorActor(Actor indicator)
-{
- mFocusIndicatorActor = indicator;
-}
-
-Actor AccessibilityFocusManager::GetFocusIndicatorActor()
-{
- return mFocusIndicatorActor;
-}
-
-bool AccessibilityFocusManager::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);
-
- if( (forward && ++focusIDIter == mFocusIDContainer.end())
- || (!forward && focusIDIter-- == mFocusIDContainer.begin()) )
- {
- if(mIsEndcapFeedbackEnabled)
- {
- if(mIsEndcapFeedbackPlayed == false)
- {
- // play sound & skip moving once
- Dali::SoundPlayer soundPlayer = Dali::SoundPlayer::Get();
- if(soundPlayer)
- {
- soundPlayer.PlaySound(FOCUS_CHAIN_END_SOUND_FILE);
- }
-
- mIsEndcapFeedbackPlayed = true;
- return true;
- }
- mIsEndcapFeedbackPlayed = false;
- }
-
- if(wrapped)
- {
- if(forward)
- {
- focusIDIter = mFocusIDContainer.begin();
- }
- else
- {
- focusIDIter = mFocusIDContainer.end();
- --focusIDIter;//We want forward iterator to the last element here
- }
- }
- else
- {
- 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);
-
- return false; // Try to move the focus out of the scope
- }
- }
-
- if((focusIDIter != mFocusIDContainer.end()) && !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;
- }
- else
- {
- return DoMoveFocus(focusIDIter, forward, wrapped);
- }
- }
-
- return true;
-}
-
-void AccessibilityFocusManager::SetFocusable(Actor actor, bool focusable)
-{
- if(actor)
- {
- // Create actor focusable property if not already created.
- Property::Index propertyActorFocusable = actor.GetPropertyIndex(ACTOR_FOCUSABLE);
- if(propertyActorFocusable == Property::INVALID_INDEX)
- {
- actor.RegisterProperty( ACTOR_FOCUSABLE, focusable, Property::READ_WRITE );
- }
- else
- {
- actor.SetProperty(propertyActorFocusable, focusable);
- }
- }
-}
-
-void AccessibilityFocusManager::CreateDefaultFocusIndicatorActor()
-{
- // Create a focus indicator actor shared by all the focusable actors
- Image borderImage = ResourceImage::New(FOCUS_BORDER_IMAGE_PATH);
-
- ImageActor focusIndicator = ImageActor::New(borderImage);
- focusIndicator.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION_PLUS_LOCAL_POSITION );
- focusIndicator.SetStyle( ImageActor::STYLE_NINE_PATCH );
- focusIndicator.SetNinePatchBorder(FOCUS_BORDER_IMAGE_BORDER);
- focusIndicator.SetPosition(Vector3(0.0f, 0.0f, 1.0f));
-
- // Apply size constraint to the focus indicator
- focusIndicator.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
-
- SetFocusIndicatorActor(focusIndicator);
-}
-
-bool AccessibilityFocusManager::ChangeAccessibilityStatus()
-{
- AccessibilityManager manager = AccessibilityManager::Get();
- mIsAccessibilityTtsEnabled = manager.IsEnabled();
-
- if(mIsAccessibilityTtsEnabled)
- {
- // Show indicator when tts turned on if there is focused actor.
- Actor actor = GetCurrentFocusActor();
- if(actor)
- {
- if(mFocusIndicatorActor)
- {
- actor.Add(mFocusIndicatorActor);
- }
- }
- mIsFocusIndicatorEnabled = true;
- }
- else
- {
- // Hide indicator when tts turned off
- Actor actor = GetCurrentFocusActor();
- if(actor)
- {
- actor.Remove(mFocusIndicatorActor);
- }
- mIsFocusIndicatorEnabled = false;
- }
-
- return true;
-}
-
-bool AccessibilityFocusManager::AccessibilityActionNext(bool allowEndFeedback)
-{
- if(mIsAccessibilityTtsEnabled)
- {
- mIsEndcapFeedbackEnabled = allowEndFeedback;
- return MoveFocusForward();
- }
- else
- {
- return false;
- }
-}
-
-bool AccessibilityFocusManager::AccessibilityActionPrevious(bool allowEndFeedback)
-{
- if(mIsAccessibilityTtsEnabled)
- {
- mIsEndcapFeedbackEnabled = allowEndFeedback;
- return MoveFocusBackward();
- }
- else
- {
- return false;
- }
-}
-
-bool AccessibilityFocusManager::AccessibilityActionActivate()
-{
- bool ret = false;
-
- Actor actor = GetCurrentFocusActor();
- if(actor)
- {
- DoActivate(actor);
- ret = true;
- }
-
- return ret;
-}
-
-bool AccessibilityFocusManager::AccessibilityActionRead(bool allowReadAgain)
-{
- bool ret = false;
-
- if(mIsAccessibilityTtsEnabled)
- {
- // Find the focusable actor at the read position
- AccessibilityManager manager = AccessibilityManager::Get();
- Dali::HitTestAlgorithm::Results results;
- Dali::HitTestAlgorithm::HitTest( Stage::GetCurrent(), manager.GetReadPosition(), results, IsActorFocusableFunction );
-
- FocusIDIter focusIDIter = mFocusIDContainer.find(GetFocusOrder(results.actor));
- if(focusIDIter != mFocusIDContainer.end())
- {
- if( allowReadAgain || (results.actor != GetCurrentFocusActor()) )
- {
- // Move the focus to the actor
- ret = SetCurrentFocusActor(results.actor);
- DALI_LOG_INFO( gLogFilter, Debug::General, "[%s:%d] SetCurrentFocusActor returns %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE");
- }
- }
- }
-
- return ret;
-}
-
-bool AccessibilityFocusManager::AccessibilityActionReadNext(bool allowEndFeedback)
-{
- if(mIsAccessibilityTtsEnabled)
- {
- return MoveFocusForward();
- }
- else
- {
- return false;
- }
-}
-
-bool AccessibilityFocusManager::AccessibilityActionReadPrevious(bool allowEndFeedback)
-{
- if(mIsAccessibilityTtsEnabled)
- {
- return MoveFocusBackward();
- }
- else
- {
- return false;
- }
-}
-
-bool AccessibilityFocusManager::AccessibilityActionUp()
-{
- bool ret = false;
-
- if(mIsAccessibilityTtsEnabled)
- {
- Actor actor = GetCurrentFocusActor();
- if(actor)
- {
- Dali::Toolkit::Control control = Dali::Toolkit::Control::DownCast(actor);
- if(control)
- {
- // Notify the control that it is activated
- ret = GetImplementation( control ).OnAccessibilityValueChange(true);
- }
- }
- }
-
- return ret;
-}
-
-bool AccessibilityFocusManager::AccessibilityActionDown()
-{
- bool ret = false;
-
- if(mIsAccessibilityTtsEnabled)
- {
- Actor actor = GetCurrentFocusActor();
- if(actor)
- {
- Dali::Toolkit::Control control = Dali::Toolkit::Control::DownCast(actor);
- if(control)
- {
- // Notify the control that it is activated
- ret = GetImplementation( control ).OnAccessibilityValueChange(false);
- }
- }
- }
-
- return ret;
-}
-
-bool AccessibilityFocusManager::ClearAccessibilityFocus()
-{
- if(mIsAccessibilityTtsEnabled)
- {
- ClearFocus();
- return true;
- }
- else
- {
- return false;
- }
-}
-
-bool AccessibilityFocusManager::AccessibilityActionBack()
-{
- // TODO: Back to previous view
-
- return mIsAccessibilityTtsEnabled;
-}
-
-bool AccessibilityFocusManager::AccessibilityActionTouch(const TouchEvent& touchEvent)
-{
- bool handled = false;
-
- // TODO: Need to convert the touchevent for the focused actor?
-
- Dali::Toolkit::Control control = Dali::Toolkit::Control::DownCast(GetCurrentFocusActor());
- if(control)
- {
- handled = GetImplementation( control ).OnAccessibilityTouch(touchEvent);
- }
-
- return handled;
-}
-
-bool AccessibilityFocusManager::HandlePanGesture(const Integration::PanGestureEvent& panEvent)
-{
- bool handled = false;
-
- if( panEvent.state == Gesture::Started )
- {
- // Find the focusable actor at the event position
- Dali::HitTestAlgorithm::Results results;
- AccessibilityManager manager = AccessibilityManager::Get();
-
- Dali::HitTestAlgorithm::HitTest( Stage::GetCurrent(), panEvent.currentPosition, results, IsActorFocusableFunction );
- mCurrentGesturedActor = results.actor;
-
- if(!mCurrentGesturedActor)
- {
- DALI_LOG_ERROR("Gesture detected, but no hit actor");
- }
- }
-
- // Gesture::Finished (Up) events are delivered with previous (Motion) event position
- // Use the real previous position; otherwise we may incorrectly get a ZERO velocity
- if ( Gesture::Finished != panEvent.state )
- {
- // Store the previous position for next Gesture::Finished iteration.
- mPreviousPosition = panEvent.previousPosition;
- }
-
- Actor rootActor = Stage::GetCurrent().GetRootLayer();
-
- Dali::PanGesture pan(panEvent.state);
- pan.time = panEvent.time;
- pan.numberOfTouches = panEvent.numberOfTouches;
- pan.screenPosition = panEvent.currentPosition;
- pan.screenDisplacement = mPreviousPosition - panEvent.currentPosition;
- pan.screenVelocity.x = pan.screenDisplacement.x / panEvent.timeDelta;
- pan.screenVelocity.y = pan.screenDisplacement.y / panEvent.timeDelta;
-
- // Only handle the pan gesture when the current focused actor is scrollable or within a scrollable actor
- while(mCurrentGesturedActor && mCurrentGesturedActor != rootActor && !handled)
- {
- Dali::Toolkit::Control control = Dali::Toolkit::Control::DownCast(mCurrentGesturedActor);
- if(control)
- {
- Vector2 localCurrent;
- control.ScreenToLocal( localCurrent.x, localCurrent.y, panEvent.currentPosition.x, panEvent.currentPosition.y );
- pan.position = localCurrent;
-
- Vector2 localPrevious;
- control.ScreenToLocal( localPrevious.x, localPrevious.y, mPreviousPosition.x, mPreviousPosition.y );
-
- pan.displacement = localCurrent - localPrevious;
- pan.velocity.x = pan.displacement.x / panEvent.timeDelta;
- pan.velocity.y = pan.displacement.y / panEvent.timeDelta;
-
- handled = GetImplementation( control ).OnAccessibilityPan(pan);
- }
-
- // If the gesture is not handled by the control, check its parent
- if(!handled)
- {
- mCurrentGesturedActor = mCurrentGesturedActor.GetParent();
-
- if(!mCurrentGesturedActor)
- {
- DALI_LOG_ERROR("no more gestured actor");
- }
- }
- else
- {
- // If handled, then update the pan gesture properties
- PanGestureDetector::SetPanGestureProperties( pan );
- }
- }
-
- return handled;
-}
-
-Toolkit::AccessibilityFocusManager::FocusChangedSignalType& AccessibilityFocusManager::FocusChangedSignal()
-{
- return mFocusChangedSignal;
-}
-
-Toolkit::AccessibilityFocusManager::FocusOvershotSignalType& AccessibilityFocusManager::FocusOvershotSignal()
-{
- return mFocusOvershotSignal;
-}
-
-Toolkit::AccessibilityFocusManager::FocusedActorActivatedSignalType& AccessibilityFocusManager::FocusedActorActivatedSignal()
-{
- return mFocusedActorActivatedSignal;
-}
-
-bool AccessibilityFocusManager::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
-{
- Dali::BaseHandle handle( object );
-
- bool connected( true );
- AccessibilityFocusManager* manager = dynamic_cast<AccessibilityFocusManager*>( object );
-
- if( 0 == strcmp( signalName.c_str(), SIGNAL_FOCUS_CHANGED ) )
- {
- manager->FocusChangedSignal().Connect( tracker, functor );
- }
- else if( 0 == strcmp( signalName.c_str(), SIGNAL_FOCUS_OVERSHOT ) )
- {
- manager->FocusOvershotSignal().Connect( tracker, functor );
- }
- else if( 0 == strcmp( signalName.c_str(), SIGNAL_FOCUSED_ACTOR_ACTIVATED ) )
- {
- manager->FocusedActorActivatedSignal().Connect( tracker, functor );
- }
- else
- {
- // signalName does not match any signal
- connected = false;
- }
-
- return connected;
-}
-
-} // namespace Internal
-
-} // namespace Toolkit
-
-} // namespace Dali
+++ /dev/null
-#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 <string>
-#include <dali/devel-api/common/map-wrapper.h>
-#include <dali/devel-api/adaptor-framework/accessibility-action-handler.h>
-#include <dali/devel-api/adaptor-framework/accessibility-gesture-handler.h>
-#include <dali/public-api/object/base-object.h>
-#include <dali/integration-api/events/pan-gesture-event.h>
-
-// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/focus-manager/accessibility-focus-manager.h>
-
-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<unsigned int, unsigned int> FocusIDPair;
- typedef std::map<unsigned int, unsigned int> FocusIDContainer;
- typedef FocusIDContainer::iterator FocusIDIter;
- typedef FocusIDContainer::const_iterator FocusIDConstIter;
-
- typedef std::pair<unsigned int, ActorAdditionalInfo> IDAdditionalInfoPair;
- typedef std::map<unsigned int, ActorAdditionalInfo> 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<Internal::AccessibilityFocusManager&>(handle);
-}
-
-inline const Internal::AccessibilityFocusManager& GetImpl(const Dali::Toolkit::AccessibilityFocusManager& obj)
-{
- DALI_ASSERT_ALWAYS(obj);
-
- const Dali::BaseObject& handle = obj.GetBaseObject();
-
- return static_cast<const Internal::AccessibilityFocusManager&>(handle);
-}
-
-} // namespace Toolkit
-
-} // namespace Dali
-
-#endif // __DALI_TOOLKIT_INTERNAL_ACCESSIBILITY_FOCUS_MANAGER_H__
// EXTERNAL INCLUDES
#include <cstring> // for strcmp
#include <dali/public-api/actors/layer.h>
-#include <dali/devel-api/adaptor-framework/accessibility-manager.h>
+#include <dali/devel-api/adaptor-framework/accessibility-adaptor.h>
#include <dali/devel-api/adaptor-framework/singleton-service.h>
#include <dali/public-api/animation/constraints.h>
#include <dali/public-api/common/stage.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/control.h>
#include <dali-toolkit/public-api/controls/control-impl.h>
-#include <dali-toolkit/public-api/focus-manager/accessibility-focus-manager.h>
+#include <dali-toolkit/public-api/accessibility-manager/accessibility-manager.h>
#include <dali-toolkit/devel-api/focus-manager/keyinput-focus-manager.h>
namespace Dali
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;
else
{
// Move the accessibility focus backward
- accessibilityFocusManager.MoveFocusBackward();
+ accessibilityManager.MoveFocusBackward();
}
}
else if (keyName == "Right")
else
{
// Move the accessibility focus forward
- accessibilityFocusManager.MoveFocusForward();
+ accessibilityManager.MoveFocusForward();
}
isFocusStartableKey = true;
}
else
{
- actor = accessibilityFocusManager.GetCurrentFocusActor();
+ actor = accessibilityManager.GetCurrentFocusActor();
}
if(actor)
--- /dev/null
+/*
+ * 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 <dali-toolkit/public-api/accessibility-manager/accessibility-manager.h>
+
+// EXTERNAL INCLUDES
+#include <dali/devel-api/adaptor-framework/singleton-service.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.h>
+
+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<Internal::AccessibilityManager*>(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
--- /dev/null
+#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 <dali/public-api/actors/actor.h>
+#include <dali/public-api/actors/image-actor.h>
+
+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__
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();
*/
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
/**
$(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
$(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 = \
+++ /dev/null
-/*
- * 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 <dali-toolkit/public-api/focus-manager/accessibility-focus-manager.h>
-
-// EXTERNAL INCLUDES
-#include <dali/devel-api/adaptor-framework/singleton-service.h>
-
-// INTERNAL INCLUDES
-#include <dali-toolkit/internal/focus-manager/accessibility-focus-manager-impl.h>
-
-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<Internal::AccessibilityFocusManager*>(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
+++ /dev/null
-#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 <dali/public-api/actors/actor.h>
-#include <dali/public-api/actors/image-actor.h>
-
-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__