Change-Id: Ie16a55fd59278d65f8665994972cb90708a4891e
return mImpl->mStyleName;
}
return mImpl->mStyleName;
}
+void Control::UpdateBackgroundState()
+{
+ // Set the depth of the background renderer after creating/modifying it.
+ // We do this regardless of whether or not it is on stage as the index
+ // is relative and still valid if this control is re-parented.
+ if( mImpl->mBackgroundRenderer )
+ {
+ mImpl->mBackgroundRenderer.SetDepthIndex( BACKGROUND_DEPTH_INDEX );
+
+ Actor self( Self() );
+ if( self.OnStage() )
+ {
+ mImpl->mBackgroundRenderer.SetOnStage( self );
+ }
+ }
+}
+
void Control::SetBackgroundColor( const Vector4& color )
{
Actor self( Self() );
void Control::SetBackgroundColor( const Vector4& color )
{
Actor self( Self() );
else
{
mImpl->mBackgroundRenderer = factory.GetControlRenderer( color );
else
{
mImpl->mBackgroundRenderer = factory.GetControlRenderer( color );
-
- if( self.OnStage() )
- {
- mImpl->mBackgroundRenderer.SetDepthIndex( BACKGROUND_DEPTH_INDEX );
- mImpl->mBackgroundRenderer.SetOnStage( self );
- }
+
+ UpdateBackgroundState();
}
Vector4 Control::GetBackgroundColor() const
}
Vector4 Control::GetBackgroundColor() const
Toolkit::RendererFactory factory = Toolkit::RendererFactory::Get();
mImpl->mBackgroundRenderer = factory.GetControlRenderer( map );
Toolkit::RendererFactory factory = Toolkit::RendererFactory::Get();
mImpl->mBackgroundRenderer = factory.GetControlRenderer( map );
- // mBackgroundRenderer might be empty, if an invalid map is provided, no background.
- if( self.OnStage() && mImpl->mBackgroundRenderer)
- {
- mImpl->mBackgroundRenderer.SetDepthIndex( BACKGROUND_DEPTH_INDEX );
- mImpl->mBackgroundRenderer.SetOnStage( self );
- }
+ UpdateBackgroundState();
}
void Control::SetBackgroundImage( Image image )
}
void Control::SetBackgroundImage( Image image )
else
{
mImpl->mBackgroundRenderer = factory.GetControlRenderer( image );
else
{
mImpl->mBackgroundRenderer = factory.GetControlRenderer( image );
-
- if( self.OnStage() )
- {
- mImpl->mBackgroundRenderer.SetDepthIndex( BACKGROUND_DEPTH_INDEX );
- mImpl->mBackgroundRenderer.SetOnStage( self );
- }
+
+ UpdateBackgroundState();
}
void Control::ClearBackground()
}
void Control::ClearBackground()
{
if( mImpl->mBackgroundRenderer)
{
{
if( mImpl->mBackgroundRenderer)
{
- mImpl->mBackgroundRenderer.SetDepthIndex( BACKGROUND_DEPTH_INDEX );
- Actor self(Self());
mImpl->mBackgroundRenderer.SetOnStage( self );
}
}
void Control::OnStageDisconnection()
{
mImpl->mBackgroundRenderer.SetOnStage( self );
}
}
void Control::OnStageDisconnection()
{
- if( mImpl->mBackgroundRenderer)
+ if( mImpl->mBackgroundRenderer )
mImpl->mBackgroundRenderer.SetOffStage( self );
}
}
mImpl->mBackgroundRenderer.SetOffStage( self );
}
}
*/
DALI_INTERNAL bool EmitKeyEventSignal( const KeyEvent& event );
*/
DALI_INTERNAL bool EmitKeyEventSignal( const KeyEvent& event );
+private:
+
+ /**
+ * Sets up the background image/color based on the current state.
+ * This will set the depth index (always), and add to stage if the control is on stage.
+ *
+ */
+ void UpdateBackgroundState();
+
protected: // For derived classes to call
/**
protected: // For derived classes to call
/**