Internal::Actor& rootImpl = GetImplementation( root );
- DALI_TEST_CHECK( rootImpl.IsLayoutDirty( WIDTH ) == expectedWidthDirty );
- DALI_TEST_CHECK( rootImpl.IsLayoutDirty( HEIGHT ) == expectedHeightDirty );
+ DALI_TEST_CHECK( rootImpl.IsLayoutDirty( Dimension::WIDTH ) == expectedWidthDirty );
+ DALI_TEST_CHECK( rootImpl.IsLayoutDirty( Dimension::HEIGHT ) == expectedHeightDirty );
for( unsigned int i = 0, numChildren = root.GetChildCount(); i < numChildren; ++i )
{
*
* @return Return the new actor
*/
-Actor NewRelayoutActor( bool expectedWidthDirty, bool expectedHeightDirty, ResizePolicy widthPolicy, ResizePolicy heightPolicy )
+Actor NewRelayoutActor( bool expectedWidthDirty, bool expectedHeightDirty, ResizePolicy::Type widthPolicy, ResizePolicy::Type heightPolicy )
{
Actor actor = Actor::New();
actor.SetRelayoutEnabled( true );
- actor.SetResizePolicy( widthPolicy, WIDTH );
- actor.SetResizePolicy( heightPolicy, HEIGHT );
+ actor.SetResizePolicy( widthPolicy, Dimension::WIDTH );
+ actor.SetResizePolicy( heightPolicy, Dimension::HEIGHT );
// Expected results for this actor
actor.RegisterProperty( EXPECTED_WIDTH_DIRTY, expectedWidthDirty, Property::READ_WRITE );
*
* @return Return the new actor
*/
-Actor NewRelayoutRootActor( bool requestWidth, bool requestHeight, bool expectedWidthDirty, bool expectedHeightDirty, ResizePolicy widthPolicy, ResizePolicy heightPolicy )
+Actor NewRelayoutRootActor( bool requestWidth, bool requestHeight, bool expectedWidthDirty, bool expectedHeightDirty, ResizePolicy::Type widthPolicy, ResizePolicy::Type heightPolicy )
{
Actor actor = NewRelayoutActor( expectedWidthDirty, expectedHeightDirty, widthPolicy, heightPolicy );
const bool widthRequest = root.GetProperty( root.GetPropertyIndex( REQUEST_WIDTH ) ).Get< bool >();
const bool heightRequest = root.GetProperty( root.GetPropertyIndex( REQUEST_HEIGHT ) ).Get< bool >();
- const Dimension dimensions = Dimension( ( ( widthRequest ) ? WIDTH : 0 ) | ( ( heightRequest ) ? HEIGHT : 0 ) );
+ const Dimension::Type dimensions = Dimension::Type( ( ( widthRequest ) ? Dimension::WIDTH : 0 ) | ( ( heightRequest ) ? Dimension::HEIGHT : 0 ) );
controller->RequestRelayout( ( entryPoint ) ? entryPoint : root, dimensions );
TestApplication application;
// Construct scene
- Actor parent = NewRelayoutRootActor( true, true, true, true, FIXED, FIXED );
+ Actor parent = NewRelayoutRootActor( true, true, true, true, ResizePolicy::FIXED, ResizePolicy::FIXED );
TestTree( application, parent );
controller->SetEnabled( false );
// Construct scene
- Actor parent = NewRelayoutRootActor( true, true, true, true, FIXED, FIXED );
+ Actor parent = NewRelayoutRootActor( true, true, true, true, ResizePolicy::FIXED, ResizePolicy::FIXED );
// Add a child
- Actor child = NewRelayoutActor( false, false, FIXED, FIXED );
+ Actor child = NewRelayoutActor( false, false, ResizePolicy::FIXED, ResizePolicy::FIXED );
parent.Add( child );
TestTree( application, parent );
controller->SetEnabled( false );
// Construct scene
- Actor parent = NewRelayoutRootActor( true, true, true, true, USE_NATURAL_SIZE, USE_NATURAL_SIZE );
+ Actor parent = NewRelayoutRootActor( true, true, true, true, ResizePolicy::USE_NATURAL_SIZE, ResizePolicy::USE_NATURAL_SIZE );
// Add a child
- Actor child = NewRelayoutActor( false, false, FIXED, FIXED );
+ Actor child = NewRelayoutActor( false, false, ResizePolicy::FIXED, ResizePolicy::FIXED );
parent.Add( child );
// Run the test
controller->SetEnabled( false );
// Construct scene
- Actor parent = NewRelayoutRootActor( true, true, true, true, FILL_TO_PARENT, FILL_TO_PARENT );
+ Actor parent = NewRelayoutRootActor( true, true, true, true, ResizePolicy::FILL_TO_PARENT, ResizePolicy::FILL_TO_PARENT );
// Add a child
- Actor child = NewRelayoutActor( false, false, FIXED, FIXED );
+ Actor child = NewRelayoutActor( false, false, ResizePolicy::FIXED, ResizePolicy::FIXED );
parent.Add( child );
// Run the test
controller->SetEnabled( false );
// Construct scene
- Actor parent = NewRelayoutRootActor( true, true, true, true, FIT_TO_CHILDREN, FIT_TO_CHILDREN );
+ Actor parent = NewRelayoutRootActor( true, true, true, true, ResizePolicy::FIT_TO_CHILDREN, ResizePolicy::FIT_TO_CHILDREN );
// Add a child
- Actor child = NewRelayoutActor( false, false, FIXED, FIXED );
+ Actor child = NewRelayoutActor( false, false, ResizePolicy::FIXED, ResizePolicy::FIXED );
parent.Add( child );
// Run the test
controller->SetEnabled( false );
// Construct scene
- Actor parent = NewRelayoutRootActor( true, true, true, true, DIMENSION_DEPENDENCY, FIT_TO_CHILDREN );
+ Actor parent = NewRelayoutRootActor( true, true, true, true, ResizePolicy::DIMENSION_DEPENDENCY, ResizePolicy::FIT_TO_CHILDREN );
// Add a child
- Actor child = NewRelayoutActor( false, false, FIXED, FIXED );
+ Actor child = NewRelayoutActor( false, false, ResizePolicy::FIXED, ResizePolicy::FIXED );
parent.Add( child );
// Run the test
controller->SetEnabled( false );
// Construct scene
- Actor parent = NewRelayoutRootActor( true, true, true, true, FIT_TO_CHILDREN, DIMENSION_DEPENDENCY );
+ Actor parent = NewRelayoutRootActor( true, true, true, true, ResizePolicy::FIT_TO_CHILDREN, ResizePolicy::DIMENSION_DEPENDENCY );
- Actor child = NewRelayoutActor( false, false, FIXED, FIXED );
+ Actor child = NewRelayoutActor( false, false, ResizePolicy::FIXED, ResizePolicy::FIXED );
parent.Add( child );
controller->SetEnabled( false );
// Construct scene
- Actor parent = NewRelayoutRootActor( true, true, true, true, FIT_TO_CHILDREN, FIT_TO_CHILDREN );
+ Actor parent = NewRelayoutRootActor( true, true, true, true, ResizePolicy::FIT_TO_CHILDREN, ResizePolicy::FIT_TO_CHILDREN );
// Add a child
- Actor child = NewRelayoutActor( true, true, FIXED, FIXED );
+ Actor child = NewRelayoutActor( true, true, ResizePolicy::FIXED, ResizePolicy::FIXED );
parent.Add( child );
// Run the test
controller->SetEnabled( false );
// Construct scene
- Actor parent = NewRelayoutRootActor( true, true, false, false, FIXED, FIXED );
+ Actor parent = NewRelayoutRootActor( true, true, false, false, ResizePolicy::FIXED, ResizePolicy::FIXED );
// Add a child
- Actor child = NewRelayoutActor( true, true, FIXED, FIXED );
+ Actor child = NewRelayoutActor( true, true, ResizePolicy::FIXED, ResizePolicy::FIXED );
parent.Add( child );
// Run the test
controller->SetEnabled( false );
// Construct scene
- Actor parent = NewRelayoutRootActor( true, true, true, true, FIXED, FIXED );
+ Actor parent = NewRelayoutRootActor( true, true, true, true, ResizePolicy::FIXED, ResizePolicy::FIXED );
// Add children
- Actor child1 = NewRelayoutActor( true, false, FILL_TO_PARENT, FIXED );
+ Actor child1 = NewRelayoutActor( true, false, ResizePolicy::FILL_TO_PARENT, ResizePolicy::FIXED );
parent.Add( child1 );
- Actor child2 = NewRelayoutActor( false, true, FIXED, FILL_TO_PARENT );
+ Actor child2 = NewRelayoutActor( false, true, ResizePolicy::FIXED, ResizePolicy::FILL_TO_PARENT );
parent.Add( child2 );
- Actor child3 = NewRelayoutActor( false, false, USE_NATURAL_SIZE, FIXED );
+ Actor child3 = NewRelayoutActor( false, false, ResizePolicy::USE_NATURAL_SIZE, ResizePolicy::FIXED );
parent.Add( child3 );
// Grand children 1
- Actor grandChild1_1 = NewRelayoutActor( true, false, FILL_TO_PARENT, FIXED );
+ Actor grandChild1_1 = NewRelayoutActor( true, false, ResizePolicy::FILL_TO_PARENT, ResizePolicy::FIXED );
child1.Add( grandChild1_1 );
- Actor grandChild1_2 = NewRelayoutActor( false, false, FIXED, FILL_TO_PARENT );
+ Actor grandChild1_2 = NewRelayoutActor( false, false, ResizePolicy::FIXED, ResizePolicy::FILL_TO_PARENT );
child1.Add( grandChild1_2 );
// Grand children 2
- Actor grandChild2_1 = NewRelayoutActor( false, false, FIXED, FIXED );
+ Actor grandChild2_1 = NewRelayoutActor( false, false, ResizePolicy::FIXED, ResizePolicy::FIXED );
child2.Add( grandChild2_1 );
- Actor grandChild2_2 = NewRelayoutActor( false, false, FIXED, FIXED );
+ Actor grandChild2_2 = NewRelayoutActor( false, false, ResizePolicy::FIXED, ResizePolicy::FIXED );
child2.Add( grandChild2_2 );
// Run the test
controller->SetEnabled( false );
// Construct scene
- Actor parent = NewRelayoutRootActor( true, false, true, false, FIXED, FIXED );
+ Actor parent = NewRelayoutRootActor( true, false, true, false, ResizePolicy::FIXED, ResizePolicy::FIXED );
// Add children
- Actor child1 = NewRelayoutActor( true, false, FILL_TO_PARENT, FIXED );
+ Actor child1 = NewRelayoutActor( true, false, ResizePolicy::FILL_TO_PARENT, ResizePolicy::FIXED );
parent.Add( child1 );
- Actor child2 = NewRelayoutActor( false, false, FIXED, FILL_TO_PARENT );
+ Actor child2 = NewRelayoutActor( false, false, ResizePolicy::FIXED, ResizePolicy::FILL_TO_PARENT );
parent.Add( child2 );
- Actor child3 = NewRelayoutActor( false, false, USE_NATURAL_SIZE, FIXED );
+ Actor child3 = NewRelayoutActor( false, false, ResizePolicy::USE_NATURAL_SIZE, ResizePolicy::FIXED );
parent.Add( child3 );
// Grand children 1
- Actor grandChild1_1 = NewRelayoutActor( true, false, FILL_TO_PARENT, FIXED );
+ Actor grandChild1_1 = NewRelayoutActor( true, false, ResizePolicy::FILL_TO_PARENT, ResizePolicy::FIXED );
child1.Add( grandChild1_1 );
- Actor grandChild1_2 = NewRelayoutActor( false, false, FIXED, FILL_TO_PARENT );
+ Actor grandChild1_2 = NewRelayoutActor( false, false, ResizePolicy::FIXED, ResizePolicy::FILL_TO_PARENT );
child1.Add( grandChild1_2 );
// Grand children 2
- Actor grandChild2_1 = NewRelayoutActor( false, false, FIXED, FIXED );
+ Actor grandChild2_1 = NewRelayoutActor( false, false, ResizePolicy::FIXED, ResizePolicy::FIXED );
child2.Add( grandChild2_1 );
- Actor grandChild2_2 = NewRelayoutActor( false, false, FIXED, FIXED );
+ Actor grandChild2_2 = NewRelayoutActor( false, false, ResizePolicy::FIXED, ResizePolicy::FIXED );
child2.Add( grandChild2_2 );
// Run the test
controller->SetEnabled( false );
// Construct scene
- Actor parent = NewRelayoutRootActor( false, true, false, true, FIXED, FIXED );
+ Actor parent = NewRelayoutRootActor( false, true, false, true, ResizePolicy::FIXED, ResizePolicy::FIXED );
// Add children
- Actor child1 = NewRelayoutActor( false, false, FILL_TO_PARENT, FIXED );
+ Actor child1 = NewRelayoutActor( false, false, ResizePolicy::FILL_TO_PARENT, ResizePolicy::FIXED );
parent.Add( child1 );
- Actor child2 = NewRelayoutActor( false, true, FIXED, FILL_TO_PARENT );
+ Actor child2 = NewRelayoutActor( false, true, ResizePolicy::FIXED, ResizePolicy::FILL_TO_PARENT );
parent.Add( child2 );
- Actor child3 = NewRelayoutActor( false, false, USE_NATURAL_SIZE, FIXED );
+ Actor child3 = NewRelayoutActor( false, false, ResizePolicy::USE_NATURAL_SIZE, ResizePolicy::FIXED );
parent.Add( child3 );
// Grand children 1
- Actor grandChild1_1 = NewRelayoutActor( false, false, FILL_TO_PARENT, FIXED );
+ Actor grandChild1_1 = NewRelayoutActor( false, false, ResizePolicy::FILL_TO_PARENT, ResizePolicy::FIXED );
child1.Add( grandChild1_1 );
- Actor grandChild1_2 = NewRelayoutActor( false, false, FIXED, FILL_TO_PARENT );
+ Actor grandChild1_2 = NewRelayoutActor( false, false, ResizePolicy::FIXED, ResizePolicy::FILL_TO_PARENT );
child1.Add( grandChild1_2 );
// Grand children 2
- Actor grandChild2_1 = NewRelayoutActor( false, false, FIXED, FIXED );
+ Actor grandChild2_1 = NewRelayoutActor( false, false, ResizePolicy::FIXED, ResizePolicy::FIXED );
child2.Add( grandChild2_1 );
- Actor grandChild2_2 = NewRelayoutActor( false, false, FIXED, FIXED );
+ Actor grandChild2_2 = NewRelayoutActor( false, false, ResizePolicy::FIXED, ResizePolicy::FIXED );
child2.Add( grandChild2_2 );
// Run the test
controller->SetEnabled( false );
// Construct scene
- Actor parent = NewRelayoutRootActor( true, true, false, false, FIXED, FIXED );
+ Actor parent = NewRelayoutRootActor( true, true, false, false, ResizePolicy::FIXED, ResizePolicy::FIXED );
// Add a child
- Actor child = NewRelayoutActor( true, true, FILL_TO_PARENT, FIXED );
- child.SetResizePolicy( DIMENSION_DEPENDENCY, HEIGHT );
+ Actor child = NewRelayoutActor( true, true, ResizePolicy::FILL_TO_PARENT, ResizePolicy::FIXED );
+ child.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT );
parent.Add( child );
// Run the test
DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::HEIGHT_RESIZE_POLICY ).Get< std::string >(), "FIXED", TEST_LOCATION );
// Set resize policy for all dimensions
- actor.SetResizePolicy( USE_NATURAL_SIZE, ALL_DIMENSIONS );
- for( unsigned int i = 0; i < DIMENSION_COUNT; ++i)
+ actor.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
+ for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i)
{
- DALI_TEST_EQUALS( actor.GetResizePolicy( static_cast< Dimension >( 1 << i ) ), USE_NATURAL_SIZE, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor.GetResizePolicy( static_cast< Dimension::Type >( 1 << i ) ), ResizePolicy::USE_NATURAL_SIZE, TEST_LOCATION );
}
// Set individual dimensions
{
}
- virtual void OnSetResizePolicy( ResizePolicy policy, Dimension dimension )
+ virtual void OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension )
{
}
- virtual void OnCalculateRelayoutSize( Dimension dimension )
+ virtual void OnCalculateRelayoutSize( Dimension::Type dimension )
{
}
- virtual float CalculateChildSize( const Dali::Actor& child, Dimension dimension )
+ virtual float CalculateChildSize( const Dali::Actor& child, Dimension::Type dimension )
{
return 0.0f;
}
- virtual void OnLayoutNegotiated( float size, Dimension dimension )
+ virtual void OnLayoutNegotiated( float size, Dimension::Type dimension )
{
}
- virtual bool RelayoutDependentOnChildren( Dimension dimension = ALL_DIMENSIONS )
+ virtual bool RelayoutDependentOnChildren( Dimension::Type dimension = Dimension::ALL_DIMENSIONS )
{
return false;
}
{
}
- virtual void OnSetResizePolicy( ResizePolicy policy, Dimension dimension )
+ virtual void OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension )
{
}
- virtual void OnCalculateRelayoutSize( Dimension dimension )
+ virtual void OnCalculateRelayoutSize( Dimension::Type dimension )
{
}
- virtual float CalculateChildSize( const Dali::Actor& child, Dimension dimension )
+ virtual float CalculateChildSize( const Dali::Actor& child, Dimension::Type dimension )
{
return 0.0f;
}
- virtual void OnLayoutNegotiated( float size, Dimension dimension )
+ virtual void OnLayoutNegotiated( float size, Dimension::Type dimension )
{
}
- virtual bool RelayoutDependentOnChildren( Dimension dimension = ALL_DIMENSIONS )
+ virtual bool RelayoutDependentOnChildren( Dimension::Type dimension = Dimension::ALL_DIMENSIONS )
{
return false;
}
{
}
- virtual void OnLayoutNegotiated( float size, Dimension dimension )
+ virtual void OnLayoutNegotiated( float size, Dimension::Type dimension )
{
}
- virtual void OnCalculateRelayoutSize( Dimension dimension )
+ virtual void OnCalculateRelayoutSize( Dimension::Type dimension )
{
}
{
}
- virtual void OnSetResizePolicy( ResizePolicy policy, Dimension dimension )
+ virtual void OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension )
{
}
- virtual void OnCalculateRelayoutSize( Dimension dimension )
+ virtual void OnCalculateRelayoutSize( Dimension::Type dimension )
{
}
- virtual float CalculateChildSize( const Dali::Actor& child, Dimension dimension )
+ virtual float CalculateChildSize( const Dali::Actor& child, Dimension::Type dimension )
{
return 0.0f;
}
- virtual void OnLayoutNegotiated( float size, Dimension dimension )
+ virtual void OnLayoutNegotiated( float size, Dimension::Type dimension )
{
}
- virtual bool RelayoutDependentOnChildren( Dimension dimension = ALL_DIMENSIONS )
+ virtual bool RelayoutDependentOnChildren( Dimension::Type dimension = Dimension::ALL_DIMENSIONS )
{
return false;
}
namespace Dali
{
+namespace ResizePolicy
+{
+
+namespace
+{
+DALI_ENUM_TO_STRING_TABLE_BEGIN( Type )DALI_ENUM_TO_STRING( FIXED )
+DALI_ENUM_TO_STRING( USE_NATURAL_SIZE )
+DALI_ENUM_TO_STRING( FILL_TO_PARENT )
+DALI_ENUM_TO_STRING( SIZE_RELATIVE_TO_PARENT )
+DALI_ENUM_TO_STRING( SIZE_FIXED_OFFSET_FROM_PARENT )
+DALI_ENUM_TO_STRING( FIT_TO_CHILDREN )
+DALI_ENUM_TO_STRING( DIMENSION_DEPENDENCY )
+DALI_ENUM_TO_STRING( USE_ASSIGNED_SIZE )
+DALI_ENUM_TO_STRING_TABLE_END( Type )
+
+} // unnamed namespace
+} // ResizePolicy
+
+namespace SizeScalePolicy
+{
+namespace
+{
+// Enumeration to / from string conversion tables
+DALI_ENUM_TO_STRING_TABLE_BEGIN( Type )DALI_ENUM_TO_STRING( USE_SIZE_SET )
+DALI_ENUM_TO_STRING( FIT_WITH_ASPECT_RATIO )
+DALI_ENUM_TO_STRING( FILL_WITH_ASPECT_RATIO )
+DALI_ENUM_TO_STRING_TABLE_END( Type )
+} // unnamed namespace
+} // SizeScalePolicy
namespace Internal
{
struct Actor::RelayoutData
{
RelayoutData()
- : sizeModeFactor( Vector3::ONE ), preferredSize( Vector2::ZERO ), sizeSetPolicy( USE_SIZE_SET ), relayoutEnabled( false ), insideRelayout( false )
+ : sizeModeFactor( Vector3::ONE ), preferredSize( Vector2::ZERO ), sizeSetPolicy( SizeScalePolicy::USE_SIZE_SET ), relayoutEnabled( false ), insideRelayout( false )
{
// Set size negotiation defaults
- for( unsigned int i = 0; i < DIMENSION_COUNT; ++i )
+ for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
{
- resizePolicies[ i ] = FIXED;
+ resizePolicies[ i ] = ResizePolicy::FIXED;
negotiatedDimensions[ i ] = 0.0f;
dimensionNegotiated[ i ] = false;
dimensionDirty[ i ] = false;
- dimensionDependencies[ i ] = ALL_DIMENSIONS;
+ dimensionDependencies[ i ] = Dimension::ALL_DIMENSIONS;
dimensionPadding[ i ] = Vector2( 0.0f, 0.0f );
minimumSize[ i ] = 0.0f;
maximumSize[ i ] = FLT_MAX;
}
}
- ResizePolicy resizePolicies[ DIMENSION_COUNT ]; ///< Resize policies
+ ResizePolicy::Type resizePolicies[ Dimension::DIMENSION_COUNT ]; ///< Resize policies
- Dimension dimensionDependencies[ DIMENSION_COUNT ]; ///< A list of dimension dependencies
+ Dimension::Type dimensionDependencies[ Dimension::DIMENSION_COUNT ]; ///< A list of dimension dependencies
- Vector2 dimensionPadding[ DIMENSION_COUNT ]; ///< Padding for each dimension. X = start (e.g. left, bottom), y = end (e.g. right, top)
+ Vector2 dimensionPadding[ Dimension::DIMENSION_COUNT ]; ///< Padding for each dimension. X = start (e.g. left, bottom), y = end (e.g. right, top)
- float negotiatedDimensions[ DIMENSION_COUNT ]; ///< Storage for when a dimension is negotiated but before set on actor
+ float negotiatedDimensions[ Dimension::DIMENSION_COUNT ]; ///< Storage for when a dimension is negotiated but before set on actor
- float minimumSize[ DIMENSION_COUNT ]; ///< The minimum size an actor can be
- float maximumSize[ DIMENSION_COUNT ]; ///< The maximum size an actor can be
+ float minimumSize[ Dimension::DIMENSION_COUNT ]; ///< The minimum size an actor can be
+ float maximumSize[ Dimension::DIMENSION_COUNT ]; ///< The maximum size an actor can be
- bool dimensionNegotiated[ DIMENSION_COUNT ]; ///< Has the dimension been negotiated
- bool dimensionDirty[ DIMENSION_COUNT ]; ///< Flags indicating whether the layout dimension is dirty or not
+ bool dimensionNegotiated[ Dimension::DIMENSION_COUNT ]; ///< Has the dimension been negotiated
+ bool dimensionDirty[ Dimension::DIMENSION_COUNT ]; ///< Flags indicating whether the layout dimension is dirty or not
Vector3 sizeModeFactor; ///< Factor of size used for certain SizeModes
Vector2 preferredSize; ///< The preferred size of the actor
- SizeScalePolicy sizeSetPolicy :3; ///< Policy to apply when setting size. Enough room for the enum
+ SizeScalePolicy::Type sizeSetPolicy :3; ///< Policy to apply when setting size. Enough room for the enum
bool relayoutEnabled :1; ///< Flag to specify if this actor should be included in size negotiation or not (defaults to true)
bool insideRelayout :1; ///< Locking flag to prevent recursive relayouts on size set
const char* const ACTION_SHOW = "show";
const char* const ACTION_HIDE = "hide";
-// Enumeration to / from string conversion tables
-
-DALI_ENUM_TO_STRING_TABLE_BEGIN( ResizePolicy )DALI_ENUM_TO_STRING( FIXED )
-DALI_ENUM_TO_STRING( USE_NATURAL_SIZE )
-DALI_ENUM_TO_STRING( FILL_TO_PARENT )
-DALI_ENUM_TO_STRING( SIZE_RELATIVE_TO_PARENT )
-DALI_ENUM_TO_STRING( SIZE_FIXED_OFFSET_FROM_PARENT )
-DALI_ENUM_TO_STRING( FIT_TO_CHILDREN )
-DALI_ENUM_TO_STRING( DIMENSION_DEPENDENCY )
-DALI_ENUM_TO_STRING( USE_ASSIGNED_SIZE )
-DALI_ENUM_TO_STRING_TABLE_END( ResizePolicy )
-
-DALI_ENUM_TO_STRING_TABLE_BEGIN( SizeScalePolicy )DALI_ENUM_TO_STRING( USE_SIZE_SET )
-DALI_ENUM_TO_STRING( FIT_WITH_ASPECT_RATIO )
-DALI_ENUM_TO_STRING( FILL_WITH_ASPECT_RATIO )
-DALI_ENUM_TO_STRING_TABLE_END( SizeScalePolicy )
-
BaseHandle CreateActor()
{
return Dali::Actor::New();
* @param[in] dimension The dimension to extract
* @return Return the value for the dimension
*/
-float GetDimensionValue( const Vector2& values, Dimension dimension )
+float GetDimensionValue( const Vector2& values, Dimension::Type dimension )
{
switch( dimension )
{
- case WIDTH:
+ case Dimension::WIDTH:
{
return values.width;
}
- case HEIGHT:
+ case Dimension::HEIGHT:
{
return values.height;
}
* @param[in] dimension The dimension to extract
* @return Return the value for the dimension
*/
-float GetDimensionValue( const Vector3& values, Dimension dimension )
+float GetDimensionValue( const Vector3& values, Dimension::Type dimension )
{
return GetDimensionValue( values.GetVectorXY(), dimension );
}
void Actor::SetPosition( const Vector3& position )
{
+ mTargetPosition = position;
+
if( NULL != mNode )
{
// mNode is being used in a separate thread; queue a message to set the value & base value
void Actor::SetX( float x )
{
+ mTargetPosition.x = x;
+
if( NULL != mNode )
{
// mNode is being used in a separate thread; queue a message to set the value & base value
void Actor::SetY( float y )
{
+ mTargetPosition.y = y;
+
if( NULL != mNode )
{
// mNode is being used in a separate thread; queue a message to set the value & base value
void Actor::SetZ( float z )
{
+ mTargetPosition.z = z;
+
if( NULL != mNode )
{
// mNode is being used in a separate thread; queue a message to set the value & base value
void Actor::TranslateBy( const Vector3& distance )
{
+ mTargetPosition += distance;
+
if( NULL != mNode )
{
// mNode is being used in a separate thread; queue a message to set the value & base value
return Vector3::ZERO;
}
+const Vector3& Actor::GetTargetPosition() const
+{
+ return mTargetPosition;
+}
+
const Vector3& Actor::GetCurrentWorldPosition() const
{
if( NULL != mNode )
return Vector3( 0.0f, 0.0f, 0.0f );
}
-void Actor::SetResizePolicy( ResizePolicy policy, Dimension dimension )
+void Actor::SetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension )
{
EnsureRelayoutData();
- for( unsigned int i = 0; i < DIMENSION_COUNT; ++i )
+ for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
{
if( dimension & ( 1 << i ) )
{
}
}
- if( policy == DIMENSION_DEPENDENCY )
+ if( policy == ResizePolicy::DIMENSION_DEPENDENCY )
{
- if( dimension & WIDTH )
+ if( dimension & Dimension::WIDTH )
{
- SetDimensionDependency( WIDTH, HEIGHT );
+ SetDimensionDependency( Dimension::WIDTH, Dimension::HEIGHT );
}
- if( dimension & HEIGHT )
+ if( dimension & Dimension::HEIGHT )
{
- SetDimensionDependency( HEIGHT, WIDTH );
+ SetDimensionDependency( Dimension::HEIGHT, Dimension::WIDTH );
}
}
RelayoutRequest();
}
-ResizePolicy Actor::GetResizePolicy( Dimension dimension ) const
+ResizePolicy::Type Actor::GetResizePolicy( Dimension::Type dimension ) const
{
EnsureRelayoutData();
// If more than one dimension is requested, just return the first one found
- for( unsigned int i = 0; i < DIMENSION_COUNT; ++i )
+ for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
{
if( ( dimension & ( 1 << i ) ) )
{
}
}
- return FIXED; // Default
+ return ResizePolicy::FIXED; // Default
}
-void Actor::SetSizeScalePolicy( SizeScalePolicy policy )
+void Actor::SetSizeScalePolicy( SizeScalePolicy::Type policy )
{
EnsureRelayoutData();
mRelayoutData->sizeSetPolicy = policy;
}
-SizeScalePolicy Actor::GetSizeScalePolicy() const
+SizeScalePolicy::Type Actor::GetSizeScalePolicy() const
{
EnsureRelayoutData();
return mRelayoutData->sizeSetPolicy;
}
-void Actor::SetDimensionDependency( Dimension dimension, Dimension dependency )
+void Actor::SetDimensionDependency( Dimension::Type dimension, Dimension::Type dependency )
{
EnsureRelayoutData();
- for( unsigned int i = 0; i < DIMENSION_COUNT; ++i )
+ for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
{
if( dimension & ( 1 << i ) )
{
}
}
-Dimension Actor::GetDimensionDependency( Dimension dimension ) const
+Dimension::Type Actor::GetDimensionDependency( Dimension::Type dimension ) const
{
EnsureRelayoutData();
// If more than one dimension is requested, just return the first one found
- for( unsigned int i = 0; i < DIMENSION_COUNT; ++i )
+ for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
{
if( ( dimension & ( 1 << i ) ) )
{
}
}
- return ALL_DIMENSIONS; // Default
+ return Dimension::ALL_DIMENSIONS; // Default
}
void Actor::SetRelayoutEnabled( bool relayoutEnabled )
return mRelayoutData && mRelayoutData->relayoutEnabled;
}
-void Actor::SetLayoutDirty( bool dirty, Dimension dimension )
+void Actor::SetLayoutDirty( bool dirty, Dimension::Type dimension )
{
EnsureRelayoutData();
- for( unsigned int i = 0; i < DIMENSION_COUNT; ++i )
+ for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
{
if( dimension & ( 1 << i ) )
{
}
}
-bool Actor::IsLayoutDirty( Dimension dimension ) const
+bool Actor::IsLayoutDirty( Dimension::Type dimension ) const
{
EnsureRelayoutData();
- for( unsigned int i = 0; i < DIMENSION_COUNT; ++i )
+ for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
{
if( ( dimension & ( 1 << i ) ) && mRelayoutData->dimensionDirty[ i ] )
{
return false;
}
-bool Actor::RelayoutPossible( Dimension dimension ) const
+bool Actor::RelayoutPossible( Dimension::Type dimension ) const
{
EnsureRelayoutData();
return mRelayoutData->relayoutEnabled && !IsLayoutDirty( dimension );
}
-bool Actor::RelayoutRequired( Dimension dimension ) const
+bool Actor::RelayoutRequired( Dimension::Type dimension ) const
{
EnsureRelayoutData();
case Dali::Actor::Property::WIDTH_RESIZE_POLICY:
{
- SetResizePolicy( Scripting::GetEnumeration< ResizePolicy >( property.Get< std::string >().c_str(), ResizePolicyTable, ResizePolicyTableCount ), WIDTH );
+ SetResizePolicy( Scripting::GetEnumeration< ResizePolicy::Type >( property.Get< std::string >().c_str(), ResizePolicy::TypeTable, ResizePolicy::TypeTableCount ), Dimension::WIDTH );
break;
}
case Dali::Actor::Property::HEIGHT_RESIZE_POLICY:
{
- SetResizePolicy( Scripting::GetEnumeration< ResizePolicy >( property.Get< std::string >().c_str(), ResizePolicyTable, ResizePolicyTableCount ), HEIGHT );
+ SetResizePolicy( Scripting::GetEnumeration< ResizePolicy::Type >( property.Get< std::string >().c_str(), ResizePolicy::TypeTable, ResizePolicy::TypeTableCount ), Dimension::HEIGHT );
break;
}
case Dali::Actor::Property::SIZE_SCALE_POLICY:
{
- SetSizeScalePolicy( Scripting::GetEnumeration< SizeScalePolicy >( property.Get< std::string >().c_str(), SizeScalePolicyTable, SizeScalePolicyTableCount ) );
+ SetSizeScalePolicy( Scripting::GetEnumeration< SizeScalePolicy::Type >( property.Get< std::string >().c_str(), SizeScalePolicy::TypeTable, SizeScalePolicy::TypeTableCount ) );
break;
}
{
if( property.Get< bool >() )
{
- SetResizePolicy( DIMENSION_DEPENDENCY, WIDTH );
+ SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::WIDTH );
}
break;
}
{
if( property.Get< bool >() )
{
- SetResizePolicy( DIMENSION_DEPENDENCY, HEIGHT );
+ SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT );
}
break;
}
case Dali::Actor::Property::PADDING:
{
Vector4 padding = property.Get< Vector4 >();
- SetPadding( Vector2( padding.x, padding.y ), WIDTH );
- SetPadding( Vector2( padding.z, padding.w ), HEIGHT );
+ SetPadding( Vector2( padding.x, padding.y ), Dimension::WIDTH );
+ SetPadding( Vector2( padding.z, padding.w ), Dimension::HEIGHT );
break;
}
case Dali::Actor::Property::MINIMUM_SIZE:
{
Vector2 size = property.Get< Vector2 >();
- SetMinimumSize( size.x, WIDTH );
- SetMinimumSize( size.y, HEIGHT );
+ SetMinimumSize( size.x, Dimension::WIDTH );
+ SetMinimumSize( size.y, Dimension::HEIGHT );
break;
}
case Dali::Actor::Property::MAXIMUM_SIZE:
{
Vector2 size = property.Get< Vector2 >();
- SetMaximumSize( size.x, WIDTH );
- SetMaximumSize( size.y, HEIGHT );
+ SetMaximumSize( size.x, Dimension::WIDTH );
+ SetMaximumSize( size.y, Dimension::HEIGHT );
break;
}
case Dali::Actor::Property::WIDTH_RESIZE_POLICY:
{
- value = Scripting::GetLinearEnumerationName< ResizePolicy >( GetResizePolicy( WIDTH ), ResizePolicyTable, ResizePolicyTableCount );
+ value = Scripting::GetLinearEnumerationName< ResizePolicy::Type >( GetResizePolicy( Dimension::WIDTH ), ResizePolicy::TypeTable, ResizePolicy::TypeTableCount );
break;
}
case Dali::Actor::Property::HEIGHT_RESIZE_POLICY:
{
- value = Scripting::GetLinearEnumerationName< ResizePolicy >( GetResizePolicy( HEIGHT ), ResizePolicyTable, ResizePolicyTableCount );
+ value = Scripting::GetLinearEnumerationName< ResizePolicy::Type >( GetResizePolicy( Dimension::HEIGHT ), ResizePolicy::TypeTable, ResizePolicy::TypeTableCount );
break;
}
case Dali::Actor::Property::SIZE_SCALE_POLICY:
{
- value = Scripting::GetLinearEnumerationName< SizeScalePolicy >( GetSizeScalePolicy(), SizeScalePolicyTable, SizeScalePolicyTableCount );
+ value = Scripting::GetLinearEnumerationName< SizeScalePolicy::Type >( GetSizeScalePolicy(), SizeScalePolicy::TypeTable, SizeScalePolicy::TypeTableCount );
break;
}
case Dali::Actor::Property::WIDTH_FOR_HEIGHT:
{
- value = ( GetResizePolicy( WIDTH ) == DIMENSION_DEPENDENCY ) && ( GetDimensionDependency( WIDTH ) == HEIGHT );
+ value = ( GetResizePolicy( Dimension::WIDTH ) == ResizePolicy::DIMENSION_DEPENDENCY ) && ( GetDimensionDependency( Dimension::WIDTH ) == Dimension::HEIGHT );
break;
}
case Dali::Actor::Property::HEIGHT_FOR_WIDTH:
{
- value = ( GetResizePolicy( HEIGHT ) == DIMENSION_DEPENDENCY ) && ( GetDimensionDependency( HEIGHT ) == WIDTH );
+ value = ( GetResizePolicy( Dimension::HEIGHT ) == ResizePolicy::DIMENSION_DEPENDENCY ) && ( GetDimensionDependency( Dimension::HEIGHT ) == Dimension::WIDTH );
break;
}
case Dali::Actor::Property::PADDING:
{
- Vector2 widthPadding = GetPadding( WIDTH );
- Vector2 heightPadding = GetPadding( HEIGHT );
+ Vector2 widthPadding = GetPadding( Dimension::WIDTH );
+ Vector2 heightPadding = GetPadding( Dimension::HEIGHT );
value = Vector4( widthPadding.x, widthPadding.y, heightPadding.x, heightPadding.y );
break;
}
case Dali::Actor::Property::MINIMUM_SIZE:
{
- value = Vector2( GetMinimumSize( WIDTH ), GetMinimumSize( HEIGHT ) );
+ value = Vector2( GetMinimumSize( Dimension::WIDTH ), GetMinimumSize( Dimension::HEIGHT ) );
break;
}
case Dali::Actor::Property::MAXIMUM_SIZE:
{
- value = Vector2( GetMaximumSize( WIDTH ), GetMaximumSize( HEIGHT ) );
+ value = Vector2( GetMaximumSize( Dimension::WIDTH ), GetMaximumSize( Dimension::HEIGHT ) );
break;
}
}
}
-bool Actor::RelayoutDependentOnParent( Dimension dimension )
+bool Actor::RelayoutDependentOnParent( Dimension::Type dimension )
{
// Check if actor is dependent on parent
- for( unsigned int i = 0; i < DIMENSION_COUNT; ++i )
+ for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
{
if( ( dimension & ( 1 << i ) ) )
{
- const ResizePolicy resizePolicy = GetResizePolicy( static_cast< Dimension >( 1 << i ) );
- if( resizePolicy == FILL_TO_PARENT || resizePolicy == SIZE_RELATIVE_TO_PARENT || resizePolicy == SIZE_FIXED_OFFSET_FROM_PARENT )
+ const ResizePolicy::Type resizePolicy = GetResizePolicy( static_cast< Dimension::Type >( 1 << i ) );
+ if( resizePolicy == ResizePolicy::FILL_TO_PARENT || resizePolicy == ResizePolicy::SIZE_RELATIVE_TO_PARENT || resizePolicy == ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT )
{
return true;
}
return false;
}
-bool Actor::RelayoutDependentOnChildren( Dimension dimension )
+bool Actor::RelayoutDependentOnChildren( Dimension::Type dimension )
{
// Check if actor is dependent on children
- for( unsigned int i = 0; i < DIMENSION_COUNT; ++i )
+ for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
{
if( ( dimension & ( 1 << i ) ) )
{
- const ResizePolicy resizePolicy = GetResizePolicy( static_cast< Dimension >( 1 << i ) );
+ const ResizePolicy::Type resizePolicy = GetResizePolicy( static_cast< Dimension::Type >( 1 << i ) );
switch( resizePolicy )
{
- case FIT_TO_CHILDREN:
- case USE_NATURAL_SIZE: // i.e. For things that calculate their size based on children
+ case ResizePolicy::FIT_TO_CHILDREN:
+ case ResizePolicy::USE_NATURAL_SIZE: // i.e. For things that calculate their size based on children
{
return true;
}
return false;
}
-bool Actor::RelayoutDependentOnChildrenBase( Dimension dimension )
+bool Actor::RelayoutDependentOnChildrenBase( Dimension::Type dimension )
{
return Actor::RelayoutDependentOnChildren( dimension );
}
-bool Actor::RelayoutDependentOnDimension( Dimension dimension, Dimension dependentDimension )
+bool Actor::RelayoutDependentOnDimension( Dimension::Type dimension, Dimension::Type dependentDimension )
{
// Check each possible dimension and see if it is dependent on the input one
- for( unsigned int i = 0; i < DIMENSION_COUNT; ++i )
+ for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
{
if( dimension & ( 1 << i ) )
{
- return mRelayoutData->resizePolicies[ i ] == DIMENSION_DEPENDENCY && mRelayoutData->dimensionDependencies[ i ] == dependentDimension;
+ return mRelayoutData->resizePolicies[ i ] == ResizePolicy::DIMENSION_DEPENDENCY && mRelayoutData->dimensionDependencies[ i ] == dependentDimension;
}
}
return false;
}
-void Actor::SetNegotiatedDimension( float negotiatedDimension, Dimension dimension )
+void Actor::SetNegotiatedDimension( float negotiatedDimension, Dimension::Type dimension )
{
- for( unsigned int i = 0; i < DIMENSION_COUNT; ++i )
+ for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
{
if( dimension & ( 1 << i ) )
{
}
}
-float Actor::GetNegotiatedDimension( Dimension dimension ) const
+float Actor::GetNegotiatedDimension( Dimension::Type dimension ) const
{
// If more than one dimension is requested, just return the first one found
- for( unsigned int i = 0; i < DIMENSION_COUNT; ++i )
+ for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
{
if( ( dimension & ( 1 << i ) ) )
{
return 0.0f; // Default
}
-void Actor::SetPadding( const Vector2& padding, Dimension dimension )
+void Actor::SetPadding( const Vector2& padding, Dimension::Type dimension )
{
EnsureRelayoutData();
- for( unsigned int i = 0; i < DIMENSION_COUNT; ++i )
+ for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
{
if( dimension & ( 1 << i ) )
{
}
}
-Vector2 Actor::GetPadding( Dimension dimension ) const
+Vector2 Actor::GetPadding( Dimension::Type dimension ) const
{
EnsureRelayoutData();
// If more than one dimension is requested, just return the first one found
- for( unsigned int i = 0; i < DIMENSION_COUNT; ++i )
+ for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
{
if( ( dimension & ( 1 << i ) ) )
{
return Vector2( 0.0f, 0.0f ); // Default
}
-void Actor::SetLayoutNegotiated( bool negotiated, Dimension dimension )
+void Actor::SetLayoutNegotiated( bool negotiated, Dimension::Type dimension )
{
- for( unsigned int i = 0; i < DIMENSION_COUNT; ++i )
+ for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
{
if( dimension & ( 1 << i ) )
{
}
}
-bool Actor::IsLayoutNegotiated( Dimension dimension ) const
+bool Actor::IsLayoutNegotiated( Dimension::Type dimension ) const
{
- for( unsigned int i = 0; i < DIMENSION_COUNT; ++i )
+ for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
{
if( ( dimension & ( 1 << i ) ) && mRelayoutData->dimensionNegotiated[ i ] )
{
return false;
}
-float Actor::CalculateChildSize( const Dali::Actor& child, Dimension dimension )
+float Actor::CalculateChildSize( const Dali::Actor& child, Dimension::Type dimension )
{
// Could be overridden in derived classes.
return CalculateChildSizeBase( child, dimension );
}
-float Actor::CalculateChildSizeBase( const Dali::Actor& child, Dimension dimension )
+float Actor::CalculateChildSizeBase( const Dali::Actor& child, Dimension::Type dimension )
{
// Fill to parent, taking size mode factor into account
switch( child.GetResizePolicy( dimension ) )
{
- case FILL_TO_PARENT:
+ case ResizePolicy::FILL_TO_PARENT:
{
return GetLatestSize( dimension );
}
- case SIZE_RELATIVE_TO_PARENT:
+ case ResizePolicy::SIZE_RELATIVE_TO_PARENT:
{
return GetLatestSize( dimension ) * GetDimensionValue( child.GetSizeModeFactor(), dimension );
}
- case SIZE_FIXED_OFFSET_FROM_PARENT:
+ case ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT:
{
return GetLatestSize( dimension ) + GetDimensionValue( child.GetSizeModeFactor(), dimension );
}
return width;
}
-float Actor::GetLatestSize( Dimension dimension ) const
+float Actor::GetLatestSize( Dimension::Type dimension ) const
{
return IsLayoutNegotiated( dimension ) ? GetNegotiatedDimension( dimension ) : GetSize( dimension );
}
-float Actor::GetRelayoutSize( Dimension dimension ) const
+float Actor::GetRelayoutSize( Dimension::Type dimension ) const
{
Vector2 padding = GetPadding( dimension );
return GetLatestSize( dimension ) + padding.x + padding.y;
}
-float Actor::NegotiateFromParent( Dimension dimension )
+float Actor::NegotiateFromParent( Dimension::Type dimension )
{
Actor* parent = GetParent();
if( parent )
return 0.0f;
}
-float Actor::NegotiateFromChildren( Dimension dimension )
+float Actor::NegotiateFromChildren( Dimension::Type dimension )
{
- float minDimensionPoint = 0.0f;
float maxDimensionPoint = 0.0f;
for( unsigned int i = 0, count = GetChildCount(); i < count; ++i )
if( !childImpl.RelayoutDependentOnParent( dimension ) )
{
// Calculate the min and max points that the children range across
- float childPosition = GetDimensionValue( childImpl.GetCurrentPosition(), dimension );
+ float childPosition = GetDimensionValue( childImpl.GetTargetPosition(), dimension );
float dimensionSize = childImpl.GetRelayoutSize( dimension );
- minDimensionPoint = std::min( minDimensionPoint, childPosition - dimensionSize * 0.5f );
- maxDimensionPoint = std::max( maxDimensionPoint, childPosition + dimensionSize * 0.5f );
+ maxDimensionPoint = std::max( maxDimensionPoint, childPosition + dimensionSize );
}
}
- return maxDimensionPoint - minDimensionPoint;
+ return maxDimensionPoint;
}
-float Actor::GetSize( Dimension dimension ) const
+float Actor::GetSize( Dimension::Type dimension ) const
{
return GetDimensionValue( GetTargetSize(), dimension );
}
-float Actor::GetNaturalSize( Dimension dimension ) const
+float Actor::GetNaturalSize( Dimension::Type dimension ) const
{
return GetDimensionValue( GetNaturalSize(), dimension );
}
-float Actor::CalculateSize( Dimension dimension, const Vector2& maximumSize )
+float Actor::CalculateSize( Dimension::Type dimension, const Vector2& maximumSize )
{
switch( GetResizePolicy( dimension ) )
{
- case USE_NATURAL_SIZE:
+ case ResizePolicy::USE_NATURAL_SIZE:
{
return GetNaturalSize( dimension );
}
- case FIXED:
+ case ResizePolicy::FIXED:
{
return GetDimensionValue( GetPreferredSize(), dimension );
}
- case USE_ASSIGNED_SIZE:
+ case ResizePolicy::USE_ASSIGNED_SIZE:
{
return GetDimensionValue( maximumSize, dimension );
}
- case FILL_TO_PARENT:
- case SIZE_RELATIVE_TO_PARENT:
- case SIZE_FIXED_OFFSET_FROM_PARENT:
+ case ResizePolicy::FILL_TO_PARENT:
+ case ResizePolicy::SIZE_RELATIVE_TO_PARENT:
+ case ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT:
{
return NegotiateFromParent( dimension );
}
- case FIT_TO_CHILDREN:
+ case ResizePolicy::FIT_TO_CHILDREN:
{
return NegotiateFromChildren( dimension );
}
- case DIMENSION_DEPENDENCY:
+ case ResizePolicy::DIMENSION_DEPENDENCY:
{
- const Dimension dimensionDependency = GetDimensionDependency( dimension );
+ const Dimension::Type dimensionDependency = GetDimensionDependency( dimension );
// Custom rules
- if( dimension == WIDTH && dimensionDependency == HEIGHT )
+ if( dimension == Dimension::WIDTH && dimensionDependency == Dimension::HEIGHT )
{
- return GetWidthForHeight( GetNegotiatedDimension( HEIGHT ) );
+ return GetWidthForHeight( GetNegotiatedDimension( Dimension::HEIGHT ) );
}
- if( dimension == HEIGHT && dimensionDependency == WIDTH )
+ if( dimension == Dimension::HEIGHT && dimensionDependency == Dimension::WIDTH )
{
- return GetHeightForWidth( GetNegotiatedDimension( WIDTH ) );
+ return GetHeightForWidth( GetNegotiatedDimension( Dimension::WIDTH ) );
}
break;
return 0.0f; // Default
}
-float Actor::ConstrainDimension( float size, Dimension dimension )
+float Actor::ConstrainDimension( float size, Dimension::Type dimension )
{
const float minSize = GetMinimumSize( dimension );
const float maxSize = GetMaximumSize( dimension );
return std::max( minSize, std::min( size, maxSize ) );
}
-void Actor::NegotiateDimension( Dimension dimension, const Vector2& allocatedSize, ActorDimensionStack& recursionStack )
+void Actor::NegotiateDimension( Dimension::Type dimension, const Vector2& allocatedSize, ActorDimensionStack& recursionStack )
{
// Check if it needs to be negotiated
if( IsLayoutDirty( dimension ) && !IsLayoutNegotiated( dimension ) )
recursionStack.push_back( ActorDimensionPair( this, dimension ) );
// Dimension dependency check
- for( unsigned int i = 0; i < DIMENSION_COUNT; ++i )
+ for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
{
- Dimension dimensionToCheck = static_cast< Dimension >( 1 << i );
+ Dimension::Type dimensionToCheck = static_cast< Dimension::Type >( 1 << i );
if( RelayoutDependentOnDimension( dimension, dimensionToCheck ) )
{
// Negotiate all dimensions that require it
ActorDimensionStack recursionStack;
- for( unsigned int i = 0; i < DIMENSION_COUNT; ++i )
+ for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
{
- const Dimension dimension = static_cast< Dimension >( 1 << i );
+ const Dimension::Type dimension = static_cast< Dimension::Type >( 1 << i );
// Negotiate
NegotiateDimension( dimension, allocatedSize, recursionStack );
{
switch( mRelayoutData->sizeSetPolicy )
{
- case USE_SIZE_SET:
+ case SizeScalePolicy::USE_SIZE_SET:
{
return size;
}
- case FIT_WITH_ASPECT_RATIO:
+ case SizeScalePolicy::FIT_WITH_ASPECT_RATIO:
{
// Scale size to fit within the original size bounds, keeping the natural size aspect ratio
const Vector3 naturalSize = GetNaturalSize();
break;
}
- case FILL_WITH_ASPECT_RATIO:
+ case SizeScalePolicy::FILL_WITH_ASPECT_RATIO:
{
// Scale size to fill the original size bounds, keeping the natural size aspect ratio. Potentially exceeding the original bounds.
const Vector3 naturalSize = GetNaturalSize();
void Actor::SetNegotiatedSize( RelayoutContainer& container )
{
// Do the set actor size
- Vector2 negotiatedSize( GetLatestSize( WIDTH ), GetLatestSize( HEIGHT ) );
+ Vector2 negotiatedSize( GetLatestSize( Dimension::WIDTH ), GetLatestSize( Dimension::HEIGHT ) );
// Adjust for size set policy
negotiatedSize = ApplySizeSetPolicy( negotiatedSize );
}
}
-void Actor::RelayoutRequest( Dimension dimension )
+void Actor::RelayoutRequest( Dimension::Type dimension )
{
Internal::RelayoutController* relayoutController = Internal::RelayoutController::Get();
if( relayoutController )
}
}
-void Actor::OnCalculateRelayoutSize( Dimension dimension )
+void Actor::OnCalculateRelayoutSize( Dimension::Type dimension )
{
}
-void Actor::OnLayoutNegotiated( float size, Dimension dimension )
+void Actor::OnLayoutNegotiated( float size, Dimension::Type dimension )
{
}
if( size.width > 0.0f )
{
- SetResizePolicy( FIXED, WIDTH );
+ SetResizePolicy( ResizePolicy::FIXED, Dimension::WIDTH );
}
if( size.height > 0.0f )
{
- SetResizePolicy( FIXED, HEIGHT );
+ SetResizePolicy( ResizePolicy::FIXED, Dimension::HEIGHT );
}
mRelayoutData->preferredSize = size;
return mRelayoutData->preferredSize;
}
-void Actor::SetMinimumSize( float size, Dimension dimension )
+void Actor::SetMinimumSize( float size, Dimension::Type dimension )
{
EnsureRelayoutData();
- for( unsigned int i = 0; i < DIMENSION_COUNT; ++i )
+ for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
{
if( dimension & ( 1 << i ) )
{
RelayoutRequest();
}
-float Actor::GetMinimumSize( Dimension dimension ) const
+float Actor::GetMinimumSize( Dimension::Type dimension ) const
{
EnsureRelayoutData();
- for( unsigned int i = 0; i < DIMENSION_COUNT; ++i )
+ for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
{
if( dimension & ( 1 << i ) )
{
return 0.0f; // Default
}
-void Actor::SetMaximumSize( float size, Dimension dimension )
+void Actor::SetMaximumSize( float size, Dimension::Type dimension )
{
EnsureRelayoutData();
- for( unsigned int i = 0; i < DIMENSION_COUNT; ++i )
+ for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
{
if( dimension & ( 1 << i ) )
{
RelayoutRequest();
}
-float Actor::GetMaximumSize( Dimension dimension ) const
+float Actor::GetMaximumSize( Dimension::Type dimension ) const
{
EnsureRelayoutData();
- for( unsigned int i = 0; i < DIMENSION_COUNT; ++i )
+ for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
{
if( dimension & ( 1 << i ) )
{
* @param[in] newActor The actor to assign
* @param[in] newDimension The dimension to assign
*/
- ActorDimensionPair( Actor* newActor, Dimension newDimension )
+ ActorDimensionPair( Actor* newActor, Dimension::Type newDimension )
: actor( newActor ),
dimension( newDimension )
{
}
Actor* actor; ///< The actor to hold
- Dimension dimension; ///< The dimension to hold
+ Dimension::Type dimension; ///< The dimension to hold
};
typedef std::vector< ActorDimensionPair > ActorDimensionStack;
*/
const Vector3& GetCurrentPosition() const;
+ /**
+ * Retrieve the target position of the Actor.
+ * The coordinates are relative to the Actor's parent.
+ * @return the Actor's position.
+ */
+ const Vector3& GetTargetPosition() const;
+
/**
* @copydoc Dali::Actor::GetCurrentWorldPosition()
*/
/**
* Sets the factor of the parents size used for the child actor.
- * Note: Only used if ResizePolicy is SIZE_RELATIVE_TO_PARENT or SIZE_FIXED_OFFSET_FROM_PARENT.
+ * Note: Only used if ResizePolicy is ResizePolicy::SIZE_RELATIVE_TO_PARENT or ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT.
* @param[in] factor The vector to multiply the parents size by to get the childs size.
*/
void SetSizeModeFactor( const Vector3& factor );
/**
* Gets the factor of the parents size used for the child actor.
- * Note: Only used if ResizePolicy is SIZE_RELATIVE_TO_PARENT or SIZE_FIXED_OFFSET_FROM_PARENT.
+ * Note: Only used if ResizePolicy is ResizePolicy::SIZE_RELATIVE_TO_PARENT or ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT.
* @return The vector being used to multiply the parents size by to get the childs size.
*/
const Vector3& GetSizeModeFactor() const;
* @param[in] policy The policy being set
* @param[in] dimension The dimension the policy is being set for
*/
- virtual void OnSetResizePolicy( ResizePolicy policy, Dimension dimension ) {}
+ virtual void OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension ) {}
/**
* @brief Virtual method to notify deriving classes that relayout dependencies have been
*
* @param dimension The dimension that is about to be calculated
*/
- virtual void OnCalculateRelayoutSize( Dimension dimension );
+ virtual void OnCalculateRelayoutSize( Dimension::Type dimension );
/**
* @brief Virtual method to notify deriving classes that the size for a dimension
* @param[in] size The new size for the given dimension
* @param[in] dimension The dimension that was just negotiated
*/
- virtual void OnLayoutNegotiated( float size, Dimension dimension );
+ virtual void OnLayoutNegotiated( float size, Dimension::Type dimension );
/**
* @brief Determine if this actor is dependent on it's children for relayout
* @param dimension The dimension(s) to check for
* @return Return if the actor is dependent on it's children
*/
- virtual bool RelayoutDependentOnChildren( Dimension dimension = ALL_DIMENSIONS );
+ virtual bool RelayoutDependentOnChildren( Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
/**
* @brief Determine if this actor is dependent on it's children for relayout.
* @param dimension The dimension(s) to check for
* @return Return if the actor is dependent on it's children
*/
- virtual bool RelayoutDependentOnChildrenBase( Dimension dimension = ALL_DIMENSIONS );
+ virtual bool RelayoutDependentOnChildrenBase( Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
/**
* @brief Calculate the size for a child
* @param[in] dimension The dimension to calculate the size for. E.g. width or height.
* @return Return the calculated size for the given dimension
*/
- virtual float CalculateChildSize( const Dali::Actor& child, Dimension dimension );
+ virtual float CalculateChildSize( const Dali::Actor& child, Dimension::Type dimension );
/**
* @brief This method is called during size negotiation when a height is required for a given width.
/**
* @copydoc Dali::Actor::SetResizePolicy()
*/
- void SetResizePolicy( ResizePolicy policy, Dimension dimension = ALL_DIMENSIONS );
+ void SetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
/**
* @copydoc Dali::Actor::GetResizePolicy()
*/
- ResizePolicy GetResizePolicy( Dimension dimension ) const;
+ ResizePolicy::Type GetResizePolicy( Dimension::Type dimension ) const;
/**
* @copydoc Dali::Actor::SetSizeScalePolicy()
*/
- void SetSizeScalePolicy( SizeScalePolicy policy );
+ void SetSizeScalePolicy( SizeScalePolicy::Type policy );
/**
* @copydoc Dali::Actor::GetSizeScalePolicy()
*/
- SizeScalePolicy GetSizeScalePolicy() const;
+ SizeScalePolicy::Type GetSizeScalePolicy() const;
/**
* @copydoc Dali::Actor::SetDimensionDependency()
*/
- void SetDimensionDependency( Dimension dimension, Dimension dependency );
+ void SetDimensionDependency( Dimension::Type dimension, Dimension::Type dependency );
/**
* @copydoc Dali::Actor::GetDimensionDependency()
*/
- Dimension GetDimensionDependency( Dimension dimension ) const;
+ Dimension::Type GetDimensionDependency( Dimension::Type dimension ) const;
/**
* @copydoc Dali::Actor::SetRelayoutEnabled()
* @param dirty Whether to mark actor as dirty or not
* @param dimension The dimension(s) to mark as dirty
*/
- void SetLayoutDirty( bool dirty, Dimension dimension = ALL_DIMENSIONS );
+ void SetLayoutDirty( bool dirty, Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
/**
* @brief Return if any of an actor's dimensions are marked as dirty
* @param dimension The dimension(s) to check
* @return Return if any of the requested dimensions are dirty
*/
- bool IsLayoutDirty( Dimension dimension = ALL_DIMENSIONS ) const;
+ bool IsLayoutDirty( Dimension::Type dimension = Dimension::ALL_DIMENSIONS ) const;
/**
* @brief Returns if relayout is enabled and the actor is not dirty
*
* @return Return if it is possible to relayout the actor
*/
- bool RelayoutPossible( Dimension dimension = ALL_DIMENSIONS ) const;
+ bool RelayoutPossible( Dimension::Type dimension = Dimension::ALL_DIMENSIONS ) const;
/**
* @brief Returns if relayout is enabled and the actor is dirty
*
* @return Return if it is required to relayout the actor
*/
- bool RelayoutRequired( Dimension dimension = ALL_DIMENSIONS ) const;
+ bool RelayoutRequired( Dimension::Type dimension = Dimension::ALL_DIMENSIONS ) const;
/**
* @brief Request a relayout, which means performing a size negotiation on this actor, its parent and children (and potentially whole scene)
* @note RelayoutRequest() can be called multiple times; the size negotiation is still
* only performed once, i.e. there is no need to keep track of this in the calling side.
*/
- void RelayoutRequest( Dimension dimension = ALL_DIMENSIONS );
+ void RelayoutRequest( Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
/**
* @brief Request to relayout of all actors in the sub-tree below the given actor.
* @param dimension The dimension(s) to check for
* @return Return if the actor is dependent on it's parent
*/
- bool RelayoutDependentOnParent( Dimension dimension = ALL_DIMENSIONS );
+ bool RelayoutDependentOnParent( Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
/**
* @brief Determine if this actor has another dimension depedent on the specified one
* @param dependentDimension The dimension to check for dependency with
* @return Return if the actor is dependent on this dimension
*/
- bool RelayoutDependentOnDimension( Dimension dimension, Dimension dependentDimension );
+ bool RelayoutDependentOnDimension( Dimension::Type dimension, Dimension::Type dependentDimension );
/**
* Negotiate sizes for a control in all dimensions
* @param[in] dimension The dimension to negotiate on
* @param[in] allocatedSize The size constraint that the actor must respect
*/
- void NegotiateDimension( Dimension dimension, const Vector2& allocatedSize, ActorDimensionStack& recursionStack );
+ void NegotiateDimension( Dimension::Type dimension, const Vector2& allocatedSize, ActorDimensionStack& recursionStack );
/**
* @brief Calculate the size of a dimension
* @param[in] maximumSize The upper bounds on the size
* @return Return the calculated size for the dimension
*/
- float CalculateSize( Dimension dimension, const Vector2& maximumSize );
+ float CalculateSize( Dimension::Type dimension, const Vector2& maximumSize );
/**
* @brief Constain a dimension given the relayout constraints on this actor
* @param[in] dimension The dimension the size exists in
* @return Return the constrained size
*/
- float ConstrainDimension( float size, Dimension dimension );
+ float ConstrainDimension( float size, Dimension::Type dimension );
/**
* Negotiate a dimension based on the size of the parent
* @param[in] dimension The dimension to negotiate on
* @return Return the negotiated size
*/
- float NegotiateFromParent( Dimension dimension );
+ float NegotiateFromParent( Dimension::Type dimension );
/**
* Negotiate a dimension based on the size of the parent. Fitting inside.
* @param[in] dimension The dimension to negotiate on
* @return Return the negotiated size
*/
- float NegotiateFromParentFit( Dimension dimension );
+ float NegotiateFromParentFit( Dimension::Type dimension );
/**
* Negotiate a dimension based on the size of the parent. Flooding the whole space.
* @param[in] dimension The dimension to negotiate on
* @return Return the negotiated size
*/
- float NegotiateFromParentFlood( Dimension dimension );
+ float NegotiateFromParentFlood( Dimension::Type dimension );
/**
* @brief Negotiate a dimension based on the size of the children
* @param[in] dimension The dimension to negotiate on
* @return Return the negotiated size
*/
- float NegotiateFromChildren( Dimension dimension );
+ float NegotiateFromChildren( Dimension::Type dimension );
/**
* Set the negotiated dimension value for the given dimension(s)
* @param negotiatedDimension The value to set
* @param dimension The dimension(s) to set the value for
*/
- void SetNegotiatedDimension( float negotiatedDimension, Dimension dimension = ALL_DIMENSIONS );
+ void SetNegotiatedDimension( float negotiatedDimension, Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
/**
* Return the value of negotiated dimension for the given dimension
* @param dimension The dimension to retrieve
* @return Return the value of the negotiated dimension
*/
- float GetNegotiatedDimension( Dimension dimension ) const;
+ float GetNegotiatedDimension( Dimension::Type dimension ) const;
/**
* @brief Set the padding for a dimension
* @param[in] padding Padding for the dimension. X = start (e.g. left, bottom), y = end (e.g. right, top)
* @param[in] dimension The dimension to set
*/
- void SetPadding( const Vector2& padding, Dimension dimension );
+ void SetPadding( const Vector2& padding, Dimension::Type dimension );
/**
* Return the value of padding for the given dimension
* @param dimension The dimension to retrieve
* @return Return the value of padding for the dimension
*/
- Vector2 GetPadding( Dimension dimension ) const;
+ Vector2 GetPadding( Dimension::Type dimension ) const;
/**
* Return the actor size for a given dimension
* @param[in] dimension The dimension to retrieve the size for
* @return Return the size for the given dimension
*/
- float GetSize( Dimension dimension ) const;
+ float GetSize( Dimension::Type dimension ) const;
/**
* Return the natural size of the actor for a given dimension
* @param[in] dimension The dimension to retrieve the size for
* @return Return the natural size for the given dimension
*/
- float GetNaturalSize( Dimension dimension ) const;
+ float GetNaturalSize( Dimension::Type dimension ) const;
/**
* @brief Return the amount of size allocated for relayout
* @param[in] dimension The dimension to retrieve
* @return Return the size
*/
- float GetRelayoutSize( Dimension dimension ) const;
+ float GetRelayoutSize( Dimension::Type dimension ) const;
/**
* @brief If the size has been negotiated return that else return normal size
* @param[in] dimension The dimension to retrieve
* @return Return the size
*/
- float GetLatestSize( Dimension dimension ) const;
+ float GetLatestSize( Dimension::Type dimension ) const;
/**
* Apply the negotiated size to the actor
* @param[in] negotiated The status of the flag to set.
* @param[in] dimension The dimension to set the flag for
*/
- void SetLayoutNegotiated( bool negotiated, Dimension dimension = ALL_DIMENSIONS );
+ void SetLayoutNegotiated( bool negotiated, Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
/**
* @brief Test whether the layout dimension for this actor has been negotiated or not.
* @param[in] dimension The dimension to determine the value of the flag for
* @return Return if the layout dimension is negotiated or not.
*/
- bool IsLayoutNegotiated( Dimension dimension = ALL_DIMENSIONS ) const;
+ bool IsLayoutNegotiated( Dimension::Type dimension = Dimension::ALL_DIMENSIONS ) const;
/**
* @brief Calculate the size for a child
* @param[in] dimension The dimension to calculate the size for. E.g. width or height.
* @return Return the calculated size for the given dimension
*/
- float CalculateChildSizeBase( const Dali::Actor& child, Dimension dimension );
+ float CalculateChildSizeBase( const Dali::Actor& child, Dimension::Type dimension );
/**
* @brief Set the preferred size for size negotiation
/**
* @copydoc Dali::Actor::SetMinimumSize
*/
- void SetMinimumSize( float size, Dimension dimension = ALL_DIMENSIONS );
+ void SetMinimumSize( float size, Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
/**
* @copydoc Dali::Actor::GetMinimumSize
*/
- float GetMinimumSize( Dimension dimension ) const;
+ float GetMinimumSize( Dimension::Type dimension ) const;
/**
* @copydoc Dali::Actor::SetMaximumSize
*/
- void SetMaximumSize( float size, Dimension dimension = ALL_DIMENSIONS );
+ void SetMaximumSize( float size, Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
/**
* @copydoc Dali::Actor::GetMaximumSize
*/
- float GetMaximumSize( Dimension dimension ) const;
+ float GetMaximumSize( Dimension::Type dimension ) const;
#ifdef DYNAMICS_SUPPORT
Dali::Actor::OffStageSignalType mOffStageSignal;
Dali::Actor::OnRelayoutSignalType mOnRelayoutSignal;
- Vector3 mTargetSize; ///< Event-side storage for size (not a pointer as most actors will have a size)
+ Vector3 mTargetSize; ///< Event-side storage for size (not a pointer as most actors will have a size)
+ Vector3 mTargetPosition; ///< Event-side storage for position (not a pointer as most actors will have a position)
std::string mName; ///< Name of the actor
unsigned int mId; ///< A unique ID to identify the actor starting from 1, and 0 is reserved
/**
* @copydoc Internal::Actor::OnSetResizePolicy
*/
- virtual void OnSetResizePolicy( ResizePolicy policy, Dimension dimension )
+ virtual void OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension )
{
mImpl->OnSetResizePolicy( policy, dimension );
}
/**
* @copydoc Internal::Actor::CalculateChildSize
*/
- virtual float CalculateChildSize( const Dali::Actor& child, Dimension dimension )
+ virtual float CalculateChildSize( const Dali::Actor& child, Dimension::Type dimension )
{
return mImpl->CalculateChildSize( child, dimension );
}
/**
* @copydoc Internal::Actor::RelayoutDependentOnChildren
*/
- virtual bool RelayoutDependentOnChildren( Dimension dimension = ALL_DIMENSIONS )
+ virtual bool RelayoutDependentOnChildren( Dimension::Type dimension = Dimension::ALL_DIMENSIONS )
{
return mImpl->RelayoutDependentOnChildren( dimension );
}
/**
* @copydoc Internal::Actor::OnCalculateRelayoutSize
*/
- virtual void OnCalculateRelayoutSize( Dimension dimension )
+ virtual void OnCalculateRelayoutSize( Dimension::Type dimension )
{
return mImpl->OnCalculateRelayoutSize( dimension );
}
/**
* @copydoc Internal::Actor::OnLayoutNegotiated
*/
- virtual void OnLayoutNegotiated( float size, Dimension dimension )
+ virtual void OnLayoutNegotiated( float size, Dimension::Type dimension )
{
return mImpl->OnLayoutNegotiated( size, dimension );
}
void ImageActor::OnInitialize()
{
- SetResizePolicy( USE_NATURAL_SIZE, ALL_DIMENSIONS );
+ SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
}
void ImageActor::SetImage( ImagePtr& image )
output << " - Pos: " << actor.GetCurrentPosition() << " Size: " << actor.GetTargetSize();
- output << ", Dirty: (" << ( GetImplementation( actor ).IsLayoutDirty( WIDTH ) ? "TRUE" : "FALSE" ) << "," << ( GetImplementation( actor ).IsLayoutDirty( HEIGHT ) ? "TRUE" : "FALSE" ) << ")";
- output << ", Negotiated: (" << ( GetImplementation( actor ).IsLayoutNegotiated( WIDTH ) ? "TRUE" : "FALSE" ) << "," << ( GetImplementation( actor ).IsLayoutNegotiated( HEIGHT ) ? "TRUE" : "FALSE" ) << ")";
+ output << ", Dirty: (" << ( GetImplementation( actor ).IsLayoutDirty( Dimension::WIDTH ) ? "TRUE" : "FALSE" ) << "," << ( GetImplementation( actor ).IsLayoutDirty( Dimension::HEIGHT ) ? "TRUE" : "FALSE" ) << ")";
+ output << ", Negotiated: (" << ( GetImplementation( actor ).IsLayoutNegotiated( Dimension::WIDTH ) ? "TRUE" : "FALSE" ) << "," << ( GetImplementation( actor ).IsLayoutNegotiated( Dimension::HEIGHT ) ? "TRUE" : "FALSE" ) << ")";
output << ", Enabled: " << ( actor.IsRelayoutEnabled() ? "TRUE" : "FALSE" );
output << ", (" << actor.GetObjectPtr() << ")" << std::endl;
}
}
-void RelayoutController::RequestRelayout( Dali::Actor& actor, Dimension dimension )
+void RelayoutController::RequestRelayout( Dali::Actor& actor, Dimension::Type dimension )
{
if( !mEnabled )
{
topOfSubTreeStack.push_back( actor );
// Propagate on all dimensions
- for( unsigned int i = 0; i < DIMENSION_COUNT; ++i )
+ for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
{
if( dimension & ( 1 << i ) )
{
// Do the propagation
- PropagateAll( actor, static_cast< Dimension >( 1 << i ), topOfSubTreeStack, potentialRedundantSubRoots );
+ PropagateAll( actor, static_cast< Dimension::Type >( 1 << i ), topOfSubTreeStack, potentialRedundantSubRoots );
}
}
}
}
-void RelayoutController::PropagateAll( Dali::Actor& actor, Dimension dimension, Dali::ActorContainer& topOfSubTreeStack, Dali::ActorContainer& potentialRedundantSubRoots )
+void RelayoutController::PropagateAll( Dali::Actor& actor, Dimension::Type dimension, Dali::ActorContainer& topOfSubTreeStack, Dali::ActorContainer& potentialRedundantSubRoots )
{
// Only set dirty flag if doing relayout and not already marked as dirty
Actor& actorImpl = GetImplementation( actor );
// Check for dimension dependecy: width for height/height for width etc
// Check each possible dimension and see if it is dependent on the input one
- for( unsigned int i = 0; i < DIMENSION_COUNT; ++i )
+ for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
{
- Dimension dimensionToCheck = static_cast< Dimension >( 1 << i );
+ Dimension::Type dimensionToCheck = static_cast< Dimension::Type >( 1 << i );
if( actorImpl.RelayoutDependentOnDimension( dimension, dimensionToCheck ) &&
!actorImpl.IsLayoutDirty( dimensionToCheck ) )
}
-void RelayoutController::PropagateFlags( Dali::Actor& actor, Dimension dimension )
+void RelayoutController::PropagateFlags( Dali::Actor& actor, Dimension::Type dimension )
{
// Only set dirty flag if doing relayout and not already marked as dirty
Actor& actorImpl = GetImplementation( actor );
// Check for dimension dependecy: width for height/height for width etc
// Check each possible dimension and see if it is dependent on the input one
- for( unsigned int i = 0; i < DIMENSION_COUNT; ++i )
+ for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
{
- Dimension dimensionToCheck = static_cast< Dimension >( 1 << i );
+ Dimension::Type dimensionToCheck = static_cast< Dimension::Type >( 1 << i );
if( actorImpl.RelayoutDependentOnDimension( dimension, dimensionToCheck ) )
{
* @param[in] actor The actor to request relayout on
* @param[in] dimension The dimension(s) to request the relayout on. Defaults to all dimensions
*/
- void RequestRelayout( Dali::Actor& actor, Dimension dimension = ALL_DIMENSIONS );
+ void RequestRelayout( Dali::Actor& actor, Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
/**
* @brief Request to relayout of all actors in the sub-tree below the given actor.
* @param[in] actor The actor to propagate from
* @param[in] dimension The dimension to propagate on
*/
- void PropagateFlags( Dali::Actor& actor, Dimension dimension = ALL_DIMENSIONS );
+ void PropagateFlags( Dali::Actor& actor, Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
/**
* @brief Relayouts all actors that have been marked as dirty
* @param[in] topOfSubTreeStack The top of the sub tree that this actor is in
* @param[in] potentialRedundantSubRoots Actors collected as potentially already being included in relayout
*/
- void PropagateAll( Dali::Actor& actor, Dimension dimension, Dali::ActorContainer& topOfSubTreeStack, Dali::ActorContainer& potentialRedundantSubRoots );
+ void PropagateAll( Dali::Actor& actor, Dimension::Type dimension, Dali::ActorContainer& topOfSubTreeStack, Dali::ActorContainer& potentialRedundantSubRoots );
/**
* Queue an actor on the relayout container
/**
* @brief Dimensions for layout
*/
-enum Dimension
+namespace Dimension
+{
+enum Type
{
WIDTH = 0x1, ///< Width dimension
HEIGHT = 0x2, ///< Height dimension
- DIMENSION_COUNT = 2, ///< Number of dimensions - update this if adding new dimension
ALL_DIMENSIONS = 0x3 ///< Mask to cover all flags
};
+enum Meta
+{
+ DIMENSION_COUNT = 2 ///< Number of dimensions - update this if adding new dimension
+};
+}
+
/**
* @brief Size negotiation resize policies
*/
-enum ResizePolicy
+namespace ResizePolicy
+{
+enum Type
{
FIXED, ///< Size is fixed as set by SetSize
USE_NATURAL_SIZE, ///< Size is to use the actor's natural size
DIMENSION_DEPENDENCY, ///< One dimension is dependent on the other
USE_ASSIGNED_SIZE ///< The size will be assigned to the actor
};
+}
/**
* @brief Policies to determine how an actor should resize itself when having its size set in size negotiation
*/
-enum SizeScalePolicy
+namespace SizeScalePolicy
+{
+enum Type
{
USE_SIZE_SET, ///< Use the size that was set
FIT_WITH_ASPECT_RATIO, ///< Fit within the size set maintaining natural size aspect ratio
FILL_WITH_ASPECT_RATIO ///< Fill up the size set maintaining natural size aspect ratio. May exceed size bounds in one dimension.
};
+}
/**
* @brief Different types of alignment.
return GetImplementation(*this).IsRelayoutEnabled();
}
-void Actor::SetResizePolicy( ResizePolicy policy, Dimension dimension )
+void Actor::SetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension )
{
GetImplementation(*this).SetResizePolicy( policy, dimension );
}
-ResizePolicy Actor::GetResizePolicy( Dimension dimension ) const
+ResizePolicy::Type Actor::GetResizePolicy( Dimension::Type dimension ) const
{
return GetImplementation(*this).GetResizePolicy( dimension );
}
-void Actor::SetSizeScalePolicy( SizeScalePolicy policy )
+void Actor::SetSizeScalePolicy( SizeScalePolicy::Type policy )
{
GetImplementation(*this).SetSizeScalePolicy( policy );
}
-SizeScalePolicy Actor::GetSizeScalePolicy() const
+SizeScalePolicy::Type Actor::GetSizeScalePolicy() const
{
return GetImplementation(*this).GetSizeScalePolicy();
}
return GetImplementation(*this).GetWidthForHeight( height );
}
-float Actor::GetRelayoutSize( Dimension dimension ) const
+float Actor::GetRelayoutSize( Dimension::Type dimension ) const
{
return GetImplementation(*this).GetRelayoutSize( dimension );
}
Internal::Actor& impl = GetImplementation(*this);
Vector2 widthPadding( padding.left, padding.right );
- impl.SetPadding( widthPadding, WIDTH );
+ impl.SetPadding( widthPadding, Dimension::WIDTH );
Vector2 heightPadding( padding.bottom, padding.top );
- impl.SetPadding( heightPadding, HEIGHT );
+ impl.SetPadding( heightPadding, Dimension::HEIGHT );
}
void Actor::GetPadding( Padding& paddingOut ) const
{
const Internal::Actor& impl = GetImplementation(*this);
- Vector2 widthPadding = impl.GetPadding( WIDTH );
- Vector2 heightPadding = impl.GetPadding( HEIGHT );
+ Vector2 widthPadding = impl.GetPadding( Dimension::WIDTH );
+ Vector2 heightPadding = impl.GetPadding( Dimension::HEIGHT );
paddingOut.left = widthPadding.x;
paddingOut.right = widthPadding.y;
{
Internal::Actor& impl = GetImplementation(*this);
- impl.SetMinimumSize( size.x, WIDTH );
- impl.SetMinimumSize( size.y, HEIGHT );
+ impl.SetMinimumSize( size.x, Dimension::WIDTH );
+ impl.SetMinimumSize( size.y, Dimension::HEIGHT );
}
Vector2 Actor::GetMinimumSize()
{
Internal::Actor& impl = GetImplementation(*this);
- return Vector2( impl.GetMinimumSize( WIDTH ), impl.GetMinimumSize( HEIGHT ) );
+ return Vector2( impl.GetMinimumSize( Dimension::WIDTH ), impl.GetMinimumSize( Dimension::HEIGHT ) );
}
void Actor::SetMaximumSize( const Vector2& size )
{
Internal::Actor& impl = GetImplementation(*this);
- impl.SetMaximumSize( size.x, WIDTH );
- impl.SetMaximumSize( size.y, HEIGHT );
+ impl.SetMaximumSize( size.x, Dimension::WIDTH );
+ impl.SetMaximumSize( size.y, Dimension::HEIGHT );
}
Vector2 Actor::GetMaximumSize()
{
Internal::Actor& impl = GetImplementation(*this);
- return Vector2( impl.GetMaximumSize( WIDTH ), impl.GetMaximumSize( HEIGHT ) );
+ return Vector2( impl.GetMaximumSize( Dimension::WIDTH ), impl.GetMaximumSize( Dimension::HEIGHT ) );
}
Actor::TouchSignalType& Actor::TouchedSignal()
* @param[in] policy The resize policy to use
* @param[in] dimension The dimension(s) to set policy for. Can be a bitfield of multiple dimensions.
*/
- void SetResizePolicy( ResizePolicy policy, Dimension dimension );
+ void SetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension );
/**
* Return the resize policy used for a single dimension
* @param[in] dimension The dimension to get policy for
* @return Return the dimension resize policy
*/
- ResizePolicy GetResizePolicy( Dimension dimension ) const;
+ ResizePolicy::Type GetResizePolicy( Dimension::Type dimension ) const;
/**
- * @brief Set the policy to use when setting size with size negotiation. Defaults to USE_SIZE_SET.
+ * @brief Set the policy to use when setting size with size negotiation. Defaults to SizeScalePolicy::USE_SIZE_SET.
*
* @param[in] policy The policy to use for when the size is set
*/
- void SetSizeScalePolicy( SizeScalePolicy policy );
+ void SetSizeScalePolicy( SizeScalePolicy::Type policy );
/**
* @brief Return the size set policy in use
*
* @return Return the size set policy
*/
- SizeScalePolicy GetSizeScalePolicy() const;
+ SizeScalePolicy::Type GetSizeScalePolicy() const;
/**
* @brief Sets the relative to parent size factor of the actor.
*
* This factor is only used when ResizePolicy is set to either:
- * SIZE_RELATIVE_TO_PARENT or SIZE_FIXED_OFFSET_FROM_PARENT.
+ * ResizePolicy::SIZE_RELATIVE_TO_PARENT or ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT.
* This actor's size is set to the actor's size multipled by or added to this factor,
* depending on ResizePolicy (See SetResizePolicy).
*
* @param dimension The dimension to retrieve
* @return Return the value of the negotiated dimension
*/
- float GetRelayoutSize( Dimension dimension ) const;
+ float GetRelayoutSize( Dimension::Type dimension ) const;
/**
* @brief Request to relayout of all actors in the sub-tree below the given actor.
mOwner->RelayoutRequest();
}
-float CustomActorImpl::CalculateChildSizeBase( const Dali::Actor& child, Dimension dimension )
+float CustomActorImpl::CalculateChildSizeBase( const Dali::Actor& child, Dimension::Type dimension )
{
return mOwner->CalculateChildSizeBase( child, dimension );
}
-bool CustomActorImpl::RelayoutDependentOnChildrenBase( Dimension dimension )
+bool CustomActorImpl::RelayoutDependentOnChildrenBase( Dimension::Type dimension )
{
return mOwner->RelayoutDependentOnChildrenBase( dimension );
}
* @param[in] policy The policy being set
* @param[in] dimension The dimension the policy is being set for
*/
- virtual void OnSetResizePolicy( ResizePolicy policy, Dimension dimension ) = 0;
+ virtual void OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension ) = 0;
/**
* Return the natural size of the actor
* @param[in] dimension The dimension to calculate the size for. E.g. width or height.
* @return Return the calculated size for the given dimension
*/
- virtual float CalculateChildSize( const Dali::Actor& child, Dimension dimension ) = 0;
+ virtual float CalculateChildSize( const Dali::Actor& child, Dimension::Type dimension ) = 0;
/**
* @brief This method is called during size negotiation when a height is required for a given width.
* @param dimension The dimension(s) to check for
* @return Return if the actor is dependent on it's children
*/
- virtual bool RelayoutDependentOnChildren( Dimension dimension = ALL_DIMENSIONS ) = 0;
+ virtual bool RelayoutDependentOnChildren( Dimension::Type dimension = Dimension::ALL_DIMENSIONS ) = 0;
/**
* @brief Virtual method to notify deriving classes that relayout dependencies have been
*
* @param dimension The dimension that is about to be calculated
*/
- virtual void OnCalculateRelayoutSize( Dimension dimension ) = 0;
+ virtual void OnCalculateRelayoutSize( Dimension::Type dimension ) = 0;
/**
* @brief Virtual method to notify deriving classes that the size for a dimension
* @param[in] size The new size for the given dimension
* @param[in] dimension The dimension that was just negotiated
*/
- virtual void OnLayoutNegotiated( float size, Dimension dimension ) = 0;
+ virtual void OnLayoutNegotiated( float size, Dimension::Type dimension ) = 0;
protected: // For derived classes
* @param[in] dimension The dimension to calculate the size for. E.g. width or height.
* @return Return the calculated size for the given dimension
*/
- float CalculateChildSizeBase( const Dali::Actor& child, Dimension dimension );
+ float CalculateChildSizeBase( const Dali::Actor& child, Dimension::Type dimension );
/**
* @brief Determine if this actor is dependent on it's children for relayout from the base class
* @param dimension The dimension(s) to check for
* @return Return if the actor is dependent on it's children
*/
- bool RelayoutDependentOnChildrenBase( Dimension dimension = ALL_DIMENSIONS );
+ bool RelayoutDependentOnChildrenBase( Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
public: // Not intended for application developers