+public:
+
+ // Size negotiation virtual functions
+
+ /**
+ * @brief Called after the size negotiation has been finished for this control.
+ *
+ * The control is expected to assign this given size to itself/its children.
+ *
+ * Should be overridden by derived classes if they need to layout
+ * actors differently after certain operations like add or remove
+ * actors, resize or after changing specific properties.
+ *
+ * Note! As this function is called from inside the size negotiation algorithm, you cannot
+ * call RequestRelayout (the call would just be ignored)
+ *
+ * @param[in] size The allocated size.
+ * @param[in,out] container The control should add actors to this container that it is not able
+ * to allocate a size for.
+ */
+ virtual void OnRelayout( const Vector2& size, RelayoutContainer& container )
+ {
+ }
+
+ /**
+ * @brief Notification for deriving classes when the resize policy is set
+ *
+ * @param[in] policy The policy being set
+ * @param[in] dimension The dimension the policy is being set for
+ */
+ virtual void OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension ) {}
+
+ /**
+ * @brief Virtual method to notify deriving classes that relayout dependencies have been
+ * met and the size for this object is about to be calculated for the given dimension
+ *
+ * @param dimension The dimension that is about to be calculated
+ */
+ virtual void OnCalculateRelayoutSize( Dimension::Type dimension );
+
+ /**
+ * @brief Virtual method to notify deriving classes that the size for a dimension
+ * has just been negotiated
+ *
+ * @param[in] size The new size for the given dimension
+ * @param[in] dimension The dimension that was just negotiated
+ */
+ virtual void OnLayoutNegotiated( float size, Dimension::Type dimension );
+
+ /**
+ * @brief Determine if this actor is dependent on it's children for relayout
+ *
+ * @param dimension The dimension(s) to check for
+ * @return Return if the actor is dependent on it's children
+ */
+ virtual bool RelayoutDependentOnChildren( Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
+
+ /**
+ * @brief Determine if this actor is dependent on it's children for relayout.
+ *
+ * Called from deriving classes
+ *
+ * @param dimension The dimension(s) to check for
+ * @return Return if the actor is dependent on it's children
+ */
+ virtual bool RelayoutDependentOnChildrenBase( Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
+
+ /**
+ * @brief Calculate the size for a child
+ *
+ * @param[in] child The child actor to calculate the size for
+ * @param[in] dimension The dimension to calculate the size for. E.g. width or height.
+ * @return Return the calculated size for the given dimension
+ */
+ virtual float CalculateChildSize( const Dali::Actor& child, Dimension::Type dimension );
+
+ /**
+ * @brief This method is called during size negotiation when a height is required for a given width.
+ *
+ * Derived classes should override this if they wish to customize the height returned.
+ *
+ * @param width to use.
+ * @return the height based on the width.
+ */
+ virtual float GetHeightForWidth( float width );
+
+ /**
+ * @brief This method is called during size negotiation when a width is required for a given height.
+ *
+ * Derived classes should override this if they wish to customize the width returned.
+ *
+ * @param height to use.
+ * @return the width based on the width.
+ */
+ virtual float GetWidthForHeight( float height );
+
+public:
+
+ // Size negotiation
+
+ /**
+ * @brief Called by the RelayoutController to negotiate the size of an actor.
+ *
+ * The size allocated by the the algorithm is passed in which the
+ * actor must adhere to. A container is passed in as well which
+ * the actor should populate with actors it has not / or does not
+ * need to handle in its size negotiation.
+ *
+ * @param[in] size The allocated size.
+ * @param[in,out] container The container that holds actors that are fed back into the
+ * RelayoutController algorithm.
+ */
+ void NegotiateSize( const Vector2& size, RelayoutContainer& container );
+
+ /**
+ * @copydoc Dali::Actor::SetResizePolicy()
+ */
+ void SetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
+
+ /**
+ * @copydoc Dali::Actor::GetResizePolicy()
+ */
+ ResizePolicy::Type GetResizePolicy( Dimension::Type dimension ) const;
+
+ /**
+ * @copydoc Dali::Actor::SetSizeScalePolicy()
+ */
+ void SetSizeScalePolicy( SizeScalePolicy::Type policy );
+
+ /**
+ * @copydoc Dali::Actor::GetSizeScalePolicy()
+ */
+ SizeScalePolicy::Type GetSizeScalePolicy() const;
+
+ /**
+ * @copydoc Dali::Actor::SetDimensionDependency()
+ */
+ void SetDimensionDependency( Dimension::Type dimension, Dimension::Type dependency );
+
+ /**
+ * @copydoc Dali::Actor::GetDimensionDependency()
+ */
+ Dimension::Type GetDimensionDependency( Dimension::Type dimension ) const;
+
+ /**
+ * @brief Set the size negotiation relayout enabled on this actor
+ *
+ * @param[in] relayoutEnabled Boolean to enable or disable relayout
+ */
+ void SetRelayoutEnabled( bool relayoutEnabled );
+
+ /**
+ * @brief Return if relayout is enabled
+ *
+ * @return Return if relayout is enabled or not for this actor
+ */
+ bool IsRelayoutEnabled() const;
+
+ /**
+ * @brief Mark an actor as having it's layout dirty
+ *
+ * @param dirty Whether to mark actor as dirty or not
+ * @param dimension The dimension(s) to mark as dirty
+ */
+ void SetLayoutDirty( bool dirty, Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
+
+ /**
+ * @brief Return if any of an actor's dimensions are marked as dirty
+ *
+ * @param dimension The dimension(s) to check
+ * @return Return if any of the requested dimensions are dirty
+ */
+ bool IsLayoutDirty( Dimension::Type dimension = Dimension::ALL_DIMENSIONS ) const;
+
+ /**
+ * @brief Returns if relayout is enabled and the actor is not dirty
+ *
+ * @return Return if it is possible to relayout the actor
+ */
+ bool RelayoutPossible( Dimension::Type dimension = Dimension::ALL_DIMENSIONS ) const;
+
+ /**
+ * @brief Returns if relayout is enabled and the actor is dirty
+ *
+ * @return Return if it is required to relayout the actor
+ */
+ bool RelayoutRequired( Dimension::Type dimension = Dimension::ALL_DIMENSIONS ) const;
+
+ /**
+ * @brief Request a relayout, which means performing a size negotiation on this actor, its parent and children (and potentially whole scene)
+ *
+ * This method is automatically called from OnStageConnection(), OnChildAdd(),
+ * OnChildRemove(), SetSizePolicy(), SetMinimumSize() and SetMaximumSize().
+ *
+ * This method can also be called from a derived class every time it needs a different size.
+ * At the end of event processing, the relayout process starts and
+ * all controls which requested Relayout will have their sizes (re)negotiated.
+ *
+ * @note RelayoutRequest() can be called multiple times; the size negotiation is still
+ * only performed once, i.e. there is no need to keep track of this in the calling side.
+ */
+ void RelayoutRequest( Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
+
+ /**
+ * @brief Determine if this actor is dependent on it's parent for relayout
+ *
+ * @param dimension The dimension(s) to check for
+ * @return Return if the actor is dependent on it's parent
+ */
+ bool RelayoutDependentOnParent( Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
+
+ /**
+ * @brief Determine if this actor has another dimension depedent on the specified one
+ *
+ * @param dimension The dimension to check for
+ * @param dependentDimension The dimension to check for dependency with
+ * @return Return if the actor is dependent on this dimension
+ */
+ bool RelayoutDependentOnDimension( Dimension::Type dimension, Dimension::Type dependentDimension );
+
+ /**
+ * Negotiate sizes for a control in all dimensions
+ *
+ * @param[in] allocatedSize The size constraint that the control must respect
+ */
+ void NegotiateDimensions( const Vector2& allocatedSize );
+
+ /**
+ * Negotiate size for a specific dimension
+ *
+ * The algorithm adopts a recursive dependency checking approach. Meaning, that wherever dependencies
+ * are found, e.g. an actor dependent on its parent, the dependency will be calculated first with NegotiatedDimension and
+ * LayoutDimensionNegotiated flags being filled in on the actor.
+ *
+ * @post All actors that exist in the dependency chain connected to the given actor will have had their NegotiatedDimensions
+ * calculated and set as well as the LayoutDimensionNegotiated flags.
+ *
+ * @param[in] dimension The dimension to negotiate on
+ * @param[in] allocatedSize The size constraint that the actor must respect
+ */
+ void NegotiateDimension( Dimension::Type dimension, const Vector2& allocatedSize, ActorDimensionStack& recursionStack );
+
+ /**
+ * @brief Calculate the size of a dimension
+ *
+ * @param[in] dimension The dimension to calculate the size for
+ * @param[in] maximumSize The upper bounds on the size
+ * @return Return the calculated size for the dimension
+ */
+ float CalculateSize( Dimension::Type dimension, const Vector2& maximumSize );
+
+ /**
+ * @brief Clamp a dimension given the relayout constraints on this actor
+ *
+ * @param[in] size The size to constrain
+ * @param[in] dimension The dimension the size exists in
+ * @return Return the clamped size
+ */
+ float ClampDimension( float size, Dimension::Type dimension );
+
+ /**
+ * Negotiate a dimension based on the size of the parent
+ *
+ * @param[in] dimension The dimension to negotiate on
+ * @return Return the negotiated size
+ */
+ float NegotiateFromParent( Dimension::Type dimension );
+
+ /**
+ * Negotiate a dimension based on the size of the parent. Fitting inside.
+ *
+ * @param[in] dimension The dimension to negotiate on
+ * @return Return the negotiated size
+ */
+ float NegotiateFromParentFit( Dimension::Type dimension );
+
+ /**
+ * Negotiate a dimension based on the size of the parent. Flooding the whole space.
+ *
+ * @param[in] dimension The dimension to negotiate on
+ * @return Return the negotiated size
+ */
+ float NegotiateFromParentFlood( Dimension::Type dimension );
+
+ /**
+ * @brief Negotiate a dimension based on the size of the children
+ *
+ * @param[in] dimension The dimension to negotiate on
+ * @return Return the negotiated size
+ */
+ float NegotiateFromChildren( Dimension::Type dimension );
+
+ /**
+ * Set the negotiated dimension value for the given dimension(s)
+ *
+ * @param negotiatedDimension The value to set
+ * @param dimension The dimension(s) to set the value for
+ */
+ void SetNegotiatedDimension( float negotiatedDimension, Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
+
+ /**
+ * Return the value of negotiated dimension for the given dimension
+ *
+ * @param dimension The dimension to retrieve
+ * @return Return the value of the negotiated dimension
+ */
+ float GetNegotiatedDimension( Dimension::Type dimension ) const;
+
+ /**
+ * @brief Set the padding for a dimension
+ *
+ * @param[in] padding Padding for the dimension. X = start (e.g. left, bottom), y = end (e.g. right, top)
+ * @param[in] dimension The dimension to set
+ */
+ void SetPadding( const Vector2& padding, Dimension::Type dimension );
+
+ /**
+ * Return the value of padding for the given dimension
+ *
+ * @param dimension The dimension to retrieve
+ * @return Return the value of padding for the dimension
+ */
+ Vector2 GetPadding( Dimension::Type dimension ) const;
+
+ /**
+ * Return the actor size for a given dimension
+ *
+ * @param[in] dimension The dimension to retrieve the size for
+ * @return Return the size for the given dimension
+ */
+ float GetSize( Dimension::Type dimension ) const;
+
+ /**
+ * Return the natural size of the actor for a given dimension
+ *
+ * @param[in] dimension The dimension to retrieve the size for
+ * @return Return the natural size for the given dimension
+ */
+ float GetNaturalSize( Dimension::Type dimension ) const;
+
+ /**
+ * @brief Return the amount of size allocated for relayout
+ *
+ * May include padding
+ *
+ * @param[in] dimension The dimension to retrieve
+ * @return Return the size
+ */
+ float GetRelayoutSize( Dimension::Type dimension ) const;
+
+ /**
+ * @brief If the size has been negotiated return that else return normal size
+ *
+ * @param[in] dimension The dimension to retrieve
+ * @return Return the size
+ */
+ float GetLatestSize( Dimension::Type dimension ) const;
+
+ /**
+ * Apply the negotiated size to the actor
+ *
+ * @param[in] container The container to fill with actors that require further relayout
+ */
+ void SetNegotiatedSize( RelayoutContainer& container );
+
+ /**
+ * @brief Flag the actor as having it's layout dimension negotiated.
+ *
+ * @param[in] negotiated The status of the flag to set.
+ * @param[in] dimension The dimension to set the flag for
+ */
+ void SetLayoutNegotiated( bool negotiated, Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
+
+ /**
+ * @brief Test whether the layout dimension for this actor has been negotiated or not.
+ *
+ * @param[in] dimension The dimension to determine the value of the flag for
+ * @return Return if the layout dimension is negotiated or not.
+ */
+ bool IsLayoutNegotiated( Dimension::Type dimension = Dimension::ALL_DIMENSIONS ) const;
+
+ /**
+ * @brief provides the Actor implementation of GetHeightForWidth
+ * @param width to use.
+ * @return the height based on the width.
+ */
+ float GetHeightForWidthBase( float width );
+
+ /**
+ * @brief provides the Actor implementation of GetWidthForHeight
+ * @param height to use.
+ * @return the width based on the height.
+ */
+ float GetWidthForHeightBase( float height );
+
+ /**
+ * @brief Calculate the size for a child
+ *
+ * @param[in] child The child actor to calculate the size for
+ * @param[in] dimension The dimension to calculate the size for. E.g. width or height.
+ * @return Return the calculated size for the given dimension
+ */
+ float CalculateChildSizeBase( const Dali::Actor& child, Dimension::Type dimension );
+
+ /**
+ * @brief Set the preferred size for size negotiation
+ *
+ * @param[in] size The preferred size to set
+ */
+ void SetPreferredSize( const Vector2& size );
+
+ /**
+ * @brief Return the preferred size used for size negotiation
+ *
+ * @return Return the preferred size
+ */
+ Vector2 GetPreferredSize() const;
+
+ /**
+ * @copydoc Dali::Actor::SetMinimumSize
+ */
+ void SetMinimumSize( float size, Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
+
+ /**
+ * @copydoc Dali::Actor::GetMinimumSize
+ */
+ float GetMinimumSize( Dimension::Type dimension ) const;
+
+ /**
+ * @copydoc Dali::Actor::SetMaximumSize
+ */
+ void SetMaximumSize( float size, Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
+
+ /**
+ * @copydoc Dali::Actor::GetMaximumSize
+ */
+ float GetMaximumSize( Dimension::Type dimension ) const;
+