X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fevent%2Factors%2Factor-impl.cpp;h=a7be0fc6fab3764363201b64c529f6953d364253;hb=3def9218a44f6a520e123aedac169c90b6f8fc8a;hp=ff1164292b1e128e20f374b56315db7ce782b9c6;hpb=50dec3a507a4a27b6a0916ffa3cd4aeb06718f17;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/event/actors/actor-impl.cpp b/dali/internal/event/actors/actor-impl.cpp index ff11642..a7be0fc 100644 --- a/dali/internal/event/actors/actor-impl.cpp +++ b/dali/internal/event/actors/actor-impl.cpp @@ -213,7 +213,7 @@ DALI_PROPERTY( "opacity", FLOAT, true, true, true, Dali: 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( "layoutDirectionInheritance", BOOLEAN, true, false, false, Dali::DevelActor::Property::LAYOUT_DIRECTION_INHERITANCE ) +DALI_PROPERTY( "inheritLayoutDirection", BOOLEAN, true, false, false, Dali::DevelActor::Property::INHERIT_LAYOUT_DIRECTION ) DALI_PROPERTY_TABLE_END( DEFAULT_ACTOR_PROPERTY_START_INDEX ) // Signals @@ -1994,6 +1994,15 @@ void Actor::EmitVisibilityChangedSignal( bool visible, DevelActor::VisibilityCha } } +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; @@ -2034,6 +2043,11 @@ DevelActor::VisibilityChangedSignalType& Actor::VisibilityChangedSignal() return mVisibilityChangedSignal; } +DevelActor::LayoutDirectionChangedSignalType& Actor::LayoutDirectionChangedSignal() +{ + return mLayoutDirectionChangedSignal; +} + bool Actor::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor ) { bool connected( true ); @@ -2110,7 +2124,7 @@ Actor::Actor( DerivedType derivedType ) mInheritScale( true ), mPositionUsesAnchorPoint( true ), mVisible( true ), - mLayoutDirectionInheritance( true ), + mInheritLayoutDirection( true ), mLayoutDirection( DevelActor::LayoutDirection::LTR ), mDrawMode( DrawMode::NORMAL ), mPositionInheritanceMode( Node::DEFAULT_POSITION_INHERITANCE_MODE ), @@ -2873,24 +2887,21 @@ void Actor::SetDefaultProperty( Property::Index index, const Property::Value& pr case Dali::DevelActor::Property::LAYOUT_DIRECTION: { Dali::DevelActor::LayoutDirection::Type direction = mLayoutDirection; - bool flag = false; if( Scripting::GetEnumerationProperty< DevelActor::LayoutDirection::Type >( property, LAYOUT_DIRECTION_TABLE, LAYOUT_DIRECTION_TABLE_COUNT, direction ) ) { - flag = mLayoutDirectionInheritance; - mLayoutDirectionInheritance = true; - InheritLayoutDirectionRecursively( this, direction ); - mLayoutDirectionInheritance = flag; + mInheritLayoutDirection = false; + InheritLayoutDirectionRecursively( this, direction, true ); } break; } - case Dali::DevelActor::Property::LAYOUT_DIRECTION_INHERITANCE: + case Dali::DevelActor::Property::INHERIT_LAYOUT_DIRECTION: { bool value = false; - if( property.Get( value ) && value != mLayoutDirectionInheritance ) + if( property.Get( value ) ) { - mLayoutDirectionInheritance = value; + SetInheritLayoutDirection( value ); } break; } @@ -4139,13 +4150,13 @@ bool Actor::GetCachedPropertyValue( Property::Index index, Property::Value& valu case Dali::DevelActor::Property::LAYOUT_DIRECTION: { - value = Scripting::GetLinearEnumerationName< DevelActor::LayoutDirection::Type >( mLayoutDirection, LAYOUT_DIRECTION_TABLE, LAYOUT_DIRECTION_TABLE_COUNT ); + value = mLayoutDirection; break; } - case Dali::DevelActor::Property::LAYOUT_DIRECTION_INHERITANCE: + case Dali::DevelActor::Property::INHERIT_LAYOUT_DIRECTION: { - value = mLayoutDirectionInheritance; + value = IsLayoutDirectionInherited(); break; } @@ -5198,7 +5209,7 @@ void Actor::Lower() ActorContainer& siblings = *(mParent->mChildren); if( siblings.front() != this ) // If not already at beginning { - for( size_t i=0; imLayoutDirectionInheritance ) + 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(); } @@ -5338,7 +5368,6 @@ void Actor::InheritLayoutDirectionRecursively( ActorPtr actor, Dali::DevelActor: } } } - } } // namespace Internal