X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=base%2Fdali-toolkit%2Finternal%2Ffocus-manager%2Fkeyboard-focus-manager-impl.cpp;h=f766b0b2865b87242a312603391a69bacc84b2e7;hb=2e47ca592320bbbec00aea1e650d53061a73283e;hp=5c762f92a75a46b3c9525f9358c5e8fa28802a1b;hpb=a881757839b7abb008873a68c67e17b3ba39669b;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/base/dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp b/base/dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp index 5c762f9..f766b0b 100644 --- a/base/dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp +++ b/base/dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp @@ -18,6 +18,15 @@ // CLASS HEADER #include "keyboard-focus-manager-impl.h" +// EXTERNAL INCLUDES +#include +#include +#include +#include +#include +#include +#include + // INTERNAL INCLUDES #include #include @@ -41,7 +50,7 @@ namespace // unnamed namespace Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_KEYBOARD_FOCUS_MANAGER"); #endif -const std::string IS_FOCUS_GROUP_PROPERTY_NAME("is-keyboard-focus-group"); // This property will be replaced by a flag in ControlImpl. +const std::string IS_FOCUS_GROUP_PROPERTY_NAME("is-keyboard-focus-group"); // This property will be replaced by a flag in Control. const char* FOCUS_BORDER_IMAGE_PATH = DALI_IMAGE_DIR "keyboard_focus.png"; const Vector4 FOCUS_BORDER_IMAGE_BORDER = Vector4(7.0f, 7.0f, 7.0f, 7.0f); @@ -50,11 +59,15 @@ BaseHandle Create() { BaseHandle handle = KeyboardFocusManager::Get(); - if ( !handle && Adaptor::IsAvailable() ) + if ( !handle ) { - Toolkit::KeyboardFocusManager manager = Toolkit::KeyboardFocusManager( new Internal::KeyboardFocusManager() ); - Adaptor::Get().RegisterSingleton( typeid( manager ), manager ); - handle = manager; + SingletonService singletonService( SingletonService::Get() ); + if ( singletonService ) + { + Toolkit::KeyboardFocusManager manager = Toolkit::KeyboardFocusManager( new Internal::KeyboardFocusManager() ); + singletonService.Register( typeid( manager ), manager ); + handle = manager; + } } return handle; @@ -67,10 +80,11 @@ Toolkit::KeyboardFocusManager KeyboardFocusManager::Get() { Toolkit::KeyboardFocusManager manager; - if ( Adaptor::IsAvailable() ) + SingletonService singletonService( SingletonService::Get() ); + if ( singletonService ) { // Check whether the keyboard focus manager is already created - Dali::BaseHandle handle = Dali::Adaptor::Get().GetSingleton( typeid( Toolkit::KeyboardFocusManager ) ); + Dali::BaseHandle handle = singletonService.GetSingleton( typeid( Toolkit::KeyboardFocusManager ) ); if(handle) { // If so, downcast the handle of singleton to keyboard focus manager @@ -342,7 +356,10 @@ void KeyboardFocusManager::ClearFocus() Actor actor = GetCurrentFocusActor(); if(actor) { - actor.Remove(mFocusIndicatorActor); + if(mFocusIndicatorActor) + { + actor.Remove(mFocusIndicatorActor); + } // Send notification for the change of focus actor if( !mFocusChangedSignalV2.Empty() ) @@ -373,7 +390,7 @@ void KeyboardFocusManager::SetAsFocusGroup(Actor actor, bool isFocusGroup) Property::Index propertyIsFocusGroup = actor.GetPropertyIndex(IS_FOCUS_GROUP_PROPERTY_NAME); if(propertyIsFocusGroup == Property::INVALID_INDEX) { - propertyIsFocusGroup = actor.RegisterProperty(IS_FOCUS_GROUP_PROPERTY_NAME, isFocusGroup); + actor.RegisterProperty(IS_FOCUS_GROUP_PROPERTY_NAME, isFocusGroup); } else { @@ -412,7 +429,25 @@ Actor KeyboardFocusManager::GetFocusGroup(Actor actor) void KeyboardFocusManager::SetFocusIndicatorActor(Actor indicator) { - mFocusIndicatorActor = indicator; + if(mFocusIndicatorActor != indicator) + { + Actor currentFocusActor = GetCurrentFocusActor(); + if(currentFocusActor) + { + // The new focus indicator should be added to the current focused actor immediately + if(mFocusIndicatorActor) + { + currentFocusActor.Remove(mFocusIndicatorActor); + } + + if(indicator) + { + currentFocusActor.Add(indicator); + } + } + + mFocusIndicatorActor = indicator; + } } Actor KeyboardFocusManager::GetFocusIndicatorActor()