X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fevent%2Factors%2Factor-impl.cpp;h=d36e103eb351ce44e24db4f8b0f14fdaf1b3f107;hb=63a75802b362f787f4331567cbbc137b9ecde652;hp=ff1164292b1e128e20f374b56315db7ce782b9c6;hpb=9f191abae0a129c2bac319a67201482668455764;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..d36e103 100644 --- a/dali/internal/event/actors/actor-impl.cpp +++ b/dali/internal/event/actors/actor-impl.cpp @@ -33,7 +33,6 @@ #include #include #include -#include #include #include #include @@ -208,12 +207,12 @@ DALI_PROPERTY( "minimumSize", VECTOR2, true, false, false, Dali: DALI_PROPERTY( "maximumSize", VECTOR2, true, false, false, Dali::Actor::Property::MAXIMUM_SIZE ) DALI_PROPERTY( "inheritPosition", BOOLEAN, true, false, false, Dali::Actor::Property::INHERIT_POSITION ) DALI_PROPERTY( "clippingMode", STRING, true, false, false, Dali::Actor::Property::CLIPPING_MODE ) +DALI_PROPERTY( "layoutDirection", STRING, true, false, false, Dali::Actor::Property::LAYOUT_DIRECTION ) +DALI_PROPERTY( "inheritLayoutDirection", BOOLEAN, true, false, false, Dali::Actor::Property::INHERIT_LAYOUT_DIRECTION ) DALI_PROPERTY( "siblingOrder", INTEGER, true, false, false, Dali::DevelActor::Property::SIBLING_ORDER ) 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( "layoutDirectionInheritance", BOOLEAN, true, false, false, Dali::DevelActor::Property::LAYOUT_DIRECTION_INHERITANCE ) DALI_PROPERTY_TABLE_END( DEFAULT_ACTOR_PROPERTY_START_INDEX ) // Signals @@ -310,8 +309,8 @@ 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_WITH_SCOPE( LayoutDirection, LEFT_TO_RIGHT ) +DALI_ENUM_TO_STRING_WITH_SCOPE( LayoutDirection, RIGHT_TO_LEFT ) DALI_ENUM_TO_STRING_TABLE_END( LAYOUT_DIRECTION ) bool GetAnchorPointConstant( const std::string& value, Vector3& anchor ) @@ -819,7 +818,7 @@ const Vector2 Actor::GetCurrentScreenPosition() const { StagePtr stage = Stage::GetCurrent(); Vector3 worldPosition = mNode->GetWorldPosition( GetEventThreadServices().GetEventBufferIndex() ); - Vector3 actorSize = GetCurrentSize() * GetCurrentScale(); + Vector3 actorSize = GetCurrentSize() * GetCurrentWorldScale(); Vector2 halfStageSize( stage->GetSize() * 0.5f ); // World position origin is center of stage Vector3 halfActorSize( actorSize * 0.5f ); Vector3 anchorPointOffSet = halfActorSize - actorSize * ( mPositionUsesAnchorPoint ? GetCurrentAnchorPoint() : AnchorPoint::TOP_LEFT ); @@ -1994,6 +1993,15 @@ void Actor::EmitVisibilityChangedSignal( bool visible, DevelActor::VisibilityCha } } +void Actor::EmitLayoutDirectionChangedSignal( LayoutDirection::Type type ) +{ + if( ! mLayoutDirectionChangedSignal.Empty() ) + { + Dali::Actor handle( this ); + mLayoutDirectionChangedSignal.Emit( handle, type ); + } +} + Dali::Actor::TouchSignalType& Actor::TouchedSignal() { return mTouchedSignal; @@ -2034,6 +2042,11 @@ DevelActor::VisibilityChangedSignalType& Actor::VisibilityChangedSignal() return mVisibilityChangedSignal; } +Dali::Actor::LayoutDirectionChangedSignalType& Actor::LayoutDirectionChangedSignal() +{ + return mLayoutDirectionChangedSignal; +} + bool Actor::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor ) { bool connected( true ); @@ -2110,8 +2123,8 @@ Actor::Actor( DerivedType derivedType ) mInheritScale( true ), mPositionUsesAnchorPoint( true ), mVisible( true ), - mLayoutDirectionInheritance( true ), - mLayoutDirection( DevelActor::LayoutDirection::LTR ), + mInheritLayoutDirection( true ), + mLayoutDirection( LayoutDirection::LEFT_TO_RIGHT ), mDrawMode( DrawMode::NORMAL ), mPositionInheritanceMode( Node::DEFAULT_POSITION_INHERITANCE_MODE ), mColorMode( Node::DEFAULT_COLOR_MODE ), @@ -2870,27 +2883,24 @@ void Actor::SetDefaultProperty( Property::Index index, const Property::Value& pr break; } - case Dali::DevelActor::Property::LAYOUT_DIRECTION: + case Dali::Actor::Property::LAYOUT_DIRECTION: { - Dali::DevelActor::LayoutDirection::Type direction = mLayoutDirection; - bool flag = false; + Dali::LayoutDirection::Type direction = mLayoutDirection; + mInheritLayoutDirection = false; - if( Scripting::GetEnumerationProperty< DevelActor::LayoutDirection::Type >( property, LAYOUT_DIRECTION_TABLE, LAYOUT_DIRECTION_TABLE_COUNT, direction ) ) + if( Scripting::GetEnumerationProperty< LayoutDirection::Type >( property, LAYOUT_DIRECTION_TABLE, LAYOUT_DIRECTION_TABLE_COUNT, direction ) ) { - flag = mLayoutDirectionInheritance; - mLayoutDirectionInheritance = true; - InheritLayoutDirectionRecursively( this, direction ); - mLayoutDirectionInheritance = flag; + InheritLayoutDirectionRecursively( this, direction, true ); } break; } - case Dali::DevelActor::Property::LAYOUT_DIRECTION_INHERITANCE: + case Dali::Actor::Property::INHERIT_LAYOUT_DIRECTION: { bool value = false; - if( property.Get( value ) && value != mLayoutDirectionInheritance ) + if( property.Get( value ) ) { - mLayoutDirectionInheritance = value; + SetInheritLayoutDirection( value ); } break; } @@ -4137,15 +4147,15 @@ bool Actor::GetCachedPropertyValue( Property::Index index, Property::Value& valu break; } - case Dali::DevelActor::Property::LAYOUT_DIRECTION: + case Dali::Actor::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::Actor::Property::INHERIT_LAYOUT_DIRECTION: { - value = mLayoutDirectionInheritance; + value = IsLayoutDirectionInherited(); break; } @@ -5198,7 +5208,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::LayoutDirection::Type direction, bool set ) +{ + if( actor && ( actor->mInheritLayoutDirection || set ) ) { if( actor->mLayoutDirection != direction) { actor->mLayoutDirection = direction; + actor->EmitLayoutDirectionChangedSignal( direction ); actor->RelayoutRequest(); } @@ -5338,7 +5367,6 @@ void Actor::InheritLayoutDirectionRecursively( ActorPtr actor, Dali::DevelActor: } } } - } } // namespace Internal