return mPadding;
}
-void Alignment::OnRelaidOut( Vector2 size, ActorSizeContainer& container )
+void Alignment::OnRelayout( const Vector2& size, ActorSizeContainer& container )
{
// lay out the actors
Vector3 anchorPointAndParentOrigin = Vector3::ZERO;
private: // From Control
/**
- * @copydoc Control::OnRelaidOut()
+ * @copydoc Control::OnRelayout()
*/
- virtual void OnRelaidOut( Vector2 size, ActorSizeContainer& container );
+ virtual void OnRelayout( const Vector2& size, ActorSizeContainer& container );
private:
SetSelected(!mSelected);
}
-void RadioButton::OnRelaidOut( Vector2 /*size*/, ActorSizeContainer& container )
+void RadioButton::OnRelayout( const Vector2& /*size*/, ActorSizeContainer& container )
{
Vector3 newSize( mRadioIcon.GetNaturalSize() );
void ToggleState();
/**
- * @copydoc Dali::Toolkit::Control::OnRelaidOut(Vector2 size, ActorSizeContainer& container)
+ * @copydoc Dali::Toolkit::Control::OnRelayout()
*/
- virtual void OnRelaidOut( Vector2 size, ActorSizeContainer& container );
+ virtual void OnRelayout( const Vector2& size, ActorSizeContainer& container );
public:
// Properties
}
}
-void Popup::OnRelaidOut( Vector2 size, ActorSizeContainer& container )
+void Popup::OnRelayout( const Vector2& size, ActorSizeContainer& container )
{
// Set the popup size
Vector2 popupSize;
virtual void OnControlChildAdd( Actor& child );
/**
- * @copydoc Control::OnRelaidOut()
+ * @copydoc Control::OnRelayout()
*/
- virtual void OnRelaidOut( Vector2 size, ActorSizeContainer& container );
+ virtual void OnRelayout( const Vector2& size, ActorSizeContainer& container );
/**
* @copydoc Control::OnKeyEvent()
return mConstraintDuration;
}
-void TableView::OnRelaidOut( Vector2 size, ActorSizeContainer& container )
+void TableView::OnRelayout( const Vector2& size, ActorSizeContainer& container )
{
float fixedHeightsTotal = 0.0f;
float fixedWidthsTotal = 0.0f;
virtual void OnControlChildRemove(Actor& child);
/**
- * @copydoc Control::OnRelaidOut
+ * @copydoc Control::OnRelayout
*/
- virtual void OnRelaidOut( Vector2 size, ActorSizeContainer& container );
+ virtual void OnRelayout( const Vector2& size, ActorSizeContainer& container );
/**
* @copydoc Control::OnInitialize()
mActiveLayer.SetSize(targetSize);
}
-void TextInput::OnRelaidOut( Vector2 size, ActorSizeContainer& container )
+void TextInput::OnRelayout( const Vector2& size, ActorSizeContainer& container )
{
Relayout( mDisplayedTextView, size, container );
Relayout( mPopupPanel.GetRootActor(), size, container );
virtual void OnControlSizeSet(const Vector3& targetSize);
/**
- * @copydoc Control::OnRelaidOut()
+ * @copydoc Control::OnRelayout()
*/
- virtual void OnRelaidOut( Vector2 size, ActorSizeContainer& container );
+ virtual void OnRelayout( const Vector2& size, ActorSizeContainer& container );
/**
* Retrieves the text-input's natural size by calling TextView::GetNaturalSize().
}
}
-void TextView::OnRelaidOut( Vector2 size, ActorSizeContainer& container )
+void TextView::OnRelayout( const Vector2& size, ActorSizeContainer& container )
{
if( ( size.width < Math::MACHINE_EPSILON_1000 ) || ( size.height < Math::MACHINE_EPSILON_1000 ) )
{
EllipsizeEnd ///< Ellipsized by the end if it exceeds the width and/or the height.
};
- // Between two OnRelaidOut methods, several calls to InsertTextAt, RemoveTextFrom or SetText can happen.
- // TextViewProcessorMetadata stores the type of operation. A vector stores all operations between two OnRelaidOut calls.
+ // Between two OnRelayout methods, several calls to InsertTextAt, RemoveTextFrom or SetText can happen.
+ // TextViewProcessorMetadata stores the type of operation. A vector stores all operations between two OnRelayout calls.
enum TextViewProcessorMetadataType
{
};
/**
- * Stores info about which data structures need to be modified when the OnRelaidOut() method is called
+ * Stores info about which data structures need to be modified when the OnRelayout() method is called
*/
struct TextViewProcessorMetadata
{
virtual void OnControlSizeSet( const Vector3& size );
/**
- * @copydoc Toolkit::Control::OnRelaidOut()
- *
- * Removes text-actor and calls DoRelayOut()..
+ * @copydoc Toolkit::Control::OnRelayout()
*/
- virtual void OnRelaidOut( Vector2 size, ActorSizeContainer& container );
+ virtual void OnRelayout( const Vector2& size, ActorSizeContainer& container );
/**
* Retrieves the text-view's natural size.
/**
* Process Snapshot. It refresh the render-task in order to generate a new snapshot image.
*
- * ProcessSnapshot is called from OnRelaidOut() only if text has been relaid out.
+ * ProcessSnapshot is called from OnRelayout() only if text has been relaid out.
* It creates a new image buffer only if the size of the text has changed.
*
* @param[in] textViewSize The new text-view's size.
private:
MarkupProcessor::StyledTextArray mCurrentStyledText; ///< text currently displayed by the view
- std::vector<TextViewProcessorMetadata> mTextViewProcessorOperations; ///< Stores all relayout operations which arrive between two consecutive OnRelaidOut() calls.
+ std::vector<TextViewProcessorMetadata> mTextViewProcessorOperations; ///< Stores all relayout operations which arrive between two consecutive OnRelayout() calls.
LayoutParameters mLayoutParameters; ///< Stores some layout parameters in a struct. To be passed in layout functions.
VisualParameters mVisualParameters; ///< Some parameters which afects text-view visualization.
/**
* @brief Sets the new alignment. By default ( HorizontalCenter | VerticalCenter ).
- * Note! there should only be one horizontal and one vertical policy
+ *
+ * @note there should only be one horizontal and one vertical policy
* @param [in] type The new alignment option.
*/
void SetAlignmentType( Type type );
return false; // Accessibility value change action is not handled by default
}
-void Control::NegotiateSize( Vector2 allocatedSize, ActorSizeContainer& container )
+void Control::NegotiateSize( const Vector2& allocatedSize, ActorSizeContainer& container )
{
Vector2 size;
allocatedSize.x, allocatedSize.y,
size.x, size.y );
- Relayout( size, container );
+ // Avoids relayout again when OnSizeSet callback arrives as a function of us or deriving class calling SetSize()
+ mImpl->mInsideRelayout = true;
+ Self().SetSize( size );
+ // Only relayout controls which requested to be relaid out.
+ OnRelayout( size, container );
+ mImpl->mInsideRelayout = false;
}
void Control::SetAsKeyboardFocusGroup(bool isFocusGroup)
}
}
-void Control::Relayout( Actor actor, Vector2 size, ActorSizeContainer& container )
+void Control::Relayout( Actor actor, const Vector2& size, ActorSizeContainer& container )
{
if ( actor )
{
{
}
-void Control::OnRelaidOut( Vector2 size, ActorSizeContainer& container )
+void Control::OnRelayout( const Vector2& size, ActorSizeContainer& container )
{
unsigned int numChildren = Self().GetChildCount();
}
}
-void Control::Relayout(Vector2 size, ActorSizeContainer& container)
-{
- // Avoids relayout again when OnSizeSet callback arrives.
- mImpl->mInsideRelayout = true;
- Self().SetSize( size );
- // @todo this really needs to be at the end of method but not sure why the scope used to be only the SetSize, needs to be cleaned up in size negotiation rework
- mImpl->mInsideRelayout = false;
-
- // Only relayout controls which requested to be relaid out.
- OnRelaidOut( size, container );
-}
-
} // namespace Internal
} // namespace Toolkit
* @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 );
* @param[in,out] container The container that holds actors that are fed back into the
* RelayoutController algorithm.
*/
- DALI_INTERNAL void NegotiateSize( Vector2 size, ActorSizeContainer& container );
+ DALI_INTERNAL void NegotiateSize( const Vector2& size, ActorSizeContainer& container );
// Keyboard Focus
// Size Negotiation
/**
- * @brief Sends a request to be relaid-out.
+ * @brief Request a relayout, which means performing a size negotiation on this control, its parent and children (and potentially whole scene)
*
- * This method is called from OnStageConnection(), OnChildAdd(),
- * OnChildRemove(), SetSizePolicy(), SetMinimumSize() and
- * SetMaximumSize().
+ * This method is automatically called from OnStageConnection(), OnChildAdd(),
+ * OnChildRemove(), SetSizePolicy(), SetMinimumSize() and SetMaximumSize().
*
- * This method could also be called from derived classes every time
- * a control's poperty change and it needs to be relaid-out. After
- * the Dali::Stage::SignalMessageQueueFlushed() is emitted a
- * relayout process starts and all controls which called this method
- * will be relaid-out.
+ * 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() only sends a request per Control before
- * the Dali::Stage::SignalMessageQueueFlushed() signal is
- * emitted. That means a control will be relaid-out only once, even
- * if more than one request is sent between two consecutive signals.
+ * @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();
* @param[in] size The size to allocate to the actor.
* @param[in,out] container The container that holds actors that have not been allocated a size yet.
*/
- static void Relayout( Actor actor, Vector2 size, ActorSizeContainer& container );
+ static void Relayout( Actor actor, const Vector2& size, ActorSizeContainer& container );
private:
virtual void OnControlSizeSet( const Vector3& size );
/**
- * @brief Called after the Dali::Stage::SignalMessageQueueFlushed()
- * signal is emitted if this control requested to be relaid-out.
+ * @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 especific properties.
+ * 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 OnRelaidOut( Vector2 size, ActorSizeContainer& container );
+ virtual void OnRelayout( const Vector2& size, ActorSizeContainer& container );
/**
* @brief Called when the control gains key input focus.
*/
DALI_INTERNAL void DoStyleChange( Toolkit::StyleManager styleManager, StyleChange change );
- // Size Negotiation
-
- /**
- * @brief Called by NegotiateSize when the size to allocate to the control has been calculated.
- *
- * It calls the OnRelaidOut() method which can be overridden by derived classes.
- *
- * @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.
- */
- DALI_INTERNAL void Relayout( Vector2 size, ActorSizeContainer& container );
-
private:
// Undefined
GetHeightForWidth() and GetWidthForHeight() can be created in a similar manner.
@code
-void ControlA::OnRelaidOut( Vector2 size, ActorSizeContainer& container )
+void ControlA::OnRelayout( const Vector2& size, ActorSizeContainer& container )
{
// Width to be shared between ControlD and ActorD
Vector2 childSize( size.width * 0.5f, size.height );
</tr></table>
@code
-void ControlA::OnRelaidOut( Vector2 size, ActorSizeContainer& container )
+void ControlA::OnRelayout( const Vector2& size, ActorSizeContainer& container )
{
// Width of children is our size minus border
Vector3 childSize( size.width - mBorder.width * 2.0f,
return mBarLayer;
}
-void NavigationControl::OnRelaidOut( Vector2 size, ActorSizeContainer& container )
+void NavigationControl::OnRelayout( const Vector2& size, ActorSizeContainer& container )
{
const Vector2 setSize( size );
virtual void OnStageConnection();
/**
- * @copydoc Control::OnRelaidOut()
+ * @copydoc Control::OnRelayout()
*/
- virtual void OnRelaidOut( Vector2 size, ActorSizeContainer& container );
+ virtual void OnRelayout( const Vector2& size, ActorSizeContainer& container );
/**
* @copydoc Control::OnControlSizeSet
}
}
-void SuperBlurView::OnRelaidOut( Vector2 size, ActorSizeContainer& container )
+void SuperBlurView::OnRelayout( const Vector2& size, ActorSizeContainer& container )
{
unsigned int numChildren = Self().GetChildCount();
virtual void OnControlSizeSet(const Vector3& targetSize);
/**
- * @copydoc Control::OnRelaidOut()
+ * @copydoc Control::OnRelayout()
*/
- virtual void OnRelaidOut( Vector2 size, ActorSizeContainer& container );
+ virtual void OnRelayout( const Vector2& size, ActorSizeContainer& container );
private:
// actor is in mLayout not in Self().
}
-void ToolBar::OnRelaidOut( Vector2 size, ActorSizeContainer& container )
-{
- Relayout( mLayout, size, container );
-}
-
void ToolBar::OnControlSizeSet( const Vector3& targetSize )
{
mToolBarSize = targetSize;
virtual void OnControlChildAdd(Actor& child);
/**
- * Called when the tool-bar is relaid out.
- * @param[in] size The size allocated.
- * @param[in/out] container the container to put actors not handled.
- */
- virtual void OnRelaidOut( Vector2 size, ActorSizeContainer& container );
-
- /**
*
* @copydoc Toolkit::Control::OnControlSizeSet( const Vector3& targetSize )
*/