const bool needsLayout = specChanged && ( !isSpecExactly || !matchesSpecSize );
- DALI_LOG_STREAM( gLayoutFilter, Debug::General, "LayoutItem::Measure("<<widthMeasureSpec<<", "<<heightMeasureSpec<<") Owner:"<<Actor::DownCast(GetOwner()).GetName() <<" forceLayout="<<forceLayout<<", specChanged="<<specChanged<<", isSpecExactly="<<isSpecExactly<<", matchesSpecSize="<<matchesSpecSize<<", needsLayout="<<needsLayout <<std::endl <<(forceLayout||needsLayout?" Remeasuring":" NoChange"));
+ DALI_LOG_STREAM( gLayoutFilter, Debug::Verbose, "LayoutItem::Measure("<<widthMeasureSpec<<", "<<heightMeasureSpec<<") Owner:"
+ <<Actor::DownCast(GetOwner()).GetName() <<" forceLayout="<<forceLayout
+ <<", specChanged="<<specChanged<<", isSpecExactly="<<isSpecExactly
+ <<", matchesSpecSize="<<matchesSpecSize
+ <<", needsLayout="<<needsLayout <<(forceLayout||needsLayout?" Remeasuring":" NoChange"));
if( forceLayout || needsLayout )
{
auto specMode = measureSpec.GetMode();
auto specSize = measureSpec.GetSize();
+ DALI_LOG_STREAM( gLayoutFilter, Debug::Verbose, "LayoutItem::GetDefaultSize MeasureSpec("<<measureSpec<< ") size:" << size << "\n" );
+
switch (specMode)
{
case MeasureSpec::Mode::UNSPECIFIED:
}
case MeasureSpec::Mode::AT_MOST:
{
+ // Ensure the default size does not exceed the spec size unless the default size is 0.
+ // Another container could provide a default size of 0.
LayoutLength tmp = specSize;
- if( size < tmp )
+
+ // Do not set size to 0, use specSize in this case as could be a legacy container
+ if( size < tmp && size > LayoutLength( 0 ) )
{
result = size;
}
break;
}
}
+ DALI_LOG_STREAM( gLayoutFilter, Debug::General, "LayoutItem::GetDefaultSize setting default size:" << result << "\n" );
return result;
}
{
DALI_LOG_INFO( gLayoutFilter, Debug::Verbose, "LayoutItem::OnMeasure\n");
+ // GetDefaultSize will limit the MeasureSpec to the suggested minimumWidth and minimumHeight
SetMeasuredDimensions( GetDefaultSize( GetSuggestedMinimumWidth(), widthMeasureSpec ),
GetDefaultSize( GetSuggestedMinimumHeight(), heightMeasureSpec ) );
}
void LayoutItem::SetParent( LayoutParent* parent )
{
mImpl->mLayoutParent = parent;
- if ( parent == nullptr )
- {
- mImpl->ClearPrivateFlag( Impl::PRIVATE_FLAG_FORCE_SET_FRAME );
- }
+ mImpl->SetPrivateFlag( Impl::PRIVATE_FLAG_FORCE_SET_FRAME );
}
LayoutParent* LayoutItem::GetParent()
mImpl->SetPrivateFlag( Impl::PRIVATE_FLAG_FORCE_LAYOUT );
}
+bool LayoutItem::IsResizePolicyRequired() const
+{
+ return mImpl->GetPrivateFlag( Impl::PRIVATE_FLAG_USE_RESIZE_POLICY );
+}
+
+void LayoutItem::SetResizePolicyRequired( bool resizePolicyRequired )
+{
+ if( resizePolicyRequired )
+ {
+ mImpl->SetPrivateFlag( Impl::PRIVATE_FLAG_USE_RESIZE_POLICY );
+ }
+ else
+ {
+ mImpl->ClearPrivateFlag( Impl::PRIVATE_FLAG_USE_RESIZE_POLICY );
+ }
+}
+
void LayoutItem::SetMeasuredDimensions( MeasuredSize measuredWidth, MeasuredSize measuredHeight )
{
- DALI_LOG_STREAM( gLayoutFilter, Debug::Verbose, "LayoutItem::SetMeasuredDimensions width(" << measuredWidth.GetSize() << ") height(" << measuredHeight.GetSize() << ") \n" );
+
+ DALI_LOG_STREAM( gLayoutFilter, Debug::Verbose, "LayoutItem::SetMeasuredDimensions width(" << measuredWidth.GetSize() << ") height(" << measuredHeight.GetSize() << ") Control:" <<
+ ( ( Actor::DownCast( GetOwner()) ) ? Actor::DownCast(GetOwner()).GetName().c_str() : "Invalid Actor" ) << "\n" );
mImpl->SetPrivateFlag( Impl::PRIVATE_FLAG_MEASURED_DIMENSION_SET );
mImpl->mMeasuredWidth = measuredWidth;
DALI_LOG_STREAM( gLayoutFilter, Debug::Verbose, "LayoutItem::SetFrame enter(" << left << ", " << top << ", " << right << ", " << bottom << ")\n" );
- if( mImpl->mLeft != left || mImpl->mRight != right || mImpl->mTop != top || mImpl->mBottom != bottom || !mImpl->GetPrivateFlag( Impl::PRIVATE_FLAG_FORCE_SET_FRAME ) )
+ if( mImpl->mLeft != left || mImpl->mRight != right || mImpl->mTop != top || mImpl->mBottom != bottom || mImpl->GetPrivateFlag( Impl::PRIVATE_FLAG_FORCE_SET_FRAME ) )
{
changed = true;
mImpl->mRight = right;
mImpl->mBottom = bottom;
- mImpl->SetPrivateFlag( Impl::PRIVATE_FLAG_FORCE_SET_FRAME );
+ mImpl->ClearPrivateFlag( Impl::PRIVATE_FLAG_FORCE_SET_FRAME );
// Reflect up to parent control