X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ffocus-manager%2Fkeyboard-focus-manager-impl.cpp;h=3653f5fdf1ec442c91f8a204a3947c87762adcdf;hb=9f0e1051b84efea31ea2ec2644bb9a498e90b680;hp=3f398c58c3e4ee3f340b312338dd6c1280fe5413;hpb=886ad3dc35609a01504e03707996a4c102ef23e7;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp b/dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp index 3f398c5..3653f5f 100644 --- a/dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp +++ b/dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp @@ -119,15 +119,17 @@ KeyboardFocusManager::KeyboardFocusManager() mFocusedActorEnterKeySignal(), mCurrentFocusActor(), mFocusIndicatorActor(), - mIsFocusIndicatorEnabled( -1 ), + mIsFocusIndicatorShown( -1 ), mFocusGroupLoopEnabled( false ), mIsWaitingKeyboardFocusChangeCommit( false ), mClearFocusOnTouch( true ), + mEnableFocusIndicator( true ), + mAlwaysShowIndicator( true ), mFocusHistory(), mSlotDelegate( this ), mCustomAlgorithmInterface(NULL) { - // TODO: Get FocusIndicatorEnable constant from stylesheet to set mIsFocusIndicatorEnabled. + // TODO: Get FocusIndicatorEnable constant from stylesheet to set mIsFocusIndicatorShown. Stage::GetCurrent().KeyEventSignal().Connect( mSlotDelegate, &KeyboardFocusManager::OnKeyEvent); Stage::GetCurrent().TouchSignal().Connect( mSlotDelegate, &KeyboardFocusManager::OnTouch ); } @@ -142,8 +144,9 @@ void KeyboardFocusManager::GetConfigurationFromStyleManger() if( styleManager ) { Property::Map config = Toolkit::DevelStyleManager::GetConfigurations( styleManager ); - mIsFocusIndicatorEnabled = static_cast(config["alwaysShowFocus"].Get()); - mClearFocusOnTouch = mIsFocusIndicatorEnabled ? false : true; + mAlwaysShowIndicator = config["alwaysShowFocus"].Get(); + mIsFocusIndicatorShown = static_cast(mAlwaysShowIndicator); + mClearFocusOnTouch = mIsFocusIndicatorShown ? false : true; } } @@ -151,7 +154,7 @@ bool KeyboardFocusManager::SetCurrentFocusActor( Actor actor ) { DALI_ASSERT_DEBUG( !mIsWaitingKeyboardFocusChangeCommit && "Calling this function in the PreFocusChangeSignal callback?" ); - if( mIsFocusIndicatorEnabled == -1 ) + if( mIsFocusIndicatorShown == -1 ) { GetConfigurationFromStyleManger(); } @@ -178,7 +181,7 @@ bool KeyboardFocusManager::DoSetCurrentFocusActor( Actor actor ) // Check whether the actor is in the stage and is keyboard focusable. if( actor && actor.IsKeyboardFocusable() && actor.OnStage() ) { - if( mIsFocusIndicatorEnabled ) + if( mIsFocusIndicatorShown && mEnableFocusIndicator ) { actor.Add( GetFocusIndicatorActor() ); } @@ -554,7 +557,7 @@ void KeyboardFocusManager::ClearFocus() } mCurrentFocusActor.Reset(); - mIsFocusIndicatorEnabled = 0; + mIsFocusIndicatorShown = static_cast(mAlwaysShowIndicator); } void KeyboardFocusManager::SetFocusGroupLoop(bool enabled) @@ -654,7 +657,7 @@ void KeyboardFocusManager::OnKeyEvent(const KeyEvent& event) std::string keyName = event.keyPressedName; - if( mIsFocusIndicatorEnabled == -1 ) + if( mIsFocusIndicatorShown == -1 ) { GetConfigurationFromStyleManger(); } @@ -667,10 +670,10 @@ void KeyboardFocusManager::OnKeyEvent(const KeyEvent& event) { if(!isAccessibilityEnabled) { - if(!mIsFocusIndicatorEnabled) + if(!mIsFocusIndicatorShown) { // Show focus indicator - mIsFocusIndicatorEnabled = 1; + mIsFocusIndicatorShown = 1; } else { @@ -690,10 +693,10 @@ void KeyboardFocusManager::OnKeyEvent(const KeyEvent& event) { if(!isAccessibilityEnabled) { - if(!mIsFocusIndicatorEnabled) + if(!mIsFocusIndicatorShown) { // Show focus indicator - mIsFocusIndicatorEnabled = 1; + mIsFocusIndicatorShown = 1; } else { @@ -711,10 +714,10 @@ void KeyboardFocusManager::OnKeyEvent(const KeyEvent& event) } else if (keyName == "Up" && !isAccessibilityEnabled) { - if(!mIsFocusIndicatorEnabled) + if(!mIsFocusIndicatorShown) { // Show focus indicator - mIsFocusIndicatorEnabled = 1; + mIsFocusIndicatorShown = 1; } else { @@ -726,10 +729,10 @@ void KeyboardFocusManager::OnKeyEvent(const KeyEvent& event) } else if (keyName == "Down" && !isAccessibilityEnabled) { - if(!mIsFocusIndicatorEnabled) + if(!mIsFocusIndicatorShown) { // Show focus indicator - mIsFocusIndicatorEnabled = 1; + mIsFocusIndicatorShown = 1; } else { @@ -741,10 +744,10 @@ void KeyboardFocusManager::OnKeyEvent(const KeyEvent& event) } else if (keyName == "Prior" && !isAccessibilityEnabled) { - if(!mIsFocusIndicatorEnabled) + if(!mIsFocusIndicatorShown) { // Show focus indicator - mIsFocusIndicatorEnabled = 1; + mIsFocusIndicatorShown = 1; } else { @@ -756,10 +759,10 @@ void KeyboardFocusManager::OnKeyEvent(const KeyEvent& event) } else if (keyName == "Next" && !isAccessibilityEnabled) { - if(!mIsFocusIndicatorEnabled) + if(!mIsFocusIndicatorShown) { // Show focus indicator - mIsFocusIndicatorEnabled = 1; + mIsFocusIndicatorShown = 1; } else { @@ -771,10 +774,10 @@ void KeyboardFocusManager::OnKeyEvent(const KeyEvent& event) } else if (keyName == "Tab" && !isAccessibilityEnabled) { - if(!mIsFocusIndicatorEnabled) + if(!mIsFocusIndicatorShown) { // Show focus indicator - mIsFocusIndicatorEnabled = 1; + mIsFocusIndicatorShown = 1; } else { @@ -787,10 +790,10 @@ void KeyboardFocusManager::OnKeyEvent(const KeyEvent& event) } else if (keyName == "space" && !isAccessibilityEnabled) { - if(!mIsFocusIndicatorEnabled) + if(!mIsFocusIndicatorShown) { // Show focus indicator - mIsFocusIndicatorEnabled = 1; + mIsFocusIndicatorShown = 1; } isFocusStartableKey = true; @@ -798,10 +801,10 @@ void KeyboardFocusManager::OnKeyEvent(const KeyEvent& event) else if (keyName == "" && !isAccessibilityEnabled) { // Check the fake key event for evas-plugin case - if(!mIsFocusIndicatorEnabled) + if(!mIsFocusIndicatorShown) { // Show focus indicator - mIsFocusIndicatorEnabled = 1; + mIsFocusIndicatorShown = 1; } isFocusStartableKey = true; @@ -818,10 +821,10 @@ void KeyboardFocusManager::OnKeyEvent(const KeyEvent& event) { if (keyName == "Return") { - if(!mIsFocusIndicatorEnabled && !isAccessibilityEnabled) + if(!mIsFocusIndicatorShown && !isAccessibilityEnabled) { // Show focus indicator - mIsFocusIndicatorEnabled = 1; + mIsFocusIndicatorShown = 1; } else { @@ -846,13 +849,16 @@ void KeyboardFocusManager::OnKeyEvent(const KeyEvent& event) } } - if(isFocusStartableKey && mIsFocusIndicatorEnabled && !isAccessibilityEnabled) + if(isFocusStartableKey && mIsFocusIndicatorShown && !isAccessibilityEnabled) { 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 { @@ -865,9 +871,9 @@ void KeyboardFocusManager::OnKeyEvent(const KeyEvent& event) void KeyboardFocusManager::OnTouch(const TouchData& touch) { - // if mIsFocusIndicatorEnabled is -1, it means Configuration is not loaded. + // if mIsFocusIndicatorShown is -1, it means Configuration is not loaded. // Try to load configuration. - if( mIsFocusIndicatorEnabled == -1 ) + if( mIsFocusIndicatorShown == -1 ) { GetConfigurationFromStyleManger(); } @@ -938,6 +944,21 @@ void KeyboardFocusManager::SetCustomAlgorithm(CustomAlgorithmInterface& interfac mCustomAlgorithmInterface = &interface; } +void KeyboardFocusManager::EnableFocusIndicator(bool enable) +{ + if( !enable && mFocusIndicatorActor ) + { + mFocusIndicatorActor.Unparent(); + } + + mEnableFocusIndicator = enable; +} + +bool KeyboardFocusManager::IsFocusIndicatorEnabled() const +{ + return mEnableFocusIndicator; +} + } // namespace Internal } // namespace Toolkit