From 99cfad1f8fe17f96c45004022372be6e78c22a0b Mon Sep 17 00:00:00 2001 From: Xiangyin Ma Date: Wed, 27 May 2015 16:30:28 +0100 Subject: [PATCH] Quick fix of Popup after removing PropagateRelayoutFlags() Change-Id: Idbf57f6cf3e4e2e80a1e9aed2748ccb83685d7d2 --- dali-toolkit/internal/controls/popup/popup-impl.cpp | 5 +++-- .../programming-guide/size-negotiation-controls.h | 16 +--------------- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/dali-toolkit/internal/controls/popup/popup-impl.cpp b/dali-toolkit/internal/controls/popup/popup-impl.cpp index b9b9da7..0a58b7c 100755 --- a/dali-toolkit/internal/controls/popup/popup-impl.cpp +++ b/dali-toolkit/internal/controls/popup/popup-impl.cpp @@ -38,6 +38,7 @@ #include #include #include +#include using namespace Dali; @@ -675,8 +676,8 @@ void Popup::OnRelayout( const Vector2& size, RelayoutContainer& container ) button.SetPosition( buttonPosition ); - button.PropagateRelayoutFlags(); // Reset relayout flags for relayout - container.Add( button, buttonSize ); + //Todo: Use the size negotiation pass instead of SetSize directly + button.SetSize( buttonSize ); } } } diff --git a/docs/content/programming-guide/size-negotiation-controls.h b/docs/content/programming-guide/size-negotiation-controls.h index a69d1e8..2f3ac40 100644 --- a/docs/content/programming-guide/size-negotiation-controls.h +++ b/docs/content/programming-guide/size-negotiation-controls.h @@ -74,24 +74,10 @@ A table view is added to the popup to specify layout. It will fill to the width mPopupLayout.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); mPopupLayout.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); @endcode -Override the OnRelayout method to position and resize the buttons. The trick to this is that the buttons do not know they are part of a popup and are -about to be resized so could already have had their sizes negotiated. The call to PropagateRelayoutFlags on the button will ensure that it and all -its child dependents are ready for a new size negotiation pass. The container.Add call will add the button to the relayout queue to be processed this frame. -The buttonSize parameter is the desired size for the button. The desired size will only be set if the size policy of the button has already been changed to -ResizePolicy::USE_ASSIGNED_SIZE, which is what happens when a button is added to the popup. +Override the OnRelayout method to position and resize the buttons. @code -void Popup::AddButton( Toolkit::Button button ) -... -button.SetResizePolicy( ResizePolicy::USE_ASSIGNED_SIZE, Dimension::ALL_DIMENSIONS ); -... - void Popup::OnRelayout( const Vector2& size, RelayoutContainer& container ) ... -button.SetPosition( buttonPosition ); - -button.PropagateRelayoutFlags(); // Reset relayout flags for relayout -container.Add( button, buttonSize ); -... @endcode Another aspect to the popup is that depending which resize policies are active on it then the inner table view requires different resize policies itself. OnSetResizePolicy can be overridden to receive notice that the resize policy has changed on the control and action can be taken. -- 2.7.4