This will not break backwards compatibility as the previous code followed a different path anyway.
Change-Id: I4a7250297fe6c1b2351bf899f2ec06f3154f51cf
DALI_TEST_EQUALS( control.GetBackgroundColor(), Color::TRANSPARENT, TEST_LOCATION );
DALI_TEST_CHECK( control.GetProperty( Control::Property::BACKGROUND ).Get< Property::Map >().Empty() );
DALI_TEST_EQUALS( control.GetBackgroundColor(), Color::TRANSPARENT, TEST_LOCATION );
DALI_TEST_CHECK( control.GetProperty( Control::Property::BACKGROUND ).Get< Property::Map >().Empty() );
- Property::Map colorMap;
- colorMap["color"] = Color::RED;
- control.SetProperty( Control::Property::BACKGROUND, colorMap );
- Property::Value propValue = control.GetProperty( Control::Property::BACKGROUND );
- Property::Map* resultMap = propValue.GetMap();
- DALI_TEST_CHECK( resultMap->Find( "rendererType" ) );
- DALI_TEST_CHECK( resultMap->Find( "rendererType" )->Get<std::string>() == "color" );
- DALI_TEST_CHECK( resultMap->Find( "blendColor" ) );
- DALI_TEST_CHECK( resultMap->Find( "blendColor" )->Get<Vector4>() == Color::RED );
-
- imageMap[ "filename" ] = "TestImage";
+ imageMap[ "rendererType" ] = "image";
+ imageMap[ "imageUrl" ] = "TestImage";
control.SetProperty( Control::Property::BACKGROUND, imageMap );
control.SetProperty( Control::Property::BACKGROUND, imageMap );
- propValue = control.GetProperty( Control::Property::BACKGROUND );
- resultMap = propValue.GetMap();
+ Property::Value propValue = control.GetProperty( Control::Property::BACKGROUND );
+ Property::Map* resultMap = propValue.GetMap();
DALI_TEST_CHECK( resultMap->Find( "rendererType" ) );
DALI_TEST_CHECK( resultMap->Find( "rendererType" )->Get<std::string>() == "image" );
DALI_TEST_CHECK( resultMap->Find( "imageUrl" ) );
DALI_TEST_CHECK( resultMap->Find( "rendererType" ) );
DALI_TEST_CHECK( resultMap->Find( "rendererType" )->Get<std::string>() == "image" );
DALI_TEST_CHECK( resultMap->Find( "imageUrl" ) );
DALI_TEST_CHECK( control.GetProperty( Control::Property::BACKGROUND_COLOR ).Get< Vector4 >() == Color::YELLOW );
DALI_TEST_CHECK( control.GetProperty( Control::Property::BACKGROUND_COLOR ).Get< Vector4 >() == control.GetBackgroundColor() );
control.ClearBackground();
DALI_TEST_CHECK( control.GetProperty( Control::Property::BACKGROUND_COLOR ).Get< Vector4 >() == Color::YELLOW );
DALI_TEST_CHECK( control.GetProperty( Control::Property::BACKGROUND_COLOR ).Get< Vector4 >() == control.GetBackgroundColor() );
control.ClearBackground();
- control.SetProperty( Control::Property::BACKGROUND_IMAGE, imageMap );
+
+ Property::Map deprecatedImageMap;
+ deprecatedImageMap[ "filename" ] = "TestImage";
+ control.SetProperty( Control::Property::BACKGROUND_IMAGE, deprecatedImageMap );
propValue = control.GetProperty( Control::Property::BACKGROUND_IMAGE );
resultMap = propValue.GetMap();
DALI_TEST_CHECK( resultMap->Find( "imageUrl" )->Get< std::string >() == "TestImage" );
propValue = control.GetProperty( Control::Property::BACKGROUND_IMAGE );
resultMap = propValue.GetMap();
DALI_TEST_CHECK( resultMap->Find( "imageUrl" )->Get< std::string >() == "TestImage" );
DALI_TYPE_REGISTRATION_END()
DALI_TYPE_REGISTRATION_END()
-const char * const BACKGROUND_COLOR_NAME("color");
const char * const COLOR_RENDERER_COLOR_NAME("blendColor");
} // unnamed namespace
const char * const COLOR_RENDERER_COLOR_NAME("blendColor");
} // unnamed namespace
case Toolkit::Control::Property::BACKGROUND:
{
case Toolkit::Control::Property::BACKGROUND:
{
- Image image = Scripting::NewImage( value );
- if ( image )
- {
- controlImpl.SetBackgroundImage( image );
- break;
- }
const Property::Map* map = value.GetMap();
if( map )
{
controlImpl.SetBackground( *map );
const Property::Map* map = value.GetMap();
if( map )
{
controlImpl.SetBackground( *map );
-
- // The background is neither a valid image nor a property map, so it is no longer required
- controlImpl.ClearBackground();
+ else
+ {
+ // The background is not a property map, so we should clear the background
+ controlImpl.ClearBackground();
+ }
void Control::SetBackground(const Property::Map& map)
{
void Control::SetBackground(const Property::Map& map)
{
- const Property::Value* colorValue = map.Find( BACKGROUND_COLOR_NAME );
- Vector4 color;
- if( colorValue && colorValue->Get(color))
- {
- SetBackgroundColor( color );
- return;
- }
-
Actor self( Self() );
mImpl->mBackgroundRenderer.RemoveAndReset( self );
Toolkit::RendererFactory factory = Toolkit::RendererFactory::Get();
Actor self( Self() );
mImpl->mBackgroundRenderer.RemoveAndReset( self );
Toolkit::RendererFactory factory = Toolkit::RendererFactory::Get();
"popupIconColor":[1.0,1.0,1.0,1.0],
"popupPressedColor":[0.24,0.72,0.8,0.11],
"background": {
"popupIconColor":[1.0,1.0,1.0,1.0],
"popupPressedColor":[0.24,0.72,0.8,0.11],
"background": {
- "filename": "{DALI_IMAGE_DIR}selection-popup-bg.9.png"
+ "rendererType": "nPatch",
+ "imageUrl": "{DALI_IMAGE_DIR}selection-popup-bg.9.png"
},
"popupFadeInDuration":0.25,
"popupFadeOutDuration":0.25
},
"popupFadeInDuration":0.25,
"popupFadeOutDuration":0.25
"popupIconColor":[1.0,1.0,1.0,1.0],
"popupPressedColor":[0.24,0.72,0.8,0.11],
"background": {
"popupIconColor":[1.0,1.0,1.0,1.0],
"popupPressedColor":[0.24,0.72,0.8,0.11],
"background": {
- "filename": "{DALI_IMAGE_DIR}selection-popup-bg.9.png"
+ "rendererType": "nPatch",
+ "imageUrl": "{DALI_IMAGE_DIR}selection-popup-bg.9.png"
},
"popupFadeInDuration":0.25,
"popupFadeOutDuration":0.25
},
"popupFadeInDuration":0.25,
"popupFadeOutDuration":0.25