/*
- * 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.
#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;
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;
+}
/*
- * 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.
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;
+}
/*
- * 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.
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
#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.
*/
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
/*
- * 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.
// 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>
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" );
// 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 );
}
}
}
}
+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
#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.
#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>
{
class ConstraintBase;
class EventThreadServices;
-class Handle;
class PropertyCondition;
class PropertyInputImpl;
class Stage;
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,
*/
virtual int GetPropertyComponentIndex( Property::Index index ) const;
+ /**
+ * @copydoc Dali::Handle::PropertySetSignal()
+ */
+ DevelHandle::PropertySetSignalType& PropertySetSignal();
+
protected:
/**
typedef PropertyNotificationContainer::iterator PropertyNotificationContainerIter;
typedef PropertyNotificationContainer::const_iterator PropertyNotificationContainerConstIter;
PropertyNotificationContainer* mPropertyNotifications; ///< Container of owned property notifications.
+ DevelHandle::PropertySetSignalType mPropertySetSignal;
};
} // namespace Internal
/*
- * 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.
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;
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;
#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.
/**
* 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
#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.
* @pre The Object has been initialized.
*/
void RemoveConstraints( unsigned int tag );
-
};
/**
/*
- * 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.
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
-
#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.
*/
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
/*
- * 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.
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
#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.
* @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 );
};