Use modern construct 'using' instead of typedef.
[platform/core/uifw/dali-core.git] / dali / public-api / animation / animation.h
index 34ced29..8f3b187 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef __DALI_ANIMATION_H__
-#define __DALI_ANIMATION_H__
+#ifndef DALI_ANIMATION_H
+#define DALI_ANIMATION_H
 
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
@@ -18,6 +18,9 @@
  *
  */
 
+// EXTERNAL INCLUDES
+#include <cstdint> // uint32_t
+
 // INTERNAL INCLUDES
 #include <dali/public-api/animation/alpha-function.h>
 #include <dali/public-api/animation/key-frames.h>
@@ -100,6 +103,10 @@ class Animation;
  * The overall animation time is superseded by the values given in the TimePeriod structure used when calling the AnimateTo(), AnimateBy(), AnimateBetween() and Animate() methods.
  * If any of the individual calls to those functions exceeds the overall animation time, then the overall animation time is automatically extended.
  *
+ * Using AnimateTo and AnimateBy for the same property of the same Actor will yield undefined behaviour especially if the TimePeriod overlaps.
+ *
+ * After calling Animation::Play(), Handle::GetProperty will return the target value of the animated property.
+ *
  * Signals
  * | %Signal Name | Method                   |
  * |--------------|--------------------------|
@@ -113,13 +120,12 @@ class Animation;
  * | pause        | Pause()                  |
  * @SINCE_1_0.0
  */
-class DALI_IMPORT_API Animation : public BaseHandle
+class DALI_CORE_API Animation : public BaseHandle
 {
 public:
+  using AnimationSignalType = Signal<void( Animation& )>; ///< Animation finished signal type @SINCE_1_0.0
 
-  typedef Signal< void (Animation&) > AnimationSignalType; ///< Animation finished signal type @SINCE_1_0.0
-
-  typedef Any AnyFunction; ///< Interpolation function @SINCE_1_0.0
+  using AnyFunction = Any; ///< Interpolation function @SINCE_1_0.0
 
   /**
    * @brief Enumeration for what to do when the animation ends, is stopped, or is destroyed.
@@ -127,9 +133,9 @@ public:
    */
   enum EndAction
   {
-    Bake,     ///< When the animation ends, the animated property values are saved. @SINCE_1_0.0
-    Discard,  ///< When the animation ends, the animated property values are forgotten. @SINCE_1_0.0
-    BakeFinal ///< If the animation is stopped, the animated property values are saved as if the animation had run to completion, otherwise behaves like Bake. @SINCE_1_0.0
+    BAKE,     ///< When the animation ends, the animated property values are saved. @SINCE_1_0.0
+    DISCARD,  ///< When the animation ends, the animated property values are forgotten. @SINCE_1_0.0
+    BAKE_FINAL ///< If the animation is stopped, the animated property values are saved as if the animation had run to completion, otherwise behaves like Bake. @SINCE_1_0.0
   };
 
   /**
@@ -138,8 +144,8 @@ public:
    */
   enum Interpolation
   {
-    Linear,   ///< Values in between key frames are interpolated using a linear polynomial. (Default) @SINCE_1_0.0
-    Cubic     ///< Values in between key frames are interpolated using a cubic polynomial. @SINCE_1_0.0
+    LINEAR,   ///< Values in between key frames are interpolated using a linear polynomial. (Default) @SINCE_1_0.0
+    CUBIC     ///< Values in between key frames are interpolated using a cubic polynomial. @SINCE_1_0.0
   };
 
   /**
@@ -157,6 +163,17 @@ public:
   };
 
   /**
+   * @brief Enumeration for what looping mode is in.
+   *
+   * @SINCE_1_2.60
+   */
+  enum LoopingMode
+  {
+    RESTART,      ///< When the animation arrives at the end in looping mode, the animation restarts from the beginning. @SINCE_1_2.60
+    AUTO_REVERSE  ///< When the animation arrives at the end in looping mode, the animation reverses direction and runs backwards again. @SINCE_1_2.60
+  };
+
+  /**
    * @brief Creates an uninitialized Animation; this can be initialized with Animation::New().
    *
    * Calling member functions with an uninitialized Animation handle is not allowed.
@@ -215,6 +232,23 @@ public:
   Animation& operator=(const Animation& rhs);
 
   /**
+   * @brief Move constructor.
+   *
+   * @SINCE_1_9.22
+   * @param[in] rhs A reference to the moved handle
+   */
+  Animation( Animation&& rhs );
+
+  /**
+   * @brief Move assignment operator.
+   *
+   * @SINCE_1_9.22
+   * @param[in] rhs A reference to the moved handle
+   * @return A reference to this handle
+   */
+  Animation& operator=( Animation&& rhs );
+
+  /**
    * @brief Sets the duration of an animation.
    *
    * @SINCE_1_0.0
@@ -246,13 +280,13 @@ public:
    * @brief Enables looping for 'count' repeats.
    *
    * A zero is the same as SetLooping(true) i.e. repeat forever.
-   * If Play() Stop() or 'count' loops is reached, the loop counter will reset.
+   * This function resets the looping value and should not be used with SetLooping(bool).
    * Setting this parameter does not cause the animation to Play().
    *
    * @SINCE_1_1.20
    * @param[in] count The number of times to loop
    */
-  void SetLoopCount(int count);
+  void SetLoopCount(int32_t  count);
 
   /**
    * @brief Gets the loop count.
@@ -263,7 +297,7 @@ public:
    * @SINCE_1_1.20
    * @return The number of times to loop
    */
-  int GetLoopCount();
+  int32_t  GetLoopCount();
 
   /**
    * @brief Gets the current loop count.
@@ -273,7 +307,7 @@ public:
    * @SINCE_1_1.20
    * @return The current number of loops that have occured
    */
-  int GetCurrentLoop();
+  int32_t  GetCurrentLoop();
 
   /**
    * @brief Queries whether the animation will loop.
@@ -336,7 +370,7 @@ public:
    */
   AlphaFunction GetDefaultAlphaFunction() const;
 
-  /*
+  /**
    * @brief Sets the progress of the animation.
    *
    * The animation will play (or continue playing) from this point. The progress
@@ -415,6 +449,16 @@ public:
   void PlayFrom( float progress );
 
   /**
+   * @brief Play the animation after a given delay time.
+   *
+   * The delay time is not included in the looping time.
+   * When the delay time is negative value, it would treat as play immediately.
+   * @SINCE_1_2.60
+   * @param[in] delaySeconds The delay time
+   */
+  void PlayAfter( float delaySeconds );
+
+  /**
    * @brief Pauses the animation.
    * @SINCE_1_0.0
    */
@@ -442,6 +486,23 @@ public:
   void Clear();
 
   /**
+   * @brief Sets the looping mode.
+   *
+   * Animation plays forwards and then restarts from the beginning or runs backwards again.
+   * @SINCE_1_2.60
+   * @param[in] loopingMode The looping mode is one of RESTART and AUTO_REVERSE
+   */
+  void SetLoopingMode( LoopingMode loopingMode );
+
+  /**
+   * @brief Gets one of the current looping mode.
+   *
+   * @SINCE_1_2.60
+   * @return The current looping mode
+   */
+  LoopingMode GetLoopingMode() const;
+
+  /**
    * @brief Connects to this signal to be notified when an Animation's animations have finished.
    *
    * @SINCE_1_0.0
@@ -593,7 +654,7 @@ public:
    * @SINCE_1_0.0
    * @param[in] target The target object property to animate
    * @param[in] keyFrames The set of time/value pairs between which to animate
-   * @param[in] period The effect will occur duing this time period
+   * @param[in] period The effect will occur during this time period
    * @param[in] interpolation The method used to interpolate between values
    */
   void AnimateBetween(Property target, KeyFrames& keyFrames, TimePeriod period, Interpolation interpolation);
@@ -616,7 +677,7 @@ public:
    * @param[in] target The target object property to animate
    * @param[in] keyFrames The set of time/value pairs between which to animate
    * @param[in] alpha The alpha function to apply to the overall progress
-   * @param[in] period The effect will occur duing this time period
+   * @param[in] period The effect will occur during this time period
    * @param[in] interpolation The method used to interpolate between values
    */
   void AnimateBetween(Property target, KeyFrames& keyFrames, AlphaFunction alpha, TimePeriod period, Interpolation interpolation);
@@ -716,4 +777,4 @@ public: // Not intended for use by Application developers
  */
 } // namespace Dali
 
-#endif // __DALI_ANIMATION_H__
+#endif // DALI_ANIMATION_H