Merge "Fix SVACE error in KeyboardFocusManager" into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / visuals / color / color-visual.cpp
index 82c6254..5bc3c6e 100644 (file)
 
 // EXTERNAL INCLUDES
 #include <dali/integration-api/debug.h>
+#include <dali/devel-api/object/handle-devel.h>
 
 //INTERNAL INCLUDES
 #include <dali-toolkit/public-api/visuals/color-visual-properties.h>
-#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
 #include <dali-toolkit/internal/visuals/visual-factory-impl.h>
 #include <dali-toolkit/internal/visuals/visual-factory-cache.h>
 #include <dali-toolkit/internal/visuals/visual-string-constants.h>
@@ -79,9 +80,11 @@ const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER(
 );
 }
 
-ColorVisualPtr ColorVisual::New( VisualFactoryCache& factoryCache )
+ColorVisualPtr ColorVisual::New( VisualFactoryCache& factoryCache, const Property::Map& properties )
 {
-  return new ColorVisual( factoryCache );
+  ColorVisualPtr colorVisualPtr( new ColorVisual( factoryCache ) );
+  colorVisualPtr->SetProperties( properties );
+  return colorVisualPtr;
 }
 
 ColorVisual::ColorVisual( VisualFactoryCache& factoryCache )
@@ -103,13 +106,6 @@ void ColorVisual::DoSetProperties( const Property::Map& propertyMap )
   }
 }
 
-void ColorVisual::SetSize( const Vector2& size )
-{
-  Visual::Base::SetSize( size );
-
-  // ToDo: renderer responds to the size change
-}
-
 void ColorVisual::DoSetOnStage( Actor& actor )
 {
   InitializeRenderer();
@@ -120,31 +116,10 @@ void ColorVisual::DoSetOnStage( Actor& actor )
 void ColorVisual::DoCreatePropertyMap( Property::Map& map ) const
 {
   map.Clear();
-  map.Insert( Toolkit::VisualProperty::TYPE, Toolkit::Visual::COLOR );
+  map.Insert( Toolkit::DevelVisual::Property::TYPE, Toolkit::Visual::COLOR );
   map.Insert( Toolkit::ColorVisual::Property::MIX_COLOR, mMixColor );
 }
 
-void ColorVisual::DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue )
-{
-  // TODO
-  /* David Steele comented :
-
-     Some things to bear in mind:
-
-     We currently keep a copy of the mix color in the ColorVisual object, which is then used to instantiate the registered property on the renderer.
-
-     The user can get the renderer and animate the mixColor property (it's registered, so is automatically a scene-graph property).
-
-     The GetProperty method will have to read from the renderer, or from the cached value in the Visual, and the SetProperty will have to write to cache and to the renderer if present.
-  */
-}
-
-Dali::Property::Value ColorVisual::DoGetProperty( Dali::Property::Index index )
-{
-  // TODO
-  return Dali::Property::Value();
-}
-
 void ColorVisual::OnSetTransform()
 {
   if( mImpl->mRenderer )
@@ -156,11 +131,6 @@ void ColorVisual::OnSetTransform()
 void ColorVisual::InitializeRenderer()
 {
   Geometry geometry = mFactoryCache.GetGeometry( VisualFactoryCache::QUAD_GEOMETRY );
-  if( !geometry )
-  {
-    geometry =  VisualFactoryCache::CreateQuadGeometry();
-    mFactoryCache.SaveGeometry( VisualFactoryCache::QUAD_GEOMETRY, geometry );
-  }
 
   Shader shader = mFactoryCache.GetShader( VisualFactoryCache::COLOR_SHADER );
   if( !shader )
@@ -171,7 +141,7 @@ void ColorVisual::InitializeRenderer()
 
   mImpl->mRenderer = Renderer::New( geometry, shader );
 
-  mMixColorIndex = mImpl->mRenderer.RegisterProperty( Toolkit::ColorVisual::Property::MIX_COLOR, COLOR_NAME, mMixColor );
+  mMixColorIndex = DevelHandle::RegisterProperty( mImpl->mRenderer, Toolkit::ColorVisual::Property::MIX_COLOR, COLOR_NAME, mMixColor );
   if( mMixColor.a < 1.f )
   {
     mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON );