X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ffocus-manager%2Fkeyinput-focus-manager-impl.cpp;h=cdcc8e26f7dbe91e8c09d499668dec6759ad156b;hp=dc8cefa1e594964049fa72c81e4c3ddf14c4925a;hb=901499a7ec86ca342c4e0fdec62a6e4eeeee5c5f;hpb=2ddfbb9e23a7c3fc30e604236c41e0ef6d2ed6a2 diff --git a/dali-toolkit/internal/focus-manager/keyinput-focus-manager-impl.cpp b/dali-toolkit/internal/focus-manager/keyinput-focus-manager-impl.cpp index dc8cefa..cdcc8e2 100644 --- a/dali-toolkit/internal/focus-manager/keyinput-focus-manager-impl.cpp +++ b/dali-toolkit/internal/focus-manager/keyinput-focus-manager-impl.cpp @@ -19,6 +19,7 @@ #include "keyinput-focus-manager-impl.h" // EXTERNAL INCLUDES +#include // for strcmp #include #include @@ -35,6 +36,16 @@ namespace Toolkit namespace Internal { +namespace +{ + +// Signals + +const char* const SIGNAL_KEY_INPUT_FOCUS_CHANGED = "keyInputFocusChanged"; +const char* const SIGNAL_UNHANDLED_KEY_EVENT = "unhandledKeyEvent"; + +} + KeyInputFocusManager::KeyInputFocusManager() : mSlotDelegate( this ) { @@ -77,13 +88,13 @@ void KeyInputFocusManager::SetFocus( Toolkit::Control control ) if( previousFocusControl ) { // Notify the control that it has lost key input focus - previousFocusControl.GetImplementation().OnKeyInputFocusLost(); + GetImplementation( previousFocusControl ).OnKeyInputFocusLost(); } mFocusStack.PushBack( &control.GetBaseObject() ); // Tell the new actor that it has gained focus. - control.GetImplementation().OnKeyInputFocusGained(); + GetImplementation( control ).OnKeyInputFocusGained(); // Emit the signal to inform focus change to the application. if ( !mKeyInputFocusChangedSignal.Empty() ) @@ -102,7 +113,7 @@ void KeyInputFocusManager::RemoveFocus( Toolkit::Control control ) control.OffStageSignal().Disconnect( mSlotDelegate, &KeyInputFocusManager::OnFocusControlStageDisconnection ); // Notify the control that it has lost key input focus - control.GetImplementation().OnKeyInputFocusLost(); + GetImplementation( control ).OnKeyInputFocusLost(); // If this is the top-most actor, pop it and change focus to the previous control if( pos == mFocusStack.End() - 1 ) @@ -113,7 +124,7 @@ void KeyInputFocusManager::RemoveFocus( Toolkit::Control control ) if( previouslyFocusedControl ) { // Tell the control that it has gained focus. - previouslyFocusedControl.GetImplementation().OnKeyInputFocusGained(); + GetImplementation( previouslyFocusedControl ).OnKeyInputFocusGained(); } } else @@ -183,7 +194,7 @@ void KeyInputFocusManager::OnKeyEvent( const KeyEvent& event ) if( control ) { // Notify the control about the key event - consumed = control.GetImplementation().EmitKeyEventSignal( event ); + consumed = GetImplementation( control ).EmitKeyEventSignal( event ); } } } @@ -217,19 +228,24 @@ void KeyInputFocusManager::OnObjectDestroyed( const Dali::RefObject* object ) bool KeyInputFocusManager::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor ) { - Dali::BaseHandle handle( object ); - bool connected( true ); - KeyInputFocusManager* manager = dynamic_cast(object); + KeyInputFocusManager* manager = dynamic_cast( object ); - if( Dali::Toolkit::KeyInputFocusManager::SIGNAL_KEY_INPUT_FOCUS_CHANGED == signalName ) - { - manager->KeyInputFocusChangedSignal().Connect( tracker, functor ); - } - else + if( manager ) { - // signalName does not match any signal - connected = false; + if( 0 == strcmp( signalName.c_str(), SIGNAL_KEY_INPUT_FOCUS_CHANGED ) ) + { + manager->KeyInputFocusChangedSignal().Connect( tracker, functor ); + } + else if( 0 == strcmp( signalName.c_str(), SIGNAL_UNHANDLED_KEY_EVENT ) ) + { + manager->UnhandledKeyEventSignal().Connect( tracker, functor ); + } + else + { + // signalName does not match any signal + connected = false; + } } return connected;