Quick fix of Popup after removing PropagateRelayoutFlags() 18/40018/2
authorXiangyin Ma <x1.ma@samsung.com>
Wed, 27 May 2015 15:30:28 +0000 (16:30 +0100)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Wed, 27 May 2015 17:05:18 +0000 (10:05 -0700)
Change-Id: Idbf57f6cf3e4e2e80a1e9aed2748ccb83685d7d2

dali-toolkit/internal/controls/popup/popup-impl.cpp
docs/content/programming-guide/size-negotiation-controls.h

index b9b9da77dc0e92f5cfe4fe627acc5fc5543901a6..0a58b7c4f167e1610c6d738a025d4fb3af988fc9 100755 (executable)
@@ -38,6 +38,7 @@
 #include <dali-toolkit/public-api/controls/default-controls/solid-color-actor.h>
 #include <dali-toolkit/public-api/focus-manager/focus-manager.h>
 #include <dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.h>
+#include <dali-toolkit/internal/controls/buttons/button-impl.h>
 
 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 );
     }
   }
 }
index a69d1e81ab57bf3de150168aec8bdeb9aeb9cb11..2f3ac40ab6ad37d9edc03d58ba06bbb4b8834710 100644 (file)
@@ -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.