+/**
+ * Performs actions as requested using the action name.
+ * @param[in] object The object on which to perform the action.
+ * @param[in] actionName The action to perform.
+ * @param[in] attributes The attributes with which to perfrom this action.
+ * @return true if action has been accepted by this control
+ */
+const char* ACTION_CONTROL_ACTIVATED = "control-activated";
+static bool DoAction( BaseObject* object, const std::string& actionName, const Property::Map& attributes )
+{
+ bool ret = false;
+
+ if( object && ( 0 == strcmp( actionName.c_str(), ACTION_CONTROL_ACTIVATED ) ) )
+ {
+ Toolkit::Control control = Toolkit::Control::DownCast( BaseHandle( object ) );
+ if( control )
+ {
+ // if cast succeeds there is an implementation so no need to check
+ ret = Internal::GetImplementation( control ).OnAccessibilityActivated();
+ }
+ }
+
+ return ret;
+}
+
+/**
+ * Connects a callback function with the object's signals.
+ * @param[in] object The object providing the signal.
+ * @param[in] tracker Used to disconnect the signal.
+ * @param[in] signalName The signal to connect to.
+ * @param[in] functor A newly allocated FunctorDelegate.
+ * @return True if the signal was connected.
+ * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
+ */
+const char* SIGNAL_KEY_EVENT = "key-event";
+const char* SIGNAL_KEY_INPUT_FOCUS_GAINED = "key-input-focus-gained";
+const char* SIGNAL_KEY_INPUT_FOCUS_LOST = "key-input-focus-lost";
+const char* SIGNAL_TAPPED = "tapped";
+const char* SIGNAL_PANNED = "panned";
+const char* SIGNAL_PINCHED = "pinched";
+const char* SIGNAL_LONG_PRESSED = "long-pressed";
+static bool 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 )
+ {
+ Internal::Control& controlImpl( Internal::GetImplementation( control ) );
+ connected = true;
+
+ if ( 0 == strcmp( signalName.c_str(), SIGNAL_KEY_EVENT ) )
+ {
+ controlImpl.KeyEventSignal().Connect( tracker, functor );
+ }
+ else if( 0 == strcmp( signalName.c_str(), SIGNAL_KEY_INPUT_FOCUS_GAINED ) )
+ {
+ controlImpl.KeyInputFocusGainedSignal().Connect( tracker, functor );
+ }
+ else if( 0 == strcmp( signalName.c_str(), SIGNAL_KEY_INPUT_FOCUS_LOST ) )
+ {
+ controlImpl.KeyInputFocusLostSignal().Connect( tracker, functor );
+ }
+ else if( 0 == strcmp( signalName.c_str(), SIGNAL_TAPPED ) )
+ {
+ controlImpl.EnableGestureDetection( Gesture::Tap );
+ controlImpl.GetTapGestureDetector().DetectedSignal().Connect( tracker, functor );
+ }
+ else if( 0 == strcmp( signalName.c_str(), SIGNAL_PANNED ) )
+ {
+ controlImpl.EnableGestureDetection( Gesture::Pan );
+ controlImpl.GetPanGestureDetector().DetectedSignal().Connect( tracker, functor );
+ }
+ else if( 0 == strcmp( signalName.c_str(), SIGNAL_PINCHED ) )
+ {
+ controlImpl.EnableGestureDetection( Gesture::Pinch );
+ controlImpl.GetPinchGestureDetector().DetectedSignal().Connect( tracker, functor );
+ }
+ else if( 0 == strcmp( signalName.c_str(), SIGNAL_LONG_PRESSED ) )
+ {
+ controlImpl.EnableGestureDetection( Gesture::LongPress );
+ controlImpl.GetLongPressGestureDetector().DetectedSignal().Connect( tracker, functor );
+ }
+ }
+ return connected;
+}
+