END_TEST;
}
+
+int UtcDaliKeyboardFocusManagerEnableFocusIndicator(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline( "Ensure we cannot set an actor to be focused if it is not staged and that we do not retrieve an actor if it has been unstaged" );
+
+ KeyboardFocusManager manager = KeyboardFocusManager::Get();
+ DALI_TEST_CHECK( ! manager.GetCurrentFocusActor() );
+
+ Actor actor = Actor::New();
+ actor.SetKeyboardFocusable( true );
+ Stage::GetCurrent().Add( actor );
+ manager.SetCurrentFocusActor( actor );
+
+ // Press Any key to notice physical keyboard event is comming to KeyboardFocusManager
+ // It makes mIsFocusIndicatorEnabled true and add focus indicator to focused actor.
+ Integration::KeyEvent rightEvent( "Right", "", 0, 0, 0, Integration::KeyEvent::Down, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE );
+ application.ProcessEvent(rightEvent);
+
+ Actor indicatorActor = manager.GetFocusIndicatorActor();
+
+ tet_infoline( "Indicator is added to focused actor" );
+ DALI_TEST_CHECK( actor == indicatorActor.GetParent() );
+
+ Dali::Toolkit::DevelKeyboardFocusManager::EnableFocusIndicator(manager, false);
+ DALI_TEST_CHECK( !Dali::Toolkit::DevelKeyboardFocusManager::IsFocusIndicatorEnabled(manager) );
+
+ tet_infoline( "Indicator is removed from focused actor because mUseFocusIndicator is false" );
+ DALI_TEST_CHECK( !indicatorActor.GetParent() );
+
+ END_TEST;
+}
+
+
+
GetImpl(keyboardFocusManager).SetCustomAlgorithm(interface);
}
+void EnableFocusIndicator(KeyboardFocusManager keyboardFocusManager, bool enable)
+{
+ GetImpl(keyboardFocusManager).EnableFocusIndicator(enable);
+}
+
+bool IsFocusIndicatorEnabled(KeyboardFocusManager keyboardFocusManager)
+{
+ return GetImpl(keyboardFocusManager).IsFocusIndicatorEnabled();
+}
+
} // namespace DevelKeyboardFocusManager
} // namespace Toolkit
*/
DALI_TOOLKIT_API void SetCustomAlgorithm(KeyboardFocusManager keyboardFocusManager, CustomAlgorithmInterface& interface);
+/**
+ * @brief Decide using focus indicator or not
+ *
+ * @param[in] keyboardFocusManager The instance of KeyboardFocusManager
+ * @param[in] enable Whether using focus indicator or not
+ */
+DALI_TOOLKIT_API void EnableFocusIndicator(KeyboardFocusManager keyboardFocusManager, bool enable);
+
+/**
+ * @brief Check focus indicator is enabled or not
+ *
+ * @param[in] keyboardFocusManager The instance of KeyboardFocusManager
+ * @return True when focus indicator is enabled
+ */
+DALI_TOOLKIT_API bool IsFocusIndicatorEnabled(KeyboardFocusManager keyboardFocusManager);
+
} // namespace DevelKeyboardFocusManager
} // namespace Toolkit
mFocusGroupLoopEnabled( false ),
mIsWaitingKeyboardFocusChangeCommit( false ),
mClearFocusOnTouch( true ),
+ mEnableFocusIndicator( true ),
mFocusHistory(),
mSlotDelegate( this ),
mCustomAlgorithmInterface(NULL)
// Check whether the actor is in the stage and is keyboard focusable.
if( actor && actor.IsKeyboardFocusable() && actor.OnStage() )
{
- if( mIsFocusIndicatorEnabled )
+ if( mIsFocusIndicatorEnabled && mEnableFocusIndicator )
{
actor.Add( GetFocusIndicatorActor() );
}
Actor actor = GetCurrentFocusActor();
if( actor )
{
- // Make sure the focused actor is highlighted
- actor.Add( GetFocusIndicatorActor() );
+ if( mEnableFocusIndicator )
+ {
+ // Make sure the focused actor is highlighted
+ actor.Add( GetFocusIndicatorActor() );
+ }
}
else
{
mCustomAlgorithmInterface = &interface;
}
+void KeyboardFocusManager::EnableFocusIndicator(bool enable)
+{
+ if( !enable && mFocusIndicatorActor )
+ {
+ mFocusIndicatorActor.Unparent();
+ }
+
+ mEnableFocusIndicator = enable;
+}
+
+bool KeyboardFocusManager::IsFocusIndicatorEnabled() const
+{
+ return mEnableFocusIndicator;
+}
+
} // namespace Internal
} // namespace Toolkit
*/
void SetCustomAlgorithm(CustomAlgorithmInterface& interface);
+ /**
+ * @copydoc Toolkit::DevelKeyboardFocusManager::UseFocusIndicator
+ */
+ void EnableFocusIndicator(bool enable);
+
+ /**
+ * @copydoc Toolkit::DevelKeyboardFocusManager::UseFocusIndicator
+ */
+ bool IsFocusIndicatorEnabled() const;
+
public:
/**
bool mClearFocusOnTouch:1; ///< Whether clear focus on touch.
+ bool mEnableFocusIndicator; ///< Whether use focus indicator
+
FocusStack mFocusHistory; ///< Stack to contain pre-focused actor's BaseObject*
SlotDelegate< KeyboardFocusManager > mSlotDelegate;