DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::WORLD_POSITION_Z ) );
// Type registered properties are not animatable
- DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( PropertyRegistration::START_INDEX ) ); // START
- DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( PropertyRegistration::START_INDEX + ( ( PropertyRegistration::MAX_INDEX - PropertyRegistration::START_INDEX ) * 0.5 ) ) ); // MIDDLE
- DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( PropertyRegistration::MAX_INDEX ) ); // MAX
+ DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( PROPERTY_REGISTRATION_START_INDEX ) ); // START
+ DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( PROPERTY_REGISTRATION_START_INDEX + ( ( PROPERTY_REGISTRATION_MAX_INDEX - PROPERTY_REGISTRATION_START_INDEX ) * 0.5 ) ) ); // MIDDLE
+ DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( PROPERTY_REGISTRATION_MAX_INDEX ) ); // MAX
}
void UtcDaliHandleGetPropertyType()
// Invalid Property
try
{
- active.GetPropertyName( PropertyRegistration::START_INDEX );
+ active.GetPropertyName( PROPERTY_REGISTRATION_START_INDEX );
tet_result( TET_FAIL );
}
catch ( DaliException& e )
DALI_TEST_EQUALS( active.GetPropertyIndex( "invalid-property-name"), Property::INVALID_INDEX, TEST_LOCATION );
try
{
- active.IsPropertyWritable( PropertyRegistration::START_INDEX );
+ active.IsPropertyWritable( PROPERTY_REGISTRATION_START_INDEX );
tet_result( TET_FAIL );
}
catch ( DaliException& e )
{
DALI_TEST_ASSERT_CONDITION_STARTS_WITH_SUBSTRING( e, "! \"Cannot find property index", TEST_LOCATION );
}
- DALI_TEST_CHECK( ! active.IsPropertyAnimatable( PropertyRegistration::START_INDEX ) );
+ DALI_TEST_CHECK( ! active.IsPropertyAnimatable( PROPERTY_REGISTRATION_START_INDEX ) );
try
{
- active.GetPropertyType( PropertyRegistration::START_INDEX );
+ active.GetPropertyType( PROPERTY_REGISTRATION_START_INDEX );
tet_result( TET_FAIL );
}
catch ( DaliException& e )
}
try
{
- active.SetProperty( PropertyRegistration::START_INDEX, true );
+ active.SetProperty( PROPERTY_REGISTRATION_START_INDEX, true );
tet_result( TET_FAIL );
}
catch ( DaliException& e )
}
try
{
- active.GetProperty< bool >( PropertyRegistration::START_INDEX );
+ active.GetProperty< bool >( PROPERTY_REGISTRATION_START_INDEX );
tet_result( TET_FAIL );
}
catch ( DaliException& e )
{
TestApplication application;
Actor actor = Actor::New();
- Constraint constraint = Constraint::New<Vector3>( Actor::POSITION, LocalSource( PropertyRegistration::START_INDEX ), MultiplyConstraint() );
+ Constraint constraint = Constraint::New<Vector3>( Actor::POSITION, LocalSource( PROPERTY_REGISTRATION_START_INDEX ), MultiplyConstraint() );
Stage::GetCurrent().Add( actor );
// Currently, Type registry properties cannot be animated
try
{
- actor.AddPropertyNotification( PropertyRegistration::START_INDEX, GreaterThanCondition( 100.0f ) );
+ actor.AddPropertyNotification( PROPERTY_REGISTRATION_START_INDEX, GreaterThanCondition( 100.0f ) );
}
catch ( DaliException& e )
{
unsigned int initialPropertyCount( customActor.GetPropertyCount() );
std::string propertyName( "prop-1" );
- int propertyIndex( PropertyRegistration::START_INDEX );
+ int propertyIndex( PROPERTY_REGISTRATION_START_INDEX );
Property::Type propertyType( Property::BOOLEAN );
PropertyRegistration property1( customType1, propertyName, propertyIndex, propertyType, &SetProperty, &GetProperty );
// Attempt to register a property type out-of-bounds index (less than)
try
{
- PropertyRegistration property1( customType1, "prop-name", PropertyRegistration::START_INDEX - 1, Property::BOOLEAN, &SetProperty, &GetProperty );
+ PropertyRegistration property1( customType1, "prop-name", PROPERTY_REGISTRATION_START_INDEX - 1, Property::BOOLEAN, &SetProperty, &GetProperty );
tet_result( TET_FAIL );
}
catch ( DaliException& e )
{
- DALI_TEST_ASSERT_CONDITION_STARTS_WITH_SUBSTRING( e, "( index >= START_INDEX ) && ( index <= MAX_INDEX )", TEST_LOCATION );
+ DALI_TEST_ASSERT( e, "( index >= PROPERTY_REGISTRATION_START_INDEX ) && ( index <= PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
}
// Attempt to register a property type out-of-bounds index (greater than)
try
{
- PropertyRegistration property1( customType1, "prop-name", PropertyRegistration::MAX_INDEX + 1, Property::BOOLEAN, &SetProperty, &GetProperty );
+ PropertyRegistration property1( customType1, "prop-name", PROPERTY_REGISTRATION_MAX_INDEX + 1, Property::BOOLEAN, &SetProperty, &GetProperty );
tet_result( TET_FAIL );
}
catch ( DaliException& e )
{
- DALI_TEST_ASSERT_CONDITION_STARTS_WITH_SUBSTRING( e, "( index >= START_INDEX ) && ( index <= MAX_INDEX )", TEST_LOCATION );
+ DALI_TEST_ASSERT( e, "( index >= PROPERTY_REGISTRATION_START_INDEX ) && ( index <= PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
}
}
void UtcDaliPropertyRegistrationFunctions()
{
TestApplication application;
- int propertyIndex = PropertyRegistration::START_INDEX + 10;
+ int propertyIndex = PROPERTY_REGISTRATION_START_INDEX + 10;
// Attempt to register a property without a setter
try
}
catch ( DaliException& e )
{
- DALI_TEST_ASSERT_CONDITION_STARTS_WITH_SUBSTRING( e, "! \"GetProperty", TEST_LOCATION );
+ DALI_TEST_ASSERT( e, "! \"GetProperty", TEST_LOCATION );
}
}
void UtcDaliPropertyRegistrationAddSameIndex()
{
TestApplication application;
- int propertyIndex = PropertyRegistration::START_INDEX + 100;
+ int propertyIndex = PROPERTY_REGISTRATION_START_INDEX + 100;
// Add one property with a valid property index
PropertyRegistration property1( customType1, "prop-name", propertyIndex, Property::BOOLEAN, &SetProperty, &GetProperty );
}
catch ( DaliException& e )
{
- DALI_TEST_ASSERT_CONDITION_STARTS_WITH_SUBSTRING( e, "! \"Property index already added", TEST_LOCATION );
+ DALI_TEST_ASSERT( e, "! \"Property index already added", TEST_LOCATION );
}
}
void UtcDaliPropertyRegistrationPropertyWritable()
{
TestApplication application;
- int propertyIndex1 = PropertyRegistration::START_INDEX + 200;
- int propertyIndex2 = PropertyRegistration::START_INDEX + 201;
+ int propertyIndex1 = PROPERTY_REGISTRATION_START_INDEX + 200;
+ int propertyIndex2 = PROPERTY_REGISTRATION_START_INDEX + 201;
// Add two properties, one with SetProperty, one without
PropertyRegistration property1( customType1, "prop-name-readwrite", propertyIndex1, Property::BOOLEAN, &SetProperty, &GetProperty );
void UtcDaliPropertyRegistrationPropertyAnimatable()
{
TestApplication application;
- int propertyIndex = PropertyRegistration::START_INDEX + 400;
+ int propertyIndex = PROPERTY_REGISTRATION_START_INDEX + 400;
// These properties are not animatable
PropertyRegistration property1( customType1, "prop-name", propertyIndex, Property::BOOLEAN, &SetProperty, &GetProperty );
void UtcDaliPropertyRegistrationInvalidGetAndSet()
{
TestApplication application;
- int propertyIndex = PropertyRegistration::START_INDEX + 2000;
+ int propertyIndex = PROPERTY_REGISTRATION_START_INDEX + 2000;
// Create custom-actor
TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( typeid(MyTestCustomActor) );
}
catch ( DaliException& e )
{
- DALI_TEST_ASSERT_CONDITION_STARTS_WITH_SUBSTRING( e, "! \"Cannot find property index", TEST_LOCATION );
+ DALI_TEST_ASSERT( e, "! \"Cannot find property index", TEST_LOCATION );
}
// Try to get an index that hasn't been added
}
catch ( DaliException& e )
{
- DALI_TEST_ASSERT_CONDITION_STARTS_WITH_SUBSTRING( e, "! \"Cannot find property index", TEST_LOCATION );
+ DALI_TEST_ASSERT( e, "! \"Cannot find property index", TEST_LOCATION );
}
}
#include <dali/public-api/object/handle.h>
#include <dali/public-api/object/object-registry.h>
#include <dali/public-api/object/property-conditions.h>
+#include <dali/public-api/object/property-index.h>
#include <dali/public-api/object/property-input.h>
#include <dali/public-api/object/property-notification-declarations.h>
#include <dali/public-api/object/property-notification.h>
$(capi_devel_src_dir)/object/handle.h \
$(capi_devel_src_dir)/object/object-registry.h \
$(capi_devel_src_dir)/object/property-conditions.h \
+ $(capi_devel_src_dir)/object/property-index.h \
$(capi_devel_src_dir)/object/property-input.h \
$(capi_devel_src_dir)/object/property-notification-declarations.h \
$(capi_devel_src_dir)/object/property-notification.h \
--- /dev/null
+#ifndef __DALI_PROPERTY_INDEX_H__
+#define __DALI_PROPERTY_INDEX_H__
+
+//
+// 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.
+//
+
+/**
+ * @addtogroup CAPI_DALI_FRAMEWORK
+ * @{
+ */
+
+// INTERNAL INCLUDES
+#include <dali/public-api/common/dali-common.h>
+
+namespace Dali DALI_IMPORT_API
+{
+
+/**
+ * PropertyRegistration indices should be between this range.
+ * Enumerations are being used here rather than static constants so that switch statements can be
+ * used to compare property indices.
+ */
+enum
+{
+ PROPERTY_REGISTRATION_START_INDEX = 10000000, ///< The index when registering a property should start from this number
+ PROPERTY_REGISTRATION_MAX_INDEX = 19999999 ///< The maximum index supported when registering a property
+};
+
+} // namespace Dali
+
+/**
+ * @}
+ */
+#endif // __DALI_PROPERTY_INDEX_H__
// limitations under the License.
//
-#include <dali/public-api/object/type-registry.h>
+#include <dali/public-api/object/property-index.h>
namespace Dali
{
* Specifies the allowed ranges for different class types to cater for future allocation
*/
-#define DEFAULT_PROPERTY_MAX_COUNT PropertyRegistration::START_INDEX ///< Default Property Range: 0 to 9999999
+#define DEFAULT_PROPERTY_MAX_COUNT PROPERTY_REGISTRATION_START_INDEX ///< Default Property Range: 0 to 9999999
#define DEFAULT_ACTOR_PROPERTY_MAX_COUNT 10000 ///< Actor Range: 0 to 9999
#define DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT 20000 ///< Renderable Actor Range: 10000 to 19999
#include <algorithm>
// INTERNAL INCLUDES
+#include <dali/public-api/object/property-index.h>
#include <dali/integration-api/debug.h>
#include <dali/internal/event/common/stage-impl.h>
#include <dali/internal/update/common/animatable-property.h>
return GetDefaultPropertyName( index );
}
- if ( ( index >= PropertyRegistration::START_INDEX ) && ( index <= PropertyRegistration::MAX_INDEX ) )
+ if ( ( index >= PROPERTY_REGISTRATION_START_INDEX ) && ( index <= PROPERTY_REGISTRATION_MAX_INDEX ) )
{
TypeInfo* typeInfo( GetTypeInfo() );
if ( typeInfo )
return IsDefaultPropertyWritable( index );
}
- if ( ( index >= PropertyRegistration::START_INDEX ) && ( index <= PropertyRegistration::MAX_INDEX ) )
+ if ( ( index >= PROPERTY_REGISTRATION_START_INDEX ) && ( index <= PROPERTY_REGISTRATION_MAX_INDEX ) )
{
TypeInfo* typeInfo( GetTypeInfo() );
if ( typeInfo )
return IsDefaultPropertyAnimatable( index );
}
- if ( ( index >= PropertyRegistration::START_INDEX ) && ( index <= PropertyRegistration::MAX_INDEX ) )
+ if ( ( index >= PROPERTY_REGISTRATION_START_INDEX ) && ( index <= PROPERTY_REGISTRATION_MAX_INDEX ) )
{
// Type Registry event-thread only properties are not animatable.
return false;
return GetDefaultPropertyType( index );
}
- if ( ( index >= PropertyRegistration::START_INDEX ) && ( index <= PropertyRegistration::MAX_INDEX ) )
+ if ( ( index >= PROPERTY_REGISTRATION_START_INDEX ) && ( index <= PROPERTY_REGISTRATION_MAX_INDEX ) )
{
TypeInfo* typeInfo( GetTypeInfo() );
if ( typeInfo )
SetDefaultProperty( index, propertyValue );
}
- else if ( ( index >= PropertyRegistration::START_INDEX ) && ( index <= PropertyRegistration::MAX_INDEX ) )
+ else if ( ( index >= PROPERTY_REGISTRATION_START_INDEX ) && ( index <= PROPERTY_REGISTRATION_MAX_INDEX ) )
{
TypeInfo* typeInfo( GetTypeInfo() );
if ( typeInfo )
{
value = GetDefaultProperty( index );
}
- else if ( ( index >= PropertyRegistration::START_INDEX ) && ( index <= PropertyRegistration::MAX_INDEX ) )
+ else if ( ( index >= PROPERTY_REGISTRATION_START_INDEX ) && ( index <= PROPERTY_REGISTRATION_MAX_INDEX ) )
{
TypeInfo* typeInfo( GetTypeInfo() );
if ( typeInfo )
{
if ( index >= DEFAULT_PROPERTY_MAX_COUNT )
{
- if ( index <= PropertyRegistration::MAX_INDEX )
+ if ( index <= PROPERTY_REGISTRATION_MAX_INDEX )
{
DALI_ASSERT_ALWAYS( false && "Property notification added to non animatable property." );
}
// limitations under the License.
//
-/**
- * @addtogroup CAPI_DALI_FRAMEWORK
- * @{
- */
-
// INTERNAL INCLUDES
#include <dali/public-api/object/base-handle.h>
const std::string& GetPropertyName( Property::Index index ) const;
public: // Not intended for application developers
+
/**
* This constructor is used by Dali Get() method
* @param [in] typeInfo A pointer to a Dali resource
} // namespace Dali
-/**
- * @}
- */
#endif // __DALI_TYPE_INFO_H__
// EXTERNAL INCLUDES
// INTERNAL INCLUDES
+#include <dali/public-api/object/property-index.h>
#include <dali/internal/event/common/type-registry-impl.h>
#include <dali/internal/event/common/property-index-ranges.h>
PropertyRegistration::PropertyRegistration( TypeRegistration& registered, const std::string& name, Property::Index index, Property::Type type, TypeInfo::SetPropertyFunction setFunc, TypeInfo::GetPropertyFunction getFunc )
{
- DALI_ASSERT_ALWAYS( ( index >= START_INDEX ) && ( index <= MAX_INDEX ) );
+ DALI_ASSERT_ALWAYS( ( index >= PROPERTY_REGISTRATION_START_INDEX ) && ( index <= PROPERTY_REGISTRATION_MAX_INDEX ) );
Internal::TypeRegistry::Get()->RegisterProperty( registered, name, index, type, setFunc, getFunc );
}
// limitations under the License.
//
-/**
- * @addtogroup CAPI_DALI_FRAMEWORK
- * @{
- */
-
// EXTERNAL INCLUDES
#include <typeinfo>
{
public:
- // Enumerations are being used here rather than static constants so that switch statements can be used to compare property indices
- enum
- {
- START_INDEX = 10000000, ///< The index for this type should start from this number
- MAX_INDEX = 19999999 ///< The maximum index supported for this type
- };
-
/**
* This constructor registers the property with the registered type. This constructor is for event-thread
* only properties where the value of the property can be retrieved and set via specified functions.
*
* @param [in] registered The TypeRegistration object
* @param [in] name The name of the property
- * @param [in] index The property index. Must be a value between START_INDEX and MAX_INDEX inclusive.
+ * @param [in] index The property index. Must be a value between PROPERTY_REGISTRATION_START_INDEX and PROPERTY_REGISTRATION_MAX_INDEX inclusive.
* @param [in] type The property value type.
* @param [in] setFunc The function to call when setting the property. If NULL, then the property becomes read-only.
* @param [in] getFunc The function to call to retrieve the current value of the property. MUST be provided.
} // namespace Dali
-/**
- * @}
- */
#endif // header