DALI_SIGNAL_REGISTRATION( Toolkit, ItemView, "layoutActivated", LAYOUT_ACTIVATED_SIGNAL )
+DALI_ACTION_REGISTRATION( Toolkit, ItemView, "stopScrolling", ACTION_STOP_SCROLLING )
+
DALI_TYPE_REGISTRATION_END()
bool FindById( const ItemContainer& items, ItemId id )
{
RemoveAnimation(mScrollAnimation);
mScrollAnimation = Animation::New(durationSeconds);
- mScrollAnimation.AnimateTo( Property(self, Toolkit::ItemView::Property::LAYOUT_POSITION), firstItemScrollPosition, AlphaFunction::EASE_OUT );
+ mScrollAnimation.AnimateTo( Property(self, Toolkit::ItemView::Property::LAYOUT_POSITION), firstItemScrollPosition, mScrollToAlphaFunction );
mScrollAnimation.FinishedSignal().Connect(this, &ItemView::OnScrollFinished);
mScrollAnimation.Play();
}
{
RemoveAnimation(mScrollAnimation);
mScrollAnimation = Animation::New(duration);
- mScrollAnimation.AnimateTo( Property(self, Toolkit::ItemView::Property::LAYOUT_POSITION), firstItemScrollPosition, AlphaFunction::EASE_OUT );
+ mScrollAnimation.AnimateTo( Property(self, Toolkit::ItemView::Property::LAYOUT_POSITION), firstItemScrollPosition, mScrollToAlphaFunction );
mScrollAnimation.FinishedSignal().Connect(this, &ItemView::OnScrollFinished);
mScrollAnimation.Play();
}
return value;
}
+bool ItemView::DoAction( BaseObject* object, const std::string& actionName, const Property::Map& attributes )
+{
+ Dali::BaseHandle handle( object );
+
+ Toolkit::ItemView itemView = Toolkit::ItemView::DownCast( handle );
+
+ DALI_ASSERT_ALWAYS( itemView );
+
+ if( 0 == strcmp( actionName.c_str(), ACTION_STOP_SCROLLING ) )
+ {
+ GetImpl( itemView ).DoStopScrolling();
+ }
+
+ return true;
+}
+
+void ItemView::DoStopScrolling()
+{
+ if( mScrollAnimation )
+ {
+ mScrollAnimation.Stop();
+ mScrollAnimation.Reset();
+ }
+}
+
} // namespace Internal
} // namespace Toolkit
*/
static Property::Value GetProperty( BaseObject* object, Property::Index index );
+ /**
+ * Performs actions as requested using the action name.
+ * @param[in] object The object on which to perform the action.
+ * @param[in] actionName The action to perform.
+ * @param[in] attributes The attributes with which to perfrom this action.
+ * @return true if action has been accepted by this control
+ */
+ static bool DoAction( BaseObject* object, const std::string& actionName, const Property::Map& attributes );
+
+ /**
+ * Helper for DoAction( ACTION_STOP_SCROLLING ).
+ */
+ void DoStopScrolling();
+
private:
/**
DALI_PROPERTY_REGISTRATION( Toolkit, Scrollable, "overshootAnimationSpeed", FLOAT, OVERSHOOT_ANIMATION_SPEED )
DALI_PROPERTY_REGISTRATION( Toolkit, Scrollable, "overshootEnabled", BOOLEAN, OVERSHOOT_ENABLED )
DALI_PROPERTY_REGISTRATION( Toolkit, Scrollable, "overshootSize", VECTOR2, OVERSHOOT_SIZE )
+DALI_PROPERTY_REGISTRATION( Toolkit, Scrollable, "scrollToAlphaFunction", INTEGER, SCROLL_TO_ALPHA_FUNCTION )
DALI_ANIMATABLE_PROPERTY_REGISTRATION( Toolkit, Scrollable, "scrollRelativePosition", VECTOR2, SCROLL_RELATIVE_POSITION)
DALI_ANIMATABLE_PROPERTY_REGISTRATION( Toolkit, Scrollable, "scrollPositionMin", VECTOR2, SCROLL_POSITION_MIN)
mOvershootEffectColor( DEFAULT_OVERSHOOT_COLOUR ),
mOvershootAnimationSpeed ( DEFAULT_OVERSHOOT_ANIMATION_SPEED ),
mOvershootSize( OVERSHOOT_DEFAULT_SIZE ),
+ mScrollToAlphaFunction( AlphaFunction::EASE_OUT ),
mOvershootEnabled(true)
{
}
mOvershootEffectColor( DEFAULT_OVERSHOOT_COLOUR ),
mOvershootAnimationSpeed ( DEFAULT_OVERSHOOT_ANIMATION_SPEED ),
mOvershootSize( OVERSHOOT_DEFAULT_SIZE ),
+ mScrollToAlphaFunction( AlphaFunction::EASE_OUT ),
mOvershootEnabled(true)
{
}
scrollableImpl.EnableScrollOvershoot( scrollableImpl.IsOvershootEnabled() );
break;
}
+ case Toolkit::Scrollable::Property::SCROLL_TO_ALPHA_FUNCTION:
+ {
+ int alphaFunction = value.Get<int>();
+
+ if( alphaFunction >= AlphaFunction::DEFAULT &&
+ alphaFunction < AlphaFunction::COUNT )
+ {
+ scrollableImpl.mScrollToAlphaFunction = static_cast< AlphaFunction::BuiltinFunction >( alphaFunction );
+ }
+ break;
+ }
}
}
}
value = scrollableImpl.mOvershootSize;
break;
}
+ case Toolkit::Scrollable::Property::SCROLL_TO_ALPHA_FUNCTION:
+ {
+ value = static_cast<int>( scrollableImpl.mScrollToAlphaFunction );
+ break;
+ }
}
}
*
*/
+// EXTERNAL INCLUDES
+#include <dali/public-api/animation/alpha-function.h>
+
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/control-impl.h>
#include <dali-toolkit/public-api/controls/scrollable/scrollable.h>
float mOvershootAnimationSpeed; ///<The speed of the overshoot animation (pixels per second)
Vector2 mOvershootSize; ///<The size of the overshoot effect
+ Dali::AlphaFunction::BuiltinFunction mScrollToAlphaFunction; ///< The ScrollTo() animations use this
+
Toolkit::Scrollable::ScrollStartedSignalType mScrollStartedSignal;
Toolkit::Scrollable::ScrollUpdatedSignalType mScrollUpdatedSignal;
Toolkit::Scrollable::ScrollCompletedSignalType mScrollCompletedSignal;
* |---------------------------------|--------------------------------------------|
* | layoutActivated | @ref LayoutActivatedSignal() |
* @SINCE_1_0.0
+ *
+ * Actions
+ * | %Action Name | Attributes | Description |
+ * |---------------|-------------------------|-------------------------------------------------|
+ * | stopScrolling | Doesn't have attributes | Stops the scroll animation. See @ref DoAction() |
+ * @SINCE_1_1.33
*/
class DALI_IMPORT_API ItemView : public Scrollable
* | %Signal Name | Method |
* |------------------|------------------------------|
* | scrollStarted | @ref ScrollStartedSignal() |
- * | scrollCompleted | @ref ScrollUpdatedSignal() |
- * | scrollUpdated | @ref ScrollCompletedSignal() |
+ * | scrollCompleted | @ref ScrollCompletedSignal() |
+ * | scrollUpdated | @ref ScrollUpdatedSignal() |
* @SINCE_1_0.0
*/
class DALI_IMPORT_API Scrollable : public Control
OVERSHOOT_ANIMATION_SPEED, ///< Property, name "overshootAnimationSpeed", @see SetOvershootAnimationSpeed(), type float @SINCE_1_0.0
OVERSHOOT_ENABLED, ///< Property, name "overshootEnabled", @see SetOvershootEnabled(), type bool, @SINCE_1_1.18
OVERSHOOT_SIZE, ///< Property, name "overshootSize", type Vector2, @SINCE_1_1.31
+ SCROLL_TO_ALPHA_FUNCTION, ///< Property, name "scrollToAlphaFunction", type int, @SINCE_1_1.33
// Animatable properties
SCROLL_RELATIVE_POSITION = ANIMATABLE_PROPERTY_START_INDEX, ///< Property, name "scrollRelativePosition", type Vector2 @SINCE_1_0.0
Dali::Stage::GetCurrent().Add( itemView );
~~~
+## Actions
+The item-view provides an action to stop the scroll animation if desired.
+
+~~~{.cpp}
+Property::Map attributes;
+itemView.DoAction( "stopScrolling", attributes );
+~~~
+
+
*/
\ No newline at end of file