- changing internal type to float to maintain precision when doing multiplies and divisions
Change-Id: Ifedb450f56d6994c60aceb87d7ffc530739b57c9
LayoutLength childWidth = childLayoutImpl.GetMeasuredWidth();
LayoutLength childHeight = childLayoutImpl.GetMeasuredHeight();
- childTop = middle - (childHeight / 2);
+ childTop = middle - childHeight / 2;
childLayoutImpl.Layout( currentLeft, childTop, currentLeft + childWidth, childTop + childHeight );
currentLeft += childWidth;
}
test_return_value = TET_PASS;
}
+int UtcDaliLayouting_LayoutLength_Types(void)
+{
+ tet_infoline("UtcDaliLayouting_LayoutLength Types");
+
+ // testing that operators return correct type
+ // operator+
+ {
+ auto value = LayoutLength( 10 ) + LayoutLength();
+ DALI_TEST_EQUALS( typeid(value).name(), typeid(LayoutLength).name(), TEST_LOCATION );
+ }
+ {
+ auto value = LayoutLength( 10 ) + 20;
+ DALI_TEST_EQUALS( typeid(value).name(), typeid(LayoutLength).name(), TEST_LOCATION );
+ }
+ {
+ auto value = 22 + LayoutLength( 10 );
+ DALI_TEST_EQUALS( typeid(value).name(), typeid(LayoutLength).name(), TEST_LOCATION );
+ }
+ {
+ auto value = LayoutLength( 10 ) + 2.1f;
+ DALI_TEST_EQUALS( typeid(value).name(), typeid(LayoutLength).name(), TEST_LOCATION );
+ }
+ {
+ auto value = 2.2f + LayoutLength( 10 );
+ DALI_TEST_EQUALS( typeid(value).name(), typeid(LayoutLength).name(), TEST_LOCATION );
+ }
+ // operator-
+ {
+ auto value = LayoutLength() - LayoutLength( 10 );
+ DALI_TEST_EQUALS( typeid(value).name(), typeid(LayoutLength).name(), TEST_LOCATION );
+ }
+ {
+ auto value = LayoutLength( 10 ) - 99;
+ DALI_TEST_EQUALS( typeid(value).name(), typeid(LayoutLength).name(), TEST_LOCATION );
+ }
+ {
+ auto value = 20 - LayoutLength( 10 );
+ DALI_TEST_EQUALS( typeid(value).name(), typeid(LayoutLength).name(), TEST_LOCATION );
+ }
+ {
+ auto value = LayoutLength( 10 ) - 9.9f;
+ DALI_TEST_EQUALS( typeid(value).name(), typeid(LayoutLength).name(), TEST_LOCATION );
+ }
+ {
+ auto value = 2.0f - LayoutLength( 10 );
+ DALI_TEST_EQUALS( typeid(value).name(), typeid(LayoutLength).name(), TEST_LOCATION );
+ }
+
+ // operator*
+ {
+ auto value = LayoutLength() * LayoutLength( 10 );
+ DALI_TEST_EQUALS( typeid(value).name(), typeid(LayoutLength).name(), TEST_LOCATION );
+ }
+ {
+ auto value = LayoutLength( 10 ) * 2;
+ DALI_TEST_EQUALS( typeid(value).name(), typeid(LayoutLength).name(), TEST_LOCATION );
+ }
+ {
+ auto value = 10 * LayoutLength( 10 );
+ DALI_TEST_EQUALS( typeid(value).name(), typeid(LayoutLength).name(), TEST_LOCATION );
+ }
+ {
+ auto value = LayoutLength( 10 ) * 2.1f;
+ DALI_TEST_EQUALS( typeid(value).name(), typeid(LayoutLength).name(), TEST_LOCATION );
+ }
+ {
+ auto value = 1.0f * LayoutLength( 10 );
+ DALI_TEST_EQUALS( typeid(value).name(), typeid(LayoutLength).name(), TEST_LOCATION );
+ }
+ // operator/
+ {
+ auto value = LayoutLength( 10 ) / 2.0f;
+ DALI_TEST_EQUALS( typeid(value).name(), typeid(LayoutLength).name(), TEST_LOCATION );
+ }
+
+ // combinations
+ {
+ auto value = ( LayoutLength( 10 ) * 2.0f ) / 1.5f;
+ DALI_TEST_EQUALS( typeid(value).name(), typeid(LayoutLength).name(), TEST_LOCATION );
+ }
+ {
+ auto value = 20 + ( LayoutLength( 10 ) * 2.0f ) / 1.5f;
+ DALI_TEST_EQUALS( typeid(value).name(), typeid(LayoutLength).name(), TEST_LOCATION );
+ }
+
+ END_TEST;
+}
+
+int UtcDaliLayouting_LayoutLength_Values(void)
+{
+ tet_infoline("UtcDaliLayouting_LayoutLength Values");
+
+ // operator+
+ {
+ LayoutLength value = LayoutLength( 10 ) + LayoutLength();
+ DALI_TEST_EQUALS( value.AsInteger(), 10.0f, 0.0001f, TEST_LOCATION );
+ }
+ {
+ LayoutLength value = LayoutLength( 10 ) + 20;
+ DALI_TEST_EQUALS( value.AsInteger(), 30.0f, 0.0001f, TEST_LOCATION );
+ }
+ {
+ LayoutLength value = 22 - LayoutLength( 10 );
+ DALI_TEST_EQUALS( value.AsInteger(), 12.0f, 0.0001f, TEST_LOCATION );
+ }
+ {
+ LayoutLength value = LayoutLength( 10 ) + 2.1f;
+ DALI_TEST_EQUALS( value.AsDecimal(), 12.1f, 0.0001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( value.AsTruncated(), 12.0f, 0.0001f, TEST_LOCATION );
+ }
+ {
+ LayoutLength value = 2.3f - LayoutLength( 10 );
+ DALI_TEST_EQUALS( value.AsDecimal(), -7.7f, 0.0001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( value.AsInteger(), -8.0f, 0.0001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( value.AsTruncated(), -7.0f, 0.0001f, TEST_LOCATION );
+ }
+ // operator-
+ {
+ LayoutLength value = LayoutLength() - LayoutLength( 10 );
+ DALI_TEST_EQUALS( value.AsInteger(), -10.0f, 0.0001f, TEST_LOCATION );
+ }
+ {
+ LayoutLength value = LayoutLength( 10 ) - 99;
+ DALI_TEST_EQUALS( value.AsInteger(), -89.0f, 0.0001f, TEST_LOCATION );
+ }
+ {
+ LayoutLength value = 20 - LayoutLength( 10 );
+ DALI_TEST_EQUALS( value.AsInteger(), 10.0f, 0.0001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( value.AsTruncated(), 10.f, 0.0001f, TEST_LOCATION );
+ }
+ {
+ LayoutLength value = LayoutLength( 10 ) - 9.9f;
+ DALI_TEST_EQUALS( value.AsInteger(), 0.0f, 0.0001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( value.AsDecimal(), 0.1f, 0.0001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( value.AsTruncated(), 0.0f, 0.0001f, TEST_LOCATION );
+ }
+ {
+ LayoutLength value = 10.9f - LayoutLength( 10 );
+ DALI_TEST_EQUALS( value.AsInteger(), 1.0f, 0.0001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( value.AsDecimal(), 0.9f, 0.0001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( value.AsTruncated(), 0.0f, 0.0001f, TEST_LOCATION );
+ }
+ // operator*
+ {
+ LayoutLength value = LayoutLength() * LayoutLength( 10 );
+ DALI_TEST_EQUALS( value.AsInteger(), 0.0f, 0.0001f, TEST_LOCATION );
+ }
+ {
+ LayoutLength value = LayoutLength(1) * 10;
+ DALI_TEST_EQUALS( value.AsInteger(), 10.0f, 0.0001f, TEST_LOCATION );
+ }
+ {
+ LayoutLength value = 11 * LayoutLength( 10 );
+ DALI_TEST_EQUALS( value.AsInteger(), 110.0f, 0.0001f, TEST_LOCATION );
+ }
+ {
+ LayoutLength value = LayoutLength( 10 ) * 2.12f;
+ DALI_TEST_EQUALS( value.AsDecimal(), 21.2f, 0.0001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( value.AsInteger(), 21.0f, 0.0001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( value.AsTruncated(), 21.0f, 0.0001f, TEST_LOCATION );
+ }
+ {
+ LayoutLength value = 2.189f * LayoutLength( 10 );
+ DALI_TEST_EQUALS( value.AsDecimal(), 21.89f, 0.0001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( value.AsInteger(), 22.0f, 0.0001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( value.AsTruncated(), 21.0f, 0.0001f, TEST_LOCATION );
+ }
+ // operator/
+ {
+ LayoutLength value = LayoutLength( 11 ) / 2.0f;
+ DALI_TEST_EQUALS( value.AsDecimal(), 5.5f, 0.0001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( value.AsInteger(), 6.0f, 0.0001f, TEST_LOCATION );
+ }
+
+ // combinations
+ {
+ LayoutLength value;
+ value = 20 + ( LayoutLength( 10 ) * 2.0f ) / 1.5f;
+ DALI_TEST_EQUALS( value.AsInteger(), 33.0f, 0.0001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( value.AsDecimal(), 33.3333f, 0.0001f, TEST_LOCATION );
+ }
+ {
+ uint16_t padding( 1 );
+ LayoutLength right(35), left(10), mTotalLength(2);
+ LayoutLength value;
+ value = padding + ( right - left - mTotalLength ) / 2.0f;
+ // = 1 + ( 35 - 10 - 2 ) / 2
+ DALI_TEST_EQUALS( value.AsInteger(), 13.0f, 0.0001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( value.AsDecimal(), 12.5f, 0.0001f, TEST_LOCATION );
+ }
+ {
+ uint16_t padding = 1, top = 2, bottom = 3;
+ LayoutLength childSpace( 44 ), childHeight( 23 );
+ LayoutLength value;
+ value = padding + ( ( childSpace - childHeight ) / 2.0f ) + top - bottom;
+ // = 1 + ( ( 44 - 23 ) / 2 ) + 2 - 3
+ DALI_TEST_EQUALS( value.AsInteger(), 11.0f, 0.0001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( value.AsDecimal(), 10.5f, 0.0001f, TEST_LOCATION );
+ }
+
+ END_TEST;
+}
+
+int UtcDaliLayouting_LayoutLength_Operators(void)
+{
+ tet_infoline("UtcDaliLayouting_LayoutLength operators");
+
+ {
+ LayoutLength value = 10;
+ DALI_TEST_EQUALS( (int)value.AsInteger(), 10, TEST_LOCATION );
+ value += 1;
+ DALI_TEST_EQUALS( (int)value.AsInteger(), 11, TEST_LOCATION );
+ value -= 12;
+ DALI_TEST_EQUALS( (int)value.AsInteger(), -1, TEST_LOCATION );
+ LayoutLength value2 = value;
+ DALI_TEST_EQUALS( value == value2, true, TEST_LOCATION );
+ value2 = 123;
+ DALI_TEST_EQUALS( value != value2, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( value < value2, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( value <= value2, true, TEST_LOCATION );
+ value = 456;
+ DALI_TEST_EQUALS( value > value2, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( value >= value2, true, TEST_LOCATION );
+ }
+
+ {
+ LayoutLength value( 123 );
+ std::stringstream ss;
+ ss << value;
+ DALI_TEST_EQUALS( ss.str(), "123", TEST_LOCATION );
+ }
+ {
+ LayoutLength value( 0.123f );
+ std::stringstream ss;
+ ss << value;
+ DALI_TEST_EQUALS( ss.str(), "0.123", TEST_LOCATION );
+ }
+ END_TEST;
+}
+
int UtcDaliLayouting_HboxLayout01(void)
{
ToolkitTestApplication application;
void LayoutGroup::OnSetChildProperties( Handle& handle, Property::Index index, Property::Value value )
{
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "LayoutGroup::OnSetChildProperties property(%s)\n", handle.GetPropertyName(index).c_str());
+ DALI_LOG_STREAM( gLogFilter, Debug::Verbose, "LayoutGroup::OnSetChildProperties property(" << handle.GetPropertyName(index) << ")\n" );
if ( ( ( index >= CHILD_PROPERTY_REGISTRATION_START_INDEX ) &&
( index <= CHILD_PROPERTY_REGISTRATION_MAX_INDEX ) )
}
}
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "LayoutGroup::GetChildMeasureSpec resultSize(%u)\n", resultSize.mValue );
+ DALI_LOG_STREAM( gLogFilter, Debug::Verbose, "LayoutGroup::GetChildMeasureSpec resultSize(" << resultSize << ")\n" );
//noinspection ResourceType
return MeasureSpec( resultSize, resultMode );
}
childLayout->SetAnimateLayout( IsLayoutAnimated() ); // @todo this essentially forces animation inheritance. Bad?
- DALI_LOG_STREAM( gLogFilter, Debug::Verbose, "LayoutGroup::ChildAddedToOwner control:" << control.GetName().c_str() <<
- " desiredWidth: " << control.GetNaturalSize().width <<
- " desiredHeight:" << control.GetNaturalSize().height
- );
+ DALI_LOG_STREAM( gLogFilter, Debug::Verbose, "LayoutGroup::ChildAddedToOwner control:" << control.GetName() <<
+ " desiredWidth: " << control.GetNaturalSize().width << " desiredHeight:" << control.GetNaturalSize().height );
childControlDataImpl.SetLayout( *childLayout.Get() );
// Get size of child
MeasureChild( childLayout, widthMeasureSpec, heightMeasureSpec );
- auto childWidth = childLayout->GetMeasuredWidth();
- auto childHeight = childLayout->GetMeasuredHeight();
- auto childMargin = childLayout->GetMargin();
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "LayoutGroup::OnMeasure child width[%d] height(%d)\n", childWidth.mValue, childHeight.mValue );
+ LayoutLength childWidth = childLayout->GetMeasuredWidth();
+ LayoutLength childHeight = childLayout->GetMeasuredHeight();
+ Extents childMargin = childLayout->GetMargin();
+ DALI_LOG_STREAM( gLogFilter, Debug::Verbose, "LayoutGroup::OnMeasure child width[" << childWidth << "] height[" << childHeight << "]\n" );
layoutWidth = std::max( layoutWidth, childWidth + childMargin.start + childMargin.end );
layoutHeight = std::max( layoutHeight, childHeight + childMargin.top + childMargin.bottom );
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "LayoutGroup::OnMeasure calculated child width[%d] calculated height(%d)\n", layoutWidth.mValue, layoutHeight.mValue );
+ DALI_LOG_STREAM( gLogFilter, Debug::Verbose, "LayoutGroup::OnMeasure calculated child width[" << layoutWidth << "] height[" << layoutHeight << "]\n" );
}
else
{
layoutHeight = heightSpecSize;
}
- DALI_LOG_INFO( gLogFilter, Debug::General, "LayoutGroup::OnMeasure Measured size(%d,%d) for : %s \n", layoutWidth.mValue, layoutHeight.mValue, Actor::DownCast(GetOwner()).GetName().c_str() );
+ DALI_LOG_STREAM( gLogFilter, Debug::General, "LayoutGroup::OnMeasure Measured size(" << layoutWidth << "," << layoutHeight << ") for : " << Actor::DownCast(GetOwner()).GetName() << " \n" );
SetMeasuredDimensions( MeasuredSize( layoutWidth ), MeasuredSize( layoutHeight ) );
}
{
auto childOwner = childLayout->GetOwner();
- auto childWidth = childLayout->GetMeasuredWidth();
- auto childHeight = childLayout->GetMeasuredHeight();
- auto childMargin = childLayout->GetMargin();
+ LayoutLength childWidth = childLayout->GetMeasuredWidth();
+ LayoutLength childHeight = childLayout->GetMeasuredHeight();
+ Extents childMargin = childLayout->GetMargin();
auto control = Toolkit::Control::DownCast( childOwner );
Extents padding = GetPadding();
auto childPosition = control.GetProperty< Vector3 >( Actor::Property::POSITION );
auto anchorPoint = control.GetProperty< Vector3 >( Actor::Property::ANCHOR_POINT );
- DALI_LOG_INFO( gLogFilter, Debug::General, "LayoutGroup::OnLayout child[%s] position(%f,%f) child width[%d] height(%d)\n",
- control.GetName().c_str(),
- childPosition.x, childPosition.y,
- childWidth.mValue, childHeight.mValue
- );
+ DALI_LOG_STREAM( gLogFilter, Debug::General, "LayoutGroup::OnLayout child[" << control.GetName() <<
+ "] position(" << childPosition << ") child width[" << childWidth << "] height[" << childHeight << "]\n" );
// Margin and Padding only supported when child anchor point is TOP_LEFT.
int paddingAndMarginOffsetX = ( AnchorPoint::TOP_LEFT == anchorPoint ) ? ( padding.top + childMargin.top ) : 0;
void LayoutItem::SetMeasuredDimensions( MeasuredSize measuredWidth, MeasuredSize measuredHeight )
{
- DALI_LOG_INFO( gLayoutFilter, Debug::Verbose, "LayoutItem::SetMeasuredDimensions width(%d) height(%d) \n",
- measuredWidth.GetSize().mValue, measuredHeight.GetSize().mValue );
+ DALI_LOG_STREAM( gLayoutFilter, Debug::Verbose, "LayoutItem::SetMeasuredDimensions width(" << measuredWidth.GetSize() << ") height(" << measuredHeight.GetSize() << ") \n" );
mImpl->SetPrivateFlag( Impl::PRIVATE_FLAG_MEASURED_DIMENSION_SET );
mImpl->mMeasuredWidth = measuredWidth;
auto actor = Actor::DownCast(owner);
auto naturalSize = actor ? actor.GetNaturalSize() : Vector3::ZERO;
- return std::max( mImpl->mMinimumSize.GetWidth(), LayoutLength::IntType( naturalSize.width ) );
+ return std::max( mImpl->mMinimumSize.GetWidth(), LayoutLength( naturalSize.width ) );
}
LayoutLength LayoutItem::GetSuggestedMinimumHeight() const
auto actor = Actor::DownCast(owner);
auto naturalSize = actor ? actor.GetNaturalSize() : Vector3::ZERO;
- return std::max( mImpl->mMinimumSize.GetHeight(), LayoutLength::IntType(naturalSize.height) );
+ return std::max( mImpl->mMinimumSize.GetHeight(), LayoutLength( naturalSize.height ) );
}
MeasuredSize LayoutItem::ResolveSizeAndState( LayoutLength size, MeasureSpec measureSpec, MeasuredSize::State childMeasuredState )
{
bool changed = false;
- DALI_LOG_INFO( gLayoutFilter, Debug::Verbose, "LayoutItem::SetFrame enter(%d, %d, %d, %d)\n", left.mValue, top.mValue, right.mValue, bottom.mValue );
+ 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 ) )
{
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 );
+ DALI_LOG_STREAM( gLayoutFilter, Debug::Verbose, "LayoutItem::SetFrame owner(" << left << ", " << top << ", " << right << ", " << bottom << ")\n" );
+
if( mImpl->mAnimated )
{
auto animation = Animation::New( 0.5f );
- 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::POSITION_X ), left.AsInteger() );
+ animation.AnimateTo( Property( actor, Actor::Property::POSITION_Y ), top.AsInteger() );
- animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), newWidth.AsFloat() );
- animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), newHeight.AsFloat() );
+ animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), newWidth.AsInteger() );
+ animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), newHeight.AsInteger() );
animation.FinishedSignal().Connect( mSlotDelegate, &LayoutItem::OnLayoutAnimationFinished );
animation.Play();
else
{
// @todo Collate into list of Property & Property::Value pairs.
- actor.SetX( left.AsFloat() );
- actor.SetY( top.AsFloat() );
- actor.SetProperty( Actor::Property::SIZE_WIDTH, newWidth.AsFloat() );
- actor.SetProperty( Actor::Property::SIZE_HEIGHT, newHeight.AsFloat() );
+ actor.SetX( left.AsInteger() );
+ actor.SetY( top.AsInteger() );
+ actor.SetProperty( Actor::Property::SIZE_WIDTH, newWidth.AsInteger() );
+ actor.SetProperty( Actor::Property::SIZE_HEIGHT, newHeight.AsInteger() );
}
}
}
}
- DALI_LOG_INFO( gLayoutFilter, Debug::Verbose, "LayoutItem::SetFrame exit(%d, %d, %d, %d)\n", left.mValue, top.mValue, right.mValue, bottom.mValue );
+ DALI_LOG_STREAM( gLayoutFilter, Debug::Verbose, "LayoutItem::SetFrame exit(" << left << ", " << top << ", " << right << ", " << bottom << ")\n" );
return changed;
}
auto actor = Actor::DownCast(owner);
if( actor )
{
- actor.SetSize( Vector3( mImpl->mRight.AsFloat() - mImpl->mLeft.AsFloat(), mImpl->mBottom.AsFloat() - mImpl->mTop.AsFloat(), 0.0f ) );
+ actor.SetSize( Vector3( mImpl->mRight.AsInteger() - mImpl->mLeft.AsInteger(), mImpl->mBottom.AsInteger() - mImpl->mTop.AsInteger(), 0.0f ) );
}
}
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
+// EXTERNAL INCLUDES
#include <cstdint>
+#include <cmath>
#include <iostream>
namespace Dali
{
+
namespace Toolkit
{
/**
* @brief A type that represents a layout length.
*
- * Currently, this implies pixels, but could be extended to handle device dependant sizes, etc.
+ * Currently, this implies pixels, but could be extended to handle device dependent sizes, etc.
*/
class LayoutLength
{
public:
- using IntType = int;
+ /**
+ * @brief default constructor, initialises to 0
+ */
LayoutLength()
: mValue( 0 )
{
}
- LayoutLength( IntType value )
+ /**
+ * @brief constructor
+ *
+ * @param value the value to initialise with
+ */
+ LayoutLength( int value )
: mValue( value )
{
}
+ /**
+ * @brief constructor from float
+ *
+ * @param value the value to initialise with
+ */
+ LayoutLength( float value )
+ : mValue( value )
+ {
+ }
+
+ /**
+ * @brief constructor
+ *
+ * @param layoutLength the value to initialise with
+ */
LayoutLength( const LayoutLength& layoutLength )
: mValue( layoutLength.mValue )
{
}
- LayoutLength& operator=(const LayoutLength& rhs)
+ /**
+ * @brief assignment operator
+ *
+ * @param rhs LayoutLength to assign
+ * @return reference to itself
+ */
+ LayoutLength& operator=( const LayoutLength& rhs )
{
if( this != &rhs )
{
return *this;
}
- bool operator==( const LayoutLength& rhs )
+ /**
+ * @brief assignment operator from int
+ *
+ * @param value the value to assign
+ * @return reference to itself
+ */
+ LayoutLength& operator=( int value )
{
- return mValue == rhs.mValue;
+ mValue = value;
+ return *this;
}
- bool operator==( LayoutLength::IntType rhs )
+ /**
+ * @brief assignment operator from float
+ *
+ * @param value the value to assign
+ * @return reference to itself
+ */
+ LayoutLength& operator=( float value )
{
- return mValue == rhs;
+ mValue = value;
+ return *this;
}
- bool operator!=( const LayoutLength& rhs )
+ /**
+ * @brief plus equals operator
+ *
+ * @param rhs to add to this
+ * @return reference to itself
+ */
+ LayoutLength& operator+=( LayoutLength rhs )
{
- return !operator==(rhs);
+ mValue += rhs.mValue;
+ return *this;
}
- bool operator<( const LayoutLength& rhs )
+ /**
+ * @brief minus equals operator
+ *
+ * @param rhs to subtract from this
+ * @return reference to itself
+ */
+ LayoutLength& operator-=( LayoutLength rhs )
{
- return mValue < rhs.mValue;
+ mValue -= rhs.mValue;
+ return *this;
}
- bool operator<( const LayoutLength rhs ) const
+ /**
+ * @brief return value as decimal value (full raw value)
+ *
+ * @return the LayoutLength as full decimal value
+ */
+ float AsDecimal() const
{
- return mValue < rhs.mValue;
+ return mValue;
}
- bool operator<=( const LayoutLength& rhs )
- {
- return mValue <= rhs.mValue;
- }
- bool operator<=( LayoutLength rhs )
- {
- return mValue <= rhs.mValue;
- }
- bool operator>( const LayoutLength& rhs )
- {
- return mValue > rhs.mValue;
- }
- bool operator>( LayoutLength rhs )
- {
- return mValue > rhs.mValue;
- }
- bool operator>=( const LayoutLength& rhs )
- {
- return mValue >= rhs.mValue;
- }
- bool operator>=( LayoutLength rhs )
+ /**
+ * @brief return value as rounded integer value (whole number)
+ *
+ * @return the LayoutLength rounded to next integer value
+ */
+ float AsInteger() const
{
- return mValue >= rhs.mValue;
+ return round( mValue );
}
- LayoutLength operator+( const LayoutLength& rhs )
+ /**
+ * @brief return value as truncated integral value (whole number)
+ *
+ * @return the LayoutLength rounded to next integral value
+ */
+ float AsTruncated() const
{
- return mValue + rhs.mValue;
+ return trunc( mValue );
}
- LayoutLength operator+( LayoutLength::IntType rhs )
- {
- return mValue + rhs;
- }
+private:
- LayoutLength operator-( const LayoutLength& rhs )
- {
- return mValue - rhs.mValue;
- }
- LayoutLength operator-( LayoutLength::IntType rhs )
- {
- return mValue - rhs;
- }
+ float mValue;
- LayoutLength& operator+=( const LayoutLength& rhs )
- {
- mValue += rhs.mValue;
- return *this;
- }
- LayoutLength& operator+=( LayoutLength::IntType rhs )
- {
- mValue += rhs;
- return *this;
- }
+};
- LayoutLength& operator-=( const LayoutLength& rhs )
- {
- mValue -= rhs.mValue;
- return *this;
- }
+/**
+ * @brief equal to operator
+ *
+ * @param lhs value to compare
+ * @param rhs value to compare against
+ * @note Using value instead of reference to allow conversions from int and float
+ * @return true if identical, false otherwise
+ */
+inline bool operator==( LayoutLength lhs, LayoutLength rhs )
+{
+ return lhs.AsDecimal() == rhs.AsDecimal();
+}
- LayoutLength& operator-=( LayoutLength::IntType rhs )
- {
- mValue -= rhs;
- return *this;
- }
+/**
+ * @brief not equal to operator
+ *
+ * @param lhs value to compare
+ * @param rhs value to compare against
+ * @note Using value instead of reference to allow conversions from int and float
+ * @return true if value is not identical, false otherwise
+ */
+inline bool operator!=( LayoutLength lhs, LayoutLength rhs )
+{
+ return !operator==( lhs, rhs );
+}
- LayoutLength operator/( const LayoutLength& rhs )
- {
- return mValue / rhs.mValue;
- }
- LayoutLength operator/( LayoutLength::IntType rhs )
- {
- return mValue / rhs;
- }
+/**
+ * @brief less than operator
+ *
+ * @param lhs value to compare
+ * @param rhs value to compare against
+ * @note Using value instead of reference to allow conversions from int and float
+ * @return true if lhs value is less, false otherwise
+ */
+inline bool operator<( LayoutLength lhs, LayoutLength rhs )
+{
+ return lhs.AsDecimal() < rhs.AsDecimal();
+}
- LayoutLength operator*( const LayoutLength& rhs )
- {
- return mValue * rhs.mValue;
- }
- LayoutLength operator*( LayoutLength::IntType rhs )
- {
- return mValue * rhs;
- }
- LayoutLength operator*( float rhs )
- {
- return LayoutLength(LayoutLength::IntType(AsFloat() * rhs));
- }
+/**
+ * @brief greater than operator
+ *
+ * @param lhs value to compare
+ * @param rhs value to compare against
+ * @note Using value instead of reference to allow conversions from int and float
+ * @return true if lhs value is greater, false otherwise
+ */
+inline bool operator>( LayoutLength lhs, LayoutLength rhs )
+{
+ return rhs < lhs;
+}
- /**
- * @brief explicit method to return the value as float
- * @return the LayoutLength as float
- */
- float AsFloat() const
- {
- return static_cast<float>( mValue );
- }
+/**
+ * @brief less than or equal to operator
+ *
+ * @param lhs value to compare
+ * @param rhs value to compare against
+ * @note Using value instead of reference to allow conversions from int and float
+ * @return true if lhs value is less than or equal to, false otherwise
+ */
+inline bool operator<=( LayoutLength lhs, LayoutLength rhs )
+{
+ return !(lhs > rhs);
+}
- IntType mValue;
-};
+/**
+ * @brief greater than or equal to operator
+ *
+ * @param lhs value to compare
+ * @param rhs value to compare against
+ * @note Using value instead of reference to allow conversions from int and float
+ * @return true if lhs value is greater than or equal to, false otherwise
+ */
+inline bool operator>=( LayoutLength lhs, LayoutLength rhs )
+{
+ return !(lhs < rhs);
+}
+
+/**
+ * @brief add two LayoutLengths
+ *
+ * @param lhs The LayoutLength to add
+ * @param rhs The LayoutLength to add
+ * @note Using value instead of reference to allow conversions from int and float
+ * @return the resulting LayoutLength
+ */
+inline LayoutLength operator+( LayoutLength lhs, LayoutLength rhs )
+{
+ return lhs.AsDecimal() + rhs.AsDecimal();
+}
+
+/**
+ * @brief subtract two LayoutLengths
+ *
+ * @param lhs The LayoutLength to subtract from
+ * @param rhs The LayoutLength to subtract
+ * @note Using value instead of reference to allow conversions from int and float
+ * @return the resulting LayoutLength
+ */
+inline LayoutLength operator-( LayoutLength lhs, LayoutLength rhs )
+{
+ return lhs.AsDecimal() - rhs.AsDecimal();
+}
+
+/**
+ * @brief multiply two LayoutLengths
+ *
+ * @param lhs The LayoutLength to multiply
+ * @param rhs The LayoutLength to multiply
+ * @note Using value instead of reference to allow conversions from int and float
+ * @return the resulting LayoutLength
+ */
+inline LayoutLength operator*( LayoutLength lhs, LayoutLength rhs )
+{
+ return lhs.AsDecimal() * rhs.AsDecimal();
+}
+
+/**
+ * @brief divide LayoutLength by a LayoutLength
+ *
+ * @param lhs The LayoutLength to divide
+ * @param rhs The LayoutLength to divide by
+ * @note Using value instead of reference to allow conversions from int and float
+ * @return the resulting value as float
+ */
+inline LayoutLength operator/( LayoutLength lhs, LayoutLength rhs )
+{
+ return lhs.AsDecimal() / rhs.AsDecimal();
+}
/**
* @brief Prints a LayoutLength
*/
inline std::ostream& operator<<( std::ostream& o, const LayoutLength& layoutLength )
{
- return o<<layoutLength.mValue;
+ return o << layoutLength.AsDecimal();
}
} // namespace Toolkit
{
public:
LayoutSize()
- : x(0u),
- y(0u)
+ : x( 0 ),
+ y( 0 )
{
}
- LayoutSize( LayoutLength::IntType anX, LayoutLength::IntType aY )
+ LayoutSize( LayoutLength anX, LayoutLength aY )
: x( anX ),
y( aY )
{
}
- LayoutSize( LayoutLength anX, LayoutLength aY )
- : x( anX.mValue ),
- y( aY.mValue )
- {
- }
-
LayoutSize( const LayoutSize& layoutSize )
: x( layoutSize.x ),
y( layoutSize.y )
return *this;
}
- LayoutLength::IntType GetWidth()
+ void SetWidth( LayoutLength value )
{
- return width;
+ width = value;
}
- LayoutLength::IntType GetHeight()
+ LayoutLength GetWidth()
{
- return height;
+ return width;
}
- void SetWidth(LayoutLength::IntType value)
- {
- width=value;
- }
- void SetHeight(LayoutLength::IntType value)
+ void SetHeight( LayoutLength value )
{
- height=value;
+ height = value;
}
- void SetWidth(LayoutLength value)
- {
- width=value.mValue;
- }
- void SetHeight(LayoutLength value)
+
+ LayoutLength GetHeight()
{
- height=value.mValue;
+ return height;
}
bool operator==( const LayoutSize& rhs )
union
{
- LayoutLength::IntType x;
- LayoutLength::IntType width;
+ LayoutLength x;
+ LayoutLength width;
};
union
{
- LayoutLength::IntType y;
- LayoutLength::IntType height;
+ LayoutLength y;
+ LayoutLength height;
};
};
* limitations under the License.
*/
+// EXTERNAL INCLUDES
+#include <sstream>
#include <dali/public-api/common/dali-common.h>
+
+// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/layouting/layout-length.h>
#include <dali-toolkit/public-api/dali-toolkit-common.h>
-#include <sstream>
-
namespace Dali
{
namespace Toolkit
};
MeasuredSize()
- : mMeasuredSize( 0u ),
+ : mMeasuredSize( 0 ),
mState ( MeasuredSize::State::MEASURED_SIZE_OK )
{
}
return *this;
}
- MeasuredSize& operator=( LayoutLength::IntType rhs )
+ MeasuredSize& operator=( LayoutLength rhs )
{
this->mMeasuredSize = rhs;
this->mState = State::MEASURED_SIZE_OK;
return mMeasuredSize != value.mMeasuredSize;
}
- inline operator LayoutLength::IntType()
- {
- return mMeasuredSize.mValue;
- }
-
inline void SetState( MeasuredSize::State state )
{
mState = state;
// Store current width and height needed to contain all children.
totalWidth = maxPositionX - minPositionX;
totalHeight = maxPositionY - minPositionY;
- DALI_LOG_INFO( gLogFilter, Debug::Concise, "AbsoluteLayout::OnMeasure child width(%f) height(%f) \n", totalWidth.AsFloat(), totalHeight.AsFloat() );
+ DALI_LOG_INFO( gLogFilter, Debug::Concise, "AbsoluteLayout::OnMeasure child width(%f) height(%f) \n", totalWidth.AsDecimal(), totalHeight.AsDecimal() );
if( childLayout->GetMeasuredWidthAndState().GetState() == MeasuredSize::State::MEASURED_SIZE_TOO_SMALL )
{
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(),
- childPosition.x, childPosition.y,
- childWidth.mValue, childHeight.mValue
- );
+ DALI_LOG_STREAM( gLogFilter, Debug::General,
+ "AbsoluteLayout::OnLayout child[" << Toolkit::Control::DownCast( childOwner ).GetName().c_str() <<
+ "] position(" << childPosition << ") child width[" << childWidth << "] height[" << childHeight << "]\n" );
childLayout->Layout( childLeft, childTop, childLeft + childWidth, childTop + childHeight );
}
if( widthMeasureSpec.GetMode() == MeasureSpec::Mode::EXACTLY )
{
- width = widthMeasureSpec.GetSize().AsFloat();
+ width = widthMeasureSpec.GetSize().AsDecimal();
YGNodeStyleSetWidth( mRoot, width );
}
else if( widthMeasureSpec.GetMode() == MeasureSpec::Mode::AT_MOST )
{
- width = widthMeasureSpec.GetSize().AsFloat();
+ width = widthMeasureSpec.GetSize().AsDecimal();
YGNodeStyleSetMaxWidth( mRoot, width );
}
if ( heightMeasureSpec.GetMode() == MeasureSpec::Mode::EXACTLY )
{
- height = heightMeasureSpec.GetSize().AsFloat();
+ height = heightMeasureSpec.GetSize().AsDecimal();
YGNodeStyleSetHeight( mRoot, height );
}
else if ( heightMeasureSpec.GetMode() == MeasureSpec::Mode::AT_MOST )
{
- height = heightMeasureSpec.GetSize().AsFloat();
+ height = heightMeasureSpec.GetSize().AsDecimal();
YGNodeStyleSetMaxHeight( mRoot, height );
}
DALI_LOG_INFO( gLogFilter, Debug::Concise, oss.str().c_str() );
#endif
- YGNodeCalculateLayout( mRoot, width.AsFloat(), height.AsFloat(), isLayoutRtl ? YGDirectionRTL : YGDirectionLTR );
+ YGNodeCalculateLayout( mRoot, width.AsDecimal(), height.AsDecimal(), isLayoutRtl ? YGDirectionRTL : YGDirectionLTR );
auto count = GetChildCount();
for( unsigned int childIndex = 0; childIndex < count; childIndex++)
if( childLayout != nullptr )
{
YGNodeRef node = YGNodeGetChild(mRoot, childIndex);
- LayoutLength childLeft = LayoutLength( YGNodeLayoutGetLeft( node ) ) + left;
+ LayoutLength childLeft = LayoutLength( YGNodeLayoutGetLeft( node ) )+ left;
LayoutLength childTop = LayoutLength( YGNodeLayoutGetTop( node ) ) + top;
LayoutLength childWidth = LayoutLength( YGNodeLayoutGetWidth( node ) );
LayoutLength childHeight = LayoutLength( YGNodeLayoutGetHeight( node ) );
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 parentWidthMeasureSpec = MeasureSpec( 0 );
+ MeasureSpec parentWidthMeasureSpec( 0 );
if ( innerWidth != YGUndefined )
{
parentWidthMeasureSpec = MeasureSpec( innerWidth, static_cast<MeasureSpec::Mode>(widthMode) );
LayoutLength measuredHeight = childLayout->GetMeasuredHeight() - padding.bottom - padding.top;
return YGSize{
- .width = measuredWidth.AsFloat(),
- .height = measuredHeight.AsFloat(),
+ .width = measuredWidth.AsDecimal(),
+ .height = measuredHeight.AsDecimal(),
};
}
return mNumColumns;
}
-void Grid::DetermineNumberOfColumns( int availableSpace )
+void Grid::DetermineNumberOfColumns( LayoutLength availableSpace )
{
if( mRequestedNumColumns == AUTO_FIT )
{
if( availableSpace > 0 )
{
// Can only calculate number of columns if a column width has been set
- mNumColumns = ( mRequestedColumnWidth > 0 ) ? ( availableSpace / mRequestedColumnWidth ) : 1;
+ mNumColumns = ( mRequestedColumnWidth > 0 ) ? ( availableSpace.AsInteger() / mRequestedColumnWidth ) : 1;
}
}
}
desiredChildWidth += childMargin.start + childMargin.end;
mTotalWidth = desiredChildWidth * mNumColumns;
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Grid::OnMeasure TotalDesiredWidth(%d) \n", mTotalWidth.mValue );
+ DALI_LOG_STREAM( gLogFilter, Debug::Verbose, "Grid::OnMeasure TotalDesiredWidth(" << mTotalWidth << ") \n" );
} // Child is LayoutItem
} // Child exists
mTotalWidth = std::min( mTotalWidth, widthSize );
}
- availableContentWidth = mTotalWidth.mValue - gridLayoutPadding.start - gridLayoutPadding.end;
+ availableContentWidth = mTotalWidth - gridLayoutPadding.start - gridLayoutPadding.end;
widthSize = mTotalWidth;
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Grid::OnMeasure availableContentWidth(%d) mTotalWidth(%d) \n",
- availableContentWidth.mValue,
- mTotalWidth.mValue );
+ DALI_LOG_STREAM( gLogFilter, Debug::Verbose, "Grid::OnMeasure availableContentWidth" << availableContentWidth << " mTotalWidth(" << mTotalWidth << ") \n" );
// HEIGHT SPECIFICATIONS
// heightMode EXACTLY so grid must be the given height
{
mTotalHeight += desiredChildHeight;
}
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Grid::OnMeasure TotalDesiredHeight(%d) \n",
- mTotalHeight.mValue );
+ DALI_LOG_STREAM( gLogFilter, Debug::Verbose, "Grid::OnMeasure TotalDesiredHeight(" << mTotalHeight << ") \n" );
// Ensure ourHeight does not exceed specified atmost height
mTotalHeight = std::min( mTotalHeight, heightSize );
}
// If number of columns not defined
- DetermineNumberOfColumns( availableContentWidth.mValue );
+ DetermineNumberOfColumns( availableContentWidth );
// Locations define the start, end,top and bottom of each cell.
- mLocations->CalculateLocations( mNumColumns, availableContentWidth.mValue, availableContentHeight.mValue, childCount, 0, 0 );
+ mLocations->CalculateLocations( mNumColumns, availableContentWidth.AsInteger(), availableContentHeight.AsInteger(), childCount, 0, 0 );
SetMeasuredDimensions( ResolveSizeAndState( widthSize, widthMeasureSpec, MeasuredSize::State::MEASURED_SIZE_OK ),
* For the given availableSpace, calculate or retreive the number of required columns.
* @param[in] availableSpace the space available for a child in each column.
*/
- void DetermineNumberOfColumns( int availableSpace );
+ void DetermineNumberOfColumns( LayoutLength availableSpace );
private:
} // namespace Toolkit
} // namespace Dali
-#endif // DALI_TOOLKIT_INTERNAL_LAYOUTINGInner
\ No newline at end of file
+#endif // DALI_TOOLKIT_INTERNAL_LAYOUTINGInner
auto stageWidth = stage.GetSize().width;
auto stageHeight = stage.GetSize().height;
- auto widthSpec = MeasureSpec( stageWidth, MeasureSpec::Mode::EXACTLY );
- auto heightSpec = MeasureSpec( stageHeight, MeasureSpec::Mode::EXACTLY );
+ MeasureSpec widthSpec( stageWidth, MeasureSpec::Mode::EXACTLY );
+ MeasureSpec heightSpec( stageHeight, MeasureSpec::Mode::EXACTLY );
// Test how to perform a measure on each control.
MeasureHierarchy( stage.GetRootLayer(), widthSpec, heightSpec );
LayoutItem::Impl::Impl()
: mOwner( nullptr ),
mLayoutParent( nullptr ),
- mOldWidthMeasureSpec( 0u ),
- mOldHeightMeasureSpec( 0u ),
+ mOldWidthMeasureSpec( 0 ),
+ mOldHeightMeasureSpec( 0 ),
mMinimumSize(),
- mMeasuredWidth(0u),
- mMeasuredHeight(0u),
+ mMeasuredWidth(0),
+ mMeasuredHeight(0),
mLeft( 0 ),
mRight( 0 ),
mTop( 0 ),
childWidth = childLayout->GetMeasuredWidth();
}
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "LinearLayout::OnMeasure childWidth(%d)\n", childWidth.mValue );
- LayoutLength length = childWidth + LayoutLength::IntType( childMargin.start + childMargin.end );
+ DALI_LOG_STREAM( gLogFilter, Debug::Verbose, "LinearLayout::OnMeasure childWidth(" << childWidth << ")\n" );
+ LayoutLength length = childWidth + childMargin.start + childMargin.end;
LayoutLength cellPadding = i < GetChildCount() - 1 ? mCellPadding.width : 0;
if( isExactly )
{
LayoutLength childWidth = 0;
if( childWeight > 0 )
{
- LayoutLength share = (childWeight * remainingExcess.mValue) / remainingWeightSum;
+ LayoutLength share = ( childWeight * remainingExcess ) / remainingWeightSum;
remainingExcess -= share;
remainingWeightSum -= childWeight;
{
// Temporarily force children to reuse their old measured width
LayoutLength oldWidth = desiredWidth;
- childOwner.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, childLayout->GetMeasuredWidth().mValue );
+ childOwner.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, childLayout->GetMeasuredWidth().AsInteger() );
// Remeasure with new dimensions
MeasureChildWithMargins( childLayout, widthMeasureSpec, 0, uniformMeasureSpec, 0 );
- childOwner.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, oldWidth.mValue );
+ childOwner.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, oldWidth.AsInteger() );
}
}
}
case Dali::Toolkit::LinearLayout::Alignment::CENTER_HORIZONTAL:
{
// mTotalLength contains the padding already
- childLeft = LayoutLength( padding.start ) + ( right - left - mTotalLength ) / 2;
+ childLeft = padding.start + ( right - left - mTotalLength ) / 2.0f;
break;
}
}
childTop = height - padding.bottom - childHeight - childMargin.bottom;
break;
}
- case Dali::Toolkit::LinearLayout::Alignment::CENTER_VERTICAL:
+ case Dali::Toolkit::LinearLayout::Alignment::CENTER_VERTICAL: // FALLTHROUGH
default:
{
- childTop = LayoutLength( padding.top ) + ( ( childSpace - childHeight ) / 2 ) + childMargin.top - childMargin.bottom;
+ childTop = padding.top + ( ( childSpace - childHeight ) / 2.0f ) + childMargin.top - childMargin.bottom;
break;
}
}
childHeight = childLayout->GetMeasuredHeight();
}
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "LinearLayout::MeasureVertical childHeight(%d)\n", childHeight.mValue );
+ DALI_LOG_STREAM( gLogFilter, Debug::Verbose, "LinearLayout::MeasureVertical childHeight(" << childHeight << ")\n" );
- LayoutLength length = childHeight + LayoutLength::IntType( childMargin.top + childMargin.bottom );
+ LayoutLength length = childHeight + childMargin.top + childMargin.bottom;
LayoutLength cellPadding = i < GetChildCount() - 1 ? mCellPadding.height : 0;
LayoutLength totalLength = mTotalLength;
mTotalLength = std::max( totalLength, totalLength + length + cellPadding );
LayoutLength childHeight = 0;
if( childWeight > 0 )
{
- LayoutLength share = (childWeight * remainingExcess.mValue) / remainingWeightSum;
+ LayoutLength share = ( childWeight * remainingExcess ) / remainingWeightSum;
remainingExcess -= share;
remainingWeightSum -= childWeight;
alternativeMaxWidth = std::max( alternativeMaxWidth, matchWidthLocally ? marginWidth : childWidth );
childHeight = childLayout->GetMeasuredHeight();
- LayoutLength length = childHeight + LayoutLength::IntType( childMargin.top + childMargin.bottom );
+ LayoutLength length = childHeight + childMargin.top + childMargin.bottom;
LayoutLength cellPadding = i < GetChildCount() - 1 ? mCellPadding.height : 0;
LayoutLength totalLength = mTotalLength;
mTotalLength = std::max( totalLength, totalLength + length + cellPadding );
{
// Temporarily force children to reuse their old measured height
LayoutLength oldHeight = desiredHeight;
- childOwner.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, childLayout->GetMeasuredHeight().mValue );
+ childOwner.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, childLayout->GetMeasuredHeight().AsInteger() );
// Remeasure with new dimensions
MeasureChildWithMargins( childLayout, uniformMeasureSpec, 0, heightMeasureSpec, 0 );
- childOwner.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, oldHeight.mValue );
+ childOwner.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, oldHeight.AsInteger() );
}
}
}
default:
{
// mTotalLength contains the padding already
- childTop = LayoutLength( padding.top ) + ( bottom - top - mTotalLength ) / 2;
+ childTop = padding.top + ( bottom - top - mTotalLength ) / 2.0f;
break;
}
}
}
case Dali::Toolkit::LinearLayout::Alignment::CENTER_HORIZONTAL:
{
- childLeft = LayoutLength( padding.start ) + ( childSpace - childWidth ) / 2 + childMargin.start - childMargin.end;
+ childLeft = padding.start + ( childSpace - childWidth ) / 2.0f + childMargin.start - childMargin.end;
break;
}
}