Ensure BaseHandle class move noexcept (core public-api)
[platform/core/uifw/dali-core.git] / dali / public-api / events / pan-gesture-detector.h
index 3f6449d..7a0108d 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef __DALI_PAN_GESTURE_DETECTOR_H__
-#define __DALI_PAN_GESTURE_DETECTOR_H__
+#ifndef DALI_PAN_GESTURE_DETECTOR_H
+#define DALI_PAN_GESTURE_DETECTOR_H
 
 /*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
 
 // INTERNAL INCLUDES
 #include <dali/public-api/events/gesture-detector.h>
+#include <dali/public-api/events/pan-gesture.h>
 #include <dali/public-api/object/property-index-ranges.h>
 #include <dali/public-api/signals/dali-signal.h>
 
 namespace Dali
 {
-
 struct Radian;
 
 namespace Internal DALI_INTERNAL
@@ -36,8 +36,6 @@ namespace Internal DALI_INTERNAL
 class PanGestureDetector;
 }
 
-struct PanGesture;
-
 /**
  * @addtogroup dali_core_events
  * @{
@@ -69,7 +67,6 @@ struct PanGesture;
 class DALI_CORE_API PanGestureDetector : public GestureDetector
 {
 public:
-
   /**
    * @brief Enumeration for the instance of properties belonging to the PanGestureDetector class.
    * @SINCE_1_0.0
@@ -93,10 +90,10 @@ public:
   };
 
   // Typedefs
-  typedef Signal< void ( Actor, const PanGesture& ) > DetectedSignalType; ///< Pan gesture detected signal type @SINCE_1_0.0
+  using DetectedSignalType = Signal<void(Actor, const PanGesture&)>; ///< Pan gesture detected signal type @SINCE_1_0.0
 
   // Directional Pan
-  typedef std::pair< Radian, Radian > AngleThresholdPair; ///< Range of angles for a direction @SINCE_1_0.0
+  using AngleThresholdPair = std::pair<Radian, Radian>; ///< Range of angles for a direction @SINCE_1_0.0
 
   static const Radian DIRECTION_LEFT;       ///< For a left pan (-PI Radians).
   static const Radian DIRECTION_RIGHT;      ///< For a right pan (0 Radians).
@@ -105,10 +102,9 @@ public:
   static const Radian DIRECTION_HORIZONTAL; ///< For a left and right pan (PI Radians). Useful for AddDirection().
   static const Radian DIRECTION_VERTICAL;   ///< For an up and down pan (-0.5 * PI Radians). Useful for AddDirection().
 
-  static const Radian DEFAULT_THRESHOLD;    ///< The default threshold is PI * 0.25 radians (or 45 degrees).
+  static const Radian DEFAULT_THRESHOLD; ///< The default threshold is PI * 0.25 radians (or 45 degrees).
 
 public: // Creation & Destruction
-
   /**
    * @brief Creates an uninitialized PanGestureDetector; this can be initialized with PanGestureDetector::New().
    *
@@ -134,7 +130,7 @@ public: // Creation & Destruction
    * @param[in] handle Handle to an object
    * @return Handle to a PanGestureDetector object or an uninitialized handle
    */
-  static PanGestureDetector DownCast( BaseHandle handle );
+  static PanGestureDetector DownCast(BaseHandle handle);
 
   /**
    * @brief Destructor.
@@ -161,9 +157,25 @@ public: // Creation & Destruction
    */
   PanGestureDetector& operator=(const PanGestureDetector& rhs);
 
-public: // Setters
+  /**
+   * @brief This move constructor is required for (smart) pointer semantics.
+   *
+   * @SINCE_2_2.4
+   * @param[in] handle A reference to the moved handle
+   */
+  PanGestureDetector(PanGestureDetector&& handle) noexcept;
 
   /**
+   * @brief This move assignment operator is required for (smart) pointer semantics.
+   *
+   * @SINCE_2_2.4
+   * @param[in] rhs A reference to the moved handle
+   * @return A reference to this
+   */
+  PanGestureDetector& operator=(PanGestureDetector&& rhs) noexcept;
+
+public: // Setters
+  /**
    * @brief This is the minimum number of touches required for the pan gesture to be detected.
    *
    * @SINCE_1_0.0
@@ -183,8 +195,18 @@ public: // Setters
    */
   void SetMaximumTouchesRequired(uint32_t maximum);
 
-public: // Getters
+  /**
+   * @brief This value is a maximum duration of motion can live on the pan gesture event queue.
+   * If duration exceed it, the motion event is discarded.
+   *
+   * @SINCE_2_1.28
+   * @param[in] maximumAge Maximum age of motion events as milliseconds
+   * @pre The gesture detector has been initialized.
+   * @note The default maximumAge is 'std::numeric_limits<uint32_t>::max()'.
+   */
+  void SetMaximumMotionEventAge(uint32_t maximumAge);
 
+public: // Getters
   /**
    * @brief Retrieves the minimum number of touches required for the pan gesture to be detected.
    *
@@ -203,8 +225,16 @@ public: // Getters
    */
   uint32_t GetMaximumTouchesRequired() const;
 
-public: // Directional Panning
+  /**
+   * @brief Retrieves the maximum age for the pan gesture motion as milliseconds.
+   *
+   * @SINCE_2_1.28
+   * @return The maximum age of motion events as milliseconds
+   * @pre The gesture detector has been initialized.
+   */
+  uint32_t GetMaximumMotionEventAge() const;
 
+public: // Directional Panning
   /**
    * @brief The pan gesture is only emitted if the pan occurs in the direction specified by this method with a +/- threshold allowance.
    *
@@ -238,7 +268,7 @@ public: // Directional Panning
    * @note If the threshold is greater than PI, then PI will be used as the threshold.
    *
    */
-  void AddAngle( Radian angle, Radian threshold = DEFAULT_THRESHOLD );
+  void AddAngle(Radian angle, Radian threshold = DEFAULT_THRESHOLD);
 
   /**
    * @brief A helper method for adding bi-directional angles where the pan should take place.
@@ -260,7 +290,7 @@ public: // Directional Panning
    *
    * @see AddAngle
    */
-  void AddDirection( Radian direction, Radian threshold = DEFAULT_THRESHOLD );
+  void AddDirection(Radian direction, Radian threshold = DEFAULT_THRESHOLD);
 
   /**
    * @brief Returns the count of angles that this pan gesture detector emits a signal.
@@ -302,7 +332,7 @@ public: // Directional Panning
    * @note If an angle outside the range in AddAngle() is given, then the value is wrapped within
    *       the range and that is removed.
    */
-  void RemoveAngle( Radian angle );
+  void RemoveAngle(Radian angle);
 
   /**
    * @brief Removes the two angles that make up the direction from the container.
@@ -313,10 +343,9 @@ public: // Directional Panning
    * @note If a direction outside the range in AddAngle() is given, then the value is wrapped within
    *       the range and that is removed.
    */
-  void RemoveDirection( Radian direction );
+  void RemoveDirection(Radian direction);
 
 public: // Signals
-
   /**
    * @brief This signal is emitted when the pan gesture is detected on the attached actor.
    *
@@ -331,7 +360,6 @@ public: // Signals
   DetectedSignalType& DetectedSignal();
 
 public: // Pan Properties Setters
-
   /**
    * @brief Allows setting of the pan properties that are returned in constraints.
    *
@@ -339,10 +367,9 @@ public: // Pan Properties Setters
    * @param[in] pan The pan gesture to set
    * @note If a normal pan is taking place, then any value set is ignored.
    */
-  static void SetPanGestureProperties( const PanGesture& pan );
+  static void SetPanGestureProperties(const PanGesture& pan);
 
 public: // Not intended for Application developers
-
   /// @cond internal
   /**
    * @brief This constructor is used by PanGestureDetector::New() methods.
@@ -352,7 +379,6 @@ public: // Not intended for Application developers
    */
   explicit DALI_INTERNAL PanGestureDetector(Internal::PanGestureDetector* internal);
   /// @endcond
-
 };
 
 /**
@@ -361,4 +387,4 @@ public: // Not intended for Application developers
 
 } // namespace Dali
 
-#endif // __DALI_PAN_GESTURE_DETECTOR_H__
+#endif // DALI_PAN_GESTURE_DETECTOR_H