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;
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 );
}
(*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 )
{
}
// 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();
}
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;
}
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