X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;ds=sidebyside;f=dali%2Finternal%2Fevent%2Factors%2Factor-parent-impl.cpp;h=e26f129ed5daa98e02ea823a2f1381cb162b5257;hb=743603c4a76d89874f58e7c014b05236b445037a;hp=41a6e2ce8192a95672dd03f036403a35327057b8;hpb=1d83f1cb15cdd04e6567ca3d8fb8346aa8cfdc24;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/event/actors/actor-parent-impl.cpp b/dali/internal/event/actors/actor-parent-impl.cpp index 41a6e2c..e26f129 100644 --- a/dali/internal/event/actors/actor-parent-impl.cpp +++ b/dali/internal/event/actors/actor-parent-impl.cpp @@ -18,6 +18,7 @@ #include // INTERNAL INCLUDES +#include #include #include #include @@ -100,7 +101,7 @@ void ActorParentImpl::Add(Actor& child, bool notify) EmitChildAddedSignal(child); } - child.InheritLayoutDirectionRecursively(mOwner.GetLayoutDirection()); + child.mParentImpl.InheritLayoutDirectionRecursively(mOwner.GetLayoutDirection()); // Only put in a relayout request if there is a suitable dependency if(mOwner.RelayoutDependentOnChildren()) @@ -414,6 +415,107 @@ void ActorParentImpl::LowerChildBelow(Actor& child, Actor& target) } } +void ActorParentImpl::DepthTraverseActorTree(OwnerPointer& sceneGraphNodeDepths, + int32_t& depthIndex) +{ + uint32_t sortedDepth = depthIndex * DevelLayer::SIBLING_ORDER_MULTIPLIER; + mOwner.SetSortingDepth(sortedDepth); + sceneGraphNodeDepths->Add(const_cast(&mOwner.GetNode()), sortedDepth); + + // Create/add to children of this node + if(mChildren) + { + for(const auto& actor : *mChildren) + { + ++depthIndex; + actor->mParentImpl.DepthTraverseActorTree(sceneGraphNodeDepths, depthIndex); + } + } +} + +void ActorParentImpl::RecursiveConnectToScene(ActorContainer& connectionList, uint32_t depth) +{ + DALI_ASSERT_ALWAYS(!mOwner.OnScene()); + + mOwner.mIsOnScene = true; + mOwner.mDepth = static_cast(depth); // overflow ignored, not expected in practice + mOwner.ConnectToSceneGraph(); + + // Notification for internal derived classes + mOwner.OnSceneConnectionInternal(); + + // This stage is atomic; avoid emitting callbacks until all Actors are connected + connectionList.push_back(ActorPtr(&mOwner)); + + // Recursively connect children + if(mChildren) + { + for(const auto& actor : *mChildren) + { + actor->SetScene(*mOwner.mScene); + actor->mParentImpl.RecursiveConnectToScene(connectionList, depth + 1); + } + } +} + +void ActorParentImpl::RecursiveDisconnectFromScene(ActorContainer& disconnectionList) +{ + // need to change state first so that internals relying on IsOnScene() inside OnSceneDisconnectionInternal() get the correct value + mOwner.mIsOnScene = false; + + // Recursively disconnect children + if(mChildren) + { + for(const auto& actor : *mChildren) + { + actor->mParentImpl.RecursiveDisconnectFromScene(disconnectionList); + } + } + + // This stage is atomic; avoid emitting callbacks until all Actors are disconnected + disconnectionList.push_back(ActorPtr(&mOwner)); + + // Notification for internal derived classes + mOwner.OnSceneDisconnectionInternal(); + mOwner.DisconnectFromSceneGraph(); +} + +void ActorParentImpl::InheritLayoutDirectionRecursively(Dali::LayoutDirection::Type direction, bool set) +{ + if(mOwner.mInheritLayoutDirection || set) + { + if(mOwner.mLayoutDirection != direction) + { + mOwner.mLayoutDirection = direction; + mOwner.EmitLayoutDirectionChangedSignal(direction); + mOwner.RelayoutRequest(); + } + + if(mChildren) + { + for(const auto& child : *mChildren) + { + child->mParentImpl.InheritLayoutDirectionRecursively(direction); + } + } + } +} + +void ActorParentImpl::EmitVisibilityChangedSignalRecursively( + bool visible, + DevelActor::VisibilityChange::Type type) +{ + mOwner.EmitVisibilityChangedSignal(visible, type); + + if(mChildren) + { + for(const auto& child : *mChildren) + { + child->mParentImpl.EmitVisibilityChangedSignalRecursively(visible, DevelActor::VisibilityChange::PARENT); + } + } +} + void ActorParentImpl::EmitChildAddedSignal(Actor& child) { EmitSignal(child, mChildAddedSignal);