return layout;
}
-void CustomLayout::MeasureChildren( Dali::Toolkit::Internal::LayoutItemPtr childLayout, MeasureSpec widthMeasureSpec, MeasureSpec heightMeasureSpec, int resultingWidth, int resultingHeight )
+void CustomLayout::MeasureChildren( Dali::Toolkit::Internal::LayoutItemPtr childLayout, MeasureSpec widthMeasureSpec, MeasureSpec heightMeasureSpec, LayoutLength resultingWidth, LayoutLength resultingHeight )
{
// Initially use the measure spec of the child's parent
auto childWidthMeasureSpec = widthMeasureSpec;
MeasureChild( childLayout, childWidthMeasureSpec, childHeightMeasureSpec );
resultingWidth += childLayout->GetMeasuredWidth();
- resultingHeight = std::max( childLayout->GetMeasuredHeight().mValue, resultingHeight );
+ resultingHeight = std::max( childLayout->GetMeasuredHeight(), resultingHeight );
}
void CustomLayout::OnMeasure( MeasureSpec widthMeasureSpec, MeasureSpec heightMeasureSpec )
LayoutLength childLeft( 0 );
// We want to vertically align the children to the middle
- auto height = bottom - top;
- auto middle = height / 2;
+ LayoutLength height = bottom - top;
+ LayoutLength middle = height / 2;
auto owner = GetOwner();
auto actor = Actor::DownCast(owner);
// Horizontally align the children to the left
int count = actor.GetChildCount();
- int currentLeft = 0;
+ LayoutLength currentLeft = 0;
for( int i = 0; i < count; i++)
{
{
Dali::Toolkit::Internal::LayoutItem& childLayoutImpl = GetImplementation( childLayout );
- auto childWidth = childLayoutImpl.GetMeasuredWidth();
- auto childHeight = childLayoutImpl.GetMeasuredHeight();
+ LayoutLength childWidth = childLayoutImpl.GetMeasuredWidth();
+ LayoutLength childHeight = childLayoutImpl.GetMeasuredHeight();
childTop = middle - (childHeight / 2);
childLayoutImpl.Layout( currentLeft, childTop, currentLeft + childWidth, childTop + childHeight );
* @param[out] resultingWidth resulting width of layout after children are measured
* @param[out] resultingHeight resulting height of layout after children are measured
*/
- void MeasureChildren( Dali::Toolkit::Internal::LayoutItemPtr childLayout, MeasureSpec widthMeasureSpec, MeasureSpec heightMeasureSpec, int resultingWidth, int resultingHeight );
+ void MeasureChildren( Dali::Toolkit::Internal::LayoutItemPtr childLayout, MeasureSpec widthMeasureSpec, MeasureSpec heightMeasureSpec, LayoutLength resultingWidth, LayoutLength resultingHeight );
private:
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "LayoutGroup::MeasureChildWithMargins desiredWidth(%d)\n", desiredWidth );
MeasureSpec childWidthMeasureSpec = GetChildMeasureSpec( parentWidthMeasureSpec,
- padding.start + padding.end +
+ LayoutLength( padding.start + padding.end ) +
widthUsed, desiredWidth );
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "LayoutGroup::MeasureChildWithMargins desiredHeight(%d)\n", desiredHeight );
MeasureSpec childHeightMeasureSpec = GetChildMeasureSpec( parentHeightMeasureSpec,
- padding.top + padding.bottom +
+ LayoutLength( padding.top + padding.bottom )+
heightUsed, desiredHeight );
child->Measure( childWidthMeasureSpec, childHeightMeasureSpec );
auto specMode = measureSpec.GetMode();
LayoutLength specSize = measureSpec.GetSize();
- auto size = std::max( LayoutLength(0), specSize - padding ); // reduce available size by the owners padding
+ LayoutLength size = std::max( LayoutLength(0), specSize - padding ); // reduce available size by the owners padding
- MeasureSpec::IntType resultSize = 0;
+ LayoutLength resultSize = 0;
MeasureSpec::Mode resultMode = MeasureSpec::Mode::UNSPECIFIED;
switch( specMode )
}
}
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "LayoutGroup::GetChildMeasureSpec resultSize(%u)\n", resultSize );
-
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "LayoutGroup::GetChildMeasureSpec resultSize(%u)\n", resultSize.mValue );
//noinspection ResourceType
return MeasureSpec( resultSize, resultMode );
void LayoutItem::SetMeasuredDimensions( MeasuredSize measuredWidth, MeasuredSize measuredHeight )
{
DALI_LOG_INFO( gLayoutFilter, Debug::Verbose, "LayoutItem::SetMeasuredDimensions width(%d) height(%d) \n",
- MeasureSpec::IntType( measuredWidth.GetSize() ),
- MeasureSpec::IntType( measuredHeight.GetSize() )
- );
+ measuredWidth.GetSize().mValue, measuredHeight.GetSize().mValue );
mImpl->SetPrivateFlag( Impl::PRIVATE_FLAG_MEASURED_DIMENSION_SET );
mImpl->mMeasuredWidth = measuredWidth;
{
changed = true;
- auto oldWidth = mImpl->mRight - mImpl->mLeft;
- auto oldHeight = mImpl->mBottom - mImpl->mTop;
- auto newWidth = right - left;
- auto newHeight = bottom - top;
+ LayoutLength oldWidth = mImpl->mRight - mImpl->mLeft;
+ LayoutLength oldHeight = mImpl->mBottom - mImpl->mTop;
+ LayoutLength newWidth = right - left;
+ LayoutLength newHeight = bottom - top;
bool sizeChanged = (newWidth != oldWidth) || (newHeight != oldHeight);
mImpl->mLeft = left;
if( mImpl->mAnimated )
{
auto animation = Animation::New( 0.5f );
- 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::POSITION_X ), left.AsFloat() );
+ animation.AnimateTo( Property( actor, Actor::Property::POSITION_Y ), top.AsFloat() );
- animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), float( newWidth ) );
- animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), float( newHeight ) );
+ animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), newWidth.AsFloat() );
+ animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), newHeight.AsFloat() );
animation.FinishedSignal().Connect( mSlotDelegate, &LayoutItem::OnLayoutAnimationFinished );
animation.Play();
else
{
// @todo Collate into list of Property & Property::Value pairs.
- 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 ) );
+ actor.SetX( left.AsFloat() );
+ actor.SetY( top.AsFloat() );
+ actor.SetProperty( Actor::Property::SIZE_WIDTH, newWidth.AsFloat() );
+ actor.SetProperty( Actor::Property::SIZE_HEIGHT, newHeight.AsFloat() );
}
}
auto actor = Actor::DownCast(owner);
if( actor )
{
- actor.SetSize( Vector3( mImpl->mRight-mImpl->mLeft, mImpl->mBottom-mImpl->mTop, 0.0f ) );
+ actor.SetSize( Vector3( mImpl->mRight.AsFloat() - mImpl->mLeft.AsFloat(), mImpl->mBottom.AsFloat() - mImpl->mTop.AsFloat(), 0.0f ) );
}
}
public:
using IntType = int;
+ LayoutLength()
+ : mValue( 0 )
+ {
+ }
+
LayoutLength( IntType value )
: mValue( value )
{
}
LayoutLength operator*( float rhs )
{
- return LayoutLength(LayoutLength::IntType(float(mValue) * rhs));
+ return LayoutLength(LayoutLength::IntType(AsFloat() * rhs));
}
- operator float()
+ /**
+ * @brief explicit method to return the value as float
+ * @return the LayoutLength as float
+ */
+ float AsFloat() const
{
- return float( mValue );
+ return static_cast<float>( mValue );
}
IntType mValue;
{
}
+ LayoutSize( LayoutLength anX, LayoutLength aY )
+ : x( anX.mValue ),
+ y( aY.mValue )
+ {
+ }
+
LayoutSize( const LayoutSize& layoutSize )
: x( layoutSize.x ),
y( layoutSize.y )
class DALI_TOOLKIT_API MeasureSpec
{
public:
- using IntType = LayoutLength::IntType;
enum class Mode
{
};
MeasureSpec( LayoutLength measureSpec, MeasureSpec::Mode mode )
- : mSize( measureSpec.mValue ),
+ : mSize( measureSpec ),
mMode( mode )
{
}
- MeasureSpec( IntType measureSpec )
+ MeasureSpec( LayoutLength measureSpec )
: mSize( measureSpec ),
mMode( Mode::UNSPECIFIED )
{
}
/**
+ * @brief Set the mode of the measure spec.
+ *
+ * @param mode The mode to set
+ */
+ void SetMode( MeasureSpec::Mode mode )
+ {
+ mMode = mode;
+ }
+
+ /**
* @brief Get the mode of the measure spec.
*
* @return The mode of the measure spec
}
/**
+ * @brief Set the size of the measure spec
+ *
+ * @param size the size to set
+ */
+ void SetSize( LayoutLength size )
+ {
+ mSize = size;
+ }
+
+ /**
* @brief Get the size of the measure spec
*
* @return the size of the measure spec
*/
- IntType GetSize() const
+ LayoutLength GetSize() const
{
return mSize;
}
return MeasureSpec( size, MeasureSpec::Mode::UNSPECIFIED );
}
- if( delta < 0 && measureSpec.mSize < static_cast<IntType>(abs(delta)) )
+ if( delta < 0 && measureSpec.mSize < abs(delta) )
{
size = 0;
}
return MeasureSpec( size, mode );
}
-public:
- IntType mSize; ///< The specified size
+private:
+
+ LayoutLength mSize; ///< The specified size
Mode mMode; ///< The measure mode
+
};
inline std::ostream& operator<< (std::ostream& o, const MeasureSpec& measureSpec )
MeasuredSize::State heightState;
} childState = { MeasuredSize::State::MEASURED_SIZE_OK, MeasuredSize::State::MEASURED_SIZE_OK };
- auto minPosition = Vector3( Vector3::ZERO );
- auto maxPosition = Vector3( Vector3::ZERO );
+ LayoutLength minPositionX( 0 );
+ LayoutLength minPositionY( 0 );
+ LayoutLength maxPositionX( 0 );
+ LayoutLength maxPositionY( 0 );
// measure children
for( unsigned int i=0; i<GetChildCount(); ++i )
// Get size of child
MeasureChild( childLayout, widthMeasureSpec, heightMeasureSpec );
- auto childWidth = childLayout->GetMeasuredWidth();
- auto childHeight = childLayout->GetMeasuredHeight();
+ LayoutLength childWidth = childLayout->GetMeasuredWidth();
+ LayoutLength childHeight = childLayout->GetMeasuredHeight();
// Determine the width and height needed by the children using their given position and size.
// Children could overlap so find the left most and right most child.
auto childPosition = childOwner.GetProperty< Vector3 >( Actor::Property::POSITION );
- minPosition.x = std::min( minPosition.x, childPosition.x );
- maxPosition.x = std::max( maxPosition.x, childPosition.x + childWidth );
+ LayoutLength childLeft = childPosition.x;
+ LayoutLength childTop = childPosition.y;
+
+ minPositionX = std::min( minPositionX, childLeft );
+ maxPositionX = std::max( maxPositionX, childLeft + childWidth );
// Children could overlap so find the highest and lowest child.
- minPosition.y = std::min( minPosition.y, childPosition.y );
- maxPosition.y = std::max( maxPosition.y, childPosition.y + childHeight );
+ minPositionY = std::min( minPositionY, childTop );
+ maxPositionY = std::max( maxPositionY, childTop + childHeight );
// Store current width and height needed to contain all children.
- totalWidth = maxPosition.x - minPosition.x;
- totalHeight = maxPosition.y - minPosition.y;
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "AbsoluteLayout::OnMeasure child width(%f) height(%f) \n", (float)totalWidth, (float)totalHeight );
+ totalWidth = maxPositionX - minPositionX;
+ totalHeight = maxPositionY - minPositionY;
+ DALI_LOG_INFO( gLogFilter, Debug::Concise, "AbsoluteLayout::OnMeasure child width(%f) height(%f) \n", totalWidth.AsFloat(), totalHeight.AsFloat() );
if( childLayout->GetMeasuredWidthAndState().GetState() == MeasuredSize::State::MEASURED_SIZE_TOO_SMALL )
{
if( childLayout != nullptr )
{
auto childOwner = childLayout->GetOwner();
- auto childWidth = childLayout->GetMeasuredWidth();
- auto childHeight = childLayout->GetMeasuredHeight();
+ LayoutLength childWidth = childLayout->GetMeasuredWidth();
+ LayoutLength childHeight = childLayout->GetMeasuredHeight();
auto childPosition = childOwner.GetProperty< Vector3 >( Actor::Property::POSITION );
- auto childTop = childPosition.y;
- auto childLeft = childPosition.x;
+ LayoutLength childTop = childPosition.y;
+ LayoutLength childLeft = childPosition.x;
DALI_LOG_INFO( gLogFilter, Debug::General, "AbsoluteLayout::OnLayout child[%s] position(%f,%f) child width[%d] height(%d)\n",
Toolkit::Control::DownCast( childOwner ).GetName().c_str(),
if( widthMeasureSpec.GetMode() == MeasureSpec::Mode::EXACTLY )
{
- width = widthMeasureSpec.GetSize();
+ width = widthMeasureSpec.GetSize().AsFloat();
YGNodeStyleSetWidth( mRoot, width );
}
else if( widthMeasureSpec.GetMode() == MeasureSpec::Mode::AT_MOST )
{
- width = widthMeasureSpec.GetSize();
+ width = widthMeasureSpec.GetSize().AsFloat();
YGNodeStyleSetMaxWidth( mRoot, width );
}
if ( heightMeasureSpec.GetMode() == MeasureSpec::Mode::EXACTLY )
{
- height = heightMeasureSpec.GetSize();
+ height = heightMeasureSpec.GetSize().AsFloat();
YGNodeStyleSetHeight( mRoot, height );
}
else if ( heightMeasureSpec.GetMode() == MeasureSpec::Mode::AT_MOST )
{
- height = heightMeasureSpec.GetSize();
+ height = heightMeasureSpec.GetSize().AsFloat();
YGNodeStyleSetMaxHeight( mRoot, height );
}
auto owner = GetOwner();
auto actor = Actor::DownCast(owner);
bool isLayoutRtl = actor ? actor.GetProperty( Actor::Property::LAYOUT_DIRECTION ).Get<int>() == LayoutDirection::RIGHT_TO_LEFT: false;
- auto width = right - left;
- auto height = bottom - top;
+ LayoutLength width = right - left;
+ LayoutLength height = bottom - top;
#if defined(DEBUG_ENABLED)
std::ostringstream oss;
DALI_LOG_INFO( gLogFilter, Debug::Concise, oss.str().c_str() );
#endif
- YGNodeCalculateLayout( mRoot, width, height, isLayoutRtl ? YGDirectionRTL : YGDirectionLTR );
+ YGNodeCalculateLayout( mRoot, width.AsFloat(), height.AsFloat(), isLayoutRtl ? YGDirectionRTL : YGDirectionLTR );
auto count = GetChildCount();
for( unsigned int childIndex = 0; childIndex < count; childIndex++)
if( childLayout != nullptr )
{
YGNodeRef node = YGNodeGetChild(mRoot, childIndex);
- auto childLeft = YGNodeLayoutGetLeft( node ) + left;
- auto childTop = YGNodeLayoutGetTop( node ) + top;
- auto childWidth = YGNodeLayoutGetWidth( node );
- auto childHeight = YGNodeLayoutGetHeight( node );
+ LayoutLength childLeft = LayoutLength( YGNodeLayoutGetLeft( node ) ) + left;
+ LayoutLength childTop = LayoutLength( YGNodeLayoutGetTop( node ) ) + top;
+ LayoutLength childWidth = LayoutLength( YGNodeLayoutGetWidth( node ) );
+ LayoutLength childHeight = LayoutLength( YGNodeLayoutGetHeight( node ) );
childLayout->Layout( childLeft, childTop, childLeft + childWidth, childTop + childHeight );
}
}
// Remove padding here since Yoga doesn't consider it as a part of the node size
Extents padding = childLayout->GetPadding();
- auto measuredWidth = childLayout->GetMeasuredWidth() - padding.end - padding.start;
- auto measuredHeight = childLayout->GetMeasuredHeight() - padding.bottom - padding.top;
+ LayoutLength measuredWidth = childLayout->GetMeasuredWidth() - padding.end - padding.start;
+ LayoutLength measuredHeight = childLayout->GetMeasuredHeight() - padding.bottom - padding.top;
return YGSize{
- .width = measuredWidth,
- .height = measuredHeight,
+ .width = measuredWidth.AsFloat(),
+ .height = measuredHeight.AsFloat(),
};
}
LayoutLength widthSize = widthMeasureSpec.GetSize();
LayoutLength heightSize = heightMeasureSpec.GetSize();
- int availableContentWidth(0);
- int availableContentHeight(0);
+ LayoutLength availableContentWidth( 0 );
+ LayoutLength availableContentHeight( 0 );
LayoutLength desiredChildHeight( 0 );
LayoutLength desiredChildWidth( 0 );
mTotalWidth = std::min( mTotalWidth, widthSize );
}
- availableContentWidth = mTotalWidth - gridLayoutPadding.start - gridLayoutPadding.end;
+ availableContentWidth = mTotalWidth.mValue - gridLayoutPadding.start - gridLayoutPadding.end;
widthSize = mTotalWidth;
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Grid::OnMeasure availableContentWidth(%d) mTotalWidth(%d) \n",
- availableContentWidth,
+ availableContentWidth.mValue,
mTotalWidth.mValue );
// HEIGHT SPECIFICATIONS
}
// If number of columns not defined
- DetermineNumberOfColumns( availableContentWidth );
+ DetermineNumberOfColumns( availableContentWidth.mValue );
// Locations define the start, end,top and bottom of each cell.
- mLocations->CalculateLocations( mNumColumns, availableContentWidth, availableContentHeight, childCount, 0, 0 );
+ mLocations->CalculateLocations( mNumColumns, availableContentWidth.mValue, availableContentHeight.mValue, childCount, 0, 0 );
SetMeasuredDimensions( ResolveSizeAndState( widthSize, widthMeasureSpec, MeasuredSize::State::MEASURED_SIZE_OK ),
LayoutLength alternativeMaxHeight = 0;
LayoutLength weightedMaxHeight = 0;
float totalWeight = 0;
- int usedExcessSpace = 0;
+ LayoutLength usedExcessSpace = 0;
struct
{
MeasuredSize::State widthState;
if( childLayout )
{
auto childOwner = childLayout->GetOwner();
- auto desiredHeight = childOwner.GetProperty<int>( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION );
- auto desiredWidth = childOwner.GetProperty<int>( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION );
- auto childWeight = childOwner.GetProperty<float>( Toolkit::LinearLayout::ChildProperty::WEIGHT );
- auto childMargin = childLayout->GetMargin();
+ LayoutLength desiredHeight = childOwner.GetProperty<int>( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION );
+ LayoutLength desiredWidth = childOwner.GetProperty<int>( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION );
+ float childWeight = childOwner.GetProperty<float>( Toolkit::LinearLayout::ChildProperty::WEIGHT );
+ Extents childMargin = childLayout->GetMargin();
totalWeight += childWeight;
// this child is only laid out using excess space. Measure
// using WRAP_CONTENT so that we can find out the view's
// optimal width.
- auto padding = GetPadding();
+ Extents padding = GetPadding();
const MeasureSpec childWidthMeasureSpec = GetChildMeasureSpec( widthMeasureSpec, padding.start + padding.end, Toolkit::ChildLayoutData::WRAP_CONTENT );
const MeasureSpec childHeightMeasureSpec = GetChildMeasureSpec( heightMeasureSpec, padding.top + padding.bottom, desiredHeight );
childLayout->Measure( childWidthMeasureSpec, childHeightMeasureSpec );
childWidth = childLayout->GetMeasuredWidth();
}
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "LinearLayout::OnMeasure childWidth(%d)\n", MeasureSpec::IntType( childWidth ) );
- auto length = childWidth + LayoutLength::IntType( childMargin.start + childMargin.end );
- auto cellPadding = i < GetChildCount() - 1 ? mCellPadding.width : 0;
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "LinearLayout::OnMeasure childWidth(%d)\n", childWidth.mValue );
+ LayoutLength length = childWidth + LayoutLength::IntType( childMargin.start + childMargin.end );
+ LayoutLength cellPadding = i < GetChildCount() - 1 ? mCellPadding.width : 0;
if( isExactly )
{
mTotalLength += length;
}
else
{
- auto totalLength = mTotalLength;
+ LayoutLength totalLength = mTotalLength;
mTotalLength = std::max( totalLength, totalLength + length + cellPadding );
}
}
matchHeightLocally = true;
}
- auto marginHeight = LayoutLength( childMargin.top + childMargin.bottom );
- auto childHeight = childLayout->GetMeasuredHeight() + marginHeight;
+ LayoutLength marginHeight = childMargin.top + childMargin.bottom;
+ LayoutLength childHeight = childLayout->GetMeasuredHeight() + marginHeight;
if( childLayout->GetMeasuredWidthAndState().GetState() == MeasuredSize::State::MEASURED_SIZE_TOO_SMALL )
{
Extents padding = GetPadding();
mTotalLength += padding.start + padding.end;
- auto widthSize = mTotalLength;
+ LayoutLength widthSize = mTotalLength;
widthSize = std::max( widthSize, GetSuggestedMinimumWidth() );
MeasuredSize widthSizeAndState = ResolveSizeAndState( widthSize, widthMeasureSpec, MeasuredSize::State::MEASURED_SIZE_OK);
widthSize = widthSizeAndState.GetSize();
// We cycle through weighted children now (children with weight > 0).
// The children are measured with exact size equal to their share of the available space based on their weights.
// mTotalLength is updated to include weighted children measured sizes.
- int remainingExcess = widthSize - mTotalLength + usedExcessSpace;
+ LayoutLength remainingExcess = widthSize - mTotalLength + usedExcessSpace;
if( remainingExcess != 0 && totalWeight > 0 )
{
float remainingWeightSum = totalWeight;
{
auto childLayout = GetChildAt( i );
auto childOwner = childLayout->GetOwner();
- auto desiredWidth = childOwner.GetProperty<int>( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION );
- auto desiredHeight = childOwner.GetProperty<int>( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION );
- auto childWeight = childOwner.GetProperty<float>( Toolkit::LinearLayout::ChildProperty::WEIGHT );
- auto childMargin = childLayout->GetMargin();
+ LayoutLength desiredWidth = childOwner.GetProperty<int>( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION );
+ LayoutLength desiredHeight = childOwner.GetProperty<int>( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION );
+ float childWeight = childOwner.GetProperty<float>( Toolkit::LinearLayout::ChildProperty::WEIGHT );
+ Extents childMargin = childLayout->GetMargin();
LayoutLength childWidth = 0;
if( childWeight > 0 )
{
- int share = static_cast<int>( childWeight * remainingExcess / remainingWeightSum );
+ LayoutLength share = (childWeight * remainingExcess.mValue) / remainingWeightSum;
remainingExcess -= share;
remainingWeightSum -= childWeight;
}
}
- auto length = childLayout->GetMeasuredWidth() + LayoutLength::IntType( childMargin.start + childMargin.end );
- auto cellPadding = i < GetChildCount() - 1 ? mCellPadding.width : 0;
+ LayoutLength length = childLayout->GetMeasuredWidth() + LayoutLength( childMargin.start + childMargin.end );
+ LayoutLength cellPadding = i < GetChildCount() - 1 ? mCellPadding.width : 0;
if( isExactly )
{
mTotalLength += length;
}
else
{
- auto totalLength = mTotalLength;
+ LayoutLength totalLength = mTotalLength;
mTotalLength = std::max( totalLength, totalLength + length + cellPadding );
}
bool matchHeightLocally = heightMode != MeasureSpec::Mode::EXACTLY && desiredHeight == Toolkit::ChildLayoutData::MATCH_PARENT;
- auto marginHeight = LayoutLength( childMargin.top + childMargin.bottom );
- auto childHeight = childLayout->GetMeasuredHeight() + marginHeight;
+ LayoutLength marginHeight = childMargin.top + childMargin.bottom;
+ LayoutLength childHeight = childLayout->GetMeasuredHeight() + marginHeight;
maxHeight = std::max( maxHeight, childHeight );
alternativeMaxHeight = std::max( alternativeMaxHeight, matchHeightLocally ? marginHeight : childHeight );
// Pretend that the linear layout has an exact size. This is the measured height of
// ourselves. The measured height should be the max height of the children, changed
// to accommodate the heightMeasureSpec from the parent
- auto uniformMeasureSpec = MeasureSpec( GetMeasuredHeight(), MeasureSpec::Mode::EXACTLY );
+ MeasureSpec uniformMeasureSpec( GetMeasuredHeight(), MeasureSpec::Mode::EXACTLY );
for (int i = 0; i < count; ++i)
{
LayoutItemPtr childLayout = GetChildAt(i);
if( childLayout != nullptr )
{
auto childOwner = childLayout->GetOwner();
- auto desiredWidth = childOwner.GetProperty<int>( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION );
- auto desiredHeight = childOwner.GetProperty<int>( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION );
+ LayoutLength desiredWidth = childOwner.GetProperty<int>( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION );
+ LayoutLength desiredHeight = childOwner.GetProperty<int>( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION );
if( desiredHeight == Toolkit::ChildLayoutData::MATCH_PARENT )
{
// Temporarily force children to reuse their old measured width
- int oldWidth = desiredWidth;
+ LayoutLength oldWidth = desiredWidth;
childOwner.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, childLayout->GetMeasuredWidth().mValue );
// Remeasure with new dimensions
- MeasureChildWithMargins( childLayout, widthMeasureSpec, 0, uniformMeasureSpec, 0);
+ MeasureChildWithMargins( childLayout, widthMeasureSpec, 0, uniformMeasureSpec, 0 );
- childOwner.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, oldWidth );
+ childOwner.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, oldWidth.mValue );
}
}
}
LayoutLength childLeft( padding.start );
// Where bottom of child should go
- auto height = bottom - top;
+ LayoutLength height = bottom - top;
// Space available for child
- auto childSpace = height - padding.top - padding.bottom;
+ LayoutLength childSpace = height - padding.top - padding.bottom;
auto count = GetChildCount();
{
// mTotalLength contains the padding already
// In case of RTL map BEGIN alignment to the right edge
- if ( isLayoutRtl ) {
+ if ( isLayoutRtl )
+ {
childLeft = LayoutLength( padding.start ) + right - left - mTotalLength;
}
- else {
+ else
+ {
childLeft = LayoutLength( padding.start );
}
break;
{
// mTotalLength contains the padding already
// In case of RTL map END alignment to the left edge
- if ( isLayoutRtl ) {
+ if ( isLayoutRtl )
+ {
childLeft = LayoutLength( padding.start );
}
- else {
+ else
+ {
childLeft = LayoutLength( padding.start ) + right - left - mTotalLength;
}
break;
int dir = 1;
// In case of RTL, start drawing from the last child.
- if( isLayoutRtl ) {
+ if( isLayoutRtl )
+ {
start = count - 1;
dir = -1;
}
LayoutItemPtr childLayout = GetChildAt( childIndex );
if( childLayout != nullptr )
{
- auto childWidth = childLayout->GetMeasuredWidth();
- auto childHeight = childLayout->GetMeasuredHeight();
- auto childMargin = childLayout->GetMargin();
+ LayoutLength childWidth = childLayout->GetMeasuredWidth();
+ LayoutLength childHeight = childLayout->GetMeasuredHeight();
+ Extents childMargin = childLayout->GetMargin();
switch ( mAlignment & VERTICAL_ALIGNMENT_MASK )
{
LayoutLength alternativeMaxWidth = 0;
LayoutLength weightedMaxWidth = 0;
float totalWeight = 0;
- int usedExcessSpace = 0;
+ LayoutLength usedExcessSpace = 0;
struct
{
MeasuredSize::State widthState;
if( childLayout )
{
auto childOwner = childLayout->GetOwner();
- auto desiredWidth = childOwner.GetProperty<int>( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION );
- auto desiredHeight = childOwner.GetProperty<int>( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION );
- auto childWeight = childOwner.GetProperty<float>( Toolkit::LinearLayout::ChildProperty::WEIGHT );
- auto childMargin = childLayout->GetMargin();
+ LayoutLength desiredWidth = childOwner.GetProperty<int>( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION );
+ LayoutLength desiredHeight = childOwner.GetProperty<int>( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION );
+ float childWeight = childOwner.GetProperty<float>( Toolkit::LinearLayout::ChildProperty::WEIGHT );
+ Extents childMargin = childLayout->GetMargin();
totalWeight += childWeight;
// using WRAP_CONTENT so that we can find out the view's
// optimal height. We'll restore the original height of 0
// after measurement.
- auto padding = GetPadding();
+ Extents padding = GetPadding();
const MeasureSpec childWidthMeasureSpec = GetChildMeasureSpec( widthMeasureSpec, padding.start + padding.end, desiredWidth );
const MeasureSpec childHeightMeasureSpec = GetChildMeasureSpec( heightMeasureSpec, padding.top + padding.bottom, Toolkit::ChildLayoutData::WRAP_CONTENT );
childLayout->Measure( childWidthMeasureSpec, childHeightMeasureSpec );
childHeight = childLayout->GetMeasuredHeight();
}
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "LinearLayout::MeasureVertical childHeight(%d)\n", MeasureSpec::IntType( childHeight ) );
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "LinearLayout::MeasureVertical childHeight(%d)\n", childHeight.mValue );
- auto length = childHeight + LayoutLength::IntType( childMargin.top + childMargin.bottom );
- auto cellPadding = i < GetChildCount() - 1 ? mCellPadding.height : 0;
- auto totalLength = mTotalLength;
+ LayoutLength length = childHeight + LayoutLength::IntType( childMargin.top + childMargin.bottom );
+ LayoutLength cellPadding = i < GetChildCount() - 1 ? mCellPadding.height : 0;
+ LayoutLength totalLength = mTotalLength;
mTotalLength = std::max( totalLength, totalLength + length + cellPadding );
}
matchWidthLocally = true;
}
- auto marginWidth = LayoutLength( childMargin.start + childMargin.end );
- auto childWidth = childLayout->GetMeasuredWidth() + marginWidth;
+ LayoutLength marginWidth = childMargin.start + childMargin.end;
+ LayoutLength childWidth = childLayout->GetMeasuredWidth() + marginWidth;
// was combineMeasuredStates()
if( childLayout->GetMeasuredWidthAndState().GetState() == MeasuredSize::State::MEASURED_SIZE_TOO_SMALL )
Extents padding = GetPadding();
mTotalLength += padding.top + padding.bottom;
- auto heightSize = mTotalLength;
+ LayoutLength heightSize = mTotalLength;
heightSize = std::max( heightSize, GetSuggestedMinimumHeight() );
MeasuredSize heightSizeAndState = ResolveSizeAndState( heightSize, heightMeasureSpec, MeasuredSize::State::MEASURED_SIZE_OK);
heightSize = heightSizeAndState.GetSize();
// We cycle through weighted children now (children with weight > 0).
// The children are measured with exact size equal to their share of the available space based on their weights.
// mTotalLength is updated to include weighted children measured sizes.
- int remainingExcess = heightSize - mTotalLength + usedExcessSpace;
+ LayoutLength remainingExcess = heightSize - mTotalLength + usedExcessSpace;
if( remainingExcess != 0 && totalWeight > 0.0f )
{
float remainingWeightSum = totalWeight;
{
auto childLayout = GetChildAt( i );
auto childOwner = childLayout->GetOwner();
- auto desiredWidth = childOwner.GetProperty<int>( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION );
- auto desiredHeight = childOwner.GetProperty<int>( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION );
- auto childWeight = childOwner.GetProperty<float>( Toolkit::LinearLayout::ChildProperty::WEIGHT );
- auto childMargin = childLayout->GetMargin();
+ LayoutLength desiredWidth = childOwner.GetProperty<int>( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION );
+ LayoutLength desiredHeight = childOwner.GetProperty<int>( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION );
+ float childWeight = childOwner.GetProperty<float>( Toolkit::LinearLayout::ChildProperty::WEIGHT );
+ Extents childMargin = childLayout->GetMargin();
LayoutLength childHeight = 0;
if( childWeight > 0 )
{
- int share = static_cast<int>( childWeight * remainingExcess / remainingWeightSum );
+ LayoutLength share = (childWeight * remainingExcess.mValue) / remainingWeightSum;
remainingExcess -= share;
remainingWeightSum -= childWeight;
matchWidthLocally = true;
}
- auto marginWidth = LayoutLength( childMargin.start + childMargin.end );
- auto childWidth = childLayout->GetMeasuredWidth() + marginWidth;
+ LayoutLength marginWidth = childMargin.start + childMargin.end;
+ LayoutLength childWidth = childLayout->GetMeasuredWidth() + marginWidth;
maxWidth = std::max( maxWidth, childWidth );
allFillParent = allFillParent && desiredWidth == Toolkit::ChildLayoutData::MATCH_PARENT;
alternativeMaxWidth = std::max( alternativeMaxWidth, matchWidthLocally ? marginWidth : childWidth );
childHeight = childLayout->GetMeasuredHeight();
- auto length = childHeight + LayoutLength::IntType( childMargin.top + childMargin.bottom );
- auto cellPadding = i < GetChildCount() - 1 ? mCellPadding.height : 0;
- auto totalLength = mTotalLength;
+ LayoutLength length = childHeight + LayoutLength::IntType( childMargin.top + childMargin.bottom );
+ LayoutLength cellPadding = i < GetChildCount() - 1 ? mCellPadding.height : 0;
+ LayoutLength totalLength = mTotalLength;
mTotalLength = std::max( totalLength, totalLength + length + cellPadding );
}
void LinearLayout::ForceUniformWidth( int count, MeasureSpec heightMeasureSpec )
{
// Pretend that the linear layout has an exact size.
- auto uniformMeasureSpec = MeasureSpec( GetMeasuredWidth(), MeasureSpec::Mode::EXACTLY );
+ MeasureSpec uniformMeasureSpec( GetMeasuredWidth(), MeasureSpec::Mode::EXACTLY );
for (int i = 0; i < count; ++i)
{
LayoutItemPtr childLayout = GetChildAt(i);
if( childLayout != nullptr )
{
auto childOwner = childLayout->GetOwner();
- auto desiredWidth = childOwner.GetProperty<int>( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION );
- auto desiredHeight = childOwner.GetProperty<int>( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION );
+ LayoutLength desiredWidth = childOwner.GetProperty<int>( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION );
+ LayoutLength desiredHeight = childOwner.GetProperty<int>( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION );
if( desiredWidth == Toolkit::ChildLayoutData::MATCH_PARENT )
{
// Temporarily force children to reuse their old measured height
- int oldHeight = desiredHeight;
+ LayoutLength oldHeight = desiredHeight;
childOwner.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, childLayout->GetMeasuredHeight().mValue );
// Remeasure with new dimensions
MeasureChildWithMargins( childLayout, uniformMeasureSpec, 0, heightMeasureSpec, 0 );
- childOwner.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, oldHeight );
+ childOwner.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, oldHeight.mValue );
}
}
}
LayoutLength childLeft( padding.start );
// Where end of child should go
- auto width = right - left;
+ LayoutLength width = right - left;
// Space available for child
- auto childSpace = width - padding.start - padding.end;
+ LayoutLength childSpace = width - padding.start - padding.end;
auto count = GetChildCount();
switch ( mAlignment & VERTICAL_ALIGNMENT_MASK )
LayoutItemPtr childLayout = GetChildAt( childIndex );
if( childLayout != nullptr )
{
- auto childWidth = childLayout->GetMeasuredWidth();
- auto childHeight = childLayout->GetMeasuredHeight();
- auto childMargin = childLayout->GetMargin();
+ LayoutLength childWidth = childLayout->GetMeasuredWidth();
+ LayoutLength childHeight = childLayout->GetMeasuredHeight();
+ Extents childMargin = childLayout->GetMargin();
childTop += childMargin.top;
switch ( mAlignment & HORIZONTAL_ALIGNMENT_MASK )
const unsigned int TOOLKIT_MAJOR_VERSION = 1;
const unsigned int TOOLKIT_MINOR_VERSION = 3;
-const unsigned int TOOLKIT_MICRO_VERSION = 41;
+const unsigned int TOOLKIT_MICRO_VERSION = 42;
const char * const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
Name: dali-toolkit
Summary: Dali 3D engine Toolkit
-Version: 1.3.41
+Version: 1.3.42
Release: 1
Group: System/Libraries
License: Apache-2.0 and BSD-3-Clause and MIT