Merge "Scrollable public API clean-up phase 1" into tizen
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Wed, 25 Feb 2015 12:00:13 +0000 (04:00 -0800)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Wed, 25 Feb 2015 12:00:13 +0000 (04:00 -0800)
1  2 
dali-toolkit/internal/controls/scrollable/scroll-view/scroll-base-impl.h
dali-toolkit/public-api/controls/scrollable/item-view/item-layout.cpp
dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h
dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h

@@@ -21,8 -21,6 +21,8 @@@
  // EXTERNAL INCLUDES
  // TODO - Replace list with dali-vector.h
  #include <list>
 +#include <dali/public-api/animation/active-constraint.h>
 +#include <dali/public-api/animation/constraint.h>
  
  // INTERNAL INCLUDES
  
@@@ -202,7 -200,6 +202,6 @@@ protected
    Property::Index mPropertyTime;                    ///< Scroll Time (0 to animationDuration while animating, otherwise 0)
    Property::Index mPropertyPrePosition;             ///< Scroll Position ("scroll-position") [function of scroll-x, scroll-y]
    Property::Index mPropertyPosition;                ///< Scroll Position ("scroll-position") [function of scroll-pre-position]
-   Property::Index mPropertyScale;                   ///< Scroll Scale ("scroll-scale")
    Property::Index mPropertyOvershootX;              ///< Scroll Overshoot ("scroll-overshoot-x") [function of scroll-pre-position, scroll-position]
    Property::Index mPropertyOvershootY;              ///< Scroll Overshoot ("scroll-overshoot-y") [function of scroll-pre-position, scroll-position]
    Property::Index mPropertyWrap;                    ///< Scroll Wrap ("scroll-wrap")
@@@ -19,7 -19,6 +19,7 @@@
  #include <dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h>
  
  // EXTERNAL INCLUDES
 +#include <dali/public-api/animation/active-constraint.h>
  #include <dali/public-api/animation/constraint.h>
  #include <dali/public-api/animation/time-period.h>
  
@@@ -152,150 -151,6 +152,6 @@@ float ItemLayout::GetClosestOnScreenLay
    return currentLayoutPosition;
  }
  
- void ItemLayout::GetXAxisScrollHint(Vector2& scrollHint) const
- {
-   scrollHint = Vector2::ZERO;
-   Radian scrollAngle(GetScrollDirection());
-   Vector2 scrollDirection(sinf(scrollAngle), cosf(scrollAngle));
-   switch(mOrientation)
-   {
-     case ControlOrientation::Up:
-     {
-       if(fabsf(scrollDirection.y) < Math::MACHINE_EPSILON_1)
-       {
-         // we probably want x scrolling
-         if(scrollDirection.x > 0.0f)
-         {
-           // normal positive scrolling
-           scrollHint = Vector2::XAXIS;
-         }
-         else
-         {
-           scrollHint = -Vector2::XAXIS;
-         }
-       }
-       break;
-     }
-     case ControlOrientation::Down:
-     {
-       if(fabsf(scrollDirection.y) < Math::MACHINE_EPSILON_1)
-       {
-         // we probably want x scrolling
-         if(scrollDirection.x > 0.0f)
-         {
-           // normal positive scrolling
-           scrollHint = -Vector2::XAXIS;
-         }
-         else
-         {
-           scrollHint = Vector2::XAXIS;
-         }
-       }
-       break;
-     }
-     case ControlOrientation::Left:
-     {
-       // we probably want x scrolling
-       if(scrollDirection.x > 0.0f)
-       {
-         // normal positive scrolling
-         scrollHint = Vector2::XAXIS;
-       }
-       else
-       {
-         scrollHint = -Vector2::XAXIS;
-       }
-       break;
-     }
-     case ControlOrientation::Right:
-     {
-       // we probably want x scrolling
-       if(scrollDirection.x > 0.0f)
-       {
-         // normal positive scrolling
-         scrollHint = -Vector2::XAXIS;
-       }
-       else
-       {
-         scrollHint = Vector2::XAXIS;
-       }
-       break;
-     }
-   }
- }
- void ItemLayout::GetYAxisScrollHint(Vector2& scrollHint) const
- {
-   scrollHint = Vector2::ZERO;
-   Radian scrollAngle(GetScrollDirection());
-   Vector2 scrollDirection(sinf(scrollAngle), cosf(scrollAngle));
-   switch(mOrientation)
-   {
-     case ControlOrientation::Up:
-     {
-       // we probably want x scrolling
-       if(scrollDirection.y > 0.0f)
-       {
-         // normal positive scrolling
-         scrollHint = Vector2::YAXIS;
-       }
-       else
-       {
-         scrollHint = -Vector2::YAXIS;
-       }
-       break;
-     }
-     case ControlOrientation::Down:
-     {
-       // we probably want x scrolling
-       if(scrollDirection.y > 0.0f)
-       {
-         // normal positive scrolling
-         scrollHint = -Vector2::YAXIS;
-       }
-       else
-       {
-         scrollHint = Vector2::YAXIS;
-       }
-       break;
-     }
-     case ControlOrientation::Left:
-     {
-       if(fabsf(scrollDirection.x) < Math::MACHINE_EPSILON_1)
-       {
-         // we probably want x scrolling
-         if(scrollDirection.y > 0.0f)
-         {
-           // normal positive scrolling
-           scrollHint = -Vector2::YAXIS;
-         }
-         else
-         {
-           scrollHint = Vector2::YAXIS;
-         }
-       }
-       break;
-     }
-     case ControlOrientation::Right:
-     {
-       if(fabsf(scrollDirection.x) < Math::MACHINE_EPSILON_1)
-       {
-         // we probably want x scrolling
-         if(scrollDirection.y > 0.0f)
-         {
-           // normal positive scrolling
-           scrollHint = Vector2::YAXIS;
-         }
-         else
-         {
-           scrollHint = -Vector2::YAXIS;
-         }
-       }
-       break;
-     }
-   }
- }
  int ItemLayout::GetNextFocusItemID(int itemID, int maxItems, Dali::Toolkit::Control::KeyboardFocusNavigationDirection direction, bool loopEnabled)
  {
    switch( direction )
@@@ -330,7 -185,7 +186,7 @@@ float ItemLayout::GetFlickSpeedFactor(
    return GetScrollSpeedFactor();
  }
  
 -void ItemLayout::ApplyConstraints( Actor& actor, const int itemId, const float durationSeconds, Constrainable scrollPositionObject, const Actor& itemViewActor )
 +void ItemLayout::ApplyConstraints( Actor& actor, const int itemId, const float durationSeconds, Handle scrollPositionObject, const Actor& itemViewActor )
  {
    // This just implements the default behaviour of constraint application.
    // Custom layouts can override this function to apply their custom constraints.
@@@ -19,7 -19,6 +19,7 @@@
   */
  
  // EXTERNAL INCLUDES
 +#include <dali/public-api/animation/alpha-functions.h>
  #include <dali/public-api/common/vector-wrapper.h>
  
  // INTERNAL INCLUDES
@@@ -311,38 -310,6 +311,6 @@@ public
    virtual Degree GetScrollDirection() const = 0;
  
    /**
-    * @brief Tells scroll components how to interpolate our logical scroll position as a screen x/y direction.
-    *
-    * Application developer wants to use -ve y, +ve x as up direction and +ve y, -ve x as down direction scroll values in a
-    * vertical scroll type effect (SpiralLayout). This means that scroll bar/overshoot indicator should be affected by y-axis.
-    * Returning (0.0f, 0.0f) for x and (0.0f, -1.0f) for y tells us that we need to use the y scroll value to move the scroll bar
-    * along y axis with y scroll of 0 starting at bottom (due to -1.0f on y), a value of (0.0f, 1.0f) on x axis mask would mean using y scroll value to move scroll bar along x axis
-    *
-    * This function is used by numerous objects such as scroll indicators and scroll overshoot indicators and all
-    * layout implementations should provide their own version of this function to ensure proper functionality of
-    * internal toolkit systems.
-    *
-    * @param[out] scrollHint Vector2 describing how x and y scroll values should be used for x-axis scrolling
-    */
-   DALI_IMPORT_API virtual void GetXAxisScrollHint(Vector2& scrollHint) const;
-   /**
-    * @brief Tells scroll components how to interpolate our logical scroll position as a screen x/y direction.
-    *
-    * Application developer wants to use -ve y, +ve x as up direction and +ve y, -ve x as down direction scroll values in a
-    * vertical scroll type effect (SpiralLayout). This means that scroll bar/overshoot indicator should be affected by y-axis.
-    * Returning (0.0f, 0.0f) for x and (0.0f, -1.0f) for y tells us that we need to use the y scroll value to move the scroll bar
-    * along y axis with y scroll of 0 starting at bottom (due to -1.0f on y), a value of (0.0f, 1.0f) on x axis mask would mean using y scroll value to move scroll bar along x axis
-    *
-    * This function is used by numerous objects such as scroll indicators and scroll overshoot indicators and all
-    * layout implementations should provide their own version of this function to ensure proper functionality of
-    * internal toolkit systems.
-    *
-    * @param[out] scrollHint Vector2 describing how x and y scroll values should be used for y-axis scrolling
-    */
-   DALI_IMPORT_API virtual void GetYAxisScrollHint(Vector2& scrollHint) const;
-   /**
     * @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.
     * @param[in] scrollPositionObject The object which provides the layout position property.
     * @param[in] itemViewActor The item view instance which requests the application of constraints.
     */
 -  DALI_IMPORT_API virtual void ApplyConstraints( Actor& actor, const int itemId, const float durationSeconds, Constrainable scrollPositionObject, const Actor& itemViewActor );
 +  DALI_IMPORT_API virtual void ApplyConstraints( Actor& actor, const int itemId, const float durationSeconds, Handle scrollPositionObject, const Actor& itemViewActor );
  
    /**
     * @brief Gets the position of a given item
@@@ -18,9 -18,6 +18,9 @@@
   *
   */
  
 +// EXTERNAL INCLUDES
 +#include <dali/public-api/animation/alpha-functions.h>
 +
  // INTERNAL INCLUDES
  #include <dali-toolkit/public-api/controls/scrollable/scrollable.h>
  
@@@ -36,6 -33,26 +36,26 @@@ class ScrollView
  }
  
  /**
+  * @brief How axes/rotation or scale are clamped
+  */
+ enum ClampState
+ {
+   NotClamped,   ///< The quantity isn't clamped
+   ClampedToMin, ///< The quantity is clamped to the min value
+   ClampedToMax  ///< The quantity is clamped to the max value
+ };
+ /**
+  * @brief A 3 dimensional clamp
+  */
+ struct ClampState3D
+ {
+   ClampState x; ///< The clamp state of the x axis
+   ClampState y; ///< The clamp state of the y axis
+   ClampState z; ///< The clamp state of the z axis
+ };
+ /**
   * @brief The snap type
   */
  enum SnapType
@@@ -391,14 -408,12 +411,12 @@@ public
  
    // Custom properties
  
-   static const std::string SCROLL_PAGE_CURRENT;                         ///< Property, name "scroll-page-current",       type INT
    static const std::string SCROLL_TIME_PROPERTY_NAME;                   ///< Property, name "scroll-time",               type FLOAT
    static const std::string SCROLL_POSITION_PROPERTY_NAME;               ///< Property, name "scroll-position",           type VECTOR3
    static const std::string SCROLL_PRE_POSITION_PROPERTY_NAME;           ///< Property, name "scroll-pre-position",       type VECTOR3
    static const std::string SCROLL_OVERSHOOT_X_PROPERTY_NAME;            ///< Property, name "scroll-overshoot-x",         type float
    static const std::string SCROLL_OVERSHOOT_Y_PROPERTY_NAME;            ///< Property, name "scroll-overshoot-y",         type float
    static const std::string SCROLL_FINAL_PROPERTY_NAME;                  ///< Property, name "scroll-final",              type VECTOR3
-   static const std::string SCROLL_SCALE_PROPERTY_NAME;                  ///< Property, name "scroll-scale",              type VECTOR3
    static const std::string SCROLL_WRAP_PROPERTY_NAME;                   ///< Property, name "scroll-wrap",               type BOOLEAN
    static const std::string SCROLL_PANNING_PROPERTY_NAME;                ///< Property, name "scroll-panning",            type BOOLEAN
    static const std::string SCROLL_SCROLLING_PROPERTY_NAME;              ///< Property, name "scroll-scrolling",          type BOOLEAN
    static const float DEFAULT_FLICK_SPEED_COEFFICIENT;                   ///< Default Flick speed coefficient (multiples input touch velocity)
    static const float DEFAULT_MAX_FLICK_SPEED;                           ///< Default Maximum flick speed. (in stage diagonals per second)
  
-   /// Direction of transitions
-   enum EDirectionFlag
+ public:
+   /**
+    * @brief Clamp signal event's data
+    */
+   struct ClampEvent
    {
-     DirectionFlagLeft               = 0x01,
-     DirectionFlagRight              = 0x02,
-     DirectionFlagUp                 = 0x04,
-     DirectionFlagDown               = 0x08,
-     DirectionFlagTransitionOn       = 0x10,            ///< doesnt mean a page is moving towards centre, it affects whether the current page is using values for moving onto screen or off screen, if the user changes scroll direction we dont want things to flip over when in view
-     DirectionFlagTransitionOff      = 0x20,
-     DirectionFlagMask_Direction     = DirectionFlagLeft | DirectionFlagRight | DirectionFlagUp | DirectionFlagDown,
-     DirectionFlagMask_Transition    = DirectionFlagTransitionOn | DirectionFlagTransitionOff
+     ClampState3D scale;       ///< Clamp information for scale axes
+     ClampState3D position;    ///< Clamp information for position axes
+     ClampState   rotation;    ///< Clamp information for rotation
    };
  
- public:
    /**
     * @brief Snap signal event's data.
     */
@@@ -626,24 -638,6 +641,6 @@@ public
    void SetSnapOvershootDuration(float duration);
  
    /**
-    * @brief Sets Touches required for pan gestures.
-    *
-    * Panning requires number of touches to be within (minTouches) and
-    * (maxTouches).
-    *
-    * If (endOutside) is true, then outside this range of touches,
-    * the pan gesture will end and thus will snap.
-    *
-    * If (endOutside) is false, then outside this range of touches,
-    * the pan gesture will pause. but will not end until touches = 0.
-    *
-    * @param[in] minTouches Minimum touches for panning to occur.
-    * @param[out] maxTouches Maxiumum touches for panning to occur.
-    * @param[in] endOutside Whether to end the panning gesture outside of touch range
-    */
-   void SetTouchesRequiredForPanning(unsigned int minTouches = 1, unsigned int maxTouches = 1, bool endOutside = true);
-   /**
     * @brief Enables or Disables Actor Auto-Snap mode.
     *
     * When Actor Auto-Snap mode has been enabled, ScrollView will automatically