#include "keyinput-focus-manager-impl.h"
// EXTERNAL INCLUDES
+#include <cstring> // for strcmp
#include <dali/public-api/actors/layer.h>
#include <dali/public-api/common/stage.h>
// Signals
-const char* const SIGNAL_KEY_INPUT_FOCUS_CHANGED = "key-input-focus-changed";
-const char* const SIGNAL_UNHANDLED_KEY_EVENT = "unhandled-key-event";
+const char* const SIGNAL_KEY_INPUT_FOCUS_CHANGED = "keyInputFocusChanged";
+const char* const SIGNAL_UNHANDLED_KEY_EVENT = "unhandledKeyEvent";
}
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() )
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 )
if( previouslyFocusedControl )
{
// Tell the control that it has gained focus.
- previouslyFocusedControl.GetImplementation().OnKeyInputFocusGained();
+ GetImplementation( previouslyFocusedControl ).OnKeyInputFocusGained();
}
}
else
if( control )
{
// Notify the control about the key event
- consumed = control.GetImplementation().EmitKeyEventSignal( event );
+ consumed = GetImplementation( control ).EmitKeyEventSignal( event );
}
}
}
bool KeyInputFocusManager::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
{
- Dali::BaseHandle handle( object );
-
bool connected( true );
KeyInputFocusManager* manager = dynamic_cast<KeyInputFocusManager*>( object );
- 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
+ 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;