[dali_1.1.35] Merge branch 'devel/master'
[platform/core/uifw/dali-core.git] / dali / internal / event / common / type-info-impl.h
index b6545a0..f397736 100644 (file)
@@ -2,7 +2,7 @@
 #define __DALI_INTERNAL_TYPE_INFO_H__
 
 /*
- * Copyright (c) 2014 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.
@@ -76,19 +76,34 @@ public:
   Dali::TypeInfo::CreateFunction GetCreator() const;
 
   /**
-   * @copydoc Dali::TypeInfo::GetActions
+   * @copydoc Dali::TypeInfo::GetActionCount
    */
-  void GetActions( Dali::TypeInfo::NameContainer& container ) const;
+  size_t GetActionCount() const;
 
   /**
-   * @copydoc Dali::TypeInfo::GetSignals
+   * @copydoc Dali::TypeInfo::GetActionName
    */
-  void GetSignals( Dali::TypeInfo::NameContainer& container) const;
+  std::string GetActionName(size_t index) const;
 
   /**
-   * @copydoc Dali::TypeInfo::GetProperties
+   * @copydoc Dali::TypeInfo::GetSignalCount
    */
-  void GetProperties( Dali::TypeInfo::NameContainer& container) const;
+  size_t GetSignalCount() const;
+
+  /**
+   * @copydoc Dali::TypeInfo::GetSignalName
+   */
+  std::string GetSignalName(size_t index) const;
+
+  /**
+   * @copydoc Dali::TypeInfo::GetPropertyCount
+   */
+  size_t GetPropertyCount() const;
+
+  /**
+   * @copydoc Dali::TypeInfo::GetPropertyName
+   */
+  std::string GetPropertyName(size_t index) const;
 
   /**
    * Adds the property indices to the container specified.
@@ -132,13 +147,39 @@ public:
   void AddAnimatableProperty( const std::string& name, Property::Index index, Property::Type type );
 
   /**
+   * Adds an animatable property with the given default value.
+   * @param[in] name The name of the property.
+   * @param[in] index The index of the property
+   * @param[in] type The Property::Type.
+   */
+  void AddAnimatableProperty( const std::string& name, Property::Index index, const Property::Value& defaultValue );
+
+  /**
+   * Adds a component of an animatable property to the type.
+   * The animatable property must have been type-registered and must be a Vector2, Vector3 or Vector4 type.
+   * @param[in] name The name of the component.
+   * @param[in] index The index of the property
+   * @param[in] baseIndex The index of the base animatable property
+   * @param[in] component The index The index of the component.
+   */
+  void AddAnimatablePropertyComponent( const std::string& name, Property::Index index, Property::Index baseIndex, unsigned int componentIndex );
+
+  /**
+   * Adds a child property to the type.
+   * @param[in] name The name of the property.
+   * @param[in] index The index of the property
+   * @param[in] type The Property::Type.
+   */
+  void AddChildProperty( const std::string& name, Property::Index index, Property::Type type );
+
+  /**
    * Do an action on base object
    * @param [in] object The base object to act upon
    * @param [in] actionName The name of the desired action
    * @param [in] properties The arguments of the action
    * @return bool If the action could be executed
    */
-  bool DoActionTo(BaseObject *object, const std::string &actionName, const std::vector<Property::Value> &properties);
+  bool DoActionTo(BaseObject *object, const std::string &actionName, const Property::Map &properties);
 
   /**
    * Connects a callback function with the object's signals.
@@ -152,12 +193,6 @@ public:
   bool ConnectSignal( BaseObject* object, ConnectionTrackerInterface* connectionTracker, const std::string& signalName, FunctorDelegate* functor );
 
   /**
-   * Retrieve the property count for this type.
-   * @return The total number of properties.
-   */
-  unsigned int GetPropertyCount() const;
-
-  /**
    * Given a property name, retrieve the index.
    * @param[in] name The name of the property.
    * @return The index associated with that name.
@@ -165,6 +200,20 @@ public:
   Property::Index GetPropertyIndex( const std::string& name ) const;
 
   /**
+   * Given a property index, retrieve the index of its base property.
+   * @param[in] index The index of the property.
+   * @return The index of the base property associated with the given property index.
+   */
+  Property::Index GetBasePropertyIndex( Property::Index index ) const;
+
+  /**
+   * Given a property index, retrieve its component index.
+   * @param[in] index The index of the property.
+   * @return The component index associated with that property index.
+   */
+  int GetComponentIndex( Property::Index index ) const;
+
+  /**
    * Checks if there is a setter for the property. If there is then it is writable.
    * @param[in] index The property index.
    * @return True, if writable, false otherwise.
@@ -179,6 +228,34 @@ public:
   Property::Type GetPropertyType( Property::Index index ) const;
 
   /**
+   * Given a child property name, retrieve the index.
+   * @param[in] name The name of the child property.
+   * @return The index associated with that name.
+   */
+  Property::Index GetChildPropertyIndex( const std::string& name ) const;
+
+  /**
+   * Retrieve the name of the child property at the given index.
+   * @param[in] index The property index.
+   * @return The name of the child property.
+   */
+  const std::string& GetChildPropertyName( Property::Index index ) const;
+
+  /**
+   * Retrieve the Property::Type of the child property at the given index.
+   * @param[in] index The property index.
+   * @return The Property::Type at that index.
+   */
+  Property::Type GetChildPropertyType( Property::Index index ) const;
+
+  /**
+   * Retrieve the default value of the property at the given index.
+   * @param[in] index The property index.
+   * @return The default property value at that index.
+   */
+  Property::Value GetPropertyDefaultValue( Property::Index index ) const;
+
+  /**
    * Sets the value of a property at the index specified for the given object.
    * @param[in] object The object whose property is to be set.
    * @param[in] index The property index.
@@ -218,15 +295,19 @@ private:
     : type( Property::NONE ),
       setFunc( NULL ),
       getFunc( NULL ),
-      name()
+      name(),
+      basePropertyIndex(Property::INVALID_INDEX),
+      componentIndex(Property::INVALID_COMPONENT_INDEX)
     {
     }
 
-    RegisteredProperty( Property::Type propType, Dali::TypeInfo::SetPropertyFunction set, Dali::TypeInfo::GetPropertyFunction get, const std::string& propName )
+    RegisteredProperty( Property::Type propType, Dali::TypeInfo::SetPropertyFunction set, Dali::TypeInfo::GetPropertyFunction get, const std::string& propName, Property::Index basePropertyIndex, int componentIndex )
     : type( propType ),
       setFunc( set ),
       getFunc( get ),
-      name( propName )
+      name( propName ),
+      basePropertyIndex(basePropertyIndex),
+      componentIndex(componentIndex)
     {
     }
 
@@ -234,15 +315,19 @@ private:
     Dali::TypeInfo::SetPropertyFunction setFunc;
     Dali::TypeInfo::GetPropertyFunction getFunc;
     std::string name;
+    Property::Index basePropertyIndex;
+    int componentIndex;
   };
 
   typedef std::pair<std::string, Dali::TypeInfo::SignalConnectorFunction > ConnectionPair;
   typedef std::pair<std::string, Dali::TypeInfo::ActionFunction > ActionPair;
   typedef std::pair<Property::Index, RegisteredProperty> RegisteredPropertyPair;
+  typedef std::pair<Property::Index, Property::Value> PropertyDefaultValuePair;
 
   typedef std::vector< ActionPair > ActionContainer;
   typedef std::vector< ConnectionPair > ConnectorContainer;
   typedef std::vector< RegisteredPropertyPair > RegisteredPropertyContainer;
+  typedef std::vector< PropertyDefaultValuePair > PropertyDefaultValueContainer;
 
   std::string mTypeName;
   std::string mBaseTypeName;
@@ -250,6 +335,8 @@ private:
   ActionContainer mActions;
   ConnectorContainer mSignalConnectors;
   RegisteredPropertyContainer mRegisteredProperties;
+  RegisteredPropertyContainer mRegisteredChildProperties;
+  PropertyDefaultValueContainer mPropertyDefaultValues;
 };
 
 } // namespace Internal