Merge Handle & Constrainable 87/35787/3
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Tue, 24 Feb 2015 13:17:10 +0000 (13:17 +0000)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Tue, 24 Feb 2015 16:03:47 +0000 (16:03 +0000)
Change-Id: If27ef930044532021863a224199f4d37b92693e7

19 files changed:
automated-tests/src/dali/CMakeLists.txt
automated-tests/src/dali/utc-Dali-Constrainable.cpp [deleted file]
automated-tests/src/dali/utc-Dali-Handle.cpp
dali/internal/event/common/object-impl.cpp
dali/internal/event/common/object-impl.h
dali/public-api/actors/actor.cpp
dali/public-api/actors/actor.h
dali/public-api/dali-core.h
dali/public-api/file.list
dali/public-api/geometry/animatable-mesh.cpp
dali/public-api/geometry/animatable-mesh.h
dali/public-api/object/constrainable.cpp [deleted file]
dali/public-api/object/constrainable.h [deleted file]
dali/public-api/object/handle.cpp
dali/public-api/object/handle.h
dali/public-api/render-tasks/render-task.cpp
dali/public-api/render-tasks/render-task.h
dali/public-api/shader-effects/shader-effect.cpp
dali/public-api/shader-effects/shader-effect.h

index 072ad59..f1e3b36 100644 (file)
@@ -18,7 +18,6 @@ SET(TC_SOURCES
         utc-Dali-BitmapImage.cpp
         utc-Dali-CameraActor.cpp
         utc-Dali-Character.cpp
-        utc-Dali-Constrainable.cpp
         utc-Dali-Constraint.cpp
         utc-Dali-Context.cpp
         utc-Dali-CustomActor.cpp
diff --git a/automated-tests/src/dali/utc-Dali-Constrainable.cpp b/automated-tests/src/dali/utc-Dali-Constrainable.cpp
deleted file mode 100644 (file)
index e62c67d..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (c) 2014 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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.
- *
- */
-
-#include <iostream>
-#include <stdlib.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali-test-suite-utils.h>
-
-using namespace Dali;
-
-void utc_dali_constrainable_startup(void)
-{
-  test_return_value = TET_UNDEF;
-}
-
-void utc_dali_constrainable_cleanup(void)
-{
-  test_return_value = TET_PASS;
-}
-
-int UtcDaliConstrainableDownCast(void)
-{
-  TestApplication application;
-
-  Handle handle = Constrainable::New();
-
-  Constrainable customHandle1 = Constrainable::DownCast( handle );
-  DALI_TEST_CHECK( customHandle1 );
-
-  Constrainable customHandle2 = DownCast< Constrainable >( handle );
-  DALI_TEST_CHECK( customHandle2 );
-  END_TEST;
-}
-
-int UtcDaliConstrainableDownCastNegative(void)
-{
-  TestApplication application;
-
-  Image image = ResourceImage::New( "temp" );
-  Constrainable customHandle1 = Constrainable::DownCast( image );
-  DALI_TEST_CHECK( ! customHandle1 );
-
-  Constrainable empty;
-  Constrainable customHandle2 = Constrainable::DownCast( empty );
-  DALI_TEST_CHECK( ! customHandle2 );
-  END_TEST;
-}
-
-int UtcDaliConstrainableCustomProperty(void)
-{
-  TestApplication application;
-
-  Constrainable handle = Constrainable::New();
-
-  float startValue(1.0f);
-  Property::Index index = handle.RegisterProperty( "test-property", startValue );
-  DALI_TEST_CHECK( handle.GetProperty<float>(index) == startValue );
-
-  application.SendNotification();
-  application.Render(0);
-  DALI_TEST_CHECK( handle.GetProperty<float>(index) == startValue );
-  application.Render(0);
-  DALI_TEST_CHECK( handle.GetProperty<float>(index) == startValue );
-
-  handle.SetProperty( index, 5.0f );
-
-  application.SendNotification();
-  application.Render(0);
-  DALI_TEST_CHECK( handle.GetProperty<float>(index) == 5.0f );
-  application.Render(0);
-  DALI_TEST_CHECK( handle.GetProperty<float>(index) == 5.0f );
-  END_TEST;
-}
index 0d7c5e3..cf49f4a 100644 (file)
@@ -36,6 +36,15 @@ void handle_test_cleanup(void)
 namespace
 {
 
+/// Allows the creation of a BaseObject
+class BaseObjectType : public BaseObject
+{
+public:
+  BaseObjectType()
+  {
+  }
+};
+
 Handle ImplicitCopyConstructor(Handle passedByValue)
 {
   // object + copy + passedByValue, ref count == 3
@@ -772,6 +781,22 @@ int UtcDaliHandleDownCast(void)
   END_TEST;
 }
 
+int UtcDaliHandleDownCastNegative(void)
+{
+  TestApplication application;
+
+  // BaseObject is NOT an Object, so this DownCast should fail
+  BaseHandle handle( new BaseObjectType );
+  Handle customHandle1 = Handle::DownCast( handle );
+  DALI_TEST_CHECK( ! customHandle1 );
+
+  // A DownCast on an empty handle will also fail
+  Handle empty;
+  Handle customHandle2 = Handle::DownCast( empty );
+  DALI_TEST_CHECK( ! customHandle2 );
+  END_TEST;
+}
+
 int UtcDaliHandleCreateProperty(void)
 {
   TestApplication application;
@@ -1018,3 +1043,29 @@ int UtcDaliHandleRegisterPropertyTypes(void)
   }
   END_TEST;
 }
+
+int UtcDaliHandleCustomProperty(void)
+{
+  TestApplication application;
+
+  Handle handle = Handle::New();
+
+  float startValue(1.0f);
+  Property::Index index = handle.RegisterProperty( "test-property", startValue );
+  DALI_TEST_CHECK( handle.GetProperty<float>(index) == startValue );
+
+  application.SendNotification();
+  application.Render(0);
+  DALI_TEST_CHECK( handle.GetProperty<float>(index) == startValue );
+  application.Render(0);
+  DALI_TEST_CHECK( handle.GetProperty<float>(index) == startValue );
+
+  handle.SetProperty( index, 5.0f );
+
+  application.SendNotification();
+  application.Render(0);
+  DALI_TEST_CHECK( handle.GetProperty<float>(index) == 5.0f );
+  application.Render(0);
+  DALI_TEST_CHECK( handle.GetProperty<float>(index) == 5.0f );
+  END_TEST;
+}
index b49b7ce..09d5997 100644 (file)
@@ -754,15 +754,15 @@ void Object::DisablePropertyNotifications()
 
 Dali::ActiveConstraint Object::ApplyConstraint( Constraint& constraint )
 {
-  return Dali::ActiveConstraint( DoApplyConstraint( constraint, Dali::Constrainable() ) );
+  return Dali::ActiveConstraint( DoApplyConstraint( constraint, Dali::Handle() ) );
 }
 
-Dali::ActiveConstraint Object::ApplyConstraint( Constraint& constraint, Dali::Constrainable weightObject )
+Dali::ActiveConstraint Object::ApplyConstraint( Constraint& constraint, Dali::Handle weightObject )
 {
   return Dali::ActiveConstraint( DoApplyConstraint( constraint, weightObject ) );
 }
 
-ActiveConstraintBase* Object::DoApplyConstraint( Constraint& constraint, Dali::Constrainable weightObject )
+ActiveConstraintBase* Object::DoApplyConstraint( Constraint& constraint, Dali::Handle weightObject )
 {
   ActiveConstraintBase* activeConstraintImpl = constraint.CreateActiveConstraint();
   DALI_ASSERT_DEBUG( NULL != activeConstraintImpl );
index 270a73b..1949f09 100644 (file)
@@ -24,7 +24,6 @@
 #include <dali/public-api/common/dali-vector.h>
 #include <dali/public-api/common/vector-wrapper.h>
 #include <dali/public-api/object/base-object.h>
-#include <dali/public-api/object/constrainable.h>
 #include <dali/public-api/object/handle.h>
 #include <dali/public-api/object/property.h>
 #include <dali/public-api/object/property-index.h>
@@ -238,7 +237,7 @@ public:
    * @param[in] constraint The constraint to apply.
    * @param[in] weightObject An object with a "weight" float property.
    */
-  Dali::ActiveConstraint ApplyConstraint( Constraint& constraint, Dali::Constrainable weightObject );
+  Dali::ActiveConstraint ApplyConstraint( Constraint& constraint, Dali::Handle weightObject );
 
   /**
    * Remove one constraint from a Object.
@@ -459,7 +458,7 @@ private:
    * @param[in] weightObject An object with a "weight" float property, or an empty handle.
    * @return The new active-constraint which is owned by Object.
    */
-  ActiveConstraintBase* DoApplyConstraint( Constraint& constraint, Dali::Constrainable weightObject );
+  ActiveConstraintBase* DoApplyConstraint( Constraint& constraint, Dali::Handle weightObject );
 
   /**
    * Helper to remove active constraints
index f3beeb8..f2c07d6 100644 (file)
@@ -67,7 +67,7 @@ Actor::~Actor()
 }
 
 Actor::Actor(const Actor& copy)
-: Constrainable(copy)
+: Handle(copy)
 {
 }
 
@@ -610,7 +610,7 @@ DynamicsBody Actor::GetDynamicsBody()
 }
 
 Actor::Actor(Internal::Actor* internal)
-: Constrainable(internal)
+: Handle(internal)
 {
 }
 
index fff15b4..248225a 100644 (file)
@@ -27,7 +27,7 @@
 #include <dali/public-api/animation/active-constraint-declarations.h>
 #include <dali/public-api/actors/actor-enumerations.h>
 #include <dali/public-api/actors/draw-mode.h>
-#include <dali/public-api/object/constrainable.h>
+#include <dali/public-api/object/handle.h>
 #include <dali/public-api/signals/dali-signal.h>
 
 namespace Dali
@@ -243,7 +243,7 @@ typedef ActorContainer::const_iterator ActorConstIter; ///< Const iterator for D
  * | show              | %SetVisible( true )          |
  * | hide              | %SetVisible( false )         |
  */
-class DALI_IMPORT_API Actor : public Constrainable
+class DALI_IMPORT_API Actor : public Handle
 {
 public:
 
index 35aa175..d321c74 100644 (file)
 #include <dali/public-api/object/any.h>
 #include <dali/public-api/object/base-handle.h>
 #include <dali/public-api/object/base-object.h>
-#include <dali/public-api/object/constrainable.h>
 #include <dali/public-api/object/handle.h>
 #include <dali/public-api/object/object-registry.h>
 #include <dali/public-api/object/property-conditions.h>
index 83d25a3..3b42263 100644 (file)
@@ -87,7 +87,6 @@ public_api_src_files = \
   $(public_api_src_dir)/modeling/model-data.cpp \
   $(public_api_src_dir)/object/any.cpp \
   $(public_api_src_dir)/object/base-handle.cpp \
-  $(public_api_src_dir)/object/constrainable.cpp \
   $(public_api_src_dir)/object/handle.cpp \
   $(public_api_src_dir)/object/base-object.cpp \
   $(public_api_src_dir)/object/object-registry.cpp \
@@ -254,7 +253,6 @@ public_api_core_object_header_files = \
   $(public_api_src_dir)/object/any.h \
   $(public_api_src_dir)/object/base-handle.h \
   $(public_api_src_dir)/object/base-object.h \
-  $(public_api_src_dir)/object/constrainable.h \
   $(public_api_src_dir)/object/handle.h \
   $(public_api_src_dir)/object/object-registry.h \
   $(public_api_src_dir)/object/property-conditions.h \
index 1f678f4..d545f35 100644 (file)
@@ -55,7 +55,7 @@ AnimatableMesh::~AnimatableMesh()
 }
 
 AnimatableMesh::AnimatableMesh(const AnimatableMesh& handle)
-: Constrainable(handle)
+: Handle(handle)
 {
 }
 
@@ -93,7 +93,7 @@ Property AnimatableMesh::GetVertexProperty( unsigned int vertex, Property::Index
 
 
 AnimatableMesh::AnimatableMesh( Internal::AnimatableMesh* internal )
-: Constrainable(internal)
+: Handle(internal)
 {
 }
 
index 733891e..9f49dbe 100644 (file)
@@ -20,7 +20,7 @@
 
 // INTERNAL INCLUDES
 #include <dali/public-api/common/vector-wrapper.h>
-#include <dali/public-api/object/constrainable.h>
+#include <dali/public-api/object/handle.h>
 #include <dali/public-api/geometry/animatable-vertex.h>
 #include <dali/public-api/modeling/material.h>
 
@@ -40,7 +40,7 @@ class AnimatableMesh;
  * It is recommended that the vertices of the mesh remain in the bounds -0.5 - 0.5, which
  * will match the actor size boundaries. The origin of the mesh matches the actor's position.
  */
-class DALI_IMPORT_API AnimatableMesh : public Constrainable
+class DALI_IMPORT_API AnimatableMesh : public Handle
 {
 public:
   /**
diff --git a/dali/public-api/object/constrainable.cpp b/dali/public-api/object/constrainable.cpp
deleted file mode 100644 (file)
index 1404751..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (c) 2014 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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.
- *
- */
-
-// CLASS HEADER
-#include <dali/public-api/object/constrainable.h>
-
-// INTERNAL INCLUDES
-#include <dali/public-api/object/property-index.h>
-#include <dali/public-api/animation/constraint.h>
-#include <dali/public-api/animation/active-constraint.h>
-#include <dali/internal/event/common/object-impl.h>
-#include <dali/internal/event/animation/constraint-impl.h>
-#include <dali/internal/event/object/custom-object-internal.h>
-
-namespace Dali
-{
-
-Constrainable Constrainable::New()
-{
-  return Constrainable( Internal::CustomObject::New() );
-}
-
-Constrainable::Constrainable(Dali::Internal::Object* handle)
-: Handle(handle)
-{
-}
-
-Constrainable::Constrainable()
-{
-}
-
-Constrainable Constrainable::DownCast( BaseHandle handle )
-{
-  return Constrainable( dynamic_cast<Dali::Internal::Object*>(handle.GetObjectPtr()) );
-}
-
-Constrainable::~Constrainable()
-{
-}
-
-Constrainable::Constrainable(const Constrainable& handle)
-: Handle(handle)
-{
-}
-
-Constrainable& Constrainable::operator=(const Constrainable& rhs)
-{
-  BaseHandle::operator=(rhs);
-  return *this;
-}
-
-ActiveConstraint Constrainable::ApplyConstraint( Constraint constraint )
-{
-  return GetImplementation(*this).ApplyConstraint( GetImplementation( constraint ) );
-}
-
-ActiveConstraint Constrainable::ApplyConstraint( Constraint constraint, Constrainable weightObject )
-{
-  return GetImplementation(*this).ApplyConstraint( GetImplementation( constraint ), weightObject );
-}
-
-void Constrainable::RemoveConstraint(ActiveConstraint activeConstraint)
-{
-  GetImplementation(*this).RemoveConstraint( activeConstraint );
-}
-
-void Constrainable::RemoveConstraints()
-{
-  GetImplementation(*this).RemoveConstraints();
-}
-
-void Constrainable::RemoveConstraints( unsigned int tag )
-{
-  GetImplementation(*this).RemoveConstraints( tag );
-}
-
-namespace WeightObject
-{
-
-const Property::Index WEIGHT = PROPERTY_CUSTOM_START_INDEX;
-
-Constrainable New()
-{
-  Constrainable handle = Constrainable::New();
-
-  handle.RegisterProperty( "weight", 0.0f );
-
-  return handle;
-}
-
-} // namespace WeightObject
-
-} // namespace Dali
diff --git a/dali/public-api/object/constrainable.h b/dali/public-api/object/constrainable.h
deleted file mode 100644 (file)
index b09019d..0000000
+++ /dev/null
@@ -1,168 +0,0 @@
-#ifndef __DALI_CONSTRAINABLE_H__
-#define __DALI_CONSTRAINABLE_H__
-
-/*
- * Copyright (c) 2014 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * 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.
- *
- */
-
-// INTERNAL INCLUDES
-#include <dali/public-api/object/handle.h>
-#include <dali/public-api/animation/active-constraint.h>
-#include <dali/public-api/animation/constraint.h>
-
-namespace Dali DALI_IMPORT_API
-{
-
-namespace Internal
-{
-class Object;
-}
-
-class Constraint;
-
-/**
- * @brief Dali::Constrainable is a handle to an internal property owning Dali object that
- * can have constraints applied to it.
- */
-class DALI_IMPORT_API Constrainable : public Handle
-{
-public:
-
-  /**
-   * @brief Create a constrainable object.
-   *
-   * @return A handle to a newly allocated object.
-   */
-  static Constrainable New();
-
-  /**
-   * @brief This constructor provides an uninitialized Dali::Constrainable.
-   *
-   * This should be initialized with a Dali New() method before use.
-   * Methods called on an uninitialized Dali::Constrainable will assert.
-   * @code
-   * Constrainable handle; // uninitialized
-   * handle.SomeMethod(); // unsafe! This will assert
-   *
-   * handle = SomeClass::New(); // now initialized
-   * handle.SomeMethod(); // safe
-   * @endcode
-   */
-  Constrainable();
-
-  /**
-   * @brief Downcast a handle to a custom object.
-   *
-   * @param[in] handle The handle to cast.
-   * @return A handle to a custom object or an empty handle.
-   */
-  static Constrainable DownCast( BaseHandle handle );
-
-  /**
-   * @brief Dali::Constrainable is intended as a base class
-   *
-   * This is non-virtual since derived Handle types must not contain data or virtual methods.
-   */
-  ~Constrainable();
-
-  /**
-   * @brief This copy constructor is required for (smart) pointer semantics.
-   *
-   * @param [in] handle A reference to the copied handle
-   */
-  Constrainable(const Constrainable& handle);
-
-  /**
-   * @brief This assignment operator is required for (smart) pointer semantics.
-   *
-   * @param [in] rhs  A reference to the copied handle
-   * @return A reference to this
-   */
-  Constrainable& operator=(const Constrainable& rhs);
-
-  /**
-   * @brief Constrain one of the properties of an Actor.
-   *
-   * @note The constraint will be copied by the Actor. This means that modifying the apply-time etc.
-   * of the constraint, will not affect actors which are already being constrained.
-   * @pre The Actor has been initialized.
-   * @param[in] constraint The constraint to apply.
-   * @return The active-constraint being applied to the actor.
-   */
-  ActiveConstraint ApplyConstraint( Constraint constraint );
-
-  /**
-   * @brief Constrain one of the properties of an Actor, using a custom weight property.
-   *
-   * This overload is intended to allow a single weight property to be shared by many constraints
-   * e.g. call WeightObject::New() once, and pass the return value into every call to ApplyConstraint().
-   * @pre The Actor has been initialized.
-   * @param[in] constraint The constraint to apply.
-   * @param[in] weightObject An object which is expected to have a float property named "weight".
-   * @return The active-constraint being applied to the actor.
-   */
-  ActiveConstraint ApplyConstraint( Constraint constraint, Constrainable weightObject );
-
-  /**
-   * @brief Remove one constraint from an Object.
-   *
-   * @pre The Object has been intialized.
-   * @param[in] activeConstraint The active-constraint to remove.
-   */
-  void RemoveConstraint(ActiveConstraint activeConstraint);
-
-  /**
-   * @brief Remove all constraints from an Object.
-   *
-   * @pre The object has been initialized.
-   */
-  void RemoveConstraints();
-
-  /**
-   * @brief Remove all the constraint from the Object with a matching tag.
-   *
-   * @pre The Object has been intialized.
-   * @param[in] tag The tag of the constraints which will be removed
-   */
-  void RemoveConstraints( unsigned int tag );
-
-public:
-
-  /**
-   * @brief This constructor is used by Dali New() methods.
-   *
-   * @param [in] handle A pointer to a newly allocated Dali resource
-   */
-  explicit DALI_INTERNAL Constrainable(Dali::Internal::Object* handle);
-};
-
-namespace WeightObject
-{
-
-DALI_IMPORT_API extern const Property::Index WEIGHT; ///< name "weight", type FLOAT
-
-/**
- * @brief Convenience function to create an object with a custom "weight" property.
- *
- * @return A handle to a newly allocated object.
- */
-DALI_IMPORT_API Constrainable New();
-
-} // namespace WeightObject
-
-} // namespace Dali
-
-#endif // __DALI_CONSTRAINABLE_H__
index 98fea25..34532ae 100644 (file)
 #include <dali/public-api/object/handle.h>
 
 // INTERNAL INCLUDES
+#include <dali/public-api/animation/active-constraint.h>
+#include <dali/public-api/animation/constraint.h>
 #include <dali/public-api/object/property-conditions.h>
+#include <dali/public-api/object/property-index.h>
 #include <dali/public-api/object/property-notification.h>
+#include <dali/internal/event/animation/constraint-impl.h>
 #include <dali/internal/event/common/object-impl.h>
+#include <dali/internal/event/object/custom-object-internal.h>
 #include <dali/integration-api/debug.h>
 
 namespace Dali
 {
 
-Handle::Handle(Dali::Internal::Object* handle)
-  : BaseHandle(handle)
+Handle::Handle( Dali::Internal::Object* handle )
+: BaseHandle(handle)
 {
 }
 
+
 Handle::Handle()
 {
 }
 
+Handle Handle::New()
+{
+  return Handle( Internal::CustomObject::New() );
+}
+
 Handle::~Handle()
 {
 }
@@ -149,4 +160,45 @@ void Handle::RemovePropertyNotifications()
   GetImplementation(*this).RemovePropertyNotifications();
 }
 
+ActiveConstraint Handle::ApplyConstraint( Constraint constraint )
+{
+  return GetImplementation(*this).ApplyConstraint( GetImplementation( constraint ) );
+}
+
+ActiveConstraint Handle::ApplyConstraint( Constraint constraint, Handle weightObject )
+{
+  return GetImplementation(*this).ApplyConstraint( GetImplementation( constraint ), weightObject );
+}
+
+void Handle::RemoveConstraint(ActiveConstraint activeConstraint)
+{
+  GetImplementation(*this).RemoveConstraint( activeConstraint );
+}
+
+void Handle::RemoveConstraints()
+{
+  GetImplementation(*this).RemoveConstraints();
+}
+
+void Handle::RemoveConstraints( unsigned int tag )
+{
+  GetImplementation(*this).RemoveConstraints( tag );
+}
+
+namespace WeightObject
+{
+
+const Property::Index WEIGHT = PROPERTY_CUSTOM_START_INDEX;
+
+Handle New()
+{
+  Handle handle = Handle::New();
+
+  handle.RegisterProperty( "weight", 0.0f );
+
+  return handle;
+}
+
+} // namespace WeightObject
+
 } // namespace Dali
index 3718402..0dd7eb3 100644 (file)
@@ -32,6 +32,8 @@
 namespace Dali
 {
 
+class ActiveConstraint;
+class Constraint;
 class PropertyNotification;
 class PropertyCondition;
 
@@ -41,7 +43,7 @@ class Object;
 }
 
 /**
- * @brief Dali::Handle is a handle to an internal property owning Dali object.
+ * @brief Dali::Handle is a handle to an internal property owning Dali object that can have constraints applied to it.
  */
 class DALI_IMPORT_API Handle : public BaseHandle
 {
@@ -85,6 +87,13 @@ public:
   Handle();
 
   /**
+   * @brief Create a new object.
+   *
+   * @return A handle to a newly allocated object.
+   */
+  static Handle New();
+
+  /**
    * @brief Dali::Handle is intended as a base class
    *
    * This is non-virtual since derived Handle types must not contain data or virtual methods.
@@ -115,8 +124,6 @@ public:
    */
   static Handle DownCast( BaseHandle handle );
 
-public:
-
   /**
    * @brief Query whether an handle supports a given capability.
    *
@@ -125,6 +132,8 @@ public:
    */
   bool Supports( Capability capability ) const;
 
+  // Properties
+
   /**
    * @brief Query how many properties are provided by an handle.
    *
@@ -307,8 +316,69 @@ public:
    */
   void RemovePropertyNotifications();
 
+  // Constraints
+
+  /**
+   * @brief Constrain one of the properties of an Actor.
+   *
+   * @note The constraint will be copied by the Actor. This means that modifying the apply-time etc.
+   * of the constraint, will not affect actors which are already being constrained.
+   * @pre The Actor has been initialized.
+   * @param[in] constraint The constraint to apply.
+   * @return The active-constraint being applied to the actor.
+   */
+  ActiveConstraint ApplyConstraint( Constraint constraint );
+
+  /**
+   * @brief Constrain one of the properties of an Actor, using a custom weight property.
+   *
+   * This overload is intended to allow a single weight property to be shared by many constraints
+   * e.g. call WeightObject::New() once, and pass the return value into every call to ApplyConstraint().
+   * @pre The Actor has been initialized.
+   * @param[in] constraint The constraint to apply.
+   * @param[in] weightObject An object which is expected to have a float property named "weight".
+   * @return The active-constraint being applied to the actor.
+   */
+  ActiveConstraint ApplyConstraint( Constraint constraint, Handle weightObject );
+
+  /**
+   * @brief Remove one constraint from an Object.
+   *
+   * @pre The Object has been initialized.
+   * @param[in] activeConstraint The active-constraint to remove.
+   */
+  void RemoveConstraint( ActiveConstraint activeConstraint );
+
+  /**
+   * @brief Remove all constraints from an Object.
+   *
+   * @pre The object has been initialized.
+   */
+  void RemoveConstraints();
+
+  /**
+   * @brief Remove all the constraint from the Object with a matching tag.
+   *
+   * @pre The Object has been intialized.
+   * @param[in] tag The tag of the constraints which will be removed
+   */
+  void RemoveConstraints( unsigned int tag );
 };
 
+namespace WeightObject
+{
+
+DALI_IMPORT_API extern const Property::Index WEIGHT; ///< name "weight", type FLOAT
+
+/**
+ * @brief Convenience function to create an object with a custom "weight" property.
+ *
+ * @return A handle to a newly allocated object.
+ */
+DALI_IMPORT_API Handle New();
+
+} // namespace WeightObject
+
 } // namespace Dali
 
 #endif // __DALI_HANDLE_H__
index 35fa83d..36045f8 100644 (file)
@@ -62,7 +62,7 @@ RenderTask::~RenderTask()
 }
 
 RenderTask::RenderTask(const RenderTask& handle)
-: Constrainable(handle)
+: Handle(handle)
 {
 }
 
@@ -241,7 +241,7 @@ bool RenderTask::GetInputEnabled() const
 }
 
 RenderTask::RenderTask( Internal::RenderTask* internal )
-: Constrainable(internal)
+: Handle(internal)
 {
 }
 
index 73bf6d3..8f71f52 100644 (file)
@@ -20,7 +20,7 @@
 
 // INTERNAL INCLUDES
 #include <dali/public-api/math/viewport.h>
-#include <dali/public-api/object/constrainable.h>
+#include <dali/public-api/object/handle.h>
 #include <dali/public-api/signals/dali-signal.h>
 
 namespace Dali
@@ -74,7 +74,7 @@ class RenderTask;
  * |--------------|-----------------------|
  * | finished     | @ref FinishedSignal() |
  */
-class DALI_IMPORT_API RenderTask : public Constrainable
+class DALI_IMPORT_API RenderTask : public Handle
 {
 public:
   /**
index 6f440e1..39ad964 100644 (file)
@@ -41,7 +41,7 @@ ShaderEffect::ShaderEffect()
 }
 
 ShaderEffect::ShaderEffect(Internal::ShaderEffect* internal)
-: Constrainable(internal)
+: Handle(internal)
 {
 }
 
@@ -50,7 +50,7 @@ ShaderEffect::~ShaderEffect()
 }
 
 ShaderEffect::ShaderEffect(const ShaderEffect& handle)
-: Constrainable(handle)
+: Handle(handle)
 {
 }
 
index 13ce2c2..446bb12 100644 (file)
@@ -20,7 +20,7 @@
 
 // INTERNAL INCLUDES
 #include <dali/public-api/animation/active-constraint-declarations.h>
-#include <dali/public-api/object/constrainable.h>
+#include <dali/public-api/object/handle.h>
 
 namespace Dali
 {
@@ -147,7 +147,7 @@ enum GeometryType
  * with the uniform color "uColor" of the node
  * </B>
  */
-class DALI_IMPORT_API ShaderEffect : public Constrainable
+class DALI_IMPORT_API ShaderEffect : public Handle
 {
 public:
   /**