// Take ownership of existing children
for( unsigned int childIndex = 0 ; childIndex < control.GetChildCount(); ++childIndex )
{
- ChildAddedToOwner( control.GetChildAt( childIndex ) );
+ ChildAddedToOwnerImpl( control.GetChildAt( childIndex ) );
}
DevelActor::ChildAddedSignal( control ).Connect( mSlotDelegate, &LayoutGroup::ChildAddedToOwner );
}
}
}
+
+ RequestLayout( Dali::Toolkit::LayoutTransitionData::Type::ON_OWNER_SET );
}
}
{
// Remove children
RemoveAll();
+
+ auto control = Toolkit::Control::DownCast( GetOwner() );
+ if( control )
+ {
+ DevelActor::ChildAddedSignal( control ).Disconnect( mSlotDelegate, &LayoutGroup::ChildAddedToOwner );
+ DevelActor::ChildRemovedSignal( control ).Disconnect( mSlotDelegate, &LayoutGroup::ChildRemovedFromOwner );
+ DevelActor::ChildOrderChangedSignal( control ).Disconnect( mSlotDelegate, &LayoutGroup::ChildOrderChanged );
+ DevelHandle::PropertySetSignal( control ).Disconnect( mSlotDelegate, &LayoutGroup::OnOwnerPropertySet );
+ }
}
void LayoutGroup::RemoveChild( LayoutItem& item )
void LayoutGroup::ChildAddedToOwner( Actor child )
{
+ ChildAddedToOwnerImpl( child );
+ RequestLayout( Dali::Toolkit::LayoutTransitionData::Type::ON_CHILD_ADD, child, Actor() );
+}
+
+void LayoutGroup::ChildAddedToOwnerImpl( Actor child )
+{
LayoutItemPtr childLayout;
Toolkit::Control control = Toolkit::Control::DownCast( child );
if( childLayout )
{
Remove( *childLayout.Get() );
+ RequestLayout( Dali::Toolkit::LayoutTransitionData::Type::ON_CHILD_REMOVE, child, Actor() );
}
}
}
bool exactWidth ( false );
bool exactHeight ( false );
- // Default Layouting behaviour if not overridden
+ // Layouting behaviour
// EXACT, width and height as provided.
- // MATCH_PARENT, width and hewidthSpecSizeight that of parent
-
+ // MATCH_PARENT, width and height that of parent
// WRAP_CONTENT, take width of widest child and height size of longest child (within given limit)
// UNSPECIFIED, take width of widest child and height size of longest child.
// Check below will be true for legacy containers and controls with layout required set.
// Other layouts will have their own OnMeasure (a checked requirement) hence not execute LayoutGroup::OnMeasure.
// Controls which have set layout required will not be legacy controls hence should not have a ResizePolicy set.
- if( childControl.GetChildCount() > 0 )
+ // Only need to map the resize policy the first time as the Layouting system will then set it to FIXED.
+ if( childControl.GetChildCount() > 0 && ! mImpl->mResizePolicyMapped )
{
// First pass, Static mappings that are not dependant on parent
SizeNegotiationMapper::SetLayoutParametersUsingResizePolicy( childControl, childLayout, Dimension::WIDTH );
SizeNegotiationMapper::SetLayoutParametersUsingResizePolicy( childControl, childLayout, Dimension::HEIGHT );
+ mImpl->mResizePolicyMapped = true;
}
// Second pass, if any mappings were not possible due to parent size dependancies then calculate an exact desired size for child