+bool Control::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
+{
+ Dali::BaseHandle handle( object );
+
+ bool connected( false );
+ Toolkit::Control control = Toolkit::Control::DownCast(handle);
+ if ( control )
+ {
+ Control& controlImpl( control.GetImplementation() );
+ connected = true;
+
+ if ( Toolkit::Control::SIGNAL_KEY_EVENT == signalName )
+ {
+ controlImpl.KeyEventSignal().Connect( tracker, functor );
+ }
+ else if( Toolkit::Control::SIGNAL_TAPPED == signalName )
+ {
+ controlImpl.EnableGestureDetection( Gesture::Tap );
+ controlImpl.GetTapGestureDetector().DetectedSignal().Connect( tracker, functor );
+ }
+ else if( Toolkit::Control::SIGNAL_PANNED == signalName )
+ {
+ controlImpl.EnableGestureDetection( Gesture::Pan );
+ controlImpl.GetPanGestureDetector().DetectedSignal().Connect( tracker, functor );
+ }
+ else if( Toolkit::Control::SIGNAL_PINCHED == signalName )
+ {
+ controlImpl.EnableGestureDetection( Gesture::Pinch );
+ controlImpl.GetPinchGestureDetector().DetectedSignal().Connect( tracker, functor );
+ }
+ else if( Toolkit::Control::SIGNAL_LONG_PRESSED == signalName )
+ {
+ controlImpl.EnableGestureDetection( Gesture::LongPress );
+ controlImpl.GetLongPressGestureDetector().DetectedSignal().Connect( tracker, functor );
+ }
+ else
+ {
+ // signalName does not match any signal
+ connected = false;
+ }
+ }
+ return connected;
+}
+