Move the logic of constraint application from ItemView to the layout
[platform/core/uifw/dali-toolkit.git] / capi / dali-toolkit / public-api / controls / scrollable / item-view / item-layout.h
index 98deaec..727709b 100644 (file)
@@ -345,9 +345,9 @@ public:
   virtual void GetYAxisScrollHint(Vector2& scrollHint) const;
 
   /**
-   * @brief Query the scroll speed factor of the layout.
+   * @brief Query the scroll speed factor of the layout while dragging.
    *
-   * This factor is used by the layout to customise its scroll speed while dragging and swiping.
+   * This factor is used by the layout to customise its scroll speed while dragging.
    * The factor will be multiplied with the scroll distance of how many pixels in actor coordinate,
    * and the layout position of the actors in ItemView will be moved by this result.
    * For example, when the speed factor is 0.01, if the scroll distance is 100 pixels, the layout
@@ -387,6 +387,55 @@ public:
    */
   virtual int GetNextFocusItemID(int itemID, int maxItems, Dali::Toolkit::Control::KeyboardFocusNavigationDirection direction, bool loopEnabled);
 
+  /**
+   * @brief Query the flick speed factor of the layout while swipping.
+   *
+   * This factor is used by the layout to customise its scroll speed while swiping.
+   * The factor will be multiplied with the scroll distance of how many pixels in actor coordinate,
+   * and the layout position of the actors in ItemView will be moved by this result.
+   * For example, when the speed factor is 0.01, if the scroll distance is 100 pixels, the layout
+   * position of actors will be moved by 1.
+   * Therefore, the bigger the factor is, the faster the flick speed will be.
+   *
+   * @return The scroll speed factor of the layout.
+   */
+  virtual float GetFlickSpeedFactor() const;
+
+  /*
+   * @brief Applies constraints defined by the layout to an actor.
+   *
+   * @param[in] actor The actor to constrain.
+   * @param[in] itemId The ID of the item represented by the actor.
+   * @param[in] durationSeconds The time taken to fully constrain the actors.
+   * @param[in] scrollPositionObject The object which provides the layout position property.
+   * @param[in] itemViewActor The item view instance which requests the application of constraints.
+   */
+  virtual void ApplyConstraints( Actor& actor, const int itemId, const float durationSeconds, Constrainable scrollPositionObject, const Actor& itemViewActor );
+
+  /**
+   * @brief Gets the position of a given item
+   *
+   * @param[in] itemID id of the item we want to get its position
+   * @param[in] currentLayoutPosition the current layout position of the item view instance
+   * @param[in] layoutSize the current size of the item view instance
+   * @return The item position (x,y,z)
+   */
+  virtual Vector3 GetItemPosition(int itemID, float currentLayoutPosition, const Vector3& layoutSize) const;
+
+  /**
+   * @brief Set the alpha function used when applying constraints
+   *
+   * @param[in] func The alpha function to use.
+   */
+  void SetAlphaFunction(AlphaFunction func);
+
+  /**
+   * @brief Retrieve the alpha function used when applying constraints
+   *
+   * @return The alpha function.
+   */
+  AlphaFunction GetAlphaFunction() const;
+
 protected:
 
   /**
@@ -396,7 +445,8 @@ protected:
 
 protected:
 
-  ControlOrientation::Type mOrientation; ///< the orientation of the layout.
+  ControlOrientation::Type mOrientation;   ///< the orientation of the layout.
+  AlphaFunction            mAlphaFunction; ///<Alpha function to be applied when removing/adding constraints
 };
 
 } // namespace Toolkit