mParentImpl.UnparentChildren();
}
-void Actor::ConnectToScene(uint32_t parentDepth)
+void Actor::ConnectToScene(uint32_t parentDepth, bool notify)
{
// This container is used instead of walking the Actor hierarchy.
// It protects us when the Actor hierarchy is modified during OnSceneConnectionExternal callbacks.
// Notify applications about the newly connected actors.
for(const auto& actor : connectionList)
{
- actor->NotifyStageConnection();
+ actor->NotifyStageConnection(notify);
}
RelayoutRequest();
OnSceneObjectAdd();
}
-void Actor::NotifyStageConnection()
+void Actor::NotifyStageConnection(bool notify)
{
// Actors can be removed (in a callback), before the on-stage stage is reported.
// The actor may also have been reparented, in which case mOnSceneSignalled will be true.
if(OnScene() && !mOnSceneSignalled)
{
- // Notification for external (CustomActor) derived classes
- OnSceneConnectionExternal(mDepth);
-
- if(!mOnSceneSignal.Empty())
+ if(notify)
{
- Dali::Actor handle(this);
- mOnSceneSignal.Emit(handle);
+ // Notification for external (CustomActor) derived classes
+ OnSceneConnectionExternal(mDepth);
+
+ if(!mOnSceneSignal.Empty())
+ {
+ Dali::Actor handle(this);
+ mOnSceneSignal.Emit(handle);
+ }
}
// Guard against Remove during callbacks
}
}
-void Actor::DisconnectFromStage()
+void Actor::DisconnectFromStage(bool notify)
{
// This container is used instead of walking the Actor hierachy.
// It protects us when the Actor hierachy is modified during OnSceneDisconnectionExternal callbacks.
// Notify applications about the newly disconnected actors.
for(const auto& actor : disconnectionList)
{
- actor->NotifyStageDisconnection();
+ actor->NotifyStageDisconnection(notify);
}
}
OnSceneObjectRemove();
}
-void Actor::NotifyStageDisconnection()
+void Actor::NotifyStageDisconnection(bool notify)
{
// Actors can be added (in a callback), before the off-stage state is reported.
// Also if the actor was added & removed before mOnSceneSignalled was set, then we don't notify here.
// only do this step if there is a stage, i.e. Core is not being shut down
if(EventThreadServices::IsCoreRunning() && !OnScene() && mOnSceneSignalled)
{
- // Notification for external (CustomeActor) derived classes
- OnSceneDisconnectionExternal();
-
- if(!mOffSceneSignal.Empty())
+ if(notify)
{
- Dali::Actor handle(this);
- mOffSceneSignal.Emit(handle);
+ // Notification for external (CustomeActor) derived classes
+ OnSceneDisconnectionExternal();
+
+ if(!mOffSceneSignal.Empty())
+ {
+ Dali::Actor handle(this);
+ mOffSceneSignal.Emit(handle);
+ }
}
// Guard against Add during callbacks
}
}
-void Actor::SetParent(ActorParent* parent, bool keepOnScene)
+void Actor::SetParent(ActorParent* parent, bool notify)
{
if(parent)
{
mScene = parentActor->mScene;
if(EventThreadServices::IsCoreRunning() && // Don't emit signals or send messages during Core destruction
- parentActor->OnScene() && !keepOnScene)
+ parentActor->OnScene())
{
// Instruct each actor to create a corresponding node in the scene graph
- ConnectToScene(parentActor->GetHierarchyDepth());
+ ConnectToScene(parentActor->GetHierarchyDepth(), notify);
}
// Resolve the name and index for the child properties if any
mParent = nullptr;
if(EventThreadServices::IsCoreRunning() && // Don't emit signals or send messages during Core destruction
- OnScene() && !keepOnScene)
+ OnScene())
{
// Disconnect the Node & its children from the scene-graph.
DisconnectNodeMessage(GetEventThreadServices().GetUpdateManager(), GetNode());
// Instruct each actor to discard pointers to the scene-graph
- DisconnectFromStage();
+ DisconnectFromStage(notify);
}
mScene = nullptr;
/**
* Called on a child during Add() when the parent actor is connected to the Scene.
* @param[in] parentDepth The depth of the parent in the hierarchy.
+ * @param[in] notify Emits notification if set to true.
*/
- void ConnectToScene(uint32_t parentDepth);
+ void ConnectToScene(uint32_t parentDepth, bool notify);
/**
* Helper for ConnectToScene, to recursively connect a tree of actors.
/**
* Helper for ConnectToScene, to notify a connected actor through the public API.
+ * @param[in] notify Emits notification if set to true.
*/
- void NotifyStageConnection();
+ void NotifyStageConnection(bool notify);
/**
* Called on a child during Remove() when the actor was previously on the Stage.
+ * @param[in] notify Emits notification if set to true.
*/
- void DisconnectFromStage();
+ void DisconnectFromStage(bool notify);
/**
* Helper for DisconnectFromStage, to recursively disconnect a tree of actors.
/**
* Helper for DisconnectFromStage, to notify a disconnected actor through the public API.
+ * @param[in] notify Emits notification if set to true.
*/
- void NotifyStageDisconnection();
+ void NotifyStageDisconnection(bool notify);
/**
* When the Actor is OnScene, checks whether the corresponding Node is connected to the scene graph.
/**
* Set the actor's parent.
* @param[in] parent The new parent.
- * @param[in] keepOnScene Keep this actor to be on Scene if this is true.
+ * @param[in] notify Emits notification if set to true. Default is true.
*/
- void SetParent(ActorParent* parent, bool keepOnScene = false);
+ void SetParent(ActorParent* parent, bool notify = true);
/**
* For use in derived classes, called after Initialize()