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);
254 * @copydoc Toolkit::ScrollView::GetRefreshInterval
256 int GetRefreshInterval() const;
260 * @copydoc Toolkit::ScrollView::SetRefreshInterval
262 void SetRefreshInterval(int milliseconds);
265 * @copydoc Toolkit::ScrollView::GetScrollupdateDistance
267 int GetScrollUpdateDistance() const;
270 * @copydoc Toolkit::ScrollView::SetScrollUpdateDistance
272 void SetScrollUpdateDistance(int distance);
275 * @copydoc Toolkit::ScrollView::GetAxisAutoLock
277 bool GetAxisAutoLock() const;
280 * @copydoc Toolkit::ScrollView::SetAxisAutoLock
282 void SetAxisAutoLock(bool enable);
285 * @copydoc Toolkit::ScrollView::GetAxisAutoLockGradient
287 float GetAxisAutoLockGradient() const;
290 * @copydoc Toolkit::ScrollView::SetAxisAutoLockGradient
292 void SetAxisAutoLockGradient(float gradient);
295 * @copydoc Toolkit::ScrollView::GetFrictionCoefficient
297 float GetFrictionCoefficient() const;
300 * @copydoc Toolkit::ScrollView::SetFrictionCoefficient
302 void SetFrictionCoefficient(float friction);
305 * @copydoc Toolkit::ScrollView::GetFlickSpeedCoefficient
307 float GetFlickSpeedCoefficient() const;
310 * @copydoc Toolkit::ScrollView::SetFlickSpeedCoefficient
312 void SetFlickSpeedCoefficient(float speed);
315 * @copydoc Toolkit::ScrollView::GetMinimumDistanceForFlick
317 Vector2 GetMinimumDistanceForFlick() const;
320 * @copydoc Toolkit::ScrollView::SetMinimumDistanceForFlick
322 void SetMinimumDistanceForFlick( const Vector2& distance );
325 * @copydoc Toolkit::ScrollView::GetMinimumSpeedForFlick
327 float GetMinimumSpeedForFlick() const;
330 * @copydoc Toolkit::ScrollView::SetMinimumSpeedForFlick
332 void SetMinimumSpeedForFlick( float speed );
335 * @copydoc Toolkit::ScrollView::GetMaxFlickSpeed
337 float GetMaxFlickSpeed() const;
340 * @copydoc Toolkit::ScrollView::SetMaxFlickSpeed
342 void SetMaxFlickSpeed(float speed);
345 * @copydoc Toolkit::ScrollView::GetMouseWheelScrollDistanceStep
347 Vector2 GetMouseWheelScrollDistanceStep() const;
350 * @copydoc Toolkit::ScrollView::SetMouseWheelScrollDistanceStep
352 void SetMouseWheelScrollDistanceStep(Vector2 step);
355 * @copydoc Toolkit::ScrollView::GetCurrentPage
357 unsigned int GetCurrentPage() const;
360 * @copydoc Toolkit::ScrollView::GetCurrentScrollPosition
362 Vector3 GetCurrentScrollPosition() const;
365 * @copydoc Toolkit::ScrollView::SetScrollPosition
367 void SetScrollPosition(const Vector3& position);
370 * @copydoc Toolkit::Scrollable::GetDomainSize
372 Vector3 GetDomainSize() const;
375 * @copydoc ScrollTo(const Vector3&)
377 void TransformTo(const Vector3& position,
378 DirectionBias horizontalBias = DirectionBiasNone, DirectionBias verticalBias = DirectionBiasNone);
381 * @copydoc ScrollTo(const Vector3&, float, DirectionBias, DirectionBias)
383 void TransformTo(const Vector3& position, float duration,
384 DirectionBias horizontalBias = DirectionBiasNone, DirectionBias verticalBias = DirectionBiasNone);
387 * @copydoc Toolkit::ScrollView::ScrollTo(const Vector3 &position)
389 void ScrollTo(const Vector3 &position);
392 * @copydoc Toolkit::Scrollable::ScrollTo(const Vector3& position, float duration)
394 void ScrollTo(const Vector3& position, float duration);
397 * @copydoc Toolkit::ScrollView::ScrollTo(const Vector3 &position, float duration, DirectionBias horizontalBias, DirectionBias verticalBias)
399 void ScrollTo(const Vector3& position, float duration,
400 DirectionBias horizontalBias, DirectionBias verticalBias);
403 * @copydoc Toolkit::ScrollView::ScrollTo(unsigned int page)
405 void ScrollTo(unsigned int page);
408 * @copydoc Toolkit::ScrollView::ScrollTo(unsigned int page, float duration, DirectionBias bias)
410 void ScrollTo(unsigned int page, float duration, DirectionBias bias = DirectionBiasNone);
413 * @copydoc Toolkit::ScrollView::ScrollTo(Actor& actor)
415 void ScrollTo(Actor &actor);
418 * @copydoc Toolkit::ScrollView::ScrollTo(Actor& actor, float duration)
420 void ScrollTo(Actor &actor, float duration);
423 * @copydoc Toolkit::ScrollView::SetScrollingDirection()
425 void SetScrollingDirection( Radian direction, Radian threshold );
428 * @copydoc Toolkit::ScrollView::RemoveScrollingDirection()
430 void RemoveScrollingDirection( Radian angle );
433 * Finds the closest Actor to the current center of the ScrollView.
435 * @return A handle to the actor if found, or an empty handle if not.
437 Actor FindClosestActor();
440 * Finds the closest Actor to position in ScrollView
442 * @param[in] position position within ScrollView.
443 * @param[in] dirX Whether to search only those elements that are Left,Right, or All
444 * @param[in] dirY Whether to search only those elements that are Up,Down, or All
445 * @param[in] dirZ Whether to search only those elements that are Out,In, or All
446 * @return A handle to the actor if found, or an empty handle if not.
448 Actor FindClosestActorToPosition(const Vector3& position, FindDirection dirX = All, FindDirection dirY = All, FindDirection dirZ = All);
451 * @copydoc Toolkit::ScrollView::ScrollToSnapPoint
453 bool ScrollToSnapPoint();
458 void StopAnimation(void);
461 * Stops the input animation
463 * @param[in] the animation to stop
465 void StopAnimation(Animation& animation);
468 * Animates to position transform.
470 * @param[in] position The position to animate to
471 * @param[in] positionDuration The number of seconds this animation should run for in each axis.
472 * @param[in] alpha The easing alpha function to use.
473 * @param[in] findShortcuts (optional) Whether to find the shortest route (in Wrap mode)
474 * @param[in] horizontalBias (optional) Whether to bias animation to left or right (or no biasing)
475 * @param[in] verticalBias (optional) Whether to bias animation to top or bottom (or no biasing)
476 * @return True if animation necessary and taking place to reach desired transform.
478 bool AnimateTo(const Vector3& position, const Vector3& positionDuration,
479 AlphaFunction alpha, bool findShortcuts = true,
480 DirectionBias horizontalBias = DirectionBiasNone, DirectionBias verticalBias = DirectionBiasNone,
481 SnapType snapType = Snap);
484 * @copydoc Toolkit::Scrollable::AddOverlay()
486 void AddOverlay(Actor actor);
489 * @copydoc Toolkit::Scrollable::RemoveOverlay()
491 void RemoveOverlay(Actor actor);
494 * @copydoc Toolkit::Internal::Scrollable::SetOvershootEffectColor
496 void SetOvershootEffectColor( const Vector4& color );
501 * @copydoc Dali::Toolkit::ScrollView::SnapStartedSignal()
503 Toolkit::ScrollView::SnapStartedSignalV2& SnapStartedSignal();
506 * Connects a callback function with the object's signals.
507 * @param[in] object The object providing the signal.
508 * @param[in] tracker Used to disconnect the signal.
509 * @param[in] signalName The signal to connect to.
510 * @param[in] functor A newly allocated FunctorDelegate.
511 * @return True if the signal was connected.
512 * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
514 static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
516 private: // private overriden functions from CustomActorImpl and Controls
519 * @copydoc Dali::CustomActorImpl::OnSizeAnimation(Animation&, const Vector3&)
521 virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize);
524 * @copydoc Dali::Control::OnControlSizeSet(const Vector3&)
526 virtual void OnControlSizeSet( const Vector3& size );
529 * From CustomActorImpl; called after a child has been added to the owning actor.
530 * @param[in] child The child which has been added.
532 virtual void OnChildAdd(Actor& child);
535 * From CustomActorImpl; called shortly before a child is removed from the owning actor.
536 * @param[in] child The child being removed.
538 virtual void OnChildRemove(Actor& child);
541 * @copydoc Dali::CustomActorImpl::OnPropertySet( Property::Index index, Property::Value propertyValue )
543 virtual void OnPropertySet( Property::Index index, Property::Value propertyValue );
546 * From CustomActorImpl; called after a touch-signal is received by the owning actor.
548 * We don't listen to these events as content within the contain may consume events.
550 * @param[in] event The touch event.
551 * @return True if the event should be consumed.
553 virtual bool OnTouchEvent(const TouchEvent& event);
556 * From CustomActorImpl; called after a mouse-wheel-event is received by the owning actor.
557 * @param[in] event The mouse wheel event.
558 * @return True if the event should be consumed.
560 virtual bool OnMouseWheelEvent(const MouseWheelEvent& event);
563 * @copydoc Toolkit::Control::OnInitialize()
565 virtual void OnInitialize();
568 * @copydoc Toolkit::Control::OnControlStageConnection()
570 virtual void OnControlStageConnection();
573 * @copydoc Toolkit::Control::OnControlStageConnection()
575 virtual void OnControlStageDisconnection();
578 * @copydoc Toolkit::Control::OnAccessibilityPan()
580 virtual bool OnAccessibilityPan(PanGesture gesture);
583 * @copydoc Toolkit::Scrollable::SetOvershootEnabled()
585 virtual void SetOvershootEnabled(bool enable);
590 * Start a timer which calls OnTouchDownTimeout()
592 void StartTouchDownTimer();
595 * Stop a timer which calls OnTouchDownTimeout()
597 void StopTouchDownTimer();
600 * Helper to detect when touch-point has been down (outside of pan gesture)
602 bool OnTouchDownTimeout();
605 * Called whenever a snap animation has completed
606 * @param[in] source the Animation instance that has completed.
607 * Resets all scrolling animations and states, leaving current scroll position at mPropertyPosition
609 void ResetScrolling();
612 * Updates mScrollInternalPosition, mScrollPrePosition and mScrollPostPosition from their property counterparts
614 void UpdateLocalScrollProperties();
617 * Makes sure scroll values are ready for animated scrolling
619 void PreAnimatedScrollSetup();
622 * Finish an animated scroll, ensuring all scroll properties are updated
625 void FinaliseAnimatedScroll();
628 * Animates the internal x property to the given value
630 * @param[in] position The X position to animate to
631 * @param[in] duration The time in seconds for animation
632 * @param[in] alpha The alpha function to use for animating
634 void AnimateInternalXTo( float position, float duration, AlphaFunction alpha );
637 * Animates the internal y property to the given value
639 * @param[in] position The Y position to animate to
640 * @param[in] duration The time in seconds for animation
641 * @param[in] alpha The alpha function to use for animating
643 void AnimateInternalYTo( float position, float duration, AlphaFunction alpha );
646 * Called whenever a snap animation on the x-axis has completed
647 * @param[in] source the Animation instance that has completed.
649 void OnScrollAnimationFinished( Animation& source );
652 * Called when either the X or Y internal scroll positions have finished snapping back to mPropertyPrePosition
654 * @param[in] source the Animation instance that has completed.
656 void OnSnapInternalPositionFinished( Animation& source );
659 * Called whenever a snap animation on the x-axis has completed and we need to snap pre scroll
660 * position to our clamped position
661 * @param[in] position The x position to snap pre scroll property to
663 void SnapInternalXTo( float position );
666 * Called whenever a snap animation on the y-axis has completed and we need to snap pre scroll
667 * position to our clamped position
668 * @param[in] position The y position to snap pre scroll property to
670 void SnapInternalYTo( float position );
673 * This is called internally whenever the Scroll Rulers are
674 * modified. This will update the properties: 'scroll-position-min'
675 * and 'scroll-position-max' to reflect the changes.
677 * @param[in] size size of the visible scroll area (ScrollView control size)
679 void UpdatePropertyDomain(const Vector3& size);
682 * Called when the gesture starts.
684 void GestureStarted();
687 * Amalgamated Gesture Continuing event
689 * @param[in] panDelta average panning delta from base position (0)
691 void GestureContinuing(const Vector2& panDelta);
694 * Called upon pan gesture event.
696 * @param[in] gesture The gesture event.
698 void OnPan(PanGesture pan);
701 * Extension of the above gestures.
703 * @param[in] gesture The gesture event.
705 void OnGestureEx(Gesture::State state);
708 * Performs snapping while taking into account Velocity of gesture
709 * (velocity in pixels/sec)
711 * @param[in] velocity velocity in pixels/sec
713 bool SnapWithVelocity(Vector2 velocity);
716 * Finishes Container Transform
717 * (occurs upon finishing gesture i.e. releasing)
719 void FinishTransform();
722 * Returns overshoot vector based on current position
724 * Overshoot vector is defined as how far outside of bounds
725 * the viewport is trying to view (prior to being clamped).
727 * an overshoot of (100,50), means user is in bottom right corner,
728 * trying to pan +100 to the right, and +50 below. This can be used
729 * to determine an effect, such as stretching.
731 * @param[in] position The position for which you wish to obtain overshoot vector
733 Vector3 GetOvershoot(Vector3& position) const;
736 * Clamps position within the domain set up by X/Y Rulers
738 * @param[in,out] position The position you wish to clamp
740 void ClampPosition(Vector3& position) const;
743 * Clamps position within the domain set up by X/Y Rulers
745 * @param[in,out] position The position you wish to clamp
746 * @param[out] clamped The results of the clamping.
748 void ClampPosition(Vector3& position, ClampState3 &clamped) const;
751 * Wraps position within the domain set up by X/Y Rulers
753 * @note Only wraps if mWrapMode is enabled, and respective domains
756 * @param[in,out] position The position you wish to wrap
758 void WrapPosition(Vector3& position) const;
761 * Updates the main internal scroll constraints with new ruler and domain
764 void UpdateMainInternalConstraint();
767 * Enables/disables the overshoot constraints
769 * @param[in] enabled whether to enable or disable the overshoot constraints
771 void SetOvershootConstraintsEnabled(bool enabled);
774 * Sets internal constraints for this ScrollView.
775 * Many of these internal constraints are based on properties within
778 void SetInternalConstraints();
783 * Construct a new ScrollView.
788 * A reference counted object may only be deleted by calling Unreference()
790 virtual ~ScrollView();
795 * Searches this ScrollView, and attempts to Unbind
796 * systematically this Actor from the ScrollView attached.
798 * @param[in] child The actor to be unbound.
800 virtual void FindAndUnbindActor(Actor child);
803 * Gets position property.
805 * @return The current position
807 Vector3 GetPropertyPrePosition() const;
810 * Gets position property.
812 * @return The current position
814 Vector3 GetPropertyPosition() const;
817 * Handles a Stopped animation. Its position properties need to be saved, and the animation flag
820 void HandleStoppedAnimation();
823 * Handles a Stopped animation (whether the animation completed, or was
824 * manually stopped). Its position properties need to be saved, and the
825 * animation flag switched off.
827 void HandleSnapAnimationFinished();
830 * Checks if the property notifications are active and adds them if not
832 void SetScrollUpdateNotification( bool enabled );
835 * Refresh the ScrollView (used when animating to update application developer of changes)
836 * @return True if the refresh timer should be kept running.
838 void OnScrollUpdateNotification(Dali::PropertyNotification& source);
843 ScrollView(const ScrollView&);
846 ScrollView& operator=(const ScrollView& rhs);
850 unsigned long mTouchDownTime; ///< The touch down time
852 int mGestureStackDepth; ///< How many gestures are currently occuring.
853 Vector2 mPanStartPosition; ///< Where the pan gesture's touch down occured
854 Vector3 mPanDelta; ///< Amount currently panned.
856 unsigned int mScrollStateFlags; ///< flags indicating current state of scrolling
857 // Scroll delegate pre and post position properties...
858 Vector3 mScrollPrePosition; ///< Wrapped scroll position, but not clamped
859 Vector3 mScrollPostPosition; ///< Wrapped and clamped, this is the final scroll position used
860 Vector3 mScrollTargetPosition; ///< Final target position for an animated scroll
861 Vector3 mDomainOffset; ///< Domain offset (this keeps track of the domain boundaries that scroll positions traverses)
863 // Rulers for each axes...
867 // Last property values set to ScrollView
871 unsigned int mMinTouchesForPanning; ///< Minimum number of touches for panning to be used.
872 unsigned int mMaxTouchesForPanning; ///< Maximum number of touches for panning to be used.
874 Animation mInternalXAnimation; ///< Animates mPropertyX to a snap position or application requested scroll position
875 Animation mInternalYAnimation; ///< Animates mPropertyY to a snap position or application requested scroll position
878 Vector2 mLastVelocity; ///< Record the last velocity from PanGesture (Finish event doesn't have correct velocity)
881 Timer mTouchDownTimer; ///< Used to interrupt snap-animation. This cannot be done in OnTouchEvent without breaking fast flick behavior.
883 float mScrollUpdateDistance; ///< Distance for scrolling to travel for the scroll update notifications
884 Dali::PropertyNotification mScrollXUpdateNotification; ///< scroll x position update notification
885 Dali::PropertyNotification mScrollYUpdateNotification; ///< scroll y position update notification
887 Actor mInternalActor; ///< Internal actor (we keep internal actors in here e.g. scrollbars, so we can ignore it in searches)
889 ScrollViewEffectContainer mEffects; ///< Container keeping track of all the applied effects.
891 float mOvershootDelay; ///< Time to wait for input before reducing overshoot back to 0
892 Vector2 mMaxOvershoot; ///< Number of scrollable pixels that will take overshoot from 0.0f to 1.0f
893 Vector2 mUserMaxOvershoot; ///< Set by user, allows overriding of default max overshoot for the scroll indicator
894 float mSnapOvershootDuration; ///< Duration for overshoot snapping back to Vector3::ZERO
895 AlphaFunction mSnapOvershootAlphaFunction; ///< AlphaFunction to be used for this overshoot.
897 float mSnapDuration; ///< Time for the snap animation to take (in seconds).
898 AlphaFunction mSnapAlphaFunction; ///< AlphaFunction to be used for the Snap Animation.
900 Vector2 mMinFlickDistance; ///< Minimum pan distance required for a flick
901 float mFlickSpeedThreshold; ///< Minimum pan speed required for a flick in pixels/ms
902 float mFlickDuration; ///< Time for the flick animation to take (in seconds).
903 AlphaFunction mFlickAlphaFunction; ///< AlphaFunction to be used for the Flick Animation.
905 float mAxisAutoLockGradient; ///< Axis Auto-lock gradient threshold. Above this gradient and it will lock scrolling to closest axis.
906 float mFrictionCoefficient; ///< Friction coefficient. Amount of friction to apply to free panning flick animation. in stage.lengths/sec
907 float mFlickSpeedCoefficient; ///< Flick velocity coefficient. Input touch velocity is multiplied by this.
908 float mMaxFlickSpeed; ///< Maximum flick speed. Maximum speed of flick in stage.lengths/sec.
910 Vector2 mMouseWheelScrollDistanceStep; ///< The step of scroll distance in actor coordinates in X and Y axes for each mouse wheel event received.
912 //ScrollInternalConstraintsPtr mScrollInternalConstraints;
913 ActiveConstraint mScrollMainInternalPrePositionConstraint;
914 ActiveConstraint mScrollMainInternalPositionConstraint;
915 ActiveConstraint mScrollMainInternalOvershootXConstraint;
916 ActiveConstraint mScrollMainInternalOvershootYConstraint;
917 ActiveConstraint mScrollMainInternalDeltaConstraint;
918 ActiveConstraint mScrollMainInternalFinalConstraint;
919 ActiveConstraint mScrollMainInternalRelativeConstraint;
921 ScrollOvershootIndicatorPtr mOvershootIndicator;
923 Toolkit::ScrollView::SnapStartedSignalV2 mSnapStartedSignalV2;
925 bool mInAccessibilityPan : 1; ///< With AccessibilityPan its easier to move between snap positions
927 bool mScrolling:1; ///< Flag indicating whether the scroll view is being scrolled (by user or animation)
928 bool mScrollInterrupted:1; ///< Flag set for when a down event interrupts a scroll
929 bool mPanning:1; ///< Whether scroll view is currently panning or not
930 bool mSensitive:1; ///< Scroll Sensitivity Flag.
931 bool mTouchDownTimeoutReached:1; ///< Indicates when down event timeout occured without corresponding up event (touch still down)
932 bool mActorAutoSnapEnabled:1; ///< Whether to automatically snap to closest actor.
933 bool mAutoResizeContainerEnabled:1; ///< Whether to automatically resize container (affects RulerDomain's on X/Y axes)
934 bool mWrapMode:1; ///< Whether to wrap contents based on container size.
935 bool mAxisAutoLock:1; ///< Whether to automatically lock axis when panning.
936 bool mAlterChild:1; ///< Internal flag to control behavior of OnChildAdd/OnChildRemove when Adding internal Actors.
937 bool mDefaultMaxOvershoot:1; ///< Whether to use default max overshoot or application defined one
938 bool mCanScrollHorizontal:1; ///< Local value of our property to check against
939 bool mCanScrollVertical:1; ///< Local value of our property to check against
942 } // namespace Internal
944 // Helpers for public-api forwarding methods
946 inline Toolkit::Internal::ScrollView& GetImpl(Toolkit::ScrollView& scrollView)
948 DALI_ASSERT_ALWAYS(scrollView);
950 Dali::RefObject& handle = scrollView.GetImplementation();
952 return static_cast<Toolkit::Internal::ScrollView&>(handle);
955 inline const Toolkit::Internal::ScrollView& GetImpl(const Toolkit::ScrollView& scrollView)
957 DALI_ASSERT_ALWAYS(scrollView);
959 const Dali::RefObject& handle = scrollView.GetImplementation();
961 return static_cast<const Toolkit::Internal::ScrollView&>(handle);
964 } // namespace Toolkit
968 #endif // __DALI_TOOLKIT_INTERNAL_SCROLL_VIEW_H__