(Animatable property) default value setting and uniform mapping
[platform/core/uifw/dali-core.git] / dali / internal / event / common / type-registry-impl.cpp
index a2bad79..c487ac3 100644 (file)
@@ -1,26 +1,23 @@
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
+/*
+ * Copyright (c) 2015 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
 
 // CLASS HEADER
 #include <dali/internal/event/common/type-registry-impl.h>
 
-// EXTERNAL INCLUDES
-#include <string.h>
-#include <sstream>
-
 // INTERNAL INCLUDES
 #include <dali/internal/event/common/thread-local-storage.h>
 #include <dali/public-api/object/type-registry.h>
@@ -102,18 +99,27 @@ Dali::TypeInfo TypeRegistry::GetTypeInfo( const std::type_info& registerType )
   return ret;
 }
 
-Dali::TypeRegistry::NameContainer TypeRegistry::GetTypeNames() const
+size_t TypeRegistry::GetTypeNameCount() const
 {
-  Dali::TypeRegistry::NameContainer ret;
+  return mRegistryLut.size();
+}
 
-  for(RegistryMap::const_iterator iter = mRegistryLut.begin(); iter != mRegistryLut.end(); ++iter)
+
+std::string TypeRegistry::GetTypeName(size_t index) const
+{
+  std::string name;
+
+  if( index < mRegistryLut.size() )
   {
-    ret.push_back(iter->first);
+    RegistryMap::const_iterator iter = mRegistryLut.begin();
+    std::advance(iter, index);
+    name = iter->first;
   }
 
-  return ret;
+  return name;
 }
 
+
 bool TypeRegistry::Register( const std::type_info& theTypeInfo, const std::type_info& baseTypeInfo,
                              Dali::TypeInfo::CreateFunction createInstance, bool callCreateOnInit )
 {
@@ -164,7 +170,7 @@ std::string TypeRegistry::RegistrationName( const std::type_info& registerType )
   return DemangleClassName( registerType.name() );
 }
 
-void TypeRegistry::RegisterSignal( TypeRegistration& typeRegistration, const std::string& name, Dali::TypeInfo::SignalConnectorFunctionV2 func )
+void TypeRegistry::RegisterSignal( TypeRegistration& typeRegistration, const std::string& name, Dali::TypeInfo::SignalConnectorFunction func )
 {
   RegistryMap::iterator iter = mRegistryLut.find( typeRegistration.RegisteredName() );
 
@@ -210,7 +216,55 @@ bool TypeRegistry::RegisterProperty( TypeRegistration& registered, const std::st
   return false;
 }
 
-bool TypeRegistry::DoActionTo( BaseObject * const object, const std::string &actionName, const std::vector<Property::Value> &properties)
+bool TypeRegistry::RegisterAnimatableProperty( TypeRegistration& registered, const std::string& name, Property::Index index, Property::Type type )
+{
+  RegistryMap::iterator iter = mRegistryLut.find( registered.RegisteredName() );
+
+  if( iter != mRegistryLut.end() )
+  {
+    DALI_ASSERT_DEBUG(iter->second);
+
+    GetImplementation(iter->second).AddAnimatableProperty( name, index, type );
+
+    return true;
+  }
+
+  return false;
+}
+
+bool TypeRegistry::RegisterAnimatableProperty( TypeRegistration& registered, const std::string& name, Property::Index index, const Property::Value& value )
+{
+  RegistryMap::iterator iter = mRegistryLut.find( registered.RegisteredName() );
+
+  if( iter != mRegistryLut.end() )
+  {
+    DALI_ASSERT_DEBUG(iter->second);
+
+    GetImplementation(iter->second).AddAnimatableProperty( name, index, value );
+
+    return true;
+  }
+
+  return false;
+}
+
+bool TypeRegistry::RegisterAnimatablePropertyComponent( TypeRegistration& registered, const std::string& name, Property::Index index, Property::Index baseIndex, unsigned int componentIndex )
+{
+  RegistryMap::iterator iter = mRegistryLut.find( registered.RegisteredName() );
+
+  if( iter != mRegistryLut.end() )
+  {
+    DALI_ASSERT_DEBUG(iter->second);
+
+    GetImplementation(iter->second).AddAnimatablePropertyComponent( name, index, baseIndex, componentIndex );
+
+    return true;
+  }
+
+  return false;
+}
+
+bool TypeRegistry::DoActionTo( BaseObject * const object, const std::string &actionName, const Property::Map &properties)
 {
   bool done = false;
 
@@ -263,7 +317,8 @@ Dali::TypeInfo TypeRegistry::GetTypeInfo(const Dali::BaseObject * const pBaseObj
 
   if(pCustom)
   {
-    type = GetTypeInfo( typeid( pCustom->GetImplementation() ) );
+    const Dali::CustomActorImpl& custom = pCustom->GetImplementation();
+    type = GetTypeInfo( typeid( custom ) );
   }
   else
   {