1 #ifndef __DALI_TOOLKIT_INTERNAL_SCROLL_VIEW_H__
2 #define __DALI_TOOLKIT_INTERNAL_SCROLL_VIEW_H__
5 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/dali.h>
25 #include <dali-toolkit/public-api/controls/control-impl.h>
26 #include <dali-toolkit/internal/controls/scrollable/scroll-view/scroll-base-impl.h>
27 #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h>
28 #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-effect.h>
30 // predefined effect includes
31 #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-custom-effect.h>
43 typedef IntrusivePtr<ScrollView> ScrollViewPtr;
45 class ScrollInternalConstraints;
46 typedef IntrusivePtr<ScrollInternalConstraints> ScrollInternalConstraintsPtr;
48 class ScrollOvershootIndicator;
49 typedef IntrusivePtr<ScrollOvershootIndicator> ScrollOvershootIndicatorPtr;
52 * @copydoc Toolkit::ScrollView
54 class ScrollView : public ScrollBase
59 * FindDirection specifies how searching is conducted within the Find... routines.
63 None = -3, ///< Includes none within the search query.
64 All = -2, ///< Includes all within the search query.
65 Left = -1, ///< Includes only those not right !(>)
66 Right = 1, ///< Includes only those right (>)
67 Up = -1, ///< Includes only those not below !(>)
68 Down = 1, ///< Includes only those below (>)
69 Out = -1, ///< Includes only those not infront !(>)
70 In = 1 ///< Includes only those infront (>)
75 LockPossible = 0, ///< Locking is possible, but not set in stone yet.
76 LockHorizontal, ///< Locking is set to horizontal. (can pan vertically)
77 LockVertical, ///< Locking is set to vertical. (can pan horizontally)
78 LockNone ///< Locking is set to none (free panning).
83 AnimatingInternalX = 0x01, ///< animating mPropertyX due to externally requested ScrollTo or internal snapping operation
84 AnimatingInternalY = 0x02, ///< animating mPropertyY due to externally requested ScrollTo or internal snapping operation
85 SnappingInternalX = 0x04, ///< snapping mPropertyX back to mPropertyPreScroll x value to remove x overshoot over time
86 SnappingInternalY = 0x08, ///< snapping mPropertyY back to mPropertyPreScroll y value to remove y overshoot over time
89 static const unsigned int SCROLL_X_STATE_MASK = AnimatingInternalX | SnappingInternalX;
90 static const unsigned int SCROLL_Y_STATE_MASK = AnimatingInternalY | SnappingInternalY;
91 static const unsigned int SCROLL_ANIMATION_FLAGS = AnimatingInternalX | AnimatingInternalY;
92 static const unsigned int SNAP_ANIMATION_FLAGS = SnappingInternalX | SnappingInternalY;
97 * Create a new ScrollView.
98 * @return A public handle to the newly allocated ScrollView.
100 static Dali::Toolkit::ScrollView New();
105 * @copydoc Toolkit::ScrollView::GetScrollSnapAlphaFunction
107 AlphaFunction GetScrollSnapAlphaFunction() const;
110 * @copydoc Toolkit::ScrollView::SetScrollSnapAlphaFunction
112 void SetScrollSnapAlphaFunction(AlphaFunction alpha);
115 * @copydoc Toolkit::ScrollView::GetScrollFlickAlphaFunction
117 AlphaFunction GetScrollFlickAlphaFunction() const;
120 * @copydoc Toolkit::ScrollView::SetScrollFlickAlphaFunction
122 void SetScrollFlickAlphaFunction(AlphaFunction alpha);
125 * @copydoc Toolkit::ScrollView::GetScrollSnapDuration
127 float GetScrollSnapDuration() const;
130 * @copydoc Toolkit::ScrollView::SetScrollSnapDuration
132 void SetScrollSnapDuration(float time);
135 * @copydoc Toolkit::ScrollView::GetScrollFlickDuration
137 float GetScrollFlickDuration() const;
140 * @copydoc Toolkit::ScrollView::SetScrollFlickDuration
142 void SetScrollFlickDuration(float time);
145 * @copydoc Toolkit::ScrollView::ApplyEffect
147 void ApplyEffect(Toolkit::ScrollViewEffect effect);
150 * @brief ApplyEffect Applies a predefined effect
153 Toolkit::ScrollViewEffect ApplyEffect(Toolkit::ScrollView::PageEffect effect);
156 * @copydoc Toolkit::ScrollView::RemoveEffect
158 void RemoveEffect(Toolkit::ScrollViewEffect effect);
161 * @copydoc Toolkit::ScrollView::RemoveAllEffects
163 void RemoveAllEffects();
166 * @copydoc Toolkit::ScrollView::ApplyConstraintToChildren
168 void ApplyConstraintToChildren(Constraint constraint);
171 * @copydoc Toolkit::ScrollView::RemoveConstraintsFromChildren
173 void RemoveConstraintsFromChildren();
176 * @copydoc Toolkit::ScrollView::GetRulerX
178 const RulerPtr GetRulerX() const;
181 * @copydoc Toolkit::ScrollView::GetRulerY
183 const RulerPtr GetRulerY() const;
186 * @copydoc Toolkit::ScrollView::SetRulerX
188 void SetRulerX(RulerPtr ruler);
191 * @copydoc Toolkit::ScrollView::SetRulerY
193 void SetRulerY(RulerPtr ruler);
196 * @copydoc Toolkit::ScrollView::SetScrollSensitive
198 void SetScrollSensitive(bool sensitive);
201 * @copydoc Toolkit::ScrollView::SetMaxOvershoot
203 void SetMaxOvershoot(float overshootX, float overshootY);
206 * @copydoc Toolkit::ScrollView::SetSnapOvershootAlphaFunction
208 void SetSnapOvershootAlphaFunction(AlphaFunction alpha);
211 * @copydoc Toolkit::ScrollView::SetSnapOvershootDuration
213 void SetSnapOvershootDuration(float duration);
216 * @copydoc Toolkit::ScrollView::SetTouchesRequiredForPanning
218 void SetTouchesRequiredForPanning(unsigned int minTouches, unsigned int maxTouches, bool endOutside);
221 * @copydoc Toolkit::ScrollView::SetActorAutoSnap
223 void SetActorAutoSnap(bool enable);
226 * Enables or Disables Auto Resizing mode for ScrollView contents.
228 * When enabled, the ScrollView's X/Y Domains are restricted to the
229 * dimensions of the content's bounds, which may change as Actors are
230 * Added/Removed, and repositioned.
232 * @note This has been disabled for now, as this requires some fundamental
233 * changes to the way Actors positions and bounds are retrieved.
234 * (currently only constraints have these initial state knowledge)
236 * @param[in] enable Enables (true), or disables (false) Auto Resize.
238 void SetAutoResize(bool enable);
241 * Returns whether the wrap mode has been enabled (true) or not (false).
243 * @return Wrap Mode Enabled flag.
245 bool GetWrapMode() const;
248 * @copydoc Toolkit::ScrollView::SetWrapMode
250 void SetWrapMode(bool enable);
253 * @copydoc Toolkit::ScrollView::GetScrollupdateDistance
255 int GetScrollUpdateDistance() const;
258 * @copydoc Toolkit::ScrollView::SetScrollUpdateDistance
260 void SetScrollUpdateDistance(int distance);
263 * @copydoc Toolkit::ScrollView::GetAxisAutoLock
265 bool GetAxisAutoLock() const;
268 * @copydoc Toolkit::ScrollView::SetAxisAutoLock
270 void SetAxisAutoLock(bool enable);
273 * @copydoc Toolkit::ScrollView::GetAxisAutoLockGradient
275 float GetAxisAutoLockGradient() const;
278 * @copydoc Toolkit::ScrollView::SetAxisAutoLockGradient
280 void SetAxisAutoLockGradient(float gradient);
283 * @copydoc Toolkit::ScrollView::GetFrictionCoefficient
285 float GetFrictionCoefficient() const;
288 * @copydoc Toolkit::ScrollView::SetFrictionCoefficient
290 void SetFrictionCoefficient(float friction);
293 * @copydoc Toolkit::ScrollView::GetFlickSpeedCoefficient
295 float GetFlickSpeedCoefficient() const;
298 * @copydoc Toolkit::ScrollView::SetFlickSpeedCoefficient
300 void SetFlickSpeedCoefficient(float speed);
303 * @copydoc Toolkit::ScrollView::GetMinimumDistanceForFlick
305 Vector2 GetMinimumDistanceForFlick() const;
308 * @copydoc Toolkit::ScrollView::SetMinimumDistanceForFlick
310 void SetMinimumDistanceForFlick( const Vector2& distance );
313 * @copydoc Toolkit::ScrollView::GetMinimumSpeedForFlick
315 float GetMinimumSpeedForFlick() const;
318 * @copydoc Toolkit::ScrollView::SetMinimumSpeedForFlick
320 void SetMinimumSpeedForFlick( float speed );
323 * @copydoc Toolkit::ScrollView::GetMaxFlickSpeed
325 float GetMaxFlickSpeed() const;
328 * @copydoc Toolkit::ScrollView::SetMaxFlickSpeed
330 void SetMaxFlickSpeed(float speed);
333 * @copydoc Toolkit::ScrollView::GetMouseWheelScrollDistanceStep
335 Vector2 GetMouseWheelScrollDistanceStep() const;
338 * @copydoc Toolkit::ScrollView::SetMouseWheelScrollDistanceStep
340 void SetMouseWheelScrollDistanceStep(Vector2 step);
343 * @copydoc Toolkit::ScrollView::GetCurrentPage
345 unsigned int GetCurrentPage() const;
348 * @copydoc Toolkit::ScrollView::GetCurrentScrollPosition
350 Vector3 GetCurrentScrollPosition() const;
353 * @copydoc Toolkit::ScrollView::SetScrollPosition
355 void SetScrollPosition(const Vector3& position);
358 * @copydoc Toolkit::Scrollable::GetDomainSize
360 Vector3 GetDomainSize() const;
363 * @copydoc ScrollTo(const Vector3&)
365 void TransformTo(const Vector3& position,
366 DirectionBias horizontalBias = DirectionBiasNone, DirectionBias verticalBias = DirectionBiasNone);
369 * @copydoc ScrollTo(const Vector3&, float, DirectionBias, DirectionBias)
371 void TransformTo(const Vector3& position, float duration,
372 DirectionBias horizontalBias = DirectionBiasNone, DirectionBias verticalBias = DirectionBiasNone);
375 * @copydoc Toolkit::ScrollView::ScrollTo(const Vector3 &position)
377 void ScrollTo(const Vector3 &position);
380 * @copydoc Toolkit::Scrollable::ScrollTo(const Vector3& position, float duration)
382 void ScrollTo(const Vector3& position, float duration);
385 * @copydoc Toolkit::ScrollView::ScrollTo(const Vector3 &position, float duration, DirectionBias horizontalBias, DirectionBias verticalBias)
387 void ScrollTo(const Vector3& position, float duration,
388 DirectionBias horizontalBias, DirectionBias verticalBias);
391 * @copydoc Toolkit::ScrollView::ScrollTo(unsigned int page)
393 void ScrollTo(unsigned int page);
396 * @copydoc Toolkit::ScrollView::ScrollTo(unsigned int page, float duration, DirectionBias bias)
398 void ScrollTo(unsigned int page, float duration, DirectionBias bias = DirectionBiasNone);
401 * @copydoc Toolkit::ScrollView::ScrollTo(Actor& actor)
403 void ScrollTo(Actor &actor);
406 * @copydoc Toolkit::ScrollView::ScrollTo(Actor& actor, float duration)
408 void ScrollTo(Actor &actor, float duration);
411 * @copydoc Toolkit::ScrollView::SetScrollingDirection()
413 void SetScrollingDirection( Radian direction, Radian threshold );
416 * @copydoc Toolkit::ScrollView::RemoveScrollingDirection()
418 void RemoveScrollingDirection( Radian angle );
421 * Finds the closest Actor to the current center of the ScrollView.
423 * @return A handle to the actor if found, or an empty handle if not.
425 Actor FindClosestActor();
428 * Finds the closest Actor to position in ScrollView
430 * @param[in] position position within ScrollView.
431 * @param[in] dirX Whether to search only those elements that are Left,Right, or All
432 * @param[in] dirY Whether to search only those elements that are Up,Down, or All
433 * @param[in] dirZ Whether to search only those elements that are Out,In, or All
434 * @return A handle to the actor if found, or an empty handle if not.
436 Actor FindClosestActorToPosition(const Vector3& position, FindDirection dirX = All, FindDirection dirY = All, FindDirection dirZ = All);
439 * @copydoc Toolkit::ScrollView::ScrollToSnapPoint
441 bool ScrollToSnapPoint();
446 void StopAnimation(void);
449 * Stops the input animation
451 * @param[in] the animation to stop
453 void StopAnimation(Animation& animation);
456 * Animates to position transform.
458 * @param[in] position The position to animate to
459 * @param[in] positionDuration The number of seconds this animation should run for in each axis.
460 * @param[in] alpha The easing alpha function to use.
461 * @param[in] findShortcuts (optional) Whether to find the shortest route (in Wrap mode)
462 * @param[in] horizontalBias (optional) Whether to bias animation to left or right (or no biasing)
463 * @param[in] verticalBias (optional) Whether to bias animation to top or bottom (or no biasing)
464 * @return True if animation necessary and taking place to reach desired transform.
466 bool AnimateTo(const Vector3& position, const Vector3& positionDuration,
467 AlphaFunction alpha, bool findShortcuts = true,
468 DirectionBias horizontalBias = DirectionBiasNone, DirectionBias verticalBias = DirectionBiasNone,
469 SnapType snapType = Snap);
472 * @copydoc Toolkit::Scrollable::AddOverlay()
474 void AddOverlay(Actor actor);
477 * @copydoc Toolkit::Scrollable::RemoveOverlay()
479 void RemoveOverlay(Actor actor);
482 * @copydoc Toolkit::Internal::Scrollable::SetOvershootEffectColor
484 void SetOvershootEffectColor( const Vector4& color );
489 * @copydoc Dali::Toolkit::ScrollView::SnapStartedSignal()
491 Toolkit::ScrollView::SnapStartedSignalV2& SnapStartedSignal();
494 * Connects a callback function with the object's signals.
495 * @param[in] object The object providing the signal.
496 * @param[in] tracker Used to disconnect the signal.
497 * @param[in] signalName The signal to connect to.
498 * @param[in] functor A newly allocated FunctorDelegate.
499 * @return True if the signal was connected.
500 * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
502 static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
504 private: // private overriden functions from CustomActorImpl and Controls
507 * @copydoc Dali::CustomActorImpl::OnSizeAnimation(Animation&, const Vector3&)
509 virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize);
512 * @copydoc Dali::Control::OnControlSizeSet(const Vector3&)
514 virtual void OnControlSizeSet( const Vector3& size );
517 * From CustomActorImpl; called after a child has been added to the owning actor.
518 * @param[in] child The child which has been added.
520 virtual void OnChildAdd(Actor& child);
523 * From CustomActorImpl; called shortly before a child is removed from the owning actor.
524 * @param[in] child The child being removed.
526 virtual void OnChildRemove(Actor& child);
529 * @copydoc Dali::CustomActorImpl::OnPropertySet( Property::Index index, Property::Value propertyValue )
531 virtual void OnPropertySet( Property::Index index, Property::Value propertyValue );
534 * From CustomActorImpl; called after a touch-signal is received by the owning actor.
536 * We don't listen to these events as content within the contain may consume events.
538 * @param[in] event The touch event.
539 * @return True if the event should be consumed.
541 virtual bool OnTouchEvent(const TouchEvent& event);
544 * From CustomActorImpl; called after a mouse-wheel-event is received by the owning actor.
545 * @param[in] event The mouse wheel event.
546 * @return True if the event should be consumed.
548 virtual bool OnMouseWheelEvent(const MouseWheelEvent& event);
551 * @copydoc Toolkit::Control::OnInitialize()
553 virtual void OnInitialize();
556 * @copydoc Toolkit::Control::OnControlStageConnection()
558 virtual void OnControlStageConnection();
561 * @copydoc Toolkit::Control::OnControlStageConnection()
563 virtual void OnControlStageDisconnection();
566 * @copydoc Toolkit::Control::OnAccessibilityPan()
568 virtual bool OnAccessibilityPan(PanGesture gesture);
571 * @copydoc Toolkit::Scrollable::SetOvershootEnabled()
573 virtual void SetOvershootEnabled(bool enable);
578 * Start a timer which calls OnTouchDownTimeout()
580 void StartTouchDownTimer();
583 * Stop a timer which calls OnTouchDownTimeout()
585 void StopTouchDownTimer();
588 * Helper to detect when touch-point has been down (outside of pan gesture)
590 bool OnTouchDownTimeout();
593 * Called whenever a snap animation has completed
594 * @param[in] source the Animation instance that has completed.
595 * Resets all scrolling animations and states, leaving current scroll position at mPropertyPosition
597 void ResetScrolling();
600 * Updates mScrollInternalPosition, mScrollPrePosition and mScrollPostPosition from their property counterparts
602 void UpdateLocalScrollProperties();
605 * Makes sure scroll values are ready for animated scrolling
607 void PreAnimatedScrollSetup();
610 * Finish an animated scroll, ensuring all scroll properties are updated
613 void FinaliseAnimatedScroll();
616 * Animates the internal x property to the given value
618 * @param[in] position The X position to animate to
619 * @param[in] duration The time in seconds for animation
620 * @param[in] alpha The alpha function to use for animating
622 void AnimateInternalXTo( float position, float duration, AlphaFunction alpha );
625 * Animates the internal y property to the given value
627 * @param[in] position The Y position to animate to
628 * @param[in] duration The time in seconds for animation
629 * @param[in] alpha The alpha function to use for animating
631 void AnimateInternalYTo( float position, float duration, AlphaFunction alpha );
634 * Called whenever a snap animation on the x-axis has completed
635 * @param[in] source the Animation instance that has completed.
637 void OnScrollAnimationFinished( Animation& source );
640 * Called when either the X or Y internal scroll positions have finished snapping back to mPropertyPrePosition
642 * @param[in] source the Animation instance that has completed.
644 void OnSnapInternalPositionFinished( Animation& source );
647 * Called whenever a snap animation on the x-axis has completed and we need to snap pre scroll
648 * position to our clamped position
649 * @param[in] position The x position to snap pre scroll property to
651 void SnapInternalXTo( float position );
654 * Called whenever a snap animation on the y-axis has completed and we need to snap pre scroll
655 * position to our clamped position
656 * @param[in] position The y position to snap pre scroll property to
658 void SnapInternalYTo( float position );
661 * This is called internally whenever the Scroll Rulers are
662 * modified. This will update the properties: 'scroll-position-min'
663 * and 'scroll-position-max' to reflect the changes.
665 * @param[in] size size of the visible scroll area (ScrollView control size)
667 void UpdatePropertyDomain(const Vector3& size);
670 * Called when the gesture starts.
672 void GestureStarted();
675 * Amalgamated Gesture Continuing event
677 * @param[in] panDelta average panning delta from base position (0)
679 void GestureContinuing(const Vector2& panDelta);
682 * Called upon pan gesture event.
684 * @param[in] gesture The gesture event.
686 void OnPan(PanGesture pan);
689 * Extension of the above gestures.
691 * @param[in] gesture The gesture event.
693 void OnGestureEx(Gesture::State state);
696 * Performs snapping while taking into account Velocity of gesture
697 * (velocity in pixels/sec)
699 * @param[in] velocity velocity in pixels/sec
701 bool SnapWithVelocity(Vector2 velocity);
704 * Finishes Container Transform
705 * (occurs upon finishing gesture i.e. releasing)
707 void FinishTransform();
710 * Returns overshoot vector based on current position
712 * Overshoot vector is defined as how far outside of bounds
713 * the viewport is trying to view (prior to being clamped).
715 * an overshoot of (100,50), means user is in bottom right corner,
716 * trying to pan +100 to the right, and +50 below. This can be used
717 * to determine an effect, such as stretching.
719 * @param[in] position The position for which you wish to obtain overshoot vector
721 Vector3 GetOvershoot(Vector3& position) const;
724 * Clamps position within the domain set up by X/Y Rulers
726 * @param[in,out] position The position you wish to clamp
728 void ClampPosition(Vector3& position) const;
731 * Clamps position within the domain set up by X/Y Rulers
733 * @param[in,out] position The position you wish to clamp
734 * @param[out] clamped The results of the clamping.
736 void ClampPosition(Vector3& position, ClampState3 &clamped) const;
739 * Wraps position within the domain set up by X/Y Rulers
741 * @note Only wraps if mWrapMode is enabled, and respective domains
744 * @param[in,out] position The position you wish to wrap
746 void WrapPosition(Vector3& position) const;
749 * Updates the main internal scroll constraints with new ruler and domain
752 void UpdateMainInternalConstraint();
755 * Enables/disables the overshoot constraints
757 * @param[in] enabled whether to enable or disable the overshoot constraints
759 void SetOvershootConstraintsEnabled(bool enabled);
762 * Sets internal constraints for this ScrollView.
763 * Many of these internal constraints are based on properties within
766 void SetInternalConstraints();
771 * Construct a new ScrollView.
776 * A reference counted object may only be deleted by calling Unreference()
778 virtual ~ScrollView();
783 * Searches this ScrollView, and attempts to Unbind
784 * systematically this Actor from the ScrollView attached.
786 * @param[in] child The actor to be unbound.
788 virtual void FindAndUnbindActor(Actor child);
791 * Gets position property.
793 * @return The current position
795 Vector3 GetPropertyPrePosition() const;
798 * Gets position property.
800 * @return The current position
802 Vector3 GetPropertyPosition() const;
805 * Handles a Stopped animation. Its position properties need to be saved, and the animation flag
808 void HandleStoppedAnimation();
811 * Handles a Stopped animation (whether the animation completed, or was
812 * manually stopped). Its position properties need to be saved, and the
813 * animation flag switched off.
815 void HandleSnapAnimationFinished();
818 * Checks if the property notifications are active and adds them if not
820 void SetScrollUpdateNotification( bool enabled );
823 * Refresh the ScrollView (used when animating to update application developer of changes)
824 * @return True if the refresh timer should be kept running.
826 void OnScrollUpdateNotification(Dali::PropertyNotification& source);
831 ScrollView(const ScrollView&);
834 ScrollView& operator=(const ScrollView& rhs);
838 unsigned long mTouchDownTime; ///< The touch down time
840 int mGestureStackDepth; ///< How many gestures are currently occuring.
841 Vector2 mPanStartPosition; ///< Where the pan gesture's touch down occured
842 Vector3 mPanDelta; ///< Amount currently panned.
844 unsigned int mScrollStateFlags; ///< flags indicating current state of scrolling
845 // Scroll delegate pre and post position properties...
846 Vector3 mScrollPrePosition; ///< Wrapped scroll position, but not clamped
847 Vector3 mScrollPostPosition; ///< Wrapped and clamped, this is the final scroll position used
848 Vector3 mScrollTargetPosition; ///< Final target position for an animated scroll
849 Vector3 mDomainOffset; ///< Domain offset (this keeps track of the domain boundaries that scroll positions traverses)
851 // Rulers for each axes...
855 // Last property values set to ScrollView
859 unsigned int mMinTouchesForPanning; ///< Minimum number of touches for panning to be used.
860 unsigned int mMaxTouchesForPanning; ///< Maximum number of touches for panning to be used.
862 Animation mInternalXAnimation; ///< Animates mPropertyX to a snap position or application requested scroll position
863 Animation mInternalYAnimation; ///< Animates mPropertyY to a snap position or application requested scroll position
866 Vector2 mLastVelocity; ///< Record the last velocity from PanGesture (Finish event doesn't have correct velocity)
869 Timer mTouchDownTimer; ///< Used to interrupt snap-animation. This cannot be done in OnTouchEvent without breaking fast flick behavior.
871 float mScrollUpdateDistance; ///< Distance for scrolling to travel for the scroll update notifications
872 Dali::PropertyNotification mScrollXUpdateNotification; ///< scroll x position update notification
873 Dali::PropertyNotification mScrollYUpdateNotification; ///< scroll y position update notification
875 Actor mInternalActor; ///< Internal actor (we keep internal actors in here e.g. scrollbars, so we can ignore it in searches)
877 ScrollViewEffectContainer mEffects; ///< Container keeping track of all the applied effects.
879 float mOvershootDelay; ///< Time to wait for input before reducing overshoot back to 0
880 Vector2 mMaxOvershoot; ///< Number of scrollable pixels that will take overshoot from 0.0f to 1.0f
881 Vector2 mUserMaxOvershoot; ///< Set by user, allows overriding of default max overshoot for the scroll indicator
882 float mSnapOvershootDuration; ///< Duration for overshoot snapping back to Vector3::ZERO
883 AlphaFunction mSnapOvershootAlphaFunction; ///< AlphaFunction to be used for this overshoot.
885 float mSnapDuration; ///< Time for the snap animation to take (in seconds).
886 AlphaFunction mSnapAlphaFunction; ///< AlphaFunction to be used for the Snap Animation.
888 Vector2 mMinFlickDistance; ///< Minimum pan distance required for a flick
889 float mFlickSpeedThreshold; ///< Minimum pan speed required for a flick in pixels/ms
890 float mFlickDuration; ///< Time for the flick animation to take (in seconds).
891 AlphaFunction mFlickAlphaFunction; ///< AlphaFunction to be used for the Flick Animation.
893 float mAxisAutoLockGradient; ///< Axis Auto-lock gradient threshold. Above this gradient and it will lock scrolling to closest axis.
894 float mFrictionCoefficient; ///< Friction coefficient. Amount of friction to apply to free panning flick animation. in stage.lengths/sec
895 float mFlickSpeedCoefficient; ///< Flick velocity coefficient. Input touch velocity is multiplied by this.
896 float mMaxFlickSpeed; ///< Maximum flick speed. Maximum speed of flick in stage.lengths/sec.
898 Vector2 mMouseWheelScrollDistanceStep; ///< The step of scroll distance in actor coordinates in X and Y axes for each mouse wheel event received.
900 //ScrollInternalConstraintsPtr mScrollInternalConstraints;
901 ActiveConstraint mScrollMainInternalPrePositionConstraint;
902 ActiveConstraint mScrollMainInternalPositionConstraint;
903 ActiveConstraint mScrollMainInternalOvershootXConstraint;
904 ActiveConstraint mScrollMainInternalOvershootYConstraint;
905 ActiveConstraint mScrollMainInternalDeltaConstraint;
906 ActiveConstraint mScrollMainInternalFinalConstraint;
907 ActiveConstraint mScrollMainInternalRelativeConstraint;
909 ScrollOvershootIndicatorPtr mOvershootIndicator;
911 Toolkit::ScrollView::SnapStartedSignalV2 mSnapStartedSignalV2;
913 bool mInAccessibilityPan : 1; ///< With AccessibilityPan its easier to move between snap positions
915 bool mScrolling:1; ///< Flag indicating whether the scroll view is being scrolled (by user or animation)
916 bool mScrollInterrupted:1; ///< Flag set for when a down event interrupts a scroll
917 bool mPanning:1; ///< Whether scroll view is currently panning or not
918 bool mSensitive:1; ///< Scroll Sensitivity Flag.
919 bool mTouchDownTimeoutReached:1; ///< Indicates when down event timeout occured without corresponding up event (touch still down)
920 bool mActorAutoSnapEnabled:1; ///< Whether to automatically snap to closest actor.
921 bool mAutoResizeContainerEnabled:1; ///< Whether to automatically resize container (affects RulerDomain's on X/Y axes)
922 bool mWrapMode:1; ///< Whether to wrap contents based on container size.
923 bool mAxisAutoLock:1; ///< Whether to automatically lock axis when panning.
924 bool mAlterChild:1; ///< Internal flag to control behavior of OnChildAdd/OnChildRemove when Adding internal Actors.
925 bool mDefaultMaxOvershoot:1; ///< Whether to use default max overshoot or application defined one
926 bool mCanScrollHorizontal:1; ///< Local value of our property to check against
927 bool mCanScrollVertical:1; ///< Local value of our property to check against
930 } // namespace Internal
932 // Helpers for public-api forwarding methods
934 inline Toolkit::Internal::ScrollView& GetImpl(Toolkit::ScrollView& scrollView)
936 DALI_ASSERT_ALWAYS(scrollView);
938 Dali::RefObject& handle = scrollView.GetImplementation();
940 return static_cast<Toolkit::Internal::ScrollView&>(handle);
943 inline const Toolkit::Internal::ScrollView& GetImpl(const Toolkit::ScrollView& scrollView)
945 DALI_ASSERT_ALWAYS(scrollView);
947 const Dali::RefObject& handle = scrollView.GetImplementation();
949 return static_cast<const Toolkit::Internal::ScrollView&>(handle);
952 } // namespace Toolkit
956 #endif // __DALI_TOOLKIT_INTERNAL_SCROLL_VIEW_H__