Added int keys to animatable visual properties.
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / visuals / border / border-visual.cpp
index 3cb1688..cc00fc7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 // EXTERNAL INCLUDES
 #include <dali/integration-api/debug.h>
 
-//INTERNAL INCLUDES
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/visuals/border-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>
-#include <dali-toolkit/internal/visuals/visual-data-impl.h>
+#include <dali-toolkit/internal/visuals/visual-base-data-impl.h>
 
 namespace Dali
 {
@@ -102,7 +103,7 @@ const char* FRAGMENT_SHADER_ANTI_ALIASING = DALI_COMPOSE_SHADER(
 }
 
 BorderVisual::BorderVisual( VisualFactoryCache& factoryCache )
-: Visual( factoryCache ),
+: Visual::Base( factoryCache ),
   mBorderColor( Color::TRANSPARENT ),
   mBorderSize( 0.f ),
   mBorderColorIndex( Property::INVALID_INDEX ),
@@ -117,19 +118,19 @@ BorderVisual::~BorderVisual()
 
 void BorderVisual::DoInitialize( Actor& actor, const Property::Map& propertyMap )
 {
-  Property::Value* color = propertyMap.Find( COLOR_NAME );
+  Property::Value* color = propertyMap.Find( Toolkit::BorderVisual::Property::COLOR, COLOR_NAME );
   if( !( color && color->Get(mBorderColor) ) )
   {
-    DALI_LOG_ERROR( "Fail to provide a border color to the BorderVisual object" );
+    DALI_LOG_ERROR( "Fail to provide a border color to the BorderVisual object\n" );
   }
 
-  Property::Value* size = propertyMap.Find( SIZE_NAME );
+  Property::Value* size = propertyMap.Find( Toolkit::BorderVisual::Property::SIZE, SIZE_NAME );
   if( !( size && size->Get(mBorderSize) ) )
   {
-    DALI_LOG_ERROR( "Fail to provide a border size to the BorderVisual object" );
+    DALI_LOG_ERROR( "Fail to provide a border size to the BorderVisual object\n" );
   }
 
-  Property::Value* antiAliasing = propertyMap.Find( ANTI_ALIASING );
+  Property::Value* antiAliasing = propertyMap.Find( Toolkit::BorderVisual::Property::ANTI_ALIASING, ANTI_ALIASING );
   if( antiAliasing )
   {
     antiAliasing->Get( mAntiAliasing );
@@ -138,7 +139,7 @@ void BorderVisual::DoInitialize( Actor& actor, const Property::Map& propertyMap
 
 void BorderVisual::SetClipRect( const Rect<int>& clipRect )
 {
-  Visual::SetClipRect( clipRect );
+  Visual::Base::SetClipRect( clipRect );
 
   //ToDo: renderer responds to the clipRect change
 }
@@ -147,20 +148,21 @@ void BorderVisual::DoSetOnStage( Actor& actor )
 {
   InitializeRenderer();
 
-  mBorderColorIndex = (mImpl->mRenderer).RegisterProperty( COLOR_NAME, mBorderColor );
+  mBorderColorIndex = (mImpl->mRenderer).RegisterProperty( Toolkit::BorderVisual::Property::COLOR, COLOR_NAME, mBorderColor );
   if( mBorderColor.a < 1.f || mAntiAliasing)
   {
     mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON );
   }
-  mBorderSizeIndex = (mImpl->mRenderer).RegisterProperty( SIZE_NAME, mBorderSize );
+  mBorderSizeIndex = (mImpl->mRenderer).RegisterProperty( Toolkit::BorderVisual::Property::SIZE, SIZE_NAME, mBorderSize );
 }
 
 void BorderVisual::DoCreatePropertyMap( Property::Map& map ) const
 {
   map.Clear();
-  map.Insert( RENDERER_TYPE, BORDER_RENDERER );
-  map.Insert( COLOR_NAME, mBorderColor );
-  map.Insert( SIZE_NAME, mBorderSize );
+  map.Insert( Toolkit::Visual::Property::TYPE, Toolkit::Visual::BORDER );
+  map.Insert( Toolkit::BorderVisual::Property::COLOR, mBorderColor );
+  map.Insert( Toolkit::BorderVisual::Property::SIZE, mBorderSize );
+  map.Insert( Toolkit::BorderVisual::Property::ANTI_ALIASING, mAntiAliasing );
 }
 
 void BorderVisual::InitializeRenderer()
@@ -301,7 +303,7 @@ Geometry BorderVisual::CreateBorderGeometry()
   Geometry geometry = Geometry::New();
   geometry.AddVertexBuffer( borderVertices );
   geometry.SetIndexBuffer( indexData, sizeof(indexData)/sizeof(indexData[0]) );
-  geometry.SetGeometryType( Geometry::TRIANGLE_STRIP );
+  geometry.SetType( Geometry::TRIANGLE_STRIP );
 
   return geometry;
 }