2 * Copyright (c) 2016 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include "keyboard-focus-manager-impl.h"
22 #include <cstring> // for strcmp
23 #include <dali/public-api/actors/layer.h>
24 #include <dali/devel-api/adaptor-framework/accessibility-adaptor.h>
25 #include <dali/devel-api/adaptor-framework/singleton-service.h>
26 #include <dali/public-api/animation/constraints.h>
27 #include <dali/public-api/common/stage.h>
28 #include <dali/public-api/events/key-event.h>
29 #include <dali/public-api/events/touch-data.h>
30 #include <dali/public-api/object/type-registry.h>
31 #include <dali/public-api/object/type-registry-helper.h>
32 #include <dali/public-api/images/resource-image.h>
33 #include <dali/integration-api/debug.h>
36 #include <dali-toolkit/public-api/controls/control.h>
37 #include <dali-toolkit/public-api/controls/control-impl.h>
38 #include <dali-toolkit/public-api/controls/image-view/image-view.h>
39 #include <dali-toolkit/public-api/accessibility-manager/accessibility-manager.h>
40 #include <dali-toolkit/devel-api/focus-manager/keyinput-focus-manager.h>
41 #include <dali-toolkit/devel-api/controls/control-devel.h>
52 namespace // Unnamed namespace
55 #if defined(DEBUG_ENABLED)
56 Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_KEYBOARD_FOCUS_MANAGER");
59 const char* const IS_FOCUS_GROUP_PROPERTY_NAME = "isKeyboardFocusGroup"; // This property will be replaced by a flag in Control.
61 const char* const FOCUS_BORDER_IMAGE_PATH = DALI_IMAGE_DIR "keyboard_focus.9.png";
65 BaseHandle handle = KeyboardFocusManager::Get();
69 SingletonService singletonService( SingletonService::Get() );
70 if ( singletonService )
72 Toolkit::KeyboardFocusManager manager = Toolkit::KeyboardFocusManager( new Internal::KeyboardFocusManager() );
73 singletonService.Register( typeid( manager ), manager );
81 DALI_TYPE_REGISTRATION_BEGIN_CREATE( Toolkit::KeyboardFocusManager, Dali::BaseHandle, Create, true )
83 DALI_SIGNAL_REGISTRATION( Toolkit, KeyboardFocusManager, "keyboardPreFocusChange", SIGNAL_PRE_FOCUS_CHANGE )
84 DALI_SIGNAL_REGISTRATION( Toolkit, KeyboardFocusManager, "keyboardFocusChanged", SIGNAL_FOCUS_CHANGED )
85 DALI_SIGNAL_REGISTRATION( Toolkit, KeyboardFocusManager, "keyboardFocusGroupChanged", SIGNAL_FOCUS_GROUP_CHANGED )
86 DALI_SIGNAL_REGISTRATION( Toolkit, KeyboardFocusManager, "keyboardFocusedActorEnterKey", SIGNAL_FOCUSED_ACTOR_ENTER_KEY )
88 DALI_TYPE_REGISTRATION_END()
90 const unsigned int MAX_HISTORY_AMOUNT = 30; ///< Max length of focus history stack
92 } // unnamed namespace
94 Toolkit::KeyboardFocusManager KeyboardFocusManager::Get()
96 Toolkit::KeyboardFocusManager manager;
98 SingletonService singletonService( SingletonService::Get() );
99 if ( singletonService )
101 // Check whether the keyboard focus manager is already created
102 Dali::BaseHandle handle = singletonService.GetSingleton( typeid( Toolkit::KeyboardFocusManager ) );
105 // If so, downcast the handle of singleton to keyboard focus manager
106 manager = Toolkit::KeyboardFocusManager( dynamic_cast< KeyboardFocusManager* >( handle.GetObjectPtr() ) );
113 KeyboardFocusManager::KeyboardFocusManager()
114 : mPreFocusChangeSignal(),
115 mFocusChangedSignal(),
116 mFocusGroupChangedSignal(),
117 mFocusedActorEnterKeySignal(),
118 mCurrentFocusActor( 0 ),
119 mFocusIndicatorActor(),
120 mFocusGroupLoopEnabled( false ),
121 mIsKeyboardFocusEnabled( false ),
122 mIsFocusIndicatorEnabled( false ),
123 mIsWaitingKeyboardFocusChangeCommit( false ),
125 mSlotDelegate( this )
127 OnPhysicalKeyboardStatusChanged(PhysicalKeyboard::Get());
129 Toolkit::KeyInputFocusManager::Get().UnhandledKeyEventSignal().Connect(mSlotDelegate, &KeyboardFocusManager::OnKeyEvent);
130 Stage::GetCurrent().TouchSignal().Connect( mSlotDelegate, &KeyboardFocusManager::OnTouch );
131 PhysicalKeyboard::Get().StatusChangedSignal().Connect(mSlotDelegate, &KeyboardFocusManager::OnPhysicalKeyboardStatusChanged);
134 KeyboardFocusManager::~KeyboardFocusManager()
138 bool KeyboardFocusManager::SetCurrentFocusActor( Actor actor )
140 DALI_ASSERT_DEBUG( !mIsWaitingKeyboardFocusChangeCommit && "Calling this function in the PreFocusChangeSignal callback?" );
144 return DoSetCurrentFocusActor( actor.GetId() );
150 bool KeyboardFocusManager::DoSetCurrentFocusActor( const unsigned int actorID )
152 Actor rootActor = Stage::GetCurrent().GetRootLayer();
153 Actor actor = rootActor.FindChildById( actorID );
154 bool success = false;
156 // Check whether the actor is in the stage and is keyboard focusable.
157 if( actor && actor.IsKeyboardFocusable() )
159 mIsFocusIndicatorEnabled = true;
160 // Draw the focus indicator upon the focused actor when PhysicalKeyboard is attached
161 if( mIsKeyboardFocusEnabled )
163 actor.Add( GetFocusIndicatorActor() );
165 // Send notification for the change of focus actor
166 Actor currentFocusedActor = GetCurrentFocusActor();
168 if( !mFocusChangedSignal.Empty() )
170 mFocusChangedSignal.Emit(currentFocusedActor, actor);
173 Toolkit::Control currentlyFocusedControl = Toolkit::Control::DownCast(currentFocusedActor);
174 if( currentlyFocusedControl )
176 // Do we need it to remember if it was previously DISABLED?
177 currentlyFocusedControl.SetProperty(DevelControl::Property::STATE, DevelControl::NORMAL );
180 DALI_LOG_INFO( gLogFilter, Debug::General, "[%s:%d] Focus Changed\n", __FUNCTION__, __LINE__);
182 // Save the current focused actor
183 mCurrentFocusActor = actorID;
185 Toolkit::Control newlyFocusedControl = Toolkit::Control::DownCast(actor);
186 if( newlyFocusedControl )
188 newlyFocusedControl.SetProperty(DevelControl::Property::STATE, DevelControl::FOCUSED );
191 // Push Current Focused Actor to FocusHistory
192 mFocusHistory.PushBack( &actor.GetBaseObject() );
194 // Delete first element before add new element when Stack is full.
195 if( mFocusHistory.Count() > MAX_HISTORY_AMOUNT )
197 FocusStackIterator beginPos = mFocusHistory.Begin();
198 mFocusHistory.Erase( beginPos );
201 DALI_LOG_INFO( gLogFilter, Debug::General, "[%s:%d] SUCCEED\n", __FUNCTION__, __LINE__);
206 DALI_LOG_WARNING("[%s:%d] FAILED\n", __FUNCTION__, __LINE__);
212 Actor KeyboardFocusManager::GetCurrentFocusActor()
214 Actor rootActor = Stage::GetCurrent().GetRootLayer();
215 return rootActor.FindChildById(mCurrentFocusActor);
218 Actor KeyboardFocusManager::GetCurrentFocusGroup()
220 return GetFocusGroup(GetCurrentFocusActor());
223 void KeyboardFocusManager::MoveFocusBackward()
225 // Find Pre Focused Actor when the list size is more than 1
226 if( mFocusHistory.Count() > 1 )
228 // Delete current focused actor in history
229 FocusStackIterator endPos = mFocusHistory.End();
230 endPos = mFocusHistory.Erase( --endPos );
232 // If pre-focused actors are not on stage, remove them in stack
233 while( !Dali::Actor::DownCast(BaseHandle(mFocusHistory[ mFocusHistory.Count() - 1 ])).OnStage() )
235 endPos = mFocusHistory.Erase( --endPos );
238 // Get pre focused actor
239 BaseObject* object = mFocusHistory[ mFocusHistory.Count() - 1 ];
240 BaseHandle handle( object );
241 Actor preFocusedActor = Dali::Actor::DownCast( handle );
243 // Delete pre focused actor in history because it will pushed again by SetCurrentFocusActor()
244 mFocusHistory.Erase( --endPos );
246 SetCurrentFocusActor( preFocusedActor );
250 bool KeyboardFocusManager::IsLayoutControl(Actor actor) const
252 Toolkit::Control control = Toolkit::Control::DownCast(actor);
253 return control && GetImplementation( control ).IsKeyboardNavigationSupported();
256 Toolkit::Control KeyboardFocusManager::GetParentLayoutControl(Actor actor) const
258 // Get the actor's parent layout control that supports two dimensional keyboard navigation
259 Actor rootActor = Stage::GetCurrent().GetRootLayer();
263 parent = actor.GetParent();
266 while( parent && !IsLayoutControl(parent) && parent != rootActor )
268 parent = parent.GetParent();
271 return Toolkit::Control::DownCast(parent);
274 bool KeyboardFocusManager::MoveFocus(Toolkit::Control::KeyboardFocus::Direction direction)
276 Actor currentFocusActor = GetCurrentFocusActor();
278 bool succeed = false;
280 // Go through the actor's hierarchy until we find a layout control that knows how to move the focus
281 Toolkit::Control parentLayoutControl = GetParentLayoutControl(currentFocusActor);
282 while(parentLayoutControl && !succeed)
284 succeed = DoMoveFocusWithinLayoutControl(parentLayoutControl, currentFocusActor, direction);
285 parentLayoutControl = GetParentLayoutControl(parentLayoutControl);
288 if(!succeed && !mPreFocusChangeSignal.Empty())
290 // Don't know how to move the focus further. The application needs to tell us which actor to move the focus to
291 mIsWaitingKeyboardFocusChangeCommit = true;
292 Actor nextFocusableActor = mPreFocusChangeSignal.Emit(currentFocusActor, Actor(), direction);
293 mIsWaitingKeyboardFocusChangeCommit = false;
295 if ( nextFocusableActor && nextFocusableActor.IsKeyboardFocusable() )
297 // Whether the next focusable actor is a layout control
298 if(IsLayoutControl(nextFocusableActor))
300 // If so, move the focus inside it.
301 Toolkit::Control layoutControl = Toolkit::Control::DownCast(nextFocusableActor);
302 succeed = DoMoveFocusWithinLayoutControl(layoutControl, currentFocusActor, direction);
306 // Otherwise, just set focus to the next focusable actor
307 succeed = SetCurrentFocusActor(nextFocusableActor);
315 bool KeyboardFocusManager::DoMoveFocusWithinLayoutControl(Toolkit::Control control, Actor actor, Toolkit::Control::KeyboardFocus::Direction direction)
317 // Ask the control for the next actor to focus
318 Actor nextFocusableActor = GetImplementation( control ).GetNextKeyboardFocusableActor(actor, direction, mFocusGroupLoopEnabled);
319 if(nextFocusableActor)
321 if(!nextFocusableActor.IsKeyboardFocusable())
323 // If the actor is not focusable, ask the same layout control for the next actor to focus
324 return DoMoveFocusWithinLayoutControl(control, nextFocusableActor, direction);
328 Actor currentFocusActor = GetCurrentFocusActor();
329 Actor committedFocusActor = nextFocusableActor;
331 // We will try to move the focus to the actor. Emit a signal to notify the proposed actor to focus
332 // Signal handler can check the proposed actor and return a different actor if it wishes.
333 if( !mPreFocusChangeSignal.Empty() )
335 mIsWaitingKeyboardFocusChangeCommit = true;
336 committedFocusActor = mPreFocusChangeSignal.Emit(currentFocusActor, nextFocusableActor, direction);
337 mIsWaitingKeyboardFocusChangeCommit = false;
340 if (committedFocusActor && committedFocusActor.IsKeyboardFocusable())
342 // Whether the commited focusable actor is a layout control
343 if(IsLayoutControl(committedFocusActor))
345 // If so, move the focus inside it.
346 Toolkit::Control layoutControl = Toolkit::Control::DownCast(committedFocusActor);
347 return DoMoveFocusWithinLayoutControl(layoutControl, currentFocusActor, direction);
351 // Otherwise, just set focus to the next focusable actor
352 if(committedFocusActor == nextFocusableActor)
354 // If the application hasn't changed our proposed actor, we informs the layout control we will
355 // move the focus to what the control returns. The control might wish to perform some actions
356 // before the focus is actually moved.
357 GetImplementation( control ).OnKeyboardFocusChangeCommitted( committedFocusActor );
360 return SetCurrentFocusActor(committedFocusActor);
371 // No more actor can be focused in the given direction within the same layout control.
376 bool KeyboardFocusManager::DoMoveFocusToNextFocusGroup(bool forward)
378 bool succeed = false;
380 // Get the parent layout control of the current focus group
381 Toolkit::Control parentLayoutControl = GetParentLayoutControl(GetCurrentFocusGroup());
383 while(parentLayoutControl && !succeed)
385 // If the current focus group has a parent layout control, we can probably automatically
386 // move the focus to the next focus group in the forward or backward direction.
387 Toolkit::Control::KeyboardFocus::Direction direction = forward ? Toolkit::Control::KeyboardFocus::RIGHT : Toolkit::Control::KeyboardFocus::LEFT;
388 succeed = DoMoveFocusWithinLayoutControl(parentLayoutControl, GetCurrentFocusActor(), direction);
389 parentLayoutControl = GetParentLayoutControl(parentLayoutControl);
392 if(!mFocusGroupChangedSignal.Empty())
394 // Emit a focus group changed signal. The applicaton can move the focus to a new focus group
395 mFocusGroupChangedSignal.Emit(GetCurrentFocusActor(), forward);
401 void KeyboardFocusManager::DoKeyboardEnter(Actor actor)
405 Toolkit::Control control = Toolkit::Control::DownCast( actor );
408 // Notify the control that enter has been pressed on it.
409 GetImplementation( control ).KeyboardEnter();
412 // Send a notification for the actor.
413 if( !mFocusedActorEnterKeySignal.Empty() )
415 mFocusedActorEnterKeySignal.Emit( actor );
420 void KeyboardFocusManager::ClearFocus()
422 Actor actor = GetCurrentFocusActor();
425 if( mFocusIndicatorActor )
427 actor.Remove( mFocusIndicatorActor );
430 // Send notification for the change of focus actor
431 if( !mFocusChangedSignal.Empty() )
433 mFocusChangedSignal.Emit( actor, Actor() );
436 Toolkit::Control currentlyFocusedControl = Toolkit::Control::DownCast( actor );
437 if( currentlyFocusedControl )
439 currentlyFocusedControl.SetProperty( DevelControl::Property::STATE, DevelControl::NORMAL );
443 mCurrentFocusActor = 0;
444 mIsFocusIndicatorEnabled = false;
447 void KeyboardFocusManager::SetFocusGroupLoop(bool enabled)
449 mFocusGroupLoopEnabled = enabled;
452 bool KeyboardFocusManager::GetFocusGroupLoop() const
454 return mFocusGroupLoopEnabled;
457 void KeyboardFocusManager::SetAsFocusGroup(Actor actor, bool isFocusGroup)
461 // Create/Set focus group property.
462 actor.RegisterProperty( IS_FOCUS_GROUP_PROPERTY_NAME, isFocusGroup, Property::READ_WRITE );
466 bool KeyboardFocusManager::IsFocusGroup(Actor actor) const
468 // Check whether the actor is a focus group
469 bool isFocusGroup = false;
473 Property::Index propertyIsFocusGroup = actor.GetPropertyIndex(IS_FOCUS_GROUP_PROPERTY_NAME);
474 if(propertyIsFocusGroup != Property::INVALID_INDEX)
476 isFocusGroup = actor.GetProperty<bool>(propertyIsFocusGroup);
483 Actor KeyboardFocusManager::GetFocusGroup(Actor actor)
485 // Go through the actor's hierarchy to check which focus group the actor belongs to
486 while (actor && !IsFocusGroup(actor))
488 actor = actor.GetParent();
494 void KeyboardFocusManager::SetFocusIndicatorActor(Actor indicator)
496 if(mFocusIndicatorActor != indicator)
498 Actor currentFocusActor = GetCurrentFocusActor();
499 if(currentFocusActor)
501 // The new focus indicator should be added to the current focused actor immediately
502 if(mFocusIndicatorActor)
504 currentFocusActor.Remove(mFocusIndicatorActor);
509 currentFocusActor.Add(indicator);
513 mFocusIndicatorActor = indicator;
517 Actor KeyboardFocusManager::GetFocusIndicatorActor()
519 if( ! mFocusIndicatorActor )
521 // Create the default if it hasn't been set and one that's shared by all the keyboard focusable actors
522 mFocusIndicatorActor = Toolkit::ImageView::New( FOCUS_BORDER_IMAGE_PATH );
523 mFocusIndicatorActor.SetParentOrigin( ParentOrigin::CENTER );
525 // Apply size constraint to the focus indicator
526 mFocusIndicatorActor.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
529 return mFocusIndicatorActor;
532 void KeyboardFocusManager::OnPhysicalKeyboardStatusChanged(PhysicalKeyboard keyboard)
534 mIsKeyboardFocusEnabled = keyboard.IsAttached();
536 if(mIsKeyboardFocusEnabled)
538 // Show indicator when keyboard focus turned on if there is focused actor.
539 Actor actor = GetCurrentFocusActor();
542 actor.Add( GetFocusIndicatorActor() );
544 mIsFocusIndicatorEnabled = true;
548 // Hide indicator when keyboard focus turned off
549 Actor actor = GetCurrentFocusActor();
550 if( actor && mFocusIndicatorActor )
552 actor.Remove( mFocusIndicatorActor );
554 mIsFocusIndicatorEnabled = false;
558 void KeyboardFocusManager::OnKeyEvent(const KeyEvent& event)
560 if(!mIsKeyboardFocusEnabled)
565 AccessibilityAdaptor accessibilityAdaptor = AccessibilityAdaptor::Get();
566 bool isAccessibilityEnabled = accessibilityAdaptor.IsEnabled();
568 Toolkit::AccessibilityManager accessibilityManager = Toolkit::AccessibilityManager::Get();
570 std::string keyName = event.keyPressedName;
572 bool isFocusStartableKey = false;
574 if(event.state == KeyEvent::Down)
576 if (keyName == "Left")
578 if(!isAccessibilityEnabled)
580 if(!mIsFocusIndicatorEnabled)
582 // Show focus indicator
583 mIsFocusIndicatorEnabled = true;
587 // Move the focus towards left
588 MoveFocus(Toolkit::Control::KeyboardFocus::LEFT);
591 isFocusStartableKey = true;
595 // Move the accessibility focus backward
596 accessibilityManager.MoveFocusBackward();
599 else if (keyName == "Right")
601 if(!isAccessibilityEnabled)
603 if(!mIsFocusIndicatorEnabled)
605 // Show focus indicator
606 mIsFocusIndicatorEnabled = true;
610 // Move the focus towards right
611 MoveFocus(Toolkit::Control::KeyboardFocus::RIGHT);
616 // Move the accessibility focus forward
617 accessibilityManager.MoveFocusForward();
620 isFocusStartableKey = true;
622 else if (keyName == "Up" && !isAccessibilityEnabled)
624 if(!mIsFocusIndicatorEnabled)
626 // Show focus indicator
627 mIsFocusIndicatorEnabled = true;
631 // Move the focus towards up
632 MoveFocus(Toolkit::Control::KeyboardFocus::UP);
635 isFocusStartableKey = true;
637 else if (keyName == "Down" && !isAccessibilityEnabled)
639 if(!mIsFocusIndicatorEnabled)
641 // Show focus indicator
642 mIsFocusIndicatorEnabled = true;
646 // Move the focus towards down
647 MoveFocus(Toolkit::Control::KeyboardFocus::DOWN);
650 isFocusStartableKey = true;
652 else if (keyName == "Prior" && !isAccessibilityEnabled)
654 if(!mIsFocusIndicatorEnabled)
656 // Show focus indicator
657 mIsFocusIndicatorEnabled = true;
661 // Move the focus towards the previous page
662 MoveFocus(Toolkit::Control::KeyboardFocus::PAGE_UP);
665 isFocusStartableKey = true;
667 else if (keyName == "Next" && !isAccessibilityEnabled)
669 if(!mIsFocusIndicatorEnabled)
671 // Show focus indicator
672 mIsFocusIndicatorEnabled = true;
676 // Move the focus towards the next page
677 MoveFocus(Toolkit::Control::KeyboardFocus::PAGE_DOWN);
680 isFocusStartableKey = true;
682 else if (keyName == "Tab" && !isAccessibilityEnabled)
684 if(!mIsFocusIndicatorEnabled)
686 // Show focus indicator
687 mIsFocusIndicatorEnabled = true;
691 // "Tab" key changes the focus group in the forward direction and
692 // "Shift-Tab" key changes it in the backward direction.
693 DoMoveFocusToNextFocusGroup(!event.IsShiftModifier());
696 isFocusStartableKey = true;
698 else if (keyName == "space" && !isAccessibilityEnabled)
700 if(!mIsFocusIndicatorEnabled)
702 // Show focus indicator
703 mIsFocusIndicatorEnabled = true;
706 isFocusStartableKey = true;
708 else if (keyName == "" && !isAccessibilityEnabled)
710 // Check the fake key event for evas-plugin case
711 if(!mIsFocusIndicatorEnabled)
713 // Show focus indicator
714 mIsFocusIndicatorEnabled = true;
717 isFocusStartableKey = true;
719 else if (keyName == "Backspace" && !isAccessibilityEnabled)
721 // Emit signal to go back to the previous view???
723 else if (keyName == "Escape" && !isAccessibilityEnabled)
727 else if(event.state == KeyEvent::Up)
729 if (keyName == "Return")
731 if(!mIsFocusIndicatorEnabled && !isAccessibilityEnabled)
733 // Show focus indicator
734 mIsFocusIndicatorEnabled = true;
738 // The focused actor has enter pressed on it
740 if( !isAccessibilityEnabled )
742 actor = GetCurrentFocusActor();
746 actor = accessibilityManager.GetCurrentFocusActor();
751 DoKeyboardEnter( actor );
755 isFocusStartableKey = true;
759 if(isFocusStartableKey && mIsFocusIndicatorEnabled && !isAccessibilityEnabled)
761 Actor actor = GetCurrentFocusActor();
764 // Make sure the focused actor is highlighted
765 actor.Add( GetFocusIndicatorActor() );
769 // No actor is focused but keyboard focus is activated by the key press
770 // Let's try to move the initial focus
771 MoveFocus(Toolkit::Control::KeyboardFocus::RIGHT);
776 void KeyboardFocusManager::OnTouch(const TouchData& touch)
778 // Clear the focus when user touch the screen.
779 // We only do this on a Down event, otherwise the clear action may override a manually focused actor.
780 if( ( touch.GetPointCount() < 1 ) || ( touch.GetState( 0 ) == PointState::DOWN ) )
786 Toolkit::KeyboardFocusManager::PreFocusChangeSignalType& KeyboardFocusManager::PreFocusChangeSignal()
788 return mPreFocusChangeSignal;
791 Toolkit::KeyboardFocusManager::FocusChangedSignalType& KeyboardFocusManager::FocusChangedSignal()
793 return mFocusChangedSignal;
796 Toolkit::KeyboardFocusManager::FocusGroupChangedSignalType& KeyboardFocusManager::FocusGroupChangedSignal()
798 return mFocusGroupChangedSignal;
801 Toolkit::KeyboardFocusManager::FocusedActorEnterKeySignalType& KeyboardFocusManager::FocusedActorEnterKeySignal()
803 return mFocusedActorEnterKeySignal;
806 bool KeyboardFocusManager::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
808 Dali::BaseHandle handle( object );
810 bool connected( true );
811 KeyboardFocusManager* manager = static_cast< KeyboardFocusManager* >( object ); // TypeRegistry guarantees that this is the correct type.
813 if( 0 == strcmp( signalName.c_str(), SIGNAL_PRE_FOCUS_CHANGE ) )
815 manager->PreFocusChangeSignal().Connect( tracker, functor );
817 else if( 0 == strcmp( signalName.c_str(), SIGNAL_FOCUS_CHANGED ) )
819 manager->FocusChangedSignal().Connect( tracker, functor );
821 else if( 0 == strcmp( signalName.c_str(), SIGNAL_FOCUS_GROUP_CHANGED ) )
823 manager->FocusGroupChangedSignal().Connect( tracker, functor );
825 else if( 0 == strcmp( signalName.c_str(), SIGNAL_FOCUSED_ACTOR_ENTER_KEY ) )
827 manager->FocusedActorEnterKeySignal().Connect( tracker, functor );
831 // signalName does not match any signal
838 } // namespace Internal
840 } // namespace Toolkit