#include <dali/public-api/object/type-registry-helper.h>
#include <dali-toolkit/public-api/controls/control.h>
#include <dali-toolkit/devel-api/layouting/layout-item-impl.h>
+#include <dali-toolkit/devel-api/layouting/layout-group-impl.h>
#include <dali-toolkit/internal/layouting/layout-item-data-impl.h>
namespace
// Enable directly derived types to first remove children
OnUnparent();
+ // Remove myself from parent
+ LayoutParent* parent = GetParent();
+ if( parent )
+ {
+ parent->Remove( *this );
+ }
+
+ // Remove parent reference
+ SetParent(nullptr);
+
// Last, clear owner
mImpl->mOwner = NULL;
}
void LayoutItem::SetAnimateLayout( bool animateLayout )
{
+ DALI_LOG_INFO( gLayoutFilter, Debug::Verbose, "LayoutItem::SetAnimateLayout animateLayout(%s)\n", (animateLayout)?"true":"false" );
+
+ auto owner = GetOwner();
+ auto actor = Actor::DownCast(owner);
+
+ if( actor )
+ {
+ DALI_LOG_INFO( gLayoutFilter, Debug::Verbose, "LayoutItem::SetAnimateLayout animateLayout(%s) owner(%s)\n", (animateLayout)?"true":"false", actor.GetName().c_str() );
+ }
+
mImpl->mAnimated = animateLayout;
OnAnimationStateChanged( animateLayout );
#if defined(DEBUG_ENABLED)
std::ostringstream o;
o<<widthMeasureSpec<<","<<heightMeasureSpec;
- DALI_LOG_INFO( gLayoutFilter, Debug::Concise, "Calling %s OnMeasure( %s )\n", Actor::DownCast(GetOwner()).GetName().c_str(), o.str().c_str());
+ DALI_LOG_INFO( gLayoutFilter, Debug::Concise, "LayoutItem::Measure Calling %s OnMeasure( %s )\n", Actor::DownCast(GetOwner()).GetName().c_str(), o.str().c_str());
#endif
OnMeasure( widthMeasureSpec, heightMeasureSpec );
mImpl->ClearPrivateFlag( Impl::PRIVATE_FLAG_MEASURE_NEEDED_BEFORE_LAYOUT );
// flag not set, setMeasuredDimension() was not invoked, we raise an exception to warn the developer
DALI_ASSERT_ALWAYS( mImpl->GetPrivateFlag( Impl::PRIVATE_FLAG_MEASURED_DIMENSION_SET ) &&
- "Layout's OnMeasure() did not set the measured dimension by calling setMeasuredDimension()" );
+ "Layout's OnMeasure() mension()" );
mImpl->SetPrivateFlag( Impl::PRIVATE_FLAG_LAYOUT_REQUIRED );
}
void LayoutItem::Layout( LayoutLength l, LayoutLength t, LayoutLength r, LayoutLength b )
{
+ DALI_LOG_TRACE_METHOD( gLayoutFilter );
+
if( mImpl->GetPrivateFlag( Impl::PRIVATE_FLAG_MEASURE_NEEDED_BEFORE_LAYOUT ) )
{
OnMeasure( mImpl->mOldWidthMeasureSpec, mImpl->mOldHeightMeasureSpec );
{
Extents padding = control.GetProperty<Extents>( Toolkit::Control::Property::PADDING );
- DALI_LOG_INFO( gLayoutFilter, Debug::Verbose, "LayoutBase::Padding for %s : (%d,%d,%d,%d) \n",
+ DALI_LOG_INFO( gLayoutFilter, Debug::Verbose, "LayoutItem::Padding for %s : (%d,%d,%d,%d) \n",
control.GetName().c_str(),
padding.start, padding.end, padding.top, padding.bottom
);
void LayoutItem::OnMeasure( MeasureSpec widthMeasureSpec, MeasureSpec heightMeasureSpec)
{
+ DALI_LOG_INFO( gLayoutFilter, Debug::Verbose, "LayoutItem::OnMeasure\n");
+
SetMeasuredDimensions( GetDefaultSize( GetSuggestedMinimumWidth(), widthMeasureSpec ),
GetDefaultSize( GetSuggestedMinimumHeight(), heightMeasureSpec ) );
}
void LayoutItem::SetLayoutRequested()
{
- return mImpl->SetPrivateFlag( Impl::PRIVATE_FLAG_FORCE_LAYOUT );
+ mImpl->SetPrivateFlag( Impl::PRIVATE_FLAG_FORCE_LAYOUT );
}
void LayoutItem::SetMeasuredDimensions( MeasuredSize measuredWidth, MeasuredSize measuredHeight )
{
- DALI_LOG_INFO( gLayoutFilter, Debug::Verbose, "LayoutBase::SetMeasuredDimensions width(%d) height(%d) \n",
+ DALI_LOG_INFO( gLayoutFilter, Debug::Verbose, "LayoutItem::SetMeasuredDimensions width(%d) height(%d) \n",
MeasureSpec::IntType( measuredWidth.GetSize() ),
MeasureSpec::IntType( measuredHeight.GetSize() )
);
{
bool changed = false;
- DALI_LOG_INFO( gLayoutFilter, Debug::Verbose, "LayoutItem::SetFrame(%d, %d, %d, %d)\n", left.mValue, top.mValue, right.mValue, bottom.mValue );
+ DALI_LOG_INFO( gLayoutFilter, Debug::Verbose, "LayoutItem::SetFrame enter(%d, %d, %d, %d)\n", left.mValue, top.mValue, right.mValue, bottom.mValue );
if( mImpl->mLeft != left || mImpl->mRight != right || mImpl->mTop != top || mImpl->mBottom != bottom )
{
auto actor = Actor::DownCast(owner);
if( actor )
{
+ DALI_LOG_INFO( gLayoutFilter, Debug::Verbose, "LayoutItem::SetFrame owner(%s) (%d, %d, %d, %d)\n", actor.GetName().c_str(),
+ left.mValue, top.mValue, right.mValue, bottom.mValue );
if( mImpl->mAnimated )
{
auto animation = Animation::New( 0.5f );
- animation.AnimateTo( Property( actor, Actor::Property::POSITION ),
- Vector3( float(left.mValue), float(top.mValue), 0.0f ) );
- animation.AnimateTo( Property( actor, Actor::Property::SIZE ),
- Vector3( right-left, bottom-top, 0.0f ) );
+ animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), float( left.mValue ) );
+ animation.AnimateTo( Property( actor, Actor::Property::POSITION_Y ), float( top.mValue ) );
+
+ animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), float( newWidth ) );
+ animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), float( newHeight ) );
+
animation.FinishedSignal().Connect( mSlotDelegate, &LayoutItem::OnLayoutAnimationFinished );
animation.Play();
}
else
{
// @todo Collate into list of Property & Property::Value pairs.
- actor.SetPosition( Vector3( float(left.mValue), float(top.mValue), 0.0f ) );
- actor.SetSize( Vector3( right-left, bottom-top, 0.0f ) );
+ actor.SetX( float( left.mValue ) );
+ actor.SetY( float( top.mValue ) );
+ actor.SetProperty( Actor::Property::SIZE_WIDTH, float( newWidth ) );
+ actor.SetProperty( Actor::Property::SIZE_HEIGHT, float( newHeight ) );
}
}
SizeChange( LayoutSize( newWidth, newHeight ), LayoutSize( oldWidth, oldHeight ) );
}
}
+
+ DALI_LOG_INFO( gLayoutFilter, Debug::Verbose, "LayoutItem::SetFrame exit(%d, %d, %d, %d)\n", left.mValue, top.mValue, right.mValue, bottom.mValue );
+
return changed;
}