DALI_TEST_EQUALS( resultMap->Find( Visual::Property::TYPE )->Get<int>(), (int)Visual::IMAGE, TEST_LOCATION );
DALI_TEST_EQUALS( resultMap->Find( ImageVisual::Property::URL )->Get<std::string>(), "Foobar.png", TEST_LOCATION );
+ // set as Color
+ control.SetProperty( Control::Property::BACKGROUND, Color::RED );
+ propValue = control.GetProperty( Control::Property::BACKGROUND );
+ resultMap = propValue.GetMap();
+ DALI_TEST_EQUALS( resultMap->Find( Visual::Property::TYPE )->Get<int>(), (int)Visual::COLOR, TEST_LOCATION );
+ DALI_TEST_EQUALS( resultMap->Find( ColorVisual::Property::MIX_COLOR )->Get<Vector4>(), Color::RED, TEST_LOCATION );
+
// Deprecated Properties
control.SetProperty( Control::Property::BACKGROUND_COLOR, Color::YELLOW );
DALI_TEST_EQUALS( control.GetProperty( Control::Property::BACKGROUND_COLOR ).Get< Vector4 >(), Color::YELLOW, TEST_LOCATION );
case Toolkit::Control::Property::BACKGROUND:
{
std::string url;
+ Vector4 color;
const Property::Map* map = value.GetMap();
if( map && !map->Empty() )
{
visual.SetDepthIndex( DepthIndex::BACKGROUND );
}
}
+ else if( value.Get( color ) )
+ {
+ controlImpl.SetBackgroundColor(color);
+ }
else
{
// The background is an empty property map, so we should clear the background
*/
KEY_INPUT_FOCUS,
/**
- * @brief name "background", mutually exclusive with BACKGROUND_COLOR & BACKGROUND_IMAGE, type Map or std::string for URL.
+ * @brief name "background", mutually exclusive with BACKGROUND_COLOR & BACKGROUND_IMAGE, type Map or std::string for URL or Vector4 for Color.
* @SINCE_1_1.3
*/
BACKGROUND,
// Background property
Property.Map background = new Property.Map();
background.Add( Dali.Constants.Visual.Property.Type, new Property.Value((int)Dali.Constants.Visual.Type.Color) )
- .Add( Dali.Constants.ColorVisualProperty.MixColor, new Property.Value(Color.Red) );
+ .Add( Dali.Constants.ColorVisualProperty.MixColor, new Property.Value(Color.Red) );
spin.Background = background;
background = spin.Background;
Console.WriteLine ("Custom View BackgroundColor property : test failed");
}
+ // BackgroundImage property
+ spin.BackgroundImage = "background-image.jpg";
+ if(spin.BackgroundImage == "background-image.jpg")
+ {
+ Console.WriteLine ("Custom View BackgroundImage property : test passed");
+ }
+ else
+ {
+ Console.WriteLine ("Custom View BackgroundImage property : test failed");
+ }
+
// StyleName property
spin.StyleName = "MyCustomStyle";
if(spin.StyleName == "MyCustomStyle")
{
get
{
- Vector4 temp = new Vector4(0.0f,0.0f,0.0f,0.0f);
- GetProperty( View.Property.BACKGROUND_COLOR).Get( temp );
- return temp;
+ Vector4 backgroundColor = new Vector4(0.0f,0.0f,0.0f,0.0f);
+
+ Dali.Property.Map background = Background;
+ int visualType = 0;
+ background.Find( Dali.Constants.Visual.Property.Type ).Get( ref visualType );
+ if(visualType == (int)Dali.Constants.Visual.Type.Color)
+ {
+ background.Find( Dali.Constants.ColorVisualProperty.MixColor ).Get( backgroundColor );
+ }
+
+ return backgroundColor;
}
set
{
- SetProperty( View.Property.BACKGROUND_COLOR, new Dali.Property.Value( value ) );
+ SetProperty( View.Property.BACKGROUND, new Dali.Property.Value( value ) );
}
}
- public Dali.Property.Map BackgroundImage
+ public string BackgroundImage
{
get
{
- Dali.Property.Map temp = new Dali.Property.Map();
- GetProperty( View.Property.BACKGROUND_IMAGE).Get( temp );
- return temp;
+ string backgroundImage = "";
+
+ Dali.Property.Map background = Background;
+ int visualType = 0;
+ background.Find( Dali.Constants.Visual.Property.Type ).Get( ref visualType );
+ if(visualType == (int)Dali.Constants.Visual.Type.Image)
+ {
+ background.Find( Dali.Constants.ImageVisualProperty.URL ).Get( out backgroundImage );
+ }
+
+ return backgroundImage;
}
set
{
- SetProperty( View.Property.BACKGROUND_IMAGE, new Dali.Property.Value( value ) );
+ SetProperty( View.Property.BACKGROUND, new Dali.Property.Value( value ) );
}
}