Added code for stylable transitions
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / visuals / npatch / npatch-visual.cpp
index 893841a..77d522e 100644 (file)
@@ -25,6 +25,7 @@
 #include <dali/devel-api/images/texture-set-image.h>
 
 // INTERNAL IINCLUDES
+#include <dali-toolkit/public-api/visuals/image-visual-properties.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>
@@ -211,11 +212,11 @@ NPatchVisual::~NPatchVisual()
 
 void NPatchVisual::DoInitialize( Actor& actor, const Property::Map& propertyMap )
 {
-  Property::Value* imageURLValue = propertyMap.Find( IMAGE_URL_NAME );
+  Property::Value* imageURLValue = propertyMap.Find( Toolkit::ImageVisual::Property::URL, IMAGE_URL_NAME );
   if( imageURLValue )
   {
     //Read the borderOnly property first since InitialiseFromImage relies on mBorderOnly to be properly set
-    Property::Value* borderOnlyValue = propertyMap.Find( BORDER_ONLY );
+    Property::Value* borderOnlyValue = propertyMap.Find( Toolkit::ImageVisual::Property::BORDER_ONLY, BORDER_ONLY );
     if( borderOnlyValue )
     {
       borderOnlyValue->Get( mBorderOnly );
@@ -253,17 +254,6 @@ void NPatchVisual::GetNaturalSize( Vector2& naturalSize ) const
   }
 }
 
-void NPatchVisual::SetClipRect( const Rect<int>& clipRect )
-{
-  Visual::Base::SetClipRect( clipRect );
-  //ToDo: renderer responds to the clipRect change
-}
-
-void NPatchVisual::SetOffset( const Vector2& offset )
-{
-  //ToDo: renderer applies the offset
-}
-
 Geometry NPatchVisual::CreateGeometry()
 {
   Geometry geometry;
@@ -389,6 +379,8 @@ void NPatchVisual::DoSetOnStage( Actor& actor )
   {
     ApplyImageToSampler();
   }
+
+  actor.AddRenderer( mImpl->mRenderer );
 }
 
 void NPatchVisual::DoSetOffStage( Actor& actor )
@@ -401,16 +393,27 @@ void NPatchVisual::DoSetOffStage( Actor& actor )
 void NPatchVisual::DoCreatePropertyMap( Property::Map& map ) const
 {
   map.Clear();
-  map.Insert( RENDERER_TYPE, IMAGE_RENDERER );
+  map.Insert( Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE );
   if( !mImageUrl.empty() )
   {
-    map.Insert( IMAGE_URL_NAME, mImageUrl );
+    map.Insert( Toolkit::ImageVisual::Property::URL, mImageUrl );
   }
   else if( mImage )
   {
-    map.Insert( IMAGE_URL_NAME, mImage.GetUrl() );
+    map.Insert( Toolkit::ImageVisual::Property::URL, mImage.GetUrl() );
   }
-  map.Insert( BORDER_ONLY, mBorderOnly );
+  map.Insert( Toolkit::ImageVisual::Property::BORDER_ONLY, mBorderOnly );
+}
+
+void NPatchVisual::DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue )
+{
+  // TODO
+}
+
+Dali::Property::Value NPatchVisual::DoGetProperty( Dali::Property::Index index )
+{
+  // TODO
+  return Dali::Property::Value();
 }
 
 void NPatchVisual::ChangeRenderer( bool oldBorderOnly, size_t oldGridX, size_t oldGridY )
@@ -521,7 +524,7 @@ void NPatchVisual::InitializeFromImage( NinePatchImage nPatch )
 
 void NPatchVisual::InitializeFromBrokenImage()
 {
-  mCroppedImage = VisualFactory::GetBrokenRendererImage();
+  mCroppedImage = VisualFactoryCache::GetBrokenVisualImage();
   mImageSize = ImageDimensions( mCroppedImage.GetWidth(), mCroppedImage.GetHeight() );
 
   mStretchPixelsX.Clear();