Merge "Add tc log to check a failure" into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / control / control-data-impl.cpp
index fb42012..56be1ce 100755 (executable)
@@ -434,7 +434,7 @@ void Control::Impl::RegisterVisual( Property::Index index, Toolkit::Visual::Base
         StopObservingVisual( currentRegisteredVisual );
 
         // If control staged and visual enabled then visuals will be swapped once ready
-        if(  self.OnStage() && enabled )
+        if(  self.GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) && enabled )
         {
           // Check if visual is currently in the process of being replaced ( is in removal container )
           RegisteredVisualContainer::Iterator visualQueuedForRemoval;
@@ -524,7 +524,7 @@ void Control::Impl::RegisterVisual( Property::Index index, Toolkit::Visual::Base
 
     Internal::Visual::Base& visualImpl = Toolkit::GetImplementation( visual );
     // Put on stage if enabled and the control is already on the stage
-    if( ( enabled == VisualState::ENABLED ) && self.OnStage() )
+    if( ( enabled == VisualState::ENABLED ) && self.GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) )
     {
       visualImpl.SetOnStage( self );
     }
@@ -588,7 +588,7 @@ void Control::Impl::EnableVisual( Property::Index index, bool enable )
 
     (*iter)->enabled = enable;
     Actor parentActor = mControlImpl.Self();
-    if ( mControlImpl.Self().OnStage() ) // If control not on Stage then Visual will be added when StageConnection is called.
+    if ( mControlImpl.Self().GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) ) // If control not on Stage then Visual will be added when StageConnection is called.
     {
       if ( enable )
       {
@@ -664,7 +664,7 @@ void Control::Impl::ResourceReady( Visual::Base& object)
   }
 
   // A visual is ready so control may need relayouting if staged
-  if ( self.OnStage() )
+  if ( self.GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) )
   {
     mControlImpl.RelayoutRequest();
   }
@@ -989,12 +989,12 @@ void Control::Impl::SetProperty( BaseObject* object, Property::Index index, cons
         const Property::Map* map = value.GetMap();
         if( map && !map->Empty() )
         {
-          controlImpl.SetShadow( *map );
+          controlImpl.mImpl->SetShadow( *map );
         }
         else
         {
           // The shadow is an empty property map, so we should clear the shadow
-          controlImpl.ClearShadow();
+          controlImpl.mImpl->ClearShadow();
         }
         break;
       }
@@ -1429,6 +1429,27 @@ DevelControl::VisualEventSignalType& Control::Impl::VisualEventSignal()
   return mVisualEventSignal;
 }
 
+void Control::Impl::SetShadow( const Property::Map& map )
+{
+  Toolkit::Visual::Base visual = Toolkit::VisualFactory::Get().CreateVisual( map );
+  visual.SetName("shadow");
+
+  if( visual )
+  {
+    mControlImpl.mImpl->RegisterVisual( Toolkit::DevelControl::Property::SHADOW, visual, DepthIndex::BACKGROUND_EFFECT );
+
+    mControlImpl.RelayoutRequest();
+  }
+}
+
+void Control::Impl::ClearShadow()
+{
+   mControlImpl.mImpl->UnregisterVisual( Toolkit::DevelControl::Property::SHADOW );
+
+   // Trigger a size negotiation request that may be needed when unregistering a visual.
+   mControlImpl.RelayoutRequest();
+}
+
 } // namespace Internal
 
 } // namespace Toolkit