- sources.push_back( Internal::Source( source1 ) );
- sources.push_back( Internal::Source( source2 ) );
-
- return Constraint( new Internal::Constraint( target,
- targetType,
- sources,
- func,
- interpolator ) );
-}
-
-Constraint Constraint::New( Property::Index target,
- Property::Type targetType,
- ConstraintSource source1,
- ConstraintSource source2,
- ConstraintSource source3,
- AnyFunction func,
- AnyFunction interpolator )
-{
- Internal::SourceContainer sources;
- sources.push_back( Internal::Source( source1 ) );
- sources.push_back( Internal::Source( source2 ) );
- sources.push_back( Internal::Source( source3 ) );
-
- return Constraint( new Internal::Constraint( target,
- targetType,
- sources,
- func,
- interpolator ) );
-}
-
-Constraint Constraint::New( Property::Index target,
- Property::Type targetType,
- ConstraintSource source1,
- ConstraintSource source2,
- ConstraintSource source3,
- ConstraintSource source4,
- AnyFunction func,
- AnyFunction interpolator )
-{
- Internal::SourceContainer sources;
- sources.push_back( Internal::Source( source1 ) );
- sources.push_back( Internal::Source( source2 ) );
- sources.push_back( Internal::Source( source3 ) );
- sources.push_back( Internal::Source( source4 ) );
-
- return Constraint( new Internal::Constraint( target,
- targetType,
- sources,
- func,
- interpolator ) );
-}
-
-Constraint Constraint::New( Property::Index target,
- Property::Type targetType,
- ConstraintSource source1,
- ConstraintSource source2,
- ConstraintSource source3,
- ConstraintSource source4,
- ConstraintSource source5,
- AnyFunction func,
- AnyFunction interpolator )
-{
- Internal::SourceContainer sources;
- sources.push_back( Internal::Source( source1 ) );
- sources.push_back( Internal::Source( source2 ) );
- sources.push_back( Internal::Source( source3 ) );
- sources.push_back( Internal::Source( source4 ) );
- sources.push_back( Internal::Source( source5 ) );
-
- return Constraint( new Internal::Constraint( target,
- targetType,
- sources,
- func,
- interpolator ) );
-}
-
-Constraint Constraint::New( Property::Index target,
- Property::Type targetType,
- ConstraintSource source1,
- ConstraintSource source2,
- ConstraintSource source3,
- ConstraintSource source4,
- ConstraintSource source5,
- ConstraintSource source6,
- AnyFunction func,
- AnyFunction interpolator )
-{
- Internal::SourceContainer sources;
- sources.push_back( Internal::Source( source1 ) );
- sources.push_back( Internal::Source( source2 ) );
- sources.push_back( Internal::Source( source3 ) );
- sources.push_back( Internal::Source( source4 ) );
- sources.push_back( Internal::Source( source5 ) );
- sources.push_back( Internal::Source( source6 ) );
-
- return Constraint( new Internal::Constraint( target,
- targetType,
- sources,
- func,
- interpolator ) );
-}
-
-Constraint Constraint::DownCast( BaseHandle handle )
-{
- return Constraint( dynamic_cast<Dali::Internal::Constraint*>(handle.GetObjectPtr()) );
+ Internal::Object& object = GetImplementation( handle );
+
+ switch ( targetType )
+ {
+ case Property::BOOLEAN:
+ {
+ Internal::PropertyConstraintPtr< bool >::Type funcPtr( CreatePropertyConstraint< bool >( function ) );
+
+ constraint = Dali::Constraint( Internal::Constraint< bool >::New( object,
+ targetIndex,
+ sources,
+ funcPtr ) );
+ break;
+ }
+
+ case Property::FLOAT:
+ {
+ Internal::PropertyConstraintPtr< float >::Type funcPtr( CreatePropertyConstraint< float >( function ) );
+
+ constraint = Dali::Constraint( Internal::Constraint< float >::New( object,
+ targetIndex,
+ sources,
+ funcPtr ) );
+ break;
+ }
+
+ case Property::INTEGER:
+ {
+ Internal::PropertyConstraintPtr< int >::Type funcPtr( CreatePropertyConstraint< int >( function ) );
+
+ constraint = Dali::Constraint( Internal::Constraint< int >::New( object,
+ targetIndex,
+ sources,
+ funcPtr ) );
+ break;
+ }
+
+ case Property::VECTOR2:
+ {
+ Internal::PropertyConstraintPtr< Vector2 >::Type funcPtr( CreatePropertyConstraint< Vector2 >( function ) );
+
+ constraint = Dali::Constraint( Internal::Constraint< Vector2 >::New( object,
+ targetIndex,
+ sources,
+ funcPtr ) );
+ break;
+ }
+
+ case Property::VECTOR3:
+ {
+ Internal::PropertyConstraintPtr< Vector3 >::Type funcPtr( CreatePropertyConstraint< Vector3 >( function ) );
+
+ constraint = Dali::Constraint( Internal::Constraint< Vector3 >::New( object,
+ targetIndex,
+ sources,
+ funcPtr ) );
+ break;
+ }
+
+ case Property::VECTOR4:
+ {
+ Internal::PropertyConstraintPtr< Vector4 >::Type funcPtr( CreatePropertyConstraint< Vector4 >( function ) );
+
+ constraint = Dali::Constraint( Internal::Constraint< Vector4 >::New( object,
+ targetIndex,
+ sources,
+ funcPtr ) );
+ break;
+ }
+
+ case Property::ROTATION:
+ {
+ Internal::PropertyConstraintPtr< Quaternion >::Type funcPtr( CreatePropertyConstraint< Quaternion >( function ) );
+
+ constraint = Dali::Constraint( Internal::Constraint< Quaternion >::New( object,
+ targetIndex,
+ sources,
+ funcPtr ) );
+ break;
+ }
+
+ case Property::MATRIX:
+ {
+ Internal::PropertyConstraintPtr< Matrix >::Type funcPtr( CreatePropertyConstraint< Matrix >( function ) );
+
+ constraint = Dali::Constraint( Internal::Constraint< Matrix >::New( object,
+ targetIndex,
+ sources,
+ funcPtr ) );
+ break;
+ }
+
+ case Property::MATRIX3:
+ {
+ Internal::PropertyConstraintPtr<Matrix3>::Type funcPtr( CreatePropertyConstraint<Matrix3>( function ) );
+
+ constraint = Dali::Constraint( Internal::Constraint< Matrix3 >::New( object,
+ targetIndex,
+ sources,
+ funcPtr ) );
+ break;
+ }
+
+ default:
+ {
+ DALI_ABORT( "Property not constrainable" );
+ break;
+ }
+ }
+
+ return constraint;