DALI_PROPERTY( "opacity", FLOAT, true, true, true, Dali::DevelActor::Property::OPACITY )
DALI_PROPERTY( "screenPosition", VECTOR2, false, false, false, Dali::DevelActor::Property::SCREEN_POSITION )
DALI_PROPERTY( "positionUsesAnchorPoint", BOOLEAN, true, false, false, Dali::DevelActor::Property::POSITION_USES_ANCHOR_POINT )
+DALI_PROPERTY( "layoutDirection", STRING, true, false, false, Dali::DevelActor::Property::LAYOUT_DIRECTION )
+DALI_PROPERTY( "inheritLayoutDirection", BOOLEAN, true, false, false, Dali::DevelActor::Property::INHERIT_LAYOUT_DIRECTION )
DALI_PROPERTY_TABLE_END( DEFAULT_ACTOR_PROPERTY_START_INDEX )
// Signals
DALI_ENUM_TO_STRING_WITH_SCOPE( ClippingMode, CLIP_CHILDREN )
DALI_ENUM_TO_STRING_TABLE_END( CLIPPING_MODE )
+DALI_ENUM_TO_STRING_TABLE_BEGIN( LAYOUT_DIRECTION )
+DALI_ENUM_TO_STRING_WITH_SCOPE( DevelActor::LayoutDirection, LTR )
+DALI_ENUM_TO_STRING_WITH_SCOPE( DevelActor::LayoutDirection, RTL )
+DALI_ENUM_TO_STRING_TABLE_END( LAYOUT_DIRECTION )
bool GetAnchorPointConstant( const std::string& value, Vector3& anchor )
{
// Notification for derived classes
OnChildAdd( child );
+ InheritLayoutDirectionRecursively( ActorPtr( &child ), mLayoutDirection );
+
// Only put in a relayout request if there is a suitable dependency
if( RelayoutDependentOnChildren() )
{
}
}
+void Actor::EmitLayoutDirectionChangedSignal( DevelActor::LayoutDirection::Type type )
+{
+ if( ! mLayoutDirectionChangedSignal.Empty() )
+ {
+ Dali::Actor handle( this );
+ mLayoutDirectionChangedSignal.Emit( handle, type );
+ }
+}
+
Dali::Actor::TouchSignalType& Actor::TouchedSignal()
{
return mTouchedSignal;
return mVisibilityChangedSignal;
}
+DevelActor::LayoutDirectionChangedSignalType& Actor::LayoutDirectionChangedSignal()
+{
+ return mLayoutDirectionChangedSignal;
+}
+
bool Actor::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
{
bool connected( true );
mInheritScale( true ),
mPositionUsesAnchorPoint( true ),
mVisible( true ),
+ mInheritLayoutDirection( true ),
+ mLayoutDirection( DevelActor::LayoutDirection::LTR ),
mDrawMode( DrawMode::NORMAL ),
mPositionInheritanceMode( Node::DEFAULT_POSITION_INHERITANCE_MODE ),
mColorMode( Node::DEFAULT_COLOR_MODE ),
break;
}
+ case Dali::DevelActor::Property::LAYOUT_DIRECTION:
+ {
+ Dali::DevelActor::LayoutDirection::Type direction = mLayoutDirection;
+ mInheritLayoutDirection = false;
+
+ if( Scripting::GetEnumerationProperty< DevelActor::LayoutDirection::Type >( property, LAYOUT_DIRECTION_TABLE, LAYOUT_DIRECTION_TABLE_COUNT, direction ) )
+ {
+ InheritLayoutDirectionRecursively( this, direction, true );
+ }
+ break;
+ }
+
+ case Dali::DevelActor::Property::INHERIT_LAYOUT_DIRECTION:
+ {
+ bool value = false;
+ if( property.Get( value ) )
+ {
+ SetInheritLayoutDirection( value );
+ }
+ break;
+ }
+
default:
{
// this can happen in the case of a non-animatable default property so just do nothing
break;
}
+ case Dali::DevelActor::Property::LAYOUT_DIRECTION:
+ {
+ value = mLayoutDirection;
+ break;
+ }
+
+ case Dali::DevelActor::Property::INHERIT_LAYOUT_DIRECTION:
+ {
+ value = IsLayoutDirectionInherited();
+ break;
+ }
+
default:
{
// Must be a scene-graph only property
}
}
-Vector2 Actor::ApplySizeSetPolicy( const Vector2 size )
+Vector2 Actor::ApplySizeSetPolicy( const Vector2& size )
{
switch( mRelayoutData->sizeSetPolicy )
{
SetNegotiatedSize( container );
// Negotiate down to children
- const Vector2 newBounds = mTargetSize.GetVectorXY();
-
for( unsigned int i = 0, count = GetChildCount(); i < count; ++i )
{
ActorPtr child = GetChildAt( i );
// Only relayout if required
if( child->RelayoutRequired() )
{
- container.Add( Dali::Actor( child.Get() ), newBounds );
+ container.Add( Dali::Actor( child.Get() ), mTargetSize.GetVectorXY() );
}
}
DALI_LOG_TIMER_END( NegSizeTimer1, gLogRelayoutFilter, Debug::Concise, "NegotiateSize() took: ");
}
}
+void Actor::SetInheritLayoutDirection( bool inherit )
+{
+ if( mInheritLayoutDirection != inherit )
+ {
+ mInheritLayoutDirection = inherit;
+
+ if( inherit && mParent )
+ {
+ InheritLayoutDirectionRecursively( this, mParent->mLayoutDirection );
+ }
+ }
+}
+
+bool Actor::IsLayoutDirectionInherited() const
+{
+ return mInheritLayoutDirection;
+}
+
+void Actor::InheritLayoutDirectionRecursively( ActorPtr actor, Dali::DevelActor::LayoutDirection::Type direction, bool set )
+{
+ if( actor && ( actor->mInheritLayoutDirection || set ) )
+ {
+ if( actor->mLayoutDirection != direction)
+ {
+ actor->mLayoutDirection = direction;
+ actor->EmitLayoutDirectionChangedSignal( direction );
+ actor->RelayoutRequest();
+ }
+
+ if( actor->GetChildCount() > 0 )
+ {
+ ActorContainer& children = actor->GetChildrenInternal();
+ for( ActorIter iter = children.begin(), endIter = children.end(); iter != endIter; ++iter )
+ {
+ InheritLayoutDirectionRecursively( *iter, direction );
+ }
+ }
+ }
+}
+
} // namespace Internal
} // namespace Dali