actor1.Add( actor2 );
gLayoutDirectionType = DevelActor::LayoutDirection::LTR;
DevelActor::LayoutDirectionChangedSignal( actor2 ).Connect( LayoutDirectionChanged );
-
- DALI_TEST_EQUALS( actor1.GetProperty< bool >( DevelActor::Property::INHERIT_LAYOUT_DIRECTION ), true, TEST_LOCATION );
actor1.SetProperty( DevelActor::Property::LAYOUT_DIRECTION, DevelActor::LayoutDirection::RTL );
- DALI_TEST_EQUALS( actor1.GetProperty< bool >( DevelActor::Property::INHERIT_LAYOUT_DIRECTION ), false, TEST_LOCATION );
-
DALI_TEST_EQUALS( actor1.GetProperty< std::string >( DevelActor::Property::LAYOUT_DIRECTION ), "RTL", TEST_LOCATION );
DALI_TEST_EQUALS( actor2.GetProperty< std::string >( DevelActor::Property::LAYOUT_DIRECTION ), "RTL", TEST_LOCATION );
DALI_TEST_EQUALS( gLayoutDirectionType, DevelActor::LayoutDirection::RTL, TEST_LOCATION );
- actor1.SetProperty( DevelActor::Property::INHERIT_LAYOUT_DIRECTION, true );
actor0.Add( actor1 );
DALI_TEST_EQUALS( actor1.GetProperty< std::string >( DevelActor::Property::LAYOUT_DIRECTION ), "LTR", TEST_LOCATION );
DALI_TEST_EQUALS( actor2.GetProperty< std::string >( DevelActor::Property::LAYOUT_DIRECTION ), "LTR", TEST_LOCATION );
actor3.SetProperty( DevelActor::Property::LAYOUT_DIRECTION, "RTL" );
actor5.SetProperty( DevelActor::Property::LAYOUT_DIRECTION, DevelActor::LayoutDirection::LTR );
- DALI_TEST_EQUALS( actor8.GetProperty< bool >( DevelActor::Property::INHERIT_LAYOUT_DIRECTION ), true, TEST_LOCATION );
- actor8.SetProperty( DevelActor::Property::INHERIT_LAYOUT_DIRECTION, false );
- DALI_TEST_EQUALS( actor8.GetProperty< bool >( DevelActor::Property::INHERIT_LAYOUT_DIRECTION ), false, TEST_LOCATION );
+ DALI_TEST_EQUALS( actor8.GetProperty< bool >( DevelActor::Property::LAYOUT_DIRECTION_INHERITANCE ), true, TEST_LOCATION );
+ actor8.SetProperty( DevelActor::Property::LAYOUT_DIRECTION_INHERITANCE, false );
+ DALI_TEST_EQUALS( actor8.GetProperty< bool >( DevelActor::Property::LAYOUT_DIRECTION_INHERITANCE ), false, TEST_LOCATION );
actor7.SetProperty( DevelActor::Property::LAYOUT_DIRECTION, "RTL" );
DALI_TEST_EQUALS( actor8.GetProperty< std::string >( DevelActor::Property::LAYOUT_DIRECTION ), "RTL", TEST_LOCATION );
DALI_TEST_EQUALS( actor9.GetProperty< std::string >( DevelActor::Property::LAYOUT_DIRECTION ), "RTL", TEST_LOCATION );
- actor8.SetProperty( DevelActor::Property::INHERIT_LAYOUT_DIRECTION, true );
- DALI_TEST_EQUALS( actor8.GetProperty< std::string >( DevelActor::Property::LAYOUT_DIRECTION ), "LTR", TEST_LOCATION );
- DALI_TEST_EQUALS( actor9.GetProperty< std::string >( DevelActor::Property::LAYOUT_DIRECTION ), "LTR", TEST_LOCATION );
-
END_TEST;
}
/**
* @brief The direction of layout.
- * @details Name "layoutDirection", type Property::INTEGER, @see LayoutDirection::Type for supported values.
+ * @details Name "layoutDirection", type Property::STRING.
*/
LAYOUT_DIRECTION = CLIPPING_MODE + 5,
* @brief Determines whether child actors inherit the layout direction from a parent.
* @details Name "layoutDirectionInheritance", type Property::BOOLEAN.
*/
- INHERIT_LAYOUT_DIRECTION = CLIPPING_MODE + 6
+ LAYOUT_DIRECTION_INHERITANCE = CLIPPING_MODE + 6
};
} // namespace Property
enum Type
{
- LTR, ///< Layout direction is from Left to Right direction (Default).
- RTL ///< Layout direction is from Right to Left direction.
+ LTR, ///< Left to Right direction (Default).
+ RTL ///< Right to Left direction.
};
} // namespace
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( "layoutDirectionInheritance", BOOLEAN, true, false, false, Dali::DevelActor::Property::LAYOUT_DIRECTION_INHERITANCE )
DALI_PROPERTY_TABLE_END( DEFAULT_ACTOR_PROPERTY_START_INDEX )
// Signals
mInheritScale( true ),
mPositionUsesAnchorPoint( true ),
mVisible( true ),
- mInheritLayoutDirection( true ),
+ mLayoutDirectionInheritance( true ),
mLayoutDirection( DevelActor::LayoutDirection::LTR ),
mDrawMode( DrawMode::NORMAL ),
mPositionInheritanceMode( Node::DEFAULT_POSITION_INHERITANCE_MODE ),
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 ) )
{
- mInheritLayoutDirection = true;
+ flag = mLayoutDirectionInheritance;
+ mLayoutDirectionInheritance = true;
InheritLayoutDirectionRecursively( this, direction );
- mInheritLayoutDirection = false;
+ mLayoutDirectionInheritance = flag;
}
break;
}
- case Dali::DevelActor::Property::INHERIT_LAYOUT_DIRECTION:
+ case Dali::DevelActor::Property::LAYOUT_DIRECTION_INHERITANCE:
{
bool value = false;
- if( property.Get( value ) )
+ if( property.Get( value ) && value != mLayoutDirectionInheritance )
{
- SetInheritLayoutDirection( value );
+ mLayoutDirectionInheritance = value;
}
break;
}
break;
}
- case Dali::DevelActor::Property::INHERIT_LAYOUT_DIRECTION:
+ case Dali::DevelActor::Property::LAYOUT_DIRECTION_INHERITANCE:
{
- value = IsLayoutDirectionInherited();
+ value = mLayoutDirectionInheritance;
break;
}
}
}
-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 )
{
- if( actor && actor->mInheritLayoutDirection )
+ if( actor && actor->mLayoutDirectionInheritance )
{
if( actor->mLayoutDirection != direction)
{
}
}
}
+
}
} // namespace Internal
void SetVisibleInternal( bool visible, SendMessage::Type sendMessage );
/**
- * Set whether a child actor inherits it's parent's layout direction. Default is to inherit.
- * @param[in] inherit - true if the actor should inherit layout direction, false otherwise.
- */
- void SetInheritLayoutDirection( bool inherit );
-
- /**
- * Returns whether the actor inherits it's parent's layout direction.
- * @return true if the actor inherits it's parent's layout direction, false otherwise.
- */
- bool IsLayoutDirectionInherited() const;
-
- /**
* @brief Propagates layout direction recursively.
* @param[in] actor The actor for seting layout direction.
* @param[in] direction New layout direction.
bool mInheritScale : 1; ///< Cached: Whether the parent's scale should be inherited.
bool mPositionUsesAnchorPoint : 1; ///< Cached: Whether the position uses the anchor point or not.
bool mVisible : 1; ///< Cached: Whether the actor is visible or not.
- bool mInheritLayoutDirection : 1; ///< Whether the actor inherits the layout direction from parent.
+ bool mLayoutDirectionInheritance : 1; ///< Whether the actor inherits the layout direction from parent.
DevelActor::LayoutDirection::Type mLayoutDirection : 1; ///< Layout direction, Left to Right or Right to Left.
DrawMode::Type mDrawMode : 2; ///< Cached: How the actor and its children should be drawn
PositionInheritanceMode mPositionInheritanceMode : 2; ///< Cached: Determines how position is inherited