Inherit parent's layout animation
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-api / layouting / layout-group-impl.cpp
index fd30091..428ac89 100644 (file)
@@ -471,6 +471,15 @@ void LayoutGroup::ChildAddedToOwner( Actor child )
 
       // Default layout data will be generated by Add().
     }
+    else
+    {
+      LayoutGroupPtr layoutGroup( dynamic_cast< LayoutGroup* >( childLayout.Get() ) );
+      if( !layoutGroup )
+      {
+        // Set only in case of leaf children
+        childLayout->SetAnimateLayout( IsLayoutAnimated() );
+      }
+    }
 
     Add( *childLayout.Get() );
   }
@@ -507,6 +516,20 @@ void LayoutGroup::OnOwnerPropertySet( Handle& handle, Property::Index index, Pro
   }
 }
 
+void LayoutGroup::OnAnimationStateChanged( bool animateLayout )
+{
+  // Change children's animation state
+  for( auto&& child : mImpl->mChildren )
+  {
+    LayoutGroupPtr parentGroup( dynamic_cast< LayoutGroup* >( child.child.Get() ) );
+    if( !parentGroup )
+    {
+      // Change state only in case of leaf children
+      child.child->SetAnimateLayout( animateLayout );
+    }
+  }
+}
+
 } // namespace Internal
 } // namespace Toolkit
 } // namespace Dali