ItemView API to set the alpha function 62/18162/3
authorPaul Wisbey <p.wisbey@samsung.com>
Mon, 17 Mar 2014 14:22:51 +0000 (14:22 +0000)
committerPaul Wisbey <p.wisbey@samsung.com>
Mon, 17 Mar 2014 18:07:11 +0000 (18:07 +0000)
[Issue#]   N/A
[Problem]  Can't customize ItemView constraint animations
[Cause]    API limitations
[Solution] Added API to set the alpha function

Change-Id: I9cd7e789739916e084a6b122b871c8e33c5b4d98
Signed-off-by: Paul Wisbey <p.wisbey@samsung.com>
capi/dali-toolkit/public-api/controls/scrollable/item-view/item-view.h
dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp
dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.h
dali-toolkit/public-api/controls/scrollable/item-view/item-view.cpp

index d7b04c6..5d123b1 100644 (file)
@@ -175,6 +175,20 @@ public:
   void DeactivateCurrentLayout();
 
   /**
   void DeactivateCurrentLayout();
 
   /**
+   * @brief Set default the alpha function used when applying constraints e.g. during ActivateLayout().
+   *
+   * @param[in] func The default alpha function to use.
+   */
+  void SetDefaultAlphaFunction(AlphaFunction func);
+
+  /**
+   * @brief Retrieve the default alpha function for an animation.
+   *
+   * @return The default alpha function.
+   */
+  AlphaFunction GetDefaultAlphaFunction() const;
+
+  /**
    * @brief Set the minimum swipe speed in pixels per second; A pan
    * gesture must exceed this to trigger a swipe.
    *
    * @brief Set the minimum swipe speed in pixels per second; A pan
    * gesture must exceed this to trigger a swipe.
    *
index dad90ef..d38f69c 100644 (file)
@@ -19,7 +19,6 @@
 
 // EXTERNAL INCLUDES
 #include <algorithm>
 
 // EXTERNAL INCLUDES
 #include <algorithm>
-#include <set>
 
 // INTERNAL INCLUDES
 #include <dali/public-api/events/mouse-wheel-event.h>
 
 // INTERNAL INCLUDES
 #include <dali/public-api/events/mouse-wheel-event.h>
@@ -396,6 +395,7 @@ ItemView::ItemView(ItemFactory& factory)
 : Scrollable(),
   mItemFactory(factory),
   mActiveLayout(NULL),
 : Scrollable(),
   mItemFactory(factory),
   mActiveLayout(NULL),
+  mDefaultAlphaFunction(Dali::Constraint::DEFAULT_ALPHA_FUNCTION),
   mAnimatingOvershootOn(false),
   mAnimateOvershootOff(false),
   mAnchoringEnabled(true),
   mAnimatingOvershootOn(false),
   mAnimateOvershootOff(false),
   mAnchoringEnabled(true),
@@ -634,6 +634,16 @@ void ItemView::DeactivateCurrentLayout()
   CancelRefreshTimer();
 }
 
   CancelRefreshTimer();
 }
 
+void ItemView::SetDefaultAlphaFunction(AlphaFunction func)
+{
+  mDefaultAlphaFunction = func;
+}
+
+AlphaFunction ItemView::GetDefaultAlphaFunction() const
+{
+  return mDefaultAlphaFunction;
+}
+
 bool ItemView::OnRefreshTick()
 {
   // Short-circuit if there is no active layout
 bool ItemView::OnRefreshTick()
 {
   // Short-circuit if there is no active layout
@@ -1115,6 +1125,7 @@ void ItemView::ApplyConstraints(Actor& actor, ItemLayout& layout, unsigned int i
                                                       ParentSource( Actor::SIZE ),
                                                       wrapped );
     constraint.SetApplyTime(duration);
                                                       ParentSource( Actor::SIZE ),
                                                       wrapped );
     constraint.SetApplyTime(duration);
+    constraint.SetAlphaFunction(mDefaultAlphaFunction);
 
     actor.ApplyConstraint(constraint);
   }
 
     actor.ApplyConstraint(constraint);
   }
@@ -1130,6 +1141,7 @@ void ItemView::ApplyConstraints(Actor& actor, ItemLayout& layout, unsigned int i
                                                          ParentSource( Actor::SIZE ),
                                                          wrapped );
     constraint.SetApplyTime(duration);
                                                          ParentSource( Actor::SIZE ),
                                                          wrapped );
     constraint.SetApplyTime(duration);
+    constraint.SetAlphaFunction(mDefaultAlphaFunction);
 
     actor.ApplyConstraint(constraint);
   }
 
     actor.ApplyConstraint(constraint);
   }
@@ -1145,6 +1157,7 @@ void ItemView::ApplyConstraints(Actor& actor, ItemLayout& layout, unsigned int i
                                                       ParentSource( Actor::SIZE ),
                                                       wrapped );
     constraint.SetApplyTime(duration);
                                                       ParentSource( Actor::SIZE ),
                                                       wrapped );
     constraint.SetApplyTime(duration);
+    constraint.SetAlphaFunction(mDefaultAlphaFunction);
 
     actor.ApplyConstraint(constraint);
   }
 
     actor.ApplyConstraint(constraint);
   }
@@ -1160,6 +1173,7 @@ void ItemView::ApplyConstraints(Actor& actor, ItemLayout& layout, unsigned int i
                                                       ParentSource( Actor::SIZE ),
                                                       wrapped );
     constraint.SetApplyTime(duration);
                                                       ParentSource( Actor::SIZE ),
                                                       wrapped );
     constraint.SetApplyTime(duration);
+    constraint.SetAlphaFunction(mDefaultAlphaFunction);
 
     // Release color constraints slowly; this allows ItemView to co-exist with ImageActor fade-in
     constraint.SetRemoveTime(DEFAULT_COLOR_VISIBILITY_REMOVE_TIME);
 
     // Release color constraints slowly; this allows ItemView to co-exist with ImageActor fade-in
     constraint.SetRemoveTime(DEFAULT_COLOR_VISIBILITY_REMOVE_TIME);
@@ -1179,6 +1193,7 @@ void ItemView::ApplyConstraints(Actor& actor, ItemLayout& layout, unsigned int i
                                                    ParentSource( Actor::SIZE ),
                                                    wrapped );
     constraint.SetApplyTime(duration);
                                                    ParentSource( Actor::SIZE ),
                                                    wrapped );
     constraint.SetApplyTime(duration);
+    constraint.SetAlphaFunction(mDefaultAlphaFunction);
 
     // Release visibility constraints the same time as the color constraint
     constraint.SetRemoveTime(DEFAULT_COLOR_VISIBILITY_REMOVE_TIME);
 
     // Release visibility constraints the same time as the color constraint
     constraint.SetRemoveTime(DEFAULT_COLOR_VISIBILITY_REMOVE_TIME);
index f92894e..a6972ca 100644 (file)
@@ -19,7 +19,6 @@
 
 // EXTERNAL INCLUDES
 #include <dali/dali.h>
 
 // EXTERNAL INCLUDES
 #include <dali/dali.h>
-#include <map>
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/public-api/controls/control-impl.h>
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/public-api/controls/control-impl.h>
@@ -100,6 +99,16 @@ public:
   void ActivateLayout(unsigned int layoutIndex, const Vector3& targetSize, float durationSeconds);
 
   /**
   void ActivateLayout(unsigned int layoutIndex, const Vector3& targetSize, float durationSeconds);
 
   /**
+   * @copydoc Toolkit::ItemView::SetDefaultAlphaFunction
+   */
+  void SetDefaultAlphaFunction(AlphaFunction func);
+
+  /**
+   * @copydoc Toolkit::ItemView::GetDefaultAlphaFunction
+   */
+  AlphaFunction GetDefaultAlphaFunction() const;
+
+  /**
    * @copydoc Toolkit::ItemView::DeactivateCurrentLayout
    */
   void DeactivateCurrentLayout();
    * @copydoc Toolkit::ItemView::DeactivateCurrentLayout
    */
   void DeactivateCurrentLayout();
@@ -492,6 +501,8 @@ private:
   ItemLayout* mActiveLayout;
   Vector3 mActiveLayoutTargetSize;
 
   ItemLayout* mActiveLayout;
   Vector3 mActiveLayoutTargetSize;
 
+  AlphaFunction mDefaultAlphaFunction;
+
   Animation mResizeAnimation;
   Animation mScrollAnimation;
   Animation mScrollSpeedAnimation;
   Animation mResizeAnimation;
   Animation mScrollAnimation;
   Animation mScrollSpeedAnimation;
index 3e7f757..eff45ac 100644 (file)
@@ -112,6 +112,16 @@ void ItemView::DeactivateCurrentLayout()
   GetImpl(*this).DeactivateCurrentLayout();
 }
 
   GetImpl(*this).DeactivateCurrentLayout();
 }
 
+void ItemView::SetDefaultAlphaFunction(AlphaFunction func)
+{
+  GetImpl(*this).SetDefaultAlphaFunction(func);
+}
+
+AlphaFunction ItemView::GetDefaultAlphaFunction() const
+{
+  return GetImpl(*this).GetDefaultAlphaFunction();
+}
+
 void ItemView::SetMinimumSwipeSpeed(float speed)
 {
   GetImpl(*this).SetMinimumSwipeSpeed(speed);
 void ItemView::SetMinimumSwipeSpeed(float speed)
 {
   GetImpl(*this).SetMinimumSwipeSpeed(speed);