{
if( iter->layoutId == childId )
{
- OnChildRemove( *iter->child.Get() );
+ RemoveChild( *iter->child.Get() );
mImpl->mChildren.erase(iter);
break;
}
{
if( iter->child.Get() == &child )
{
- OnChildRemove( *iter->child.Get() );
+ RemoveChild( *iter->child.Get() );
mImpl->mChildren.erase(iter);
break;
}
{
for( auto iter = mImpl->mChildren.begin() ; iter != mImpl->mChildren.end() ; )
{
- OnChildRemove( *iter->child.Get() );
+ RemoveChild( *iter->child.Get() );
iter = mImpl->mChildren.erase(iter);
}
}
DevelActor::ChildAddedSignal( control ).Connect( mSlotDelegate, &LayoutGroup::ChildAddedToOwner );
DevelActor::ChildRemovedSignal( control ).Connect( mSlotDelegate, &LayoutGroup::ChildRemovedFromOwner );
+ DevelActor::ChildOrderChangedSignal( control ).Connect( mSlotDelegate, &LayoutGroup::ChildOrderChanged );
DevelHandle::PropertySetSignal( control ).Connect( mSlotDelegate, &LayoutGroup::OnOwnerPropertySet );
if( control.GetParent() )
{
// Remove children
RemoveAll();
+}
- // Remove myself from parent
- LayoutParent* parent = GetParent();
- if( parent )
- {
- LayoutGroupPtr parentGroup( dynamic_cast< LayoutGroup* >( parent ) );
- if( parentGroup )
- {
- parentGroup->Remove( *this );
- }
- }
+void LayoutGroup::RemoveChild( LayoutItem& item )
+{
+ item.SetParent( nullptr );
+ OnChildRemove( item );
}
void LayoutGroup::ChildAddedToOwner( Actor child )
{
LayoutItemPtr childLayout;
Toolkit::Control control = Toolkit::Control::DownCast( child );
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "LayoutGroup::ChildAddedToOwner(%s)\n", control.GetName().c_str() );
+
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "LayoutGroup::ChildAddedToOwner control(%s)\n", control?control.GetName().c_str():"Invalid" );
if( control ) // Can only support adding Controls, not Actors to layout
{
#endif
childControlDataImpl.SetLayout( *childLayout.Get() );
+ Vector3 size = child.GetTargetSize();
+ // If the size of the control is set explicitly make sure that the control size
+ // stays the same after the layout except it is over written with match parent specs.
+ if ( size.x != 0 )
+ {
+ childLayout->SetMinimumWidth( size.x );
+ }
+
+ if ( size.y != 0 )
+ {
+ childLayout->SetMinimumHeight( size.y );
+ }
// 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() );
}
}
}
+void LayoutGroup::ChildOrderChanged()
+{
+ RequestLayout();
+ // Force Children to be relaid out:
+ for( auto&& child : mImpl->mChildren )
+ {
+ child.child->SetLayoutRequested();
+ }
+}
+
void LayoutGroup::OnOwnerPropertySet( Handle& handle, Property::Index index, Property::Value value )
{
DALI_LOG_INFO( gLogFilter, Debug::Concise, "LayoutGroup::OnOwnerPropertySet\n");
}
}
+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