control.SetProperty( Control::Property::BACKGROUND, emptyMap );
DALI_TEST_CHECK( control.GetProperty( Control::Property::BACKGROUND ).Get< Property::Map >().Empty() );
+ // Deprecated Properties
+ control.SetProperty( Control::Property::BACKGROUND_COLOR, Color::YELLOW );
+ 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 );
+ propValue = control.GetProperty( Control::Property::BACKGROUND_IMAGE );
+ resultMap = propValue.GetMap();
+ DALI_TEST_CHECK( resultMap->Find( "imageUrl" )->Get< std::string >() == "TestImage" );
+ control.SetProperty( Control::Property::BACKGROUND_IMAGE, emptyMap );
+ DALI_TEST_CHECK( control.GetProperty( Control::Property::BACKGROUND_IMAGE ).Get< Property::Map >().Empty() );
+
END_TEST;
}
controlImpl.SetStyleName( value.Get< std::string >() );
break;
}
- case Toolkit::Control::Property::BACKGROUND:
+
+ case Toolkit::Control::Property::BACKGROUND_COLOR:
{
+ DALI_LOG_WARNING( "BACKGROUND_COLOR property is deprecated. Use BACKGROUND property instead\n" );
+ controlImpl.SetBackgroundColor( value.Get< Vector4 >() );
+ break;
+ }
+
+ case Toolkit::Control::Property::BACKGROUND_IMAGE:
+ {
+ DALI_LOG_WARNING( "BACKGROUND_IMAGE property is deprecated. Use BACKGROUND property instead\n" );
Image image = Scripting::NewImage( value );
if ( image )
{
controlImpl.SetBackgroundImage( image );
- break;
}
- const Property::Map* map = value.GetMap();
- if( map )
+ else
{
- controlImpl.SetBackground( *map );
- break;
+ // An empty map means the background is no longer required
+ controlImpl.ClearBackground();
}
-
- // The background is neither a valid image nor a property map, so it is no longer required
- controlImpl.ClearBackground();
break;
}
}
break;
}
+
+ 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 );
+ break;
+ }
+
+ // The background is neither a valid image nor a property map, so it is no longer required
+ controlImpl.ClearBackground();
+ break;
+ }
}
}
}
break;
}
- case Toolkit::Control::Property::BACKGROUND:
+ case Toolkit::Control::Property::BACKGROUND_COLOR:
{
+ DALI_LOG_WARNING( "BACKGROUND_COLOR property is deprecated. Use BACKGROUND property instead\n" );
+ value = controlImpl.GetBackgroundColor();
+ break;
+ }
+
+ case Toolkit::Control::Property::BACKGROUND_IMAGE:
+ {
+ DALI_LOG_WARNING( "BACKGROUND_IMAGE property is deprecated. Use BACKGROUND property instead\n" );
Property::Map map;
if( controlImpl.mImpl->mBackgroundRenderer )
{
- (controlImpl.mImpl->mBackgroundRenderer).CreatePropertyMap( map );
+ controlImpl.mImpl->mBackgroundRenderer.CreatePropertyMap( map );
}
-
value = map;
break;
}
value = controlImpl.HasKeyInputFocus();
break;
}
+
+ case Toolkit::Control::Property::BACKGROUND:
+ {
+ Property::Map map;
+ if( controlImpl.mImpl->mBackgroundRenderer )
+ {
+ (controlImpl.mImpl->mBackgroundRenderer).CreatePropertyMap( map );
+ }
+
+ value = map;
+ break;
+ }
+
}
}
bool mAddRemoveBackgroundChild:1; ///< Flag to know when we are adding or removing our own actor to avoid call to OnControlChildAdd
// Properties - these need to be members of Internal::Control::Impl as they need to function within this class.
- static PropertyRegistration PROPERTY_1;
- static PropertyRegistration PROPERTY_2;
- static PropertyRegistration PROPERTY_3;
+ static const PropertyRegistration PROPERTY_1;
+ static const PropertyRegistration PROPERTY_2;
+ static const PropertyRegistration PROPERTY_3;
+ static const PropertyRegistration PROPERTY_4;
+ static const PropertyRegistration PROPERTY_5;
};
// Properties registered without macro to use specific member variables.
-PropertyRegistration Control::Impl::PROPERTY_1( typeRegistration, "styleName", Toolkit::Control::Property::STYLE_NAME, Property::STRING, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
-PropertyRegistration Control::Impl::PROPERTY_2( typeRegistration, "background", Toolkit::Control::Property::BACKGROUND, Property::MAP, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
-PropertyRegistration Control::Impl::PROPERTY_3( typeRegistration, "keyInputFocus", Toolkit::Control::Property::KEY_INPUT_FOCUS, Property::BOOLEAN, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
+const PropertyRegistration Control::Impl::PROPERTY_1( typeRegistration, "styleName", Toolkit::Control::Property::STYLE_NAME, Property::STRING, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
+const PropertyRegistration Control::Impl::PROPERTY_2( typeRegistration, "backgroundColor", Toolkit::Control::Property::BACKGROUND_COLOR, Property::VECTOR4, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
+const PropertyRegistration Control::Impl::PROPERTY_3( typeRegistration, "backgroundImage", Toolkit::Control::Property::BACKGROUND_IMAGE, Property::MAP, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
+const PropertyRegistration Control::Impl::PROPERTY_4( typeRegistration, "keyInputFocus", Toolkit::Control::Property::KEY_INPUT_FOCUS, Property::BOOLEAN, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
+const PropertyRegistration Control::Impl::PROPERTY_5( typeRegistration, "background", Toolkit::Control::Property::BACKGROUND, Property::MAP, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
Toolkit::Control Control::New()
{
{
enum
{
- STYLE_NAME = PROPERTY_START_INDEX, ///< name "styleName", @see SetStyleName, type std::string
- BACKGROUND, ///< name "background", @since DALi 1.1.4, type Map
- KEY_INPUT_FOCUS, ///< name "keyInputFocus", @see SetKeyInputFocus, type bool
+ STYLE_NAME = PROPERTY_START_INDEX, ///< name "styleName", @see SetStyleName, type std::string
+ BACKGROUND_COLOR, ///< name "background-color", @deprecated DALi 1.1.3 mutually exclusive with BACKGROUND_IMAGE & BACKGROUND, type Vector4
+ BACKGROUND_IMAGE, ///< name "background-image", @deprecated DALi 1.1.3 mutually exclusive with BACKGROUND_COLOR & BACKGROUND, type Map
+ KEY_INPUT_FOCUS, ///< name "keyInputFocus", @see SetKeyInputFocus, type bool
+ BACKGROUND, ///< name "background", @since DALi 1.1.3 mutually exclusive with BACKGROUND_COLOR & BACKGROUND_IMAGE, type Map
};
};