Remove Constraints from Cluster,ToolBar,View & ImageView
[platform/core/uifw/dali-toolkit.git] / optional / dali-toolkit / internal / controls / tool-bar / tool-bar-impl.cpp
index ae0c35e..d49c718 100644 (file)
@@ -73,7 +73,7 @@ void ToolBar::SetBackground( Actor background )
   // ToolBar image
   background.SetParentOrigin( Dali::ParentOrigin::TOP_CENTER );
   background.SetAnchorPoint( Dali::AnchorPoint::TOP_CENTER );
-  background.ApplyConstraint( Constraint::New<Vector3>( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) );
+  background.SetSize( mToolBarSize );
 
   RenderableActor renderableActor = RenderableActor::DownCast( background );
   if ( renderableActor )
@@ -82,6 +82,7 @@ void ToolBar::SetBackground( Actor background )
   }
 
   Self().Add( background );
+  mBackground = background;
 }
 
 void ToolBar::AddControl( Actor control, float relativeSize, Toolkit::Alignment::Type alignment, const Toolkit::Alignment::Padding& padding )
@@ -356,6 +357,12 @@ void ToolBar::OnRelaidOut( Vector2 size, ActorSizeContainer& container )
   Relayout( mLayout, size, container );
 }
 
+void ToolBar::OnControlSizeSet( const Vector3& targetSize )
+{
+  mToolBarSize = targetSize;
+  mBackground.SetSize( mToolBarSize );
+}
+
 } // namespace Internal
 
 } // namespace Toolkit