Allow background property to be set as a URL string, get will still return a map
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / controls / control-impl.cpp
index c731c0d..b71a080 100644 (file)
@@ -407,11 +407,22 @@ public:
 
         case Toolkit::Control::Property::BACKGROUND:
         {
+          std::string url;
           const Property::Map* map = value.GetMap();
           if( map && !map->Empty() )
           {
             controlImpl.SetBackground( *map );
           }
+          else if( value.Get( url ) )
+          {
+            // don't know the size to load
+            Toolkit::Visual::Base visual = Toolkit::VisualFactory::Get().CreateVisual( url, ImageDimensions() );
+            if( visual )
+            {
+              controlImpl.RegisterVisual( Toolkit::Control::Property::BACKGROUND, visual );
+              visual.SetDepthIndex( DepthIndex::BACKGROUND );
+            }
+          }
           else
           {
             // The background is an empty property map, so we should clear the background