X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ffocus-manager%2Fkeyboard-focus-manager-impl.cpp;h=197550fff616dcbe8ccecff4a98ec581319ae6a5;hp=f67ca6fd297585a58d36cabe395fa430d3a7e664;hb=1770d0f68a05d545757fc8050333c0c9c4be96c9;hpb=ceef53ad56a8e9004014dc1c320127e64f90acff 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 f67ca6f..197550f 100644 --- a/dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp +++ b/dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp @@ -117,14 +117,17 @@ KeyboardFocusManager::KeyboardFocusManager() mCurrentFocusActor( 0 ), mFocusIndicatorActor(), mFocusGroupLoopEnabled( false ), + mIsKeyboardFocusEnabled( false ), mIsFocusIndicatorEnabled( false ), mIsWaitingKeyboardFocusChangeCommit( false ), mFocusHistory(), mSlotDelegate( this ) { - // TODO: Get FocusIndicatorEnable constant from stylesheet to set mIsFocusIndicatorEnabled. + OnPhysicalKeyboardStatusChanged(PhysicalKeyboard::Get()); + Toolkit::KeyInputFocusManager::Get().UnhandledKeyEventSignal().Connect(mSlotDelegate, &KeyboardFocusManager::OnKeyEvent); Stage::GetCurrent().TouchSignal().Connect( mSlotDelegate, &KeyboardFocusManager::OnTouch ); + PhysicalKeyboard::Get().StatusChangedSignal().Connect(mSlotDelegate, &KeyboardFocusManager::OnPhysicalKeyboardStatusChanged); } KeyboardFocusManager::~KeyboardFocusManager() @@ -152,8 +155,9 @@ bool KeyboardFocusManager::DoSetCurrentFocusActor( const unsigned int actorID ) // Check whether the actor is in the stage and is keyboard focusable. if( actor && actor.IsKeyboardFocusable() ) { - // Draw the focus indicator upon the focused actor when Focus Indicator is enabled - if( mIsFocusIndicatorEnabled ) + mIsFocusIndicatorEnabled = true; + // Draw the focus indicator upon the focused actor when PhysicalKeyboard is attached + if( mIsKeyboardFocusEnabled ) { actor.Add( GetFocusIndicatorActor() ); } @@ -503,8 +507,39 @@ Actor KeyboardFocusManager::GetFocusIndicatorActor() return mFocusIndicatorActor; } +void KeyboardFocusManager::OnPhysicalKeyboardStatusChanged(PhysicalKeyboard keyboard) +{ + mIsKeyboardFocusEnabled = keyboard.IsAttached(); + + if(mIsKeyboardFocusEnabled) + { + // Show indicator when keyboard focus turned on if there is focused actor. + Actor actor = GetCurrentFocusActor(); + if(actor) + { + actor.Add( GetFocusIndicatorActor() ); + } + mIsFocusIndicatorEnabled = true; + } + else + { + // Hide indicator when keyboard focus turned off + Actor actor = GetCurrentFocusActor(); + if( actor && mFocusIndicatorActor ) + { + actor.Remove( mFocusIndicatorActor ); + } + mIsFocusIndicatorEnabled = false; + } +} + void KeyboardFocusManager::OnKeyEvent(const KeyEvent& event) { + if(!mIsKeyboardFocusEnabled) + { + return; + } + AccessibilityAdaptor accessibilityAdaptor = AccessibilityAdaptor::Get(); bool isAccessibilityEnabled = accessibilityAdaptor.IsEnabled();