DALI_PROPERTY( "padding", VECTOR4, true, false, false, Dali::Actor::Property::PADDING )
DALI_PROPERTY( "minimumSize", VECTOR2, true, false, false, Dali::Actor::Property::MINIMUM_SIZE )
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_TABLE_END( DEFAULT_ACTOR_PROPERTY_START_INDEX )
// Signals
return mPositionInheritanceMode;
}
+void Actor::SetInheritPosition( bool inherit )
+{
+ mInheritPosition = inherit;
+ if( NULL != mNode )
+ {
+ SetInheritPositionMessage( GetEventThreadServices(), *mNode, inherit );
+ }
+}
+
+bool Actor::IsPositionInherited() const
+{
+ return mInheritPosition;
+}
+
void Actor::SetOrientation( const Radian& angle, const Vector3& axis )
{
Vector3 normalizedAxis( axis.x, axis.y, axis.z );
mDerivedRequiresWheelEvent( false ),
mOnStageSignalled( false ),
mInsideOnSizeSet( false ),
+ mInheritPosition( true ),
mInheritOrientation( true ),
mInheritScale( true ),
mDrawMode( DrawMode::NORMAL ),
break;
}
+ case Dali::Actor::Property::INHERIT_POSITION:
+ {
+ SetInheritPosition( property.Get< bool >() );
+ break;
+ }
+
case Dali::Actor::Property::INHERIT_ORIENTATION:
{
SetInheritOrientation( property.Get< bool >() );
break;
}
+ case Dali::Actor::Property::INHERIT_POSITION:
+ {
+ value = IsPositionInherited();
+ break;
+ }
+
case Dali::Actor::Property::INHERIT_ORIENTATION:
{
value = IsOrientationInherited();
PositionInheritanceMode GetPositionInheritanceMode() const;
/**
+ * @copydoc Dali::Actor::SetInheritPosition()
+ */
+ void SetInheritPosition( bool inherit );
+
+ /**
+ * @copydoc Dali::Actor::IsPositionInherited()
+ */
+ bool IsPositionInherited() const;
+
+ /**
* Sets the orientation of the Actor.
* @param [in] angleRadians The new orientation angle in radians.
* @param [in] axis The new axis of orientation.
bool mDerivedRequiresWheelEvent : 1; ///< Whether the derived actor type requires wheel event signals
bool mOnStageSignalled : 1; ///< Set to true before OnStageConnection signal is emitted, and false before OnStageDisconnection
bool mInsideOnSizeSet : 1; ///< Whether we are inside OnSizeSet
+ bool mInheritPosition : 1; ///< Cached: Whether the parent's position should be inherited.
bool mInheritOrientation : 1; ///< Cached: Whether the parent's orientation should be inherited.
bool mInheritScale : 1; ///< Cached: Whether the parent's scale should be inherited.
DrawMode::Type mDrawMode : 2; ///< Cached: How the actor and its children should be drawn
mDepth(0u),
mDirtyFlags(AllFlags),
mIsRoot( false ),
+ mInheritPosition( true ),
mInheritOrientation( true ),
mInheritScale( true ),
mDrawMode( DrawMode::NORMAL ),
}
/**
+ * Set whether the Node inherits position.
+ * @param[in] inherit True if the parent position is inherited.
+ */
+ void SetInheritPosition(bool inherit)
+ {
+ if (inherit != mInheritPosition)
+ {
+ mInheritPosition = inherit;
+ mPositionInheritanceMode = inherit ? INHERIT_PARENT_POSITION : DONT_INHERIT_POSITION;
+ SetDirtyFlag(TransformFlag);
+ }
+ }
+
+ /**
* Set the position inheritance mode.
* @see Dali::Actor::PositionInheritanceMode
* @param[in] mode The new position inheritance mode.
int mDirtyFlags:8; ///< A composite set of flags for each of the Node properties
bool mIsRoot:1; ///< True if the node cannot have a parent
+ bool mInheritPosition:1; ///< Whether the parent's position should be inherited.
bool mInheritOrientation:1; ///< Whether the parent's orientation should be inherited.
bool mInheritScale:1; ///< Whether the parent's scale should be inherited.
DrawMode::Type mDrawMode:2; ///< How the Node and its children should be drawn
- PositionInheritanceMode mPositionInheritanceMode:2;///< Determines how position is inherited, 2 bits is enough
+ PositionInheritanceMode mPositionInheritanceMode:2;///< Determines how position is inherited, 2 bits is enough.
ColorMode mColorMode:2; ///< Determines whether mWorldColor is inherited, 2 bits is enough
// Changes scope, should be at end of class
new (slot) LocalType( &node, &Node::SetPositionInheritanceMode, mode );
}
+inline void SetInheritPositionMessage( EventThreadServices& eventThreadServices, const Node& node, bool inherit )
+{
+ typedef MessageValue1< Node, bool > LocalType;
+
+ // Reserve some memory inside the message queue
+ unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+
+ // Construct message in the message queue memory; note that delete should not be called on the return value
+ new (slot) LocalType( &node, &Node::SetInheritPosition, inherit );
+}
+
inline void SetInheritScaleMessage( EventThreadServices& eventThreadServices, const Node& node, bool inherit )
{
typedef MessageValue1< Node, bool > LocalType;
};
/**
+ * @DEPRECATED_1_1.24 Use SetInheritPosition instead
* @brief Actor position inheritance mode.
* @SINCE_1_0.0
*/
INHERIT_ORIENTATION, ///< name "inheritOrientation", type bool @SINCE_1_0.0
INHERIT_SCALE, ///< name "inheritScale", type bool @SINCE_1_0.0
COLOR_MODE, ///< name "colorMode", type std::string @SINCE_1_0.0
- POSITION_INHERITANCE, ///< name "positionInheritance", type std::string @SINCE_1_0.0
+ POSITION_INHERITANCE, ///< name "positionInheritance", type std::string @DEPRECATED_1_1.24 Use INHERIT_POSITION instead
DRAW_MODE, ///< name "drawMode", type std::string @SINCE_1_0.0
SIZE_MODE_FACTOR, ///< name "sizeModeFactor", type Vector3 @SINCE_1_0.0
WIDTH_RESIZE_POLICY, ///< name "widthResizePolicy", type String @SINCE_1_0.0
PADDING, ///< name "padding", type Vector4 @SINCE_1_0.0
MINIMUM_SIZE, ///< name "minimumSize", type Vector2 @SINCE_1_0.0
MAXIMUM_SIZE, ///< name "maximumSize", type Vector2 @SINCE_1_0.0
+ INHERIT_POSITION, ///< name "inheritPosition", type bool @SINCE_1_1.24
};
};
Vector3 GetCurrentWorldPosition() const;
/**
+ * @DEPRECATED_1_1.24 Use SetInheritPosition instead
* @brief Set the actors position inheritance mode.
*
* The default is to inherit.
void SetPositionInheritanceMode( PositionInheritanceMode mode );
/**
+ * @brief Set whether a child actor inherits it's parent's position.
+ *
+ * Default is to inherit.
+ * Switching this off means that using SetPosition() sets the actor's world position3
+ * @SINCE_1_1.24
+ * @param[in] inherit - true if the actor should inherit position, false otherwise.
+ * @pre The Actor has been initialized.
+ */
+ inline void SetInheritPosition( bool inherit )
+ {
+ SetProperty(Property::INHERIT_POSITION, inherit );
+ }
+
+ /**
+ * @DEPRECATED_1_1.24 Use IsPositionInherited
* @brief Returns the actors position inheritance mode.
*
* @SINCE_1_0.0
PositionInheritanceMode GetPositionInheritanceMode() const;
/**
+ * @brief Returns whether the actor inherits its parent's position.
+ *
+ * @SINCE_1_1.24
+ * @return True if the actor inherits its parent position, false if it uses world position.
+ * @pre The Actor has been initialized.
+ */
+ inline bool IsPositionInherited() const
+ {
+ return GetProperty(Property::INHERIT_POSITION ).Get<bool>();
+ }
+
+ /**
* @brief Sets the orientation of the Actor.
*
* An actor's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.