Merge "TextController refactor." into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / visuals / color / color-visual.cpp
index 17cf68a..a1ef6d2 100644 (file)
@@ -91,28 +91,39 @@ void ColorVisual::SetSize( const Vector2& size )
   // ToDo: renderer responds to the size change
 }
 
-void ColorVisual::SetClipRect( const Rect<int>& clipRect )
+void ColorVisual::DoSetOnStage( Actor& actor )
 {
-  Visual::Base::SetClipRect( clipRect );
+  InitializeRenderer();
 
-  //ToDo: renderer responds to the clipRect change
+  actor.AddRenderer( mImpl->mRenderer );
 }
 
-void ColorVisual::SetOffset( const Vector2& offset )
+void ColorVisual::DoCreatePropertyMap( Property::Map& map ) const
 {
-  //ToDo: renderer applies the offset
+  map.Clear();
+  map.Insert( Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR );
+  map.Insert( Toolkit::ColorVisual::Property::MIX_COLOR, mMixColor );
 }
 
-void ColorVisual::DoSetOnStage( Actor& actor )
+void ColorVisual::DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue )
 {
-  InitializeRenderer();
+  // 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.
+  */
 }
 
-void ColorVisual::DoCreatePropertyMap( Property::Map& map ) const
+Dali::Property::Value ColorVisual::DoGetProperty( Dali::Property::Index index )
 {
-  map.Clear();
-  map.Insert( Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR );
-  map.Insert( Toolkit::ColorVisual::Property::MIX_COLOR, mMixColor );
+  // TODO
+  return Dali::Property::Value();
 }
 
 void ColorVisual::InitializeRenderer()
@@ -133,7 +144,7 @@ void ColorVisual::InitializeRenderer()
 
   mImpl->mRenderer = Renderer::New( geometry, shader );
 
-  mMixColorIndex = mImpl->mRenderer.RegisterProperty( COLOR_NAME, mMixColor );
+  mMixColorIndex = mImpl->mRenderer.RegisterProperty( Toolkit::ColorVisual::Property::MIX_COLOR, COLOR_NAME, mMixColor );
   if( mMixColor.a < 1.f )
   {
     mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON );