Added mechanism for registering child properties on arbitrary actor 62/173462/3
authorDavid Steele <david.steele@samsung.com>
Wed, 14 Mar 2018 16:48:37 +0000 (16:48 +0000)
committerDavid Steele <david.steele@samsung.com>
Thu, 5 Apr 2018 17:31:48 +0000 (18:31 +0100)
Want to register child properties for a container view from a second
class, e.g. a layout. This adds mechanism to register properties on
a registered type by type name.

Added a signal which triggers when a property is set on an object
(Note, OnPropertySet is available for derived types, but not for arbitrary objects)

Change-Id: Icf5c9856c66e1beadf80e55bc31ca9c1130f4a60
Signed-off-by: David Steele <david.steele@samsung.com>
13 files changed:
automated-tests/src/dali/utc-Dali-Handle.cpp
automated-tests/src/dali/utc-Dali-TypeRegistry.cpp
dali/devel-api/object/handle-devel.cpp
dali/devel-api/object/handle-devel.h
dali/internal/event/common/object-impl.cpp
dali/internal/event/common/object-impl.h
dali/internal/event/common/type-registry-impl.cpp
dali/internal/event/common/type-registry-impl.h
dali/public-api/object/handle.h
dali/public-api/object/type-info.cpp
dali/public-api/object/type-info.h
dali/public-api/object/type-registry.cpp
dali/public-api/object/type-registry.h

index 19e04f6..71b431f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
@@ -22,6 +22,8 @@
 #include <dali/devel-api/actors/actor-devel.h>
 #include <dali/devel-api/object/handle-devel.h>
 #include "dali-test-suite-utils/dali-test-suite-utils.h"
+#include "dali-test-suite-utils/test-custom-actor.h"
+
 #include <mesh-builder.h>
 
 using namespace Dali;
@@ -1036,3 +1038,229 @@ int UtcDaliHandleGetCurrentProperty(void)
 
   END_TEST;
 }
+
+int UtcDaliHandleDoesCustomPropertyExistP1(void)
+{
+  TestApplication application; // Needs type registry
+
+  tet_infoline( "Test if a registered custom property exists on object" );
+
+  Actor actor = Actor::New();
+  auto propertyIndex = actor.RegisterProperty("customProperty1", 1.0f);
+
+  DALI_TEST_EQUALS( DevelHandle::DoesCustomPropertyExist( actor, propertyIndex ), true, TEST_LOCATION );
+  END_TEST;
+}
+
+int UtcDaliHandleDoesCustomPropertyExistN1(void)
+{
+  TestApplication application; // Needs type registry
+
+  tet_infoline( "Test if a registered custom property does not exist on object" );
+
+  Actor actor = Actor::New();
+  auto propertyIndex = actor.RegisterProperty("customProperty1", 1.0f);
+
+  DALI_TEST_EQUALS( DevelHandle::DoesCustomPropertyExist( actor, propertyIndex+1 ), false, TEST_LOCATION );
+  END_TEST;
+}
+
+int UtcDaliHandleDoesCustomPropertyExistN2(void)
+{
+  TestApplication application; // Needs type registry
+
+  tet_infoline( "Test that a default property does not show as a custom property on object" );
+
+  Actor actor = Actor::New();
+  DALI_TEST_EQUALS( DevelHandle::DoesCustomPropertyExist( actor, Actor::Property::POSITION ), false, TEST_LOCATION );
+  END_TEST;
+}
+
+int UtcDaliHandleDoesCustomPropertyExistN3(void)
+{
+  TestApplication application; // Needs type registry
+
+  tet_infoline( "Test that a child property does not exist on actor after parenting to container" );
+  TypeRegistry typeRegistry = TypeRegistry::Get();
+
+  auto customActorTypeInfo = typeRegistry.GetTypeInfo( typeid(Test::TestCustomActor) );
+
+  const Property::Index CHILD_PROPERTY( CHILD_PROPERTY_REGISTRATION_START_INDEX );
+  const char* CHILD_PROPERTY_NAME( "childProperty" );
+
+  ChildPropertyRegistration( customActorTypeInfo.GetName(), CHILD_PROPERTY_NAME, CHILD_PROPERTY, Property::INTEGER );
+
+  auto container = Test::TestCustomActor::New();
+  Stage::GetCurrent().Add( container );
+  auto child = Actor::New();
+  container.Add( child ); // Resolve child properties (if any)
+
+  DALI_TEST_EQUALS( DevelHandle::DoesCustomPropertyExist( child, CHILD_PROPERTY ), false, TEST_LOCATION );
+  END_TEST;
+}
+
+int UtcDaliHandleDoesCustomPropertyExistP2(void)
+{
+  TestApplication application; // Needs type registry
+
+  tet_infoline( "Test that a child property exists after being set" );
+  TypeRegistry typeRegistry = TypeRegistry::Get();
+
+  auto customActorTypeInfo = typeRegistry.GetTypeInfo( typeid(Test::TestCustomActor) );
+
+  const Property::Index CHILD_PROPERTY( CHILD_PROPERTY_REGISTRATION_START_INDEX );
+  const char* CHILD_PROPERTY_NAME( "childProperty" );
+
+  ChildPropertyRegistration( customActorTypeInfo.GetName(), CHILD_PROPERTY_NAME, CHILD_PROPERTY, Property::INTEGER );
+
+  auto container = Test::TestCustomActor::New();
+  Stage::GetCurrent().Add( container );
+  auto child = Actor::New();
+  container.Add( child ); // Resolve child properties (if any)
+  child.SetProperty( CHILD_PROPERTY, 2 );
+
+  DALI_TEST_EQUALS( DevelHandle::DoesCustomPropertyExist( child, CHILD_PROPERTY ), true, TEST_LOCATION );
+  DALI_TEST_EQUALS( child.GetProperty<int>( CHILD_PROPERTY ), 2, TEST_LOCATION );
+  END_TEST;
+}
+
+int UtcDaliHandleDoesCustomPropertyExistP3(void)
+{
+  TestApplication application; // Needs type registry
+
+  tet_infoline( "Test that a child property is re-indexed after registration, and that it exists" );
+  TypeRegistry typeRegistry = TypeRegistry::Get();
+
+  auto customActorTypeInfo = typeRegistry.GetTypeInfo( typeid(Test::TestCustomActor) );
+
+  const Property::Index CHILD_PROPERTY( CHILD_PROPERTY_REGISTRATION_START_INDEX );
+  const char* CHILD_PROPERTY_NAME( "childProperty" );
+
+  ChildPropertyRegistration( customActorTypeInfo.GetName(), CHILD_PROPERTY_NAME, CHILD_PROPERTY, Property::INTEGER );
+
+  auto container = Test::TestCustomActor::New();
+  Stage::GetCurrent().Add( container );
+  auto child = Actor::New();
+  child.RegisterProperty( CHILD_PROPERTY_NAME, Property::Value(3) );
+  container.Add( child ); // Resolve child properties (if any)
+
+  DALI_TEST_EQUALS( DevelHandle::DoesCustomPropertyExist( child, CHILD_PROPERTY ), true, TEST_LOCATION );
+  DALI_TEST_EQUALS( child.GetProperty<int>( CHILD_PROPERTY ), 3, TEST_LOCATION );
+  END_TEST;
+}
+
+namespace
+{
+
+struct PropertySetSignalCheck
+{
+  PropertySetSignalCheck(bool& signalReceived, Property::Value& value)
+  : mSignalReceived(signalReceived),
+    mValue(value)
+  {
+  }
+
+  void operator()(Handle& handle, Property::Index index, Property::Value value)
+  {
+    mSignalReceived = true;
+    mValue = value;
+  }
+
+  void Reset()
+  {
+    mSignalReceived = false;
+  }
+
+  void CheckSignalReceived()
+  {
+    if (!mSignalReceived)
+    {
+      tet_printf("Expected Property Set signal was not received\n");
+      tet_result(TET_FAIL);
+    }
+    else
+    {
+      tet_result(TET_PASS);
+    }
+  }
+
+  bool& mSignalReceived; // owned by individual tests
+  Property::Value& mValue;
+};
+
+} // anon namespace
+
+int UtcDaliHandlePropertySetSignal01(void)
+{
+  TestApplication app;
+
+  bool signalReceived(false);
+  Property::Value value;
+  PropertySetSignalCheck propertySetCheck(signalReceived, value);
+
+  tet_infoline( "Test that setting a default property triggers a signal" );
+
+  auto actor = Actor::New();
+  DevelHandle::PropertySetSignal(actor).Connect(&app, propertySetCheck);
+
+  actor.SetProperty( Actor::Property::POSITION, Vector3::XAXIS );
+  propertySetCheck.CheckSignalReceived();
+
+  END_TEST;
+}
+
+
+int UtcDaliHandlePropertySetSignal02(void)
+{
+  TestApplication app;
+
+  bool signalReceived(false);
+  Property::Value value;
+  PropertySetSignalCheck propertySetCheck(signalReceived, value);
+
+  tet_infoline( "Test that setting a custom property triggers a signal" );
+
+  auto actor = Actor::New();
+  DevelHandle::PropertySetSignal(actor).Connect(&app, propertySetCheck);
+
+  auto propertyIndex = actor.RegisterProperty("propName", 3.0f);
+  actor.SetProperty( propertyIndex, 5.0f );
+  propertySetCheck.CheckSignalReceived();
+  DALI_TEST_EQUALS( propertySetCheck.mValue, Property::Value( 5.0f ), 0.001f, TEST_LOCATION );
+
+  END_TEST;
+}
+
+int UtcDaliHandlePropertySetSignal03(void)
+{
+  TestApplication app;
+  TypeRegistry typeRegistry = TypeRegistry::Get();
+
+  bool signalReceived(false);
+  Property::Value value;
+  PropertySetSignalCheck propertySetCheck(signalReceived, value);
+
+  tet_infoline( "Test that setting a child property triggers a signal" );
+
+  auto customActorTypeInfo = typeRegistry.GetTypeInfo( typeid(Test::TestCustomActor) );
+
+  const Property::Index CHILD_PROPERTY( CHILD_PROPERTY_REGISTRATION_START_INDEX );
+  const char* CHILD_PROPERTY_NAME( "childProperty" );
+
+  ChildPropertyRegistration( customActorTypeInfo.GetName(), CHILD_PROPERTY_NAME, CHILD_PROPERTY, Property::INTEGER );
+
+  auto container = Test::TestCustomActor::New();
+  Stage::GetCurrent().Add( container );
+  auto child = Actor::New();
+  child.RegisterProperty( CHILD_PROPERTY_NAME, Property::Value(3) );
+  DevelHandle::PropertySetSignal(child).Connect(&app, propertySetCheck);
+  container.Add( child ); // Resolve child properties (if any)
+
+  DALI_TEST_EQUALS( DevelHandle::DoesCustomPropertyExist( child, CHILD_PROPERTY ), true, TEST_LOCATION );
+  DALI_TEST_EQUALS( child.GetProperty<int>( CHILD_PROPERTY ), 3, TEST_LOCATION );
+
+  child.SetProperty( CHILD_PROPERTY, 29 );
+  propertySetCheck.CheckSignalReceived();
+  DALI_TEST_EQUALS( propertySetCheck.mValue, Property::Value( 29 ), TEST_LOCATION );
+  END_TEST;
+}
index feabd0e..7da76eb 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
@@ -2778,3 +2778,103 @@ int UtcDaliPropertyRegistrationPropertyAnimatableSynchronousSetGetWithComponents
 
   END_TEST;
 }
+
+
+int UtcDaliTypeInfoRegisterChildProperties01(void)
+{
+  TestApplication application;
+  TypeRegistry typeRegistry = TypeRegistry::Get();
+
+  tet_infoline( "Register child properties on a type via name" );
+
+  auto customActorTypeInfo = typeRegistry.GetTypeInfo( typeid(CustomActor) );
+  auto myCustomTypeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
+  DALI_TEST_CHECK( customActorTypeInfo );
+  DALI_TEST_CHECK( myCustomTypeInfo );
+
+  const Property::Index WIDTH_SPECIFICATION( CHILD_PROPERTY_REGISTRATION_START_INDEX );
+  const Property::Index HEIGHT_SPECIFICATION( CHILD_PROPERTY_REGISTRATION_START_INDEX + 1);
+  const Property::Index MARGIN_SPECIFICATION( CHILD_PROPERTY_REGISTRATION_START_INDEX + 100);
+
+  ChildPropertyRegistration( customActorTypeInfo.GetName(), "widthSpecification", WIDTH_SPECIFICATION, Property::INTEGER );
+  ChildPropertyRegistration( customActorTypeInfo.GetName(), "heightSpecification", HEIGHT_SPECIFICATION, Property::INTEGER );
+  ChildPropertyRegistration( myCustomTypeInfo.GetName(), "marginSpecification", MARGIN_SPECIFICATION, Property::EXTENTS );
+
+  auto customActor = MyTestCustomActor::New();
+  Stage::GetCurrent().Add( customActor );
+  auto child = Actor::New();
+  customActor.Add( child );
+
+  child.SetProperty( WIDTH_SPECIFICATION, 33 );
+
+  auto value = child.GetProperty( WIDTH_SPECIFICATION );
+  DALI_TEST_EQUALS( value, Property::Value(33), TEST_LOCATION );
+
+  child.SetProperty( HEIGHT_SPECIFICATION, 44 );
+  value = child.GetProperty( HEIGHT_SPECIFICATION );
+  DALI_TEST_EQUALS( value, Property::Value(44), TEST_LOCATION );
+
+  child.SetProperty( MARGIN_SPECIFICATION, Extents(10, 10, 10, 10) );
+  value = child.GetProperty( MARGIN_SPECIFICATION );
+  DALI_TEST_EQUALS( value, Property::Value(Extents(10,10,10,10)), TEST_LOCATION );
+
+  END_TEST;
+}
+
+
+int UtcDaliTypeInfoRegisterChildProperties02(void)
+{
+  TestApplication application;
+  TypeRegistry typeRegistry = TypeRegistry::Get();
+
+  tet_infoline( "Register child properties on a type via name" );
+
+  auto customActorTypeInfo = typeRegistry.GetTypeInfo( typeid(CustomActor) );
+  auto myCustomTypeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
+  DALI_TEST_CHECK( customActorTypeInfo );
+  DALI_TEST_CHECK( myCustomTypeInfo );
+
+  const Property::Index WIDTH_SPECIFICATION( CHILD_PROPERTY_REGISTRATION_START_INDEX );
+  const Property::Index HEIGHT_SPECIFICATION( CHILD_PROPERTY_REGISTRATION_START_INDEX + 1);
+  const Property::Index MARGIN_SPECIFICATION( CHILD_PROPERTY_REGISTRATION_START_INDEX + 100);
+
+  ChildPropertyRegistration( customActorTypeInfo.GetName(), "widthSpecification", WIDTH_SPECIFICATION, Property::INTEGER );
+  ChildPropertyRegistration( customActorTypeInfo.GetName(), "heightSpecification", HEIGHT_SPECIFICATION, Property::INTEGER );
+  ChildPropertyRegistration( myCustomTypeInfo.GetName(), "marginSpecification", MARGIN_SPECIFICATION, Property::EXTENTS );
+
+
+  auto index = customActorTypeInfo.GetChildPropertyIndex( "widthSpecification" );
+  DALI_TEST_EQUALS( index, WIDTH_SPECIFICATION, TEST_LOCATION );
+
+  index = customActorTypeInfo.GetChildPropertyIndex( "heightSpecification" );
+  DALI_TEST_EQUALS( index, HEIGHT_SPECIFICATION, TEST_LOCATION );
+
+  index = customActorTypeInfo.GetChildPropertyIndex( "marginSpecification" );
+  DALI_TEST_EQUALS( index, Property::INVALID_INDEX, TEST_LOCATION );
+
+  index = myCustomTypeInfo.GetChildPropertyIndex( "marginSpecification" );
+  DALI_TEST_EQUALS( index, MARGIN_SPECIFICATION, TEST_LOCATION );
+
+
+  auto name = customActorTypeInfo.GetChildPropertyName( WIDTH_SPECIFICATION );
+  DALI_TEST_EQUALS( name, "widthSpecification", TEST_LOCATION );
+
+  name = customActorTypeInfo.GetChildPropertyName( HEIGHT_SPECIFICATION );
+  DALI_TEST_EQUALS( name, "heightSpecification", TEST_LOCATION );
+
+  name = myCustomTypeInfo.GetChildPropertyName( MARGIN_SPECIFICATION );
+  DALI_TEST_EQUALS( name, "marginSpecification", TEST_LOCATION );
+
+
+  auto type = customActorTypeInfo.GetChildPropertyType( WIDTH_SPECIFICATION );
+  DALI_TEST_EQUALS( type, Property::INTEGER, TEST_LOCATION );
+
+  type = customActorTypeInfo.GetChildPropertyType( HEIGHT_SPECIFICATION );
+  DALI_TEST_EQUALS( type, Property::INTEGER, TEST_LOCATION );
+
+  type = myCustomTypeInfo.GetChildPropertyType( MARGIN_SPECIFICATION );
+  DALI_TEST_EQUALS( type, Property::EXTENTS, TEST_LOCATION );
+
+
+  END_TEST;
+}
index 3097836..f5e8951 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
@@ -49,6 +49,16 @@ void SetTypeInfo( Handle& handle, const TypeInfo& typeInfo )
   GetImplementation( handle ).SetTypeInfo( &GetImplementation( typeInfo ) );
 }
 
+bool DoesCustomPropertyExist( Handle& handle, Property::Index index )
+{
+  return GetImplementation( handle ).DoesCustomPropertyExist( index );
+}
+
+PropertySetSignalType& PropertySetSignal( Handle handle )
+{
+  return GetImplementation( handle ).PropertySetSignal();
+}
+
 } // namespace DevelHandle
 
 } // namespace Dali
index cd06a82..caae1b8 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_HANDLE_DEVEL_H
 
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
@@ -108,6 +108,30 @@ DALI_IMPORT_API Property::Index RegisterProperty( Handle handle, Property::Index
  */
 DALI_IMPORT_API void SetTypeInfo( Handle& handle, const TypeInfo& typeInfo );
 
+
+/**
+ * @brief Determine if the custom property index exists on this object without throwing a Dali::Exception.
+ *
+ * @note This does not check default properties.
+ * @param[in] handle The handle to check
+ * @param[in] index The index of the property to test for
+ */
+DALI_IMPORT_API bool DoesCustomPropertyExist( Handle& handle, Property::Index index );
+
+/**
+ * @brief PropertySetSignal function prototype for signal handler. Called when a property is set on this object.
+ */
+using PropertySetSignalType = Signal< void( Handle& handle, Property::Index index, Property::Value value ) >;
+
+/**
+ * @brief Get a signal when a property is set on this object through the API (i.e. not when animating)
+ *
+ * @param[in] handle The handle of the object to listen to.
+ * @return The signal to attach a connection to.
+ */
+DALI_IMPORT_API PropertySetSignalType& PropertySetSignal( Handle handle );
+
+
 } // namespace DevelHandle
 
 } // namespace Dali
index 2396fd1..1663e61 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
@@ -23,6 +23,7 @@
 
 // INTERNAL INCLUDES
 #include <dali/integration-api/debug.h>
+#include <dali/devel-api/object/handle-devel.h>
 #include <dali/internal/update/animation/scene-graph-constraint-base.h>
 #include <dali/internal/update/common/animatable-property.h>
 #include <dali/internal/update/common/property-owner-messages.h>
@@ -423,6 +424,11 @@ Property::Type Object::GetPropertyType( Property::Index index ) const
   return Property::NONE;
 }
 
+DevelHandle::PropertySetSignalType& Object::PropertySetSignal()
+{
+  return mPropertySetSignal;
+}
+
 void Object::SetProperty( Property::Index index, const Property::Value& propertyValue )
 {
   DALI_ASSERT_ALWAYS(index > Property::INVALID_INDEX && "Property index is out of bounds" );
@@ -523,7 +529,9 @@ void Object::SetProperty( Property::Index index, const Property::Value& property
   // TODO: We should not call this for read-only properties, SetDefaultProperty() && TypeInfo::SetProperty() should return a bool, which would be true if the property is set
   if ( propertySet )
   {
-    OnPropertySet(index, propertyValue);
+    OnPropertySet( index, propertyValue );
+    Dali::Handle handle( this );
+    mPropertySetSignal.Emit( handle, index, propertyValue );
   }
 }
 
@@ -671,6 +679,12 @@ void Object::GetPropertyIndices( Property::IndexContainer& indices ) const
   }
 }
 
+bool Object::DoesCustomPropertyExist( Property::Index index )
+{
+  auto metadata = FindCustomProperty( index );
+  return metadata != nullptr;
+}
+
 Property::Index Object::RegisterSceneGraphProperty(const std::string& name, Property::Index key, Property::Index index, const Property::Value& propertyValue) const
 {
   // Create a new property
index 89fc73f..7658482 100644 (file)
@@ -2,7 +2,7 @@
 #define __DALI_INTERNAL_OBJECT_H__
 
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
@@ -29,6 +29,7 @@
 #include <dali/public-api/object/property-input.h>
 #include <dali/public-api/object/property-notification.h>
 #include <dali/devel-api/common/owner-container.h>
+#include <dali/devel-api/object/handle-devel.h>
 #include <dali/internal/event/animation/animation-impl.h>
 #include <dali/internal/event/common/event-thread-services.h>
 #include <dali/internal/event/common/property-input-impl.h>
@@ -44,7 +45,6 @@ namespace Internal
 {
 class ConstraintBase;
 class EventThreadServices;
-class Handle;
 class PropertyCondition;
 class PropertyInputImpl;
 class Stage;
@@ -224,6 +224,19 @@ public:
   virtual Property::Index RegisterProperty( const std::string& name, Property::Index key, const Property::Value& propertyValue, Property::AccessMode accessMode );
 
   /**
+   * @brief returns true if the custom property exists on this object.
+   *
+   * @note The property may be defined for a type within the type registry, but it isn't explicity
+   * defined in every consequent instantiation. It can be automatically added, e.g. parenting an actor
+   * automatically registers it's parent container's child properties.
+   *
+   * @param[in] handle The handle of the object to test
+   * @param[in] index The property index to look for.
+   * @return true if the property exists on the object, false otherwise.
+   */
+  bool DoesCustomPropertyExist( Property::Index index );
+
+  /**
    * @copydoc Dali::Handle::AddPropertyNotification()
    */
   virtual Dali::PropertyNotification AddPropertyNotification( Property::Index index,
@@ -331,6 +344,11 @@ public:
    */
   virtual int GetPropertyComponentIndex( Property::Index index ) const;
 
+  /**
+   * @copydoc Dali::Handle::PropertySetSignal()
+   */
+  DevelHandle::PropertySetSignalType& PropertySetSignal();
+
 protected:
 
   /**
@@ -597,6 +615,7 @@ private:
   typedef PropertyNotificationContainer::iterator       PropertyNotificationContainerIter;
   typedef PropertyNotificationContainer::const_iterator PropertyNotificationContainerConstIter;
   PropertyNotificationContainer* mPropertyNotifications; ///< Container of owned property notifications.
+  DevelHandle::PropertySetSignalType mPropertySetSignal;
 };
 } // namespace Internal
 
index 977cb87..66b9fcb 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
@@ -276,12 +276,12 @@ bool TypeRegistry::RegisterAnimatablePropertyComponent( TypeRegistration& typeRe
   return false;
 }
 
-bool TypeRegistry::RegisterChildProperty( TypeRegistration& typeRegistration, const std::string& name, Property::Index index, Property::Type type )
+bool TypeRegistry::RegisterChildProperty( const std::string& registeredType, const std::string& name, Property::Index index, Property::Type type )
 {
   for( auto&& iter : mRegistryLut )
   {
     auto&& impl = GetImplementation( iter );
-    if( impl.GetName() == typeRegistration.RegisteredName() )
+    if( impl.GetName() == registeredType )
     {
       impl.AddChildProperty( name, index, type );
       return true;
@@ -291,6 +291,11 @@ bool TypeRegistry::RegisterChildProperty( TypeRegistration& typeRegistration, co
   return false;
 }
 
+bool TypeRegistry::RegisterChildProperty( TypeRegistration& typeRegistration, const std::string& name, Property::Index index, Property::Type type )
+{
+  return RegisterChildProperty( typeRegistration.RegisteredName(), name, index, type );
+}
+
 bool TypeRegistry::DoActionTo( BaseObject * const object, const std::string& actionName, const Property::Map& properties )
 {
   bool done = false;
index 47364f3..e097c76 100644 (file)
@@ -2,7 +2,7 @@
 #define __DALI_INTERNAL_TYPE_REGISTRY_H__
 
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
@@ -172,6 +172,16 @@ public:
 
   /**
    * Register a event-thread only property with a type and a default value
+   * @param [in] registeredType Name of a registered type on which to register the child property.
+   * @param [in] name Property name
+   * @param [in] index Property index
+   * @param [in] type Property type
+   * @return true if registered
+   */
+  bool RegisterChildProperty( const std::string& registeredType, const std::string& name, Property::Index index, Property::Type type );
+
+  /**
+   * Register a event-thread only property with a type and a default value
    * @param [in] registered TypeRegistration object used to register the type
    * @param [in] name Property name
    * @param [in] index Property index
index 063f0cc..f139f97 100644 (file)
@@ -2,7 +2,7 @@
 #define __DALI_HANDLE_H__
 
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
@@ -391,7 +391,6 @@ public:
    * @pre The Object has been initialized.
    */
   void RemoveConstraints( unsigned int tag );
-
 };
 
 /**
index 03d96dc..eb4c8b2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
@@ -101,10 +101,24 @@ const std::string& TypeInfo::GetPropertyName( Property::Index index ) const
   return GetImplementation(*this).GetPropertyName( index );
 }
 
+Property::Index TypeInfo::GetChildPropertyIndex( const std::string& name ) const
+{
+  return GetImplementation(*this).GetChildPropertyIndex( name );
+}
+
+const std::string& TypeInfo::GetChildPropertyName( Property::Index index ) const
+{
+  return GetImplementation(*this).GetChildPropertyName( index );
+}
+
+Property::Type TypeInfo::GetChildPropertyType( Property::Index index ) const
+{
+  return GetImplementation(*this).GetChildPropertyType( index );
+}
+
 TypeInfo::TypeInfo(Internal::TypeInfo* internal)
 : BaseHandle(internal)
 {
 }
 
 } // namespace Dali
-
index 77de7f0..87a1958 100644 (file)
@@ -2,7 +2,7 @@
 #define __DALI_TYPE_INFO_H__
 
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
@@ -215,6 +215,36 @@ public:
    */
   const std::string& GetPropertyName( Property::Index index ) const;
 
+
+  /**
+   * @brief Given a child property name, retrieve the property index associated with it,
+   *
+   * @SINCE_1_3.20
+   * @param[in] name The name of the property at the given index,
+   * @return The property index or Property::INVALID_INDEX
+   */
+  Property::Index GetChildPropertyIndex( const std::string& name ) const;
+
+  /**
+   * @brief Given a child property index, retrieve the property name associated with it.
+   *
+   * @SINCE_1_3.20
+   * @param[in] index The property index
+   * @return The name of the property at the given index, or empty string if it does not exist
+   */
+  const std::string& GetChildPropertyName( Property::Index index ) const;
+
+  /**
+   * @brief Given a child property index, retrieve the property name associated with it.
+   *
+   * @SINCE_1_3.20
+   * @param[in] index The property index
+   * @return The name of the property at the given index, or empty string if it does not exist
+   */
+  Property::Type GetChildPropertyType( Property::Index index ) const;
+
+
+
 public: // Not intended for application developers
 
   /// @cond internal
index f28bb39..ed1bb70 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
@@ -163,4 +163,12 @@ ChildPropertyRegistration::ChildPropertyRegistration( TypeRegistration& register
   Internal::TypeRegistry::Get()->RegisterChildProperty( registered, name, index, type );
 }
 
+ChildPropertyRegistration::ChildPropertyRegistration( const std::string& registered, const std::string& name, Property::Index index, Property::Type type )
+{
+  DALI_ASSERT_ALWAYS( ( index >= CHILD_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= CHILD_PROPERTY_REGISTRATION_MAX_INDEX ) );
+
+  Internal::TypeRegistry::Get()->RegisterChildProperty( registered, name, index, type );
+}
+
+
 } // namespace Dali
index a34b89d..3c7574b 100644 (file)
@@ -2,7 +2,7 @@
 #define __DALI_TYPE_REGISTRY_H__
 
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
@@ -401,6 +401,19 @@ public:
    * @pre "registered" must be registered with the TypeRegistry.
    */
   ChildPropertyRegistration( TypeRegistration& registered, const std::string& name, Property::Index index, Property::Type type );
+
+  /**
+   * @brief This constructor registers an event-thread only child property (i.e. a property
+   * that the parent supports in its children) with the registered type.
+   *
+   * @SINCE_1_3.20
+   * @param[in] registered The name of the registered type
+   * @param[in] name The name of the property
+   * @param[in] index The property index. Must be a value between CHILD_PROPERTY_REGISTRATION_START_INDEX and CHILD_PROPERTY_REGISTRATION_MAX_INDEX inclusive
+   * @param[in] type The property value type
+   * @pre "registered" must be registered with the TypeRegistry.
+   */
+  ChildPropertyRegistration( const std::string& registered, const std::string& name, Property::Index index, Property::Type type );
 };