+ // Find property index based upon focus direction
+ switch(direction)
+ {
+ case Toolkit::Control::KeyboardFocus::LEFT:
+ {
+ index = Toolkit::DevelControl::Property::LEFT_FOCUSABLE_ACTOR_ID;
+ break;
+ }
+ case Toolkit::Control::KeyboardFocus::RIGHT:
+ {
+ index = Toolkit::DevelControl::Property::RIGHT_FOCUSABLE_ACTOR_ID;
+ break;
+ }
+ case Toolkit::Control::KeyboardFocus::UP:
+ {
+ index = Toolkit::DevelControl::Property::UP_FOCUSABLE_ACTOR_ID;
+ break;
+ }
+ case Toolkit::Control::KeyboardFocus::DOWN:
+ {
+ index = Toolkit::DevelControl::Property::DOWN_FOCUSABLE_ACTOR_ID;
+ break;
+ }
+ default:
+ break;
+ }
+
+ // If the focusable property is set then determine next focusable actor
+ if(index != Property::INVALID_INDEX)
+ {
+ value = currentFocusActor.GetProperty(index);
+ actorId = value.Get<int>();
+
+ // If actor's id is valid then find actor form actor's id. The actor should be on the stage.
+ if(actorId != -1)
+ {
+ if(currentFocusActor.GetParent())
+ {
+ nextFocusableActor = currentFocusActor.GetParent().FindChildById(actorId);
+ }
+
+ if(!nextFocusableActor)
+ {
+ Integration::SceneHolder window = Integration::SceneHolder::Get(currentFocusActor);
+ if(window)
+ {
+ nextFocusableActor = window.GetRootLayer().FindChildById(actorId);
+ }
+ }
+ }
+ }
+ }
+
+ if(!nextFocusableActor)
+ {
+ // If the implementation of CustomAlgorithmInterface is provided then the PreFocusChangeSignal is no longer emitted.
+ if(mCustomAlgorithmInterface)
+ {
+ mIsWaitingKeyboardFocusChangeCommit = true;
+ nextFocusableActor = mCustomAlgorithmInterface->GetNextFocusableActor(currentFocusActor, Actor(), direction);
+ mIsWaitingKeyboardFocusChangeCommit = false;
+ }
+ else if(!mPreFocusChangeSignal.Empty())
+ {
+ // Don't know how to move the focus further. The application needs to tell us which actor to move the focus to
+ mIsWaitingKeyboardFocusChangeCommit = true;
+ nextFocusableActor = mPreFocusChangeSignal.Emit(currentFocusActor, Actor(), direction);
+ mIsWaitingKeyboardFocusChangeCommit = false;
+ }
+ else if(mEnableDefaultAlgorithm && currentFocusActor)
+ {
+ // We should find it among the actors nearby.
+ Integration::SceneHolder window = Integration::SceneHolder::Get(currentFocusActor);
+ if(window)
+ {
+ nextFocusableActor = Toolkit::FocusFinder::GetNearestFocusableActor(window.GetRootLayer(), currentFocusActor, direction);
+ }
+ }
+ }
+
+ if(nextFocusableActor && nextFocusableActor.GetProperty<bool>(Actor::Property::KEYBOARD_FOCUSABLE))