Visual replacements logic updated
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / controls / control-impl.cpp
index aa0ef0b..05f7ab3 100644 (file)
@@ -122,9 +122,10 @@ Vector4 Control::GetBackgroundColor() const
 void Control::SetBackground( const Property::Map& map )
 {
   Toolkit::Visual::Base visual = Toolkit::VisualFactory::Get().CreateVisual( map );
+  visual.SetName("background");
   if( visual )
   {
-    mImpl->RegisterVisual( Toolkit::Control::Property::BACKGROUND, visual, float( DepthIndex::BACKGROUND ) );
+    mImpl->RegisterVisual( Toolkit::Control::Property::BACKGROUND, visual, DepthIndex::BACKGROUND );
 
     // Trigger a size negotiation request that may be needed by the new visual to relayout its contents.
     RelayoutRequest();
@@ -136,7 +137,7 @@ void Control::SetBackgroundImage( Image image )
   Toolkit::Visual::Base visual = Toolkit::VisualFactory::Get().CreateVisual( image );
   if( visual )
   {
-    mImpl->RegisterVisual( Toolkit::Control::Property::BACKGROUND, visual, float( DepthIndex::BACKGROUND ) );
+    mImpl->RegisterVisual( Toolkit::Control::Property::BACKGROUND, visual, DepthIndex::BACKGROUND );
   }
 }
 
@@ -516,16 +517,7 @@ void Control::OnStageConnection( int depth )
 
 void Control::OnStageDisconnection()
 {
-  for(RegisteredVisualContainer::Iterator iter = mImpl->mVisuals.Begin(); iter!= mImpl->mVisuals.End(); iter++)
-  {
-    // Check whether the visual is empty
-    if( (*iter)->visual )
-    {
-      DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Control::OnStageDisconnection Setting visual(%d) off stage\n", (*iter)->index );
-      Actor self( Self() );
-      Toolkit::GetImplementation((*iter)->visual).SetOffStage( self );
-    }
-  }
+  mImpl->OnStageDisconnection();
 }
 
 void Control::OnKeyInputFocusGained()