-
-const char * const BACKGROUND_COLOR_NAME("color");
-
-/**
- * Structure which holds information about the background of a control
- */
-struct Background
-{
- //ToDo: remove this actor and apply the Renderer on the Control
- // when the implementation of Actor::RemoveRenderer(Renderer&) is in place.
- Actor actor; ///< Background actor
- ControlRenderer controlRenderer; ///< The control renderer to render the background
- // The background can either be an image or a solid color.
- Image image; ///< The background image
- Vector4 color; ///< The background color
-
- /**
- * Constructor
- */
- Background()
- : actor(),
- controlRenderer(),
- image(),
- color( Color::TRANSPARENT )
- {
- }
-};
-
-//ToDo: skip this actor creation and apply the Renderer on the Control
-// when the implementation of Actor::RemoveRenderer(Renderer&) is in place.
-Actor CreateBackgroundActor()
-{
- // Create the actor
- Actor actor = Actor::New();
- actor.SetSize( Vector3::ONE );
- actor.SetPositionInheritanceMode( USE_PARENT_POSITION_PLUS_LOCAL_POSITION );
- actor.SetColorMode( USE_PARENT_COLOR );
-
- //Constraint scale of the background actor to the size of the control
- Constraint constraint = Constraint::New<Vector3>( actor,
- Actor::Property::SCALE,
- EqualToConstraint() );
- constraint.AddSource( ParentSource( Actor::Property::SIZE ) );
- constraint.Apply();
-
- return actor;
-}
-
-/**
- * @brief Create the background actor for the control.
- *
- * @param[in] actor The parent actor of the background
- * @param[in] color The background color
- */
-void CreateBackground( Background& background, const Vector4& color )
-{
- background.actor = CreateBackgroundActor();
-
- background.image.Reset();
- background.color = color;
-
- // Create the control renderer
- RendererFactory rendererFactory = Toolkit::RendererFactory::Get();
- background.controlRenderer = rendererFactory.GetControlRenderer(color);
-
- // ToDo: Call SetOnStage at Control::OnStageConnection and call SetOffStage at Control::OnStageDisconnection;
- // Currently Actor::RemoveRenderer doesnot work yet.
- background.controlRenderer.SetOnStage( background.actor );
-}
-
-/**
- * @brief Create the background actor for the control.
- *
- * @param[in] actor The parent actor of the background
- * @param[in] image The background image
- */
-void CreateBackground( Background& background, const Image& image )
-{
- background.actor = CreateBackgroundActor();
-
- background.color = Color::TRANSPARENT;
- background.image = image;
-
- // Create the control renderer
- RendererFactory rendererFactory = Toolkit::RendererFactory::Get();
- background.controlRenderer = rendererFactory.GetControlRenderer(image);
-
- // ToDo: Call SetOnStage at Control::OnStageConnection and call SetOffStage at Control::OnStageDisconnection;
- // Currently Actor::RemoveRenderer doesnot work yet.
- background.controlRenderer.SetOnStage( background.actor );
-}
-