Implement Animation PlayAfter() API
[platform/core/uifw/dali-core.git] / dali / internal / event / animation / animation-impl.h
index 92dff74..bf1e628 100644 (file)
@@ -23,9 +23,9 @@
 #include <dali/public-api/object/ref-object.h>
 #include <dali/public-api/animation/animation.h>
 #include <dali/public-api/object/base-object.h>
-#include <dali/internal/event/animation/animator-connector-base.h>
+#include <dali/devel-api/common/owner-container.h>
 #include <dali/internal/event/animation/key-frames-impl.h>
-#include <dali/internal/event/animation/path-impl.h>
+#include <dali/internal/event/common/event-thread-services.h>
 
 namespace Dali
 {
@@ -42,7 +42,9 @@ class UpdateManager;
 class Actor;
 class Animation;
 class AnimationPlaylist;
+class AnimatorConnectorBase;
 class Object;
+class Path;
 
 typedef IntrusivePtr<Animation> AnimationPtr;
 typedef std::vector<AnimationPtr> AnimationContainer;
@@ -59,6 +61,13 @@ class Animation : public BaseObject
 {
 public:
 
+  enum Type
+  {
+    TO,      ///< Animating TO the given value
+    BY,      ///< Animating BY the given value
+    BETWEEN  ///< Animating BETWEEN key-frames
+  };
+
   typedef Dali::Animation::EndAction EndAction;
   typedef Dali::Animation::Interpolation Interpolation;
 
@@ -75,6 +84,16 @@ public:
   void SetDuration(float seconds);
 
   /**
+   * @copydoc Dali::DevelAnimation::SetProgressNotification()
+   */
+  void SetProgressNotification( float progress );
+
+  /**
+   * @copydoc Dali::DevelAnimation::GetProgressNotification()
+   */
+  float GetProgressNotification();
+
+  /**
    * @copydoc Dali::Animation::GetDuration()
    */
   float GetDuration() const;
@@ -151,6 +170,11 @@ public:
   void PlayFrom( float progress );
 
   /**
+   * @copydoc Dali::Animation::PlayAfter()
+   */
+  void PlayAfter( float delaySeconds );
+
+  /**
    * @copydoc Dali::Animation::Pause()
    */
   void Pause();
@@ -183,11 +207,21 @@ public:
   Dali::Animation::AnimationSignalType& FinishedSignal();
 
   /**
+   * @copydoc Dali::DevelAnimation::ProgressHasBeenReachedSignal()
+   */
+  Dali::Animation::AnimationSignalType& ProgressReachedSignal();
+
+  /**
    * Emit the Finished signal
    */
   void EmitSignalFinish();
 
   /**
+   * Emit the ProgressReached signal
+   */
+  void EmitSignalProgressReached();
+
+  /**
    * Connects a callback function with the object's signals.
    * @param[in] object The object providing the signal.
    * @param[in] tracker Used to disconnect the signal.
@@ -445,13 +479,15 @@ private:
     ConnectorTargetValues()
     : targetValue(),
       timePeriod( 0.0f ),
-      connectorIndex( 0 )
+      connectorIndex( 0 ),
+      animatorType( TO )
     {
     }
 
     Property::Value targetValue;
     TimePeriod timePeriod;
     unsigned int connectorIndex;
+    Animation::Type animatorType;
   };
 
 private:
@@ -464,6 +500,16 @@ private:
    */
   static bool CompareConnectorEndTimes( const ConnectorTargetValues& lhs, const ConnectorTargetValues& rhs );
 
+  /**
+   * Notifies all the objects whose properties are being animated.
+   */
+  void NotifyObjects();
+
+  /**
+   * Sends message to SceneGraph with final progress value
+   */
+  void SendFinalProgressNotificationMessage();
+
 private:
 
   const SceneGraph::Animation* mAnimation;
@@ -473,6 +519,9 @@ private:
 
   Dali::Animation::AnimationSignalType mFinishedSignal;
 
+  Dali::Animation::AnimationSignalType mProgressReachedSignal;
+
+  typedef OwnerContainer< AnimatorConnectorBase* > AnimatorConnectorContainer;
   AnimatorConnectorContainer mConnectors; ///< Owned by the Animation
 
   typedef std::vector< ConnectorTargetValues > ConnectorTargetValuesContainer;
@@ -489,6 +538,8 @@ private:
   EndAction mDisconnectAction;
   AlphaFunction mDefaultAlpha;
   Dali::Animation::State mState;
+  float mProgressReachedMarker;
+  float mDelaySeconds;
 };
 
 } // namespace Internal