+/**
+ * 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.
+ */
+static bool DoConnectSignal(BaseObject* object,
+ ConnectionTrackerInterface* tracker,
+ const std::string& signalName,
+ FunctorDelegate* functor)
+{
+ bool connected(true);
+ Actor* actor = static_cast<Actor*>(object); // TypeRegistry guarantees that this is the correct type.
+
+ std::string_view name(signalName);
+
+ if(name == SIGNAL_HOVERED)
+ {
+ actor->HoveredSignal().Connect(tracker, functor);
+ }
+ else if(signalName == SIGNAL_WHEEL_EVENT)
+ {
+ actor->WheelEventSignal().Connect(tracker, functor);
+ }
+ else if(name == SIGNAL_ON_SCENE)
+ {
+ actor->OnSceneSignal().Connect(tracker, functor);
+ }
+ else if(name == SIGNAL_OFF_SCENE)
+ {
+ actor->OffSceneSignal().Connect(tracker, functor);
+ }
+ else if(name == SIGNAL_ON_RELAYOUT)
+ {
+ actor->OnRelayoutSignal().Connect(tracker, functor);
+ }
+ else if(name == SIGNAL_TOUCHED)
+ {
+ actor->TouchedSignal().Connect(tracker, functor);
+ }
+ else if(name == SIGNAL_VISIBILITY_CHANGED)
+ {
+ actor->VisibilityChangedSignal().Connect(tracker, functor);
+ }
+ else if(name == SIGNAL_LAYOUT_DIRECTION_CHANGED)
+ {
+ actor->LayoutDirectionChangedSignal().Connect(tracker, functor);
+ }
+ else if(name == SIGNAL_CHILD_ADDED)
+ {
+ actor->ChildAddedSignal().Connect(tracker, functor);
+ }
+ else if(name == SIGNAL_CHILD_REMOVED)
+ {
+ actor->ChildRemovedSignal().Connect(tracker, functor);
+ }
+ else
+ {
+ // signalName does not match any signal
+ connected = false;
+ }
+
+ return connected;
+}
+
+/**
+ * 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 the action was done.
+ */
+bool DoAction(BaseObject* object,
+ const std::string& actionName,
+ const Property::Map& attributes)
+{
+ bool done = false;
+ Actor* actor = dynamic_cast<Actor*>(object);
+
+ if(actor)
+ {
+ std::string_view name(actionName);
+ if(name == ACTION_SHOW)
+ {
+ actor->SetVisible(true);
+ done = true;
+ }
+ else if(name == ACTION_HIDE)
+ {
+ actor->SetVisible(false);
+ done = true;
+ }
+ }
+
+ return done;
+}
+