-/**
- * Structure which holds information about the background of a control
- */
-struct Background
-{
- Actor actor; ///< Either a MeshActor or an ImageActor
- Vector4 color; ///< The color of the actor.
-
- /**
- * Constructor
- */
- Background()
- : actor(),
- color( Color::WHITE )
- {
- }
-};
-
-/**
- * Creates a white coloured Mesh.
- */
-Mesh CreateMesh()
-{
- Vector3 white( Color::WHITE );
-
- MeshData meshData;
-
- // Create vertices with a white color (actual color is set by actor color)
- MeshData::VertexContainer vertices(4);
- vertices[ 0 ] = MeshData::Vertex( Vector3( -0.5f, -0.5f, 0.0f ), Vector2::ZERO, white );
- vertices[ 1 ] = MeshData::Vertex( Vector3( 0.5f, -0.5f, 0.0f ), Vector2::ZERO, white );
- vertices[ 2 ] = MeshData::Vertex( Vector3( -0.5f, 0.5f, 0.0f ), Vector2::ZERO, white );
- vertices[ 3 ] = MeshData::Vertex( Vector3( 0.5f, 0.5f, 0.0f ), Vector2::ZERO, white );
-
- // Specify all the faces
- MeshData::FaceIndices faces;
- faces.reserve( 6 ); // 2 triangles in Quad
- faces.push_back( 0 ); faces.push_back( 3 ); faces.push_back( 1 );
- faces.push_back( 0 ); faces.push_back( 2 ); faces.push_back( 3 );
-
- // Create the mesh data from the vertices and faces
- meshData.SetMaterial( Material::New( "ControlMaterial" ) );
- meshData.SetVertices( vertices );
- meshData.SetFaceIndices( faces );
- meshData.SetHasColor( true );
-
- return Mesh::New( meshData );
-}
-
-/**
- * Sets all the required properties for the background actor.
- *
- * @param[in] actor The actor to set the properties on.
- * @param[in] color The required color of the actor.
- */
-void SetupBackgroundActor( Actor actor, const Vector4& color )
-{
- actor.SetColor( color );
- actor.SetPositionInheritanceMode( USE_PARENT_POSITION_PLUS_LOCAL_POSITION );
- actor.SetColorMode( USE_OWN_MULTIPLY_PARENT_COLOR );
- actor.SetZ( BACKGROUND_ACTOR_Z_POSITION );
- actor.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
-}
-
-/**
- * Sets all the required properties for the background actor.
- *
- * @param[in] actor The actor to set the properties on.
- * @param[in] constrainingIndex The property index to constrain the parent's size on.
- * @param[in] color The required color of the actor.
- */
-void SetupBackgroundActorConstrained( Actor actor, Property::Index constrainingIndex, const Vector4& color )
-{
- actor.SetColor( color );
- actor.SetPositionInheritanceMode( USE_PARENT_POSITION_PLUS_LOCAL_POSITION );
- actor.SetColorMode( USE_OWN_MULTIPLY_PARENT_COLOR );
- actor.SetZ( BACKGROUND_ACTOR_Z_POSITION );
-
- Constraint constraint = Constraint::New<Vector3>( actor,
- constrainingIndex,
- EqualToConstraint() );
- constraint.AddSource( ParentSource( Actor::Property::SIZE ) );
- constraint.Apply();
-}
-