X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Flayouting%2Fhbox-layout-impl.cpp;h=7d9d094dba7cf5bb1ae792d2a6227b17151a4e9e;hp=181a036924f2eda65413fff47d27a54302ecb18d;hb=6fac737ed2bfcf649e3965240aa8f37d5cfcded8;hpb=16634ab902b66b0ba2f3f39af8ff6ed25b5f7115 diff --git a/dali-toolkit/internal/layouting/hbox-layout-impl.cpp b/dali-toolkit/internal/layouting/hbox-layout-impl.cpp index 181a036..7d9d094 100644 --- a/dali-toolkit/internal/layouting/hbox-layout-impl.cpp +++ b/dali-toolkit/internal/layouting/hbox-layout-impl.cpp @@ -22,14 +22,16 @@ #include #include #include -#include +#include #include #include - +namespace +{ #if defined(DEBUG_ENABLED) -static Debug::Filter* gLogFilter = Debug::Filter::New( Debug::Concise, false, "LOG_LAYOUT" ); +static Debug::Filter* gLogFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_LAYOUT" ); #endif +} namespace Dali { @@ -75,7 +77,7 @@ void HboxLayout::DoRegisterChildProperties( const std::string& containerType ) } } -void HboxLayout::OnChildAdd( LayoutBase& child ) +void HboxLayout::OnChildAdd( LayoutItem& child ) { auto owner = child.GetOwner(); owner.SetProperty( Toolkit::HboxLayout::ChildProperty::WEIGHT, 1.0f ); @@ -106,6 +108,8 @@ void HboxLayout::OnMeasure( MeasureSpec widthMeasureSpec, MeasureSpec heightMeas DALI_LOG_INFO( gLogFilter, Debug::Concise, oss.str().c_str() ); #endif + DALI_LOG_INFO( gLogFilter, Debug::Concise, "HboxLayout::OnMeasure widthSize(%d) \n", widthMeasureSpec.GetSize()); + auto widthMode = widthMeasureSpec.GetMode(); auto heightMode = heightMeasureSpec.GetMode(); bool isExactly = (widthMode == MeasureSpec::Mode::EXACTLY); @@ -126,11 +130,14 @@ void HboxLayout::OnMeasure( MeasureSpec widthMeasureSpec, MeasureSpec heightMeas if( childLayout ) { auto childOwner = childLayout->GetOwner(); - auto desiredHeight = childOwner.GetProperty( Toolkit::LayoutBase::ChildProperty::HEIGHT_SPECIFICATION ); + auto desiredHeight = childOwner.GetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION ); - MeasureChildWithMargins( childLayout, widthMeasureSpec, 0, heightMeasureSpec, 0 ); + MeasureChild( childLayout, widthMeasureSpec, heightMeasureSpec ); auto childWidth = childLayout->GetMeasuredWidth(); - auto childMargin = childOwner.GetProperty( Toolkit::LayoutGroup::ChildProperty::MARGIN_SPECIFICATION ); + auto childMargin = childLayout->GetMargin(); + + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "HboxLayout::OnMeasure childWidth(%d)\n", MeasureSpec::IntType( childWidth ) ); + auto length = childWidth + LayoutLength::IntType(childMargin.start + childMargin.end); auto cellPadding = iGetOwner(); - auto desiredWidth = childOwner.GetProperty( Toolkit::LayoutBase::ChildProperty::WIDTH_SPECIFICATION ); - auto desiredHeight = childOwner.GetProperty( Toolkit::LayoutBase::ChildProperty::HEIGHT_SPECIFICATION ); + auto desiredWidth = childOwner.GetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION ); + auto desiredHeight = childOwner.GetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION ); if( desiredHeight == Toolkit::ChildLayoutData::MATCH_PARENT ) { // Temporarily force children to reuse their old measured width int oldWidth = desiredWidth; - childOwner.SetProperty( Toolkit::LayoutBase::ChildProperty::WIDTH_SPECIFICATION, childLayout->GetMeasuredWidth().mValue ); + childOwner.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, childLayout->GetMeasuredWidth().mValue ); // Remeasure with new dimensions MeasureChildWithMargins( childLayout, widthMeasureSpec, 0, uniformMeasureSpec, 0); - childOwner.SetProperty( Toolkit::LayoutBase::ChildProperty::WIDTH_SPECIFICATION, oldWidth ); + childOwner.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, oldWidth ); } } } @@ -259,14 +266,13 @@ void HboxLayout::OnLayout( bool changed, LayoutLength left, LayoutLength top, La for( unsigned int i = 0; i < count; i++) { int childIndex = start + dir * i; - LayoutBasePtr childLayout = GetChildAt( childIndex ); + LayoutItemPtr childLayout = GetChildAt( childIndex ); if( childLayout != nullptr ) { auto childWidth = childLayout->GetMeasuredWidth(); auto childHeight = childLayout->GetMeasuredHeight(); - auto childOwner = childLayout->GetOwner(); - auto childMargin = childOwner.GetProperty( Toolkit::LayoutGroup::ChildProperty::MARGIN_SPECIFICATION ); + auto childMargin = childLayout->GetMargin(); childTop = LayoutLength(padding.top) + ((childSpace - childHeight) / 2) + childMargin.top - childMargin.bottom;