void LayoutItem::Initialize( Handle& owner, const std::string& containerType )
{
- mImpl->mOwner = &(owner.GetBaseObject());
+ mImpl->mOwner = owner;
RegisterChildProperties( containerType );
OnInitialize(); // Ensure direct deriving class gets initialized
}
Handle LayoutItem::GetOwner() const
{
- return Handle::DownCast(BaseHandle(mImpl->mOwner));
+ return mImpl->mOwner.GetHandle();
}
void LayoutItem::Unparent()
SetParent(nullptr);
// Last, clear owner
- mImpl->mOwner = NULL;
+ mImpl->mOwner.Reset();
}
LayoutTransitionDataPtr LayoutItem::GetDefaultTransition()
}
LayoutData& layoutData = *mImpl->sLayoutData;
- size_t size = layoutData.childrenPropertyAnimators.size();
+ size_t size = layoutData.childrenLayoutDataArray.size();
bool changed = SetFrame( l, t, r, b );
mImpl->ClearPrivateFlag( Impl::PRIVATE_FLAG_LAYOUT_REQUIRED );
}
- if ( size != layoutData.childrenPropertyAnimators.size() )
+ if ( size != layoutData.childrenLayoutDataArray.size() )
{
- layoutData.childrenPropertyAnimators.resize( size );
+ layoutData.childrenLayoutDataArray.resize( size );
}
mImpl->ClearPrivateFlag( Impl::PRIVATE_FLAG_FORCE_LAYOUT );
Extents LayoutItem::GetPadding() const
{
- Toolkit::Control control = Toolkit::Control::DownCast( mImpl->mOwner );
+ Toolkit::Control control = Toolkit::Control::DownCast( GetOwner() );
if( control )
{
Extents padding = control.GetProperty<Extents>( Toolkit::Control::Property::PADDING );
Extents LayoutItem::GetMargin() const
{
- Toolkit::Control control = Toolkit::Control::DownCast( mImpl->mOwner );
+ Toolkit::Control control = Toolkit::Control::DownCast( GetOwner() );
if ( control )
{
return control.GetProperty<Extents>( Toolkit::Control::Property::MARGIN );
void LayoutItem::RequestLayout()
{
- Toolkit::Control control = Toolkit::Control::DownCast( mImpl->mOwner );
+ Toolkit::Control control = Toolkit::Control::DownCast( GetOwner() );
if( control )
{
DALI_LOG_INFO( gLayoutFilter, Debug::Verbose, "LayoutItem::RequestLayout control(%s)\n",
control.GetName().c_str() );
+
+ // @todo Enforce failure if called in Measure/Layout passes.
+ mImpl->SetPrivateFlag( Impl::PRIVATE_FLAG_FORCE_LAYOUT );
+ Toolkit::LayoutController layoutController = Toolkit::LayoutController::Get();
+ layoutController.RequestLayout( Toolkit::LayoutItem( this ) );
}
- // @todo Enforce failure if called in Measure/Layout passes.
- mImpl->SetPrivateFlag( Impl::PRIVATE_FLAG_FORCE_LAYOUT );
- Toolkit::LayoutController layoutController = Toolkit::LayoutController::Get();
- layoutController.RequestLayout( Toolkit::LayoutItem( this ) );
}
void LayoutItem::RequestLayout( Dali::Toolkit::LayoutTransitionData::Type layoutAnimationType )
{
- Toolkit::Control control = Toolkit::Control::DownCast( mImpl->mOwner );
+ Toolkit::Control control = Toolkit::Control::DownCast( GetOwner() );
if ( control )
{
DALI_LOG_INFO( gLayoutFilter, Debug::Verbose, "LayoutItem::RequestLayout control(%s) layoutTranstionType(%d)\n",
control.GetName().c_str(), (int)layoutAnimationType );
+
+ // @todo Enforce failure if called in Measure/Layout passes.
+ mImpl->SetPrivateFlag( Impl::PRIVATE_FLAG_FORCE_LAYOUT );
+ Toolkit::LayoutController layoutController = Toolkit::LayoutController::Get();
+ layoutController.RequestLayout( Toolkit::LayoutItem(this), layoutAnimationType );
}
- // @todo Enforce failure if called in Measure/Layout passes.
- mImpl->SetPrivateFlag( Impl::PRIVATE_FLAG_FORCE_LAYOUT );
- Toolkit::LayoutController layoutController = Toolkit::LayoutController::Get();
- layoutController.RequestLayout( Toolkit::LayoutItem(this), layoutAnimationType );
}
void LayoutItem::RequestLayout( Dali::Toolkit::LayoutTransitionData::Type layoutAnimationType, Actor gainedChild, Actor lostChild )
{
- Toolkit::Control control = Toolkit::Control::DownCast( mImpl->mOwner );
+ Toolkit::Control control = Toolkit::Control::DownCast( GetOwner() );
if ( control )
{
DALI_LOG_INFO( gLayoutFilter, Debug::Verbose, "LayoutItem::RequestLayout control(%s) layoutTranstionType(%d)\n",
control.GetName().c_str(), (int)layoutAnimationType );
+
+ // @todo Enforce failure if called in Measure/Layout passes.
+ mImpl->SetPrivateFlag( Impl::PRIVATE_FLAG_FORCE_LAYOUT );
+ Toolkit::LayoutController layoutController = Toolkit::LayoutController::Get();
+ layoutController.RequestLayout( Toolkit::LayoutItem(this), layoutAnimationType, gainedChild, lostChild );
}
- // @todo Enforce failure if called in Measure/Layout passes.
- mImpl->SetPrivateFlag( Impl::PRIVATE_FLAG_FORCE_LAYOUT );
- Toolkit::LayoutController layoutController = Toolkit::LayoutController::Get();
- layoutController.RequestLayout( Toolkit::LayoutItem(this), layoutAnimationType, gainedChild, lostChild );
}
bool LayoutItem::IsLayoutRequested() const
LayoutLength LayoutItem::GetMeasuredWidth() const
{
// Get the size portion of the measured width
- return mImpl->mMeasuredWidth.GetSize();
+ return mImpl->mMeasuredWidth.GetSize();
}
LayoutLength LayoutItem::GetMeasuredHeight() const
LayoutLength LayoutItem::GetSuggestedMinimumWidth() const
{
auto owner = GetOwner();
- auto actor = Actor::DownCast(owner);
+ auto actor = Actor::DownCast( owner );
auto naturalSize = actor ? actor.GetNaturalSize() : Vector3::ZERO;
return std::max( mImpl->mMinimumSize.GetWidth(), LayoutLength( naturalSize.width ) );
LayoutLength LayoutItem::GetSuggestedMinimumHeight() const
{
auto owner = GetOwner();
- auto actor = Actor::DownCast(owner);
+ auto actor = Actor::DownCast( owner );
auto naturalSize = actor ? actor.GetNaturalSize() : Vector3::ZERO;
return std::max( mImpl->mMinimumSize.GetHeight(), LayoutLength( naturalSize.height ) );
auto owner = GetOwner();
auto actor = Actor::DownCast( owner );
LayoutData& layoutData = *mImpl->sLayoutData;
+
if( actor )
{
- if( mImpl->mAnimated && !layoutData.speculativeLayout )
+ if( changed || mImpl->mAnimated )
{
- LayoutItem* transitionOwner = layoutData.layoutTransition.layoutItem.Get();
- LayoutTransitionDataPtr layoutTransitionDataPtr = GetTransitionData( layoutData.layoutTransition.layoutTransitionType );
+ layoutData.layoutPositionDataArray.push_back(
+ LayoutPositionData( actor, left.AsDecimal(), top.AsDecimal(), right.AsDecimal(), bottom.AsDecimal(), mImpl->mAnimated ) );
+ }
- // Found transition owner
- if( transitionOwner == this && layoutTransitionDataPtr.Get() )
+ if( mImpl->mAnimated && !layoutData.speculativeLayout )
+ {
+ if( layoutData.layoutTransition.layoutTransitionType != -1 )
{
- DALI_LOG_INFO( gLayoutFilter, Debug::Verbose, "LayoutItem::SetFrame apply transition to (%s), transition type (%d)\n", actor.GetName().c_str(), layoutData.layoutTransition.layoutTransitionType );
- layoutData.layoutPositionDataArray.push_back( LayoutPositionData( actor, left.AsDecimal(), top.AsDecimal(), right.AsDecimal(), bottom.AsDecimal(), true ) );
- layoutTransitionDataPtr->ConvertToLayoutDataElements( actor, layoutData );
- changed = true;
+ LayoutItem* transitionOwner = layoutData.layoutTransition.layoutItem.Get();
+ LayoutTransitionDataPtr layoutTransitionDataPtr = GetTransitionData( layoutData.layoutTransition.layoutTransitionType );
+
+ // Found transition owner
+ if( transitionOwner == this && layoutTransitionDataPtr.Get() )
+ {
+ DALI_LOG_INFO( gLayoutFilter, Debug::Verbose, "LayoutItem::SetFrame apply transition to (%s), transition type (%d)\n", actor.GetName().c_str(), layoutData.layoutTransition.layoutTransitionType );
+ layoutTransitionDataPtr->CollectLayoutDataElements( actor, layoutData );
+ changed = true;
+ }
+ else
+ {
+ LayoutTransitionData::CollectChildrenLayoutDataElements( actor, layoutData );
+ }
}
else
{
if( changed )
{
- layoutTransitionDataPtr = GetTransitionData( Dali::Toolkit::LayoutTransitionData::ON_LAYOUT_CHANGE );
- if ( layoutTransitionDataPtr )
+ LayoutTransitionDataPtr layoutTransitionDataPtr = GetTransitionData( Dali::Toolkit::LayoutTransitionData::ON_LAYOUT_CHANGE );
+ if( layoutTransitionDataPtr ) // has custom default animation and normal update
{
DALI_LOG_INFO( gLayoutFilter, Debug::Verbose, "LayoutItem::SetFrame apply custom default transition to (%s), transition type (%d)\n", actor.GetName().c_str(), Dali::Toolkit::LayoutTransitionData::ON_LAYOUT_CHANGE );
- layoutData.layoutPositionDataArray.push_back( LayoutPositionData( actor, left.AsDecimal(), top.AsDecimal(), right.AsDecimal(), bottom.AsDecimal(), true ) );
- layoutTransitionDataPtr->ConvertToLayoutDataElements( actor, layoutData );
+ layoutTransitionDataPtr->CollectLayoutDataElements( actor, layoutData );
}
else
{
DALI_LOG_INFO( gLayoutFilter, Debug::Verbose, "LayoutItem::SetFrame apply default transition to (%s), transition type (%d)\n", actor.GetName().c_str(), layoutData.layoutTransition.layoutTransitionType );
- layoutData.layoutPositionDataArray.push_back( LayoutPositionData( actor, left.AsDecimal(), top.AsDecimal(), right.AsDecimal(), bottom.AsDecimal(), true ) );
- GetDefaultTransition()->ConvertToLayoutDataElements( actor, layoutData );
+ GetDefaultTransition()->CollectLayoutDataElements( actor, layoutData );
}
}
- else
- {
- DALI_LOG_INFO( gLayoutFilter, Debug::Verbose, "LayoutItem::SetFrame apply children animators to (%s), transition type (%d)\n", actor.GetName().c_str(), layoutData.layoutTransition.layoutTransitionType );
- layoutData.layoutPositionDataArray.push_back( LayoutPositionData( actor, left.AsDecimal(), top.AsDecimal(), right.AsDecimal(), bottom.AsDecimal(), true ) );
- LayoutTransitionData::ConvertChildrenAnimatorsToLayoutDataElements( actor, layoutData );
- }
- }
- }
- else
- {
- if( changed )
- {
- layoutData.layoutPositionDataArray.push_back( LayoutPositionData( actor, left.AsDecimal(), top.AsDecimal(), right.AsDecimal(), bottom.AsDecimal(), false ) );
}
}
}