1 #ifndef DALI_TOOLKIT_INTERNAL_SCROLL_VIEW_H
2 #define DALI_TOOLKIT_INTERNAL_SCROLL_VIEW_H
5 * Copyright (c) 2021 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/public-api/adaptor-framework/timer.h>
23 #include <dali/public-api/animation/animation.h>
24 #include <dali/public-api/object/property-notification.h>
25 #include <dali/public-api/object/weak-handle.h>
28 #include <dali-toolkit/devel-api/controls/scroll-bar/scroll-bar.h>
29 #include <dali-toolkit/internal/controls/scrollable/scroll-view/scroll-base-impl.h>
30 #include <dali-toolkit/public-api/controls/control-impl.h>
31 #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-effect.h>
32 #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h>
33 #include <dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl-constraints.h>
42 typedef IntrusivePtr<ScrollView> ScrollViewPtr;
44 class ScrollInternalConstraints;
45 typedef IntrusivePtr<ScrollInternalConstraints> ScrollInternalConstraintsPtr;
47 class ScrollOvershootIndicator;
48 typedef IntrusivePtr<ScrollOvershootIndicator> ScrollOvershootIndicatorPtr;
50 class ScrollViewPropertyHandler;
53 * @copydoc Toolkit::ScrollView
55 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;
95 typedef std::vector<Dali::Toolkit::ScrollViewEffect> ScrollViewEffectContainer; ///< Container of Dali::Toolkit::ScrollViewEffect
96 typedef ScrollViewEffectContainer::iterator ScrollViewEffectIter; ///< Iterator for Dali::Toolkit::ScrollViewEffectContainer
100 * Create a new ScrollView.
101 * @return A public handle to the newly allocated ScrollView.
103 static Dali::Toolkit::ScrollView New();
107 * @copydoc Toolkit::ScrollView::GetScrollSnapAlphaFunction
109 AlphaFunction GetScrollSnapAlphaFunction() const
111 return mSnapAlphaFunction;
115 * @copydoc Toolkit::ScrollView::SetScrollSnapAlphaFunction
117 void SetScrollSnapAlphaFunction(AlphaFunction alpha)
119 mSnapAlphaFunction = alpha;
123 * @copydoc Toolkit::ScrollView::GetScrollFlickAlphaFunction
125 AlphaFunction GetScrollFlickAlphaFunction() const
127 return mFlickAlphaFunction;
131 * @copydoc Toolkit::ScrollView::SetScrollFlickAlphaFunction
133 void SetScrollFlickAlphaFunction(AlphaFunction alpha)
135 mFlickAlphaFunction = alpha;
139 * @copydoc Toolkit::ScrollView::GetScrollSnapDuration
141 float GetScrollSnapDuration() const
143 return mSnapDuration;
147 * @copydoc Toolkit::ScrollView::SetScrollSnapDuration
149 void SetScrollSnapDuration(float time)
151 mSnapDuration = time;
155 * @copydoc Toolkit::ScrollView::GetScrollFlickDuration
157 float GetScrollFlickDuration() const
159 return mFlickDuration;
163 * @copydoc Toolkit::ScrollView::SetScrollFlickDuration
165 void SetScrollFlickDuration(float time)
167 mFlickDuration = time;
171 * @copydoc Toolkit::ScrollView::ApplyEffect
173 void ApplyEffect(Toolkit::ScrollViewEffect effect);
176 * @copydoc Toolkit::ScrollView::RemoveEffect
178 void RemoveEffect(Toolkit::ScrollViewEffect effect);
181 * @copydoc Toolkit::ScrollView::RemoveAllEffects
183 void RemoveAllEffects();
186 * @copydoc Toolkit::ScrollView::ApplyConstraintToChildren
188 void ApplyConstraintToChildren(Constraint constraint);
191 * @copydoc Toolkit::ScrollView::RemoveConstraintsFromChildren
193 void RemoveConstraintsFromChildren();
196 * @copydoc Toolkit::ScrollView::GetRulerX
198 const RulerPtr GetRulerX() const
204 * @copydoc Toolkit::ScrollView::GetRulerY
206 const RulerPtr GetRulerY() const
212 * @copydoc Toolkit::ScrollView::SetRulerX
214 void SetRulerX(RulerPtr ruler);
217 * @copydoc Toolkit::ScrollView::SetRulerY
219 void SetRulerY(RulerPtr ruler);
222 * Retrieve the touch sensitivity.
224 * @return whether the touch sensitivity is true or false.
226 bool GetScrollSensitive()
232 * @copydoc Toolkit::ScrollView::SetScrollSensitive
234 void SetScrollSensitive(bool sensitive);
237 * @copydoc Toolkit::ScrollView::SetMaxOvershoot
239 void SetMaxOvershoot(float overshootX, float overshootY);
242 * @copydoc Toolkit::ScrollView::SetSnapOvershootAlphaFunction
244 void SetSnapOvershootAlphaFunction(AlphaFunction alpha)
246 mSnapOvershootAlphaFunction = alpha;
250 * Retrieve the duartion of Snap Overshoot animation
252 * @return the duration.
254 float GetSnapOvershootDuration()
256 return mSnapOvershootDuration;
260 * @copydoc Toolkit::ScrollView::SetSnapOvershootDuration
262 void SetSnapOvershootDuration(float duration)
264 mSnapOvershootDuration = duration;
268 * Retrieve whether Actor Auto-Snap mode is enabled or not.
270 * @return Actor Auto-Snap mode Enabled flag.
272 bool GetActorAutoSnap();
275 * @copydoc Toolkit::ScrollView::SetActorAutoSnap
277 void SetActorAutoSnap(bool enable)
279 mActorAutoSnapEnabled = enable;
283 * Enables or Disables Auto Resizing mode for ScrollView contents.
285 * When enabled, the ScrollView's X/Y Domains are restricted to the
286 * dimensions of the content's bounds, which may change as Actors are
287 * Added/Removed, and repositioned.
289 * @note This has been disabled for now, as this requires some fundamental
290 * changes to the way Actors positions and bounds are retrieved.
291 * (currently only constraints have these initial state knowledge)
293 * @param[in] enable Enables (true), or disables (false) Auto Resize.
295 void SetAutoResize(bool enable);
298 * Returns whether the wrap mode has been enabled (true) or not (false).
300 * @return Wrap Mode Enabled flag.
302 bool GetWrapMode() const
308 * @copydoc Toolkit::ScrollView::SetWrapMode
310 void SetWrapMode(bool enable);
313 * @copydoc Toolkit::ScrollView::GetScrollupdateDistance
315 int GetScrollUpdateDistance() const
317 return mScrollUpdateDistance;
321 * @copydoc Toolkit::ScrollView::SetScrollUpdateDistance
323 void SetScrollUpdateDistance(int distance)
325 mScrollUpdateDistance = distance;
329 * @copydoc Toolkit::ScrollView::GetAxisAutoLock
331 bool GetAxisAutoLock() const
333 return mAxisAutoLock;
337 * @copydoc Toolkit::ScrollView::SetAxisAutoLock
339 void SetAxisAutoLock(bool enable);
342 * @copydoc Toolkit::ScrollView::GetAxisAutoLockGradient
344 float GetAxisAutoLockGradient() const
346 return mAxisAutoLockGradient;
350 * @copydoc Toolkit::ScrollView::SetAxisAutoLockGradient
352 void SetAxisAutoLockGradient(float gradient);
355 * @copydoc Toolkit::ScrollView::GetFrictionCoefficient
357 float GetFrictionCoefficient() const
359 return mFrictionCoefficient;
363 * @copydoc Toolkit::ScrollView::SetFrictionCoefficient
365 void SetFrictionCoefficient(float friction);
368 * @copydoc Toolkit::ScrollView::GetFlickSpeedCoefficient
370 float GetFlickSpeedCoefficient() const
372 return mFlickSpeedCoefficient;
376 * @copydoc Toolkit::ScrollView::SetFlickSpeedCoefficient
378 void SetFlickSpeedCoefficient(float speed)
380 mFlickSpeedCoefficient = speed;
384 * @copydoc Toolkit::ScrollView::GetMinimumDistanceForFlick
386 Vector2 GetMinimumDistanceForFlick() const
388 return mMinFlickDistance;
392 * @copydoc Toolkit::ScrollView::SetMinimumDistanceForFlick
394 void SetMinimumDistanceForFlick(const Vector2& distance)
396 mMinFlickDistance = distance;
400 * @copydoc Toolkit::ScrollView::GetMinimumSpeedForFlick
402 float GetMinimumSpeedForFlick() const
404 return mFlickSpeedThreshold;
408 * @copydoc Toolkit::ScrollView::SetMinimumSpeedForFlick
410 void SetMinimumSpeedForFlick(float speed)
412 mFlickSpeedThreshold = speed;
416 * @copydoc Toolkit::ScrollView::GetMaxFlickSpeed
418 float GetMaxFlickSpeed() const
420 return mMaxFlickSpeed;
424 * @copydoc Toolkit::ScrollView::SetMaxFlickSpeed
426 void SetMaxFlickSpeed(float speed)
428 mMaxFlickSpeed = speed;
432 * @copydoc Toolkit::ScrollView::GetWheelScrollDistanceStep
434 Vector2 GetWheelScrollDistanceStep() const
436 return mWheelScrollDistanceStep;
440 * @copydoc Toolkit::ScrollView::SetWheelScrollDistanceStep
442 void SetWheelScrollDistanceStep(Vector2 step)
444 mWheelScrollDistanceStep = step;
448 * @copydoc Toolkit::ScrollView::GetCurrentPage
450 unsigned int GetCurrentPage() const;
453 * @copydoc Toolkit::ScrollView::GetCurrentScrollPosition
455 Vector2 GetCurrentScrollPosition() const;
458 * @copydoc ScrollTo(const Vector2&)
460 void TransformTo(const Vector2& position,
461 DirectionBias horizontalBias = DIRECTION_BIAS_NONE,
462 DirectionBias verticalBias = DIRECTION_BIAS_NONE);
465 * @copydoc ScrollTo(const Vector2&, float, AlhpaFunction, DirectionBias, DirectionBias)
467 void TransformTo(const Vector2& position, float duration, AlphaFunction alpha, DirectionBias horizontalBias = DIRECTION_BIAS_NONE, DirectionBias verticalBias = DIRECTION_BIAS_NONE);
470 * @copydoc Toolkit::ScrollView::ScrollTo(const Vector2 &position)
472 void ScrollTo(const Vector2& position);
475 * @copydoc Toolkit::Scrollable::ScrollTo(const Vector2& position, float duration)
477 void ScrollTo(const Vector2& position, float duration);
480 * @copydoc Toolkit::Scrollable::ScrollTo(const Vector2& position, float duration, AlphaFunction alpha)
482 void ScrollTo(const Vector2& position, float duration, AlphaFunction alpha);
485 * @copydoc Toolkit::ScrollView::ScrollTo(const Vector2 &position, float duration, DirectionBias horizontalBias, DirectionBias verticalBias)
487 void ScrollTo(const Vector2& position, float duration, DirectionBias horizontalBias, DirectionBias verticalBias);
490 * @copydoc Toolkit::ScrollView::ScrollTo(const Vector2 &position, float duration, AlphaFunction alpha, DirectionBias horizontalBias, DirectionBias verticalBias)
492 void ScrollTo(const Vector2& position, float duration, AlphaFunction alpha, DirectionBias horizontalBias, DirectionBias verticalBias);
495 * @copydoc Toolkit::ScrollView::ScrollTo(unsigned int page)
497 void ScrollTo(unsigned int page);
500 * @copydoc Toolkit::ScrollView::ScrollTo(unsigned int page, float duration, DirectionBias bias)
502 void ScrollTo(unsigned int page, float duration, DirectionBias bias = DIRECTION_BIAS_NONE);
505 * @copydoc Toolkit::ScrollView::ScrollTo(Actor& actor)
507 void ScrollTo(Actor& actor);
510 * @copydoc Toolkit::ScrollView::ScrollTo(Actor& actor, float duration)
512 void ScrollTo(Actor& actor, float duration);
515 * @copydoc Toolkit::ScrollView::SetScrollingDirection()
517 void SetScrollingDirection(Radian direction, Radian threshold);
520 * @copydoc Toolkit::ScrollView::RemoveScrollingDirection()
522 void RemoveScrollingDirection(Radian angle);
525 * Finds the closest Actor to the current center of the ScrollView.
527 * @return A handle to the actor if found, or an empty handle if not.
529 Actor FindClosestActor();
532 * Finds the closest Actor to position in ScrollView
534 * @param[in] position position within ScrollView.
535 * @param[in] dirX Whether to search only those elements that are Left,Right, or All
536 * @param[in] dirY Whether to search only those elements that are Up,Down, or All
537 * @param[in] dirZ Whether to search only those elements that are Out,In, or All
538 * @return A handle to the actor if found, or an empty handle if not.
540 Actor FindClosestActorToPosition(const Vector3& position, FindDirection dirX = All, FindDirection dirY = All, FindDirection dirZ = All);
543 * @copydoc Toolkit::ScrollView::ScrollToSnapPoint
545 bool ScrollToSnapPoint();
550 void StopAnimation(void);
553 * Stops the input animation
555 * @param[in] the animation to stop
557 void StopAnimation(Animation& animation);
560 * Animates to position transform.
562 * @param[in] position The position to animate to
563 * @param[in] positionDuration The number of seconds this animation should run for in each axis.
564 * @param[in] alpha The easing alpha function to use.
565 * @param[in] findShortcuts (optional) Whether to find the shortest route (in Wrap mode)
566 * @param[in] horizontalBias (optional) Whether to bias animation to left or right (or no biasing)
567 * @param[in] verticalBias (optional) Whether to bias animation to top or bottom (or no biasing)
568 * @return True if animation necessary and taking place to reach desired transform.
570 bool AnimateTo(const Vector2& position, const Vector2& positionDuration, AlphaFunction alpha, bool findShortcuts = true, DirectionBias horizontalBias = DIRECTION_BIAS_NONE, DirectionBias verticalBias = DIRECTION_BIAS_NONE, SnapType snapType = SNAP);
573 * @copydoc Toolkit::Scrollable::AddOverlay()
575 void AddOverlay(Actor actor);
578 * @copydoc Toolkit::Scrollable::RemoveOverlay()
580 void RemoveOverlay(Actor actor);
583 * @copydoc Toolkit::Internal::Scrollable::SetOvershootSize
585 void SetOvershootSize(const Vector2& size);
588 * @copydoc Toolkit::Internal::Scrollable::SetOvershootEffectColor
590 void SetOvershootEffectColor(const Vector4& color);
595 * Called when a property of an object of this type is set.
596 * @param[in] object The object whose property is set.
597 * @param[in] index The property index.
598 * @param[in] value The new property value.
600 static void SetProperty(BaseObject* object, Property::Index index, const Property::Value& value);
603 * Called to retrieve a property of an object of this type.
604 * @param[in] object The object whose property is to be retrieved.
605 * @param[in] index The property index.
606 * @return The current value of the property.
608 static Property::Value GetProperty(BaseObject* object, Property::Index index);
612 * @copydoc Dali::Toolkit::ScrollView::SnapStartedSignal()
614 Toolkit::ScrollView::SnapStartedSignalType& SnapStartedSignal();
617 * Connects a callback function with the object's signals.
618 * @param[in] object The object providing the signal.
619 * @param[in] tracker Used to disconnect the signal.
620 * @param[in] signalName The signal to connect to.
621 * @param[in] functor A newly allocated FunctorDelegate.
622 * @return True if the signal was connected.
623 * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
625 static bool DoConnectSignal(BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor);
627 private: // private overridden functions from CustomActorImpl and Controls
629 * @copydoc Dali::CustomActorImpl::OnSizeAnimation(Animation&, const Vector3&)
631 void OnSizeAnimation(Animation& animation, const Vector3& targetSize) override;
634 * @copydoc CustomActorImpl::OnSizeSet(const Vector3&)
636 void OnSizeSet(const Vector3& size) override;
639 * From CustomActorImpl; called after a child has been added to the owning actor.
640 * @param[in] child The child which has been added.
642 void OnChildAdd(Actor& child) override;
645 * From CustomActorImpl; called shortly before a child is removed from the owning actor.
646 * @param[in] child The child being removed.
648 void OnChildRemove(Actor& child) override;
651 * Called after a wheelEvent is received by the owning actor.
652 * @param[in] actor Actor associated with the event.
653 * @param[in] event The wheel event.
654 * @return True if the event should be consumed.
656 bool OnWheelEvent(Actor actor, const WheelEvent& event);
659 * @copydoc Toolkit::Control::OnInitialize()
661 void OnInitialize() override;
664 * @copydoc CustomActorImpl::OnSceneConnection()
666 void OnSceneConnection(int depth) override;
669 * @copydoc CustomActorImpl::OnSceneDisconnection()
671 void OnSceneDisconnection() override;
674 * @copydoc Toolkit::Control::OnAccessibilityPan()
676 bool OnAccessibilityPan(PanGesture gesture) override;
679 * @copydoc Toolkit::Scrollable::EnableScrollOvershoot()
681 void EnableScrollOvershoot(bool enable) override;
685 * Called after a touchSignal is received by the owning actor.
687 * We don't consume these events as content within the container may consume events.
689 * @param[in] actor The touched actor.
690 * @param[in] touch The touch information.
691 * @return True if the event should be consumed.
693 bool OnTouch(Actor actor, const TouchEvent& touch);
696 * Start a timer which calls OnTouchDownTimeout()
698 void StartTouchDownTimer();
701 * Stop a timer which calls OnTouchDownTimeout()
703 void StopTouchDownTimer();
706 * Helper to detect when touch-point has been down (outside of pan gesture)
708 bool OnTouchDownTimeout();
711 * Called whenever a snap animation has completed
712 * @param[in] source the Animation instance that has completed.
713 * Resets all scrolling animations and states, leaving current scroll position at SCROLL_POSITION
715 void ResetScrolling();
718 * Updates mScrollInternalPosition, mScrollPrePosition and mScrollPostPosition from their property counterparts
720 void UpdateLocalScrollProperties();
723 * Makes sure scroll values are ready for animated scrolling
725 void PreAnimatedScrollSetup();
728 * Finish an animated scroll, ensuring all scroll properties are updated
731 void FinaliseAnimatedScroll();
734 * Animates the internal x property to the given value
736 * @param[in] position The X position to animate to
737 * @param[in] duration The time in seconds for animation
738 * @param[in] alpha The alpha function to use for animating
740 void AnimateInternalXTo(float position, float duration, AlphaFunction alpha);
743 * Animates the internal y property to the given value
745 * @param[in] position The Y position to animate to
746 * @param[in] duration The time in seconds for animation
747 * @param[in] alpha The alpha function to use for animating
749 void AnimateInternalYTo(float position, float duration, AlphaFunction alpha);
752 * Called whenever a snap animation on the x-axis has completed
753 * @param[in] source the Animation instance that has completed.
755 void OnScrollAnimationFinished(Animation& source);
758 * Called when either the X or Y internal scroll positions have finished snapping back to SCROLL_PRE_POSITION
760 * @param[in] source the Animation instance that has completed.
762 void OnSnapInternalPositionFinished(Animation& source);
765 * Called whenever a snap animation on the x-axis has completed and we need to snap pre scroll
766 * position to our clamped position
767 * @param[in] position The x position to snap pre scroll property to
769 void SnapInternalXTo(float position);
772 * Called whenever a snap animation on the y-axis has completed and we need to snap pre scroll
773 * position to our clamped position
774 * @param[in] position The y position to snap pre scroll property to
776 void SnapInternalYTo(float position);
779 * Called when the gesture starts.
781 void GestureStarted();
784 * Amalgamated Gesture Continuing event
786 * @param[in] panDelta average panning delta from base position (0)
788 void GestureContinuing(const Vector2& panDelta);
791 * Called upon pan gesture event.
793 * @param[in] gesture The gesture event.
795 void OnPan(const PanGesture& pan);
798 * Extension of the above gestures.
800 * @param[in] gesture The gesture event.
802 void OnGestureEx(GestureState state);
805 * Performs snapping while taking into account Velocity of gesture
806 * (velocity in pixels/sec)
808 * @param[in] velocity velocity in pixels/sec
810 bool SnapWithVelocity(Vector2 velocity);
813 * Finishes Container Transform
814 * (occurs upon finishing gesture i.e. releasing)
816 void FinishTransform();
819 * Clamps position within the domain set up by X/Y Rulers
821 * @param[in,out] position The position you wish to clamp
823 void ClampPosition(Vector2& position) const;
826 * Clamps position within the domain set up by X/Y Rulers
828 * @param[in,out] position The position you wish to clamp
829 * @param[out] clamped The results of the clamping.
831 void ClampPosition(Vector2& position, ClampState2D& clamped) const;
834 * Wraps position within the domain set up by X/Y Rulers
836 * @note Only wraps if mWrapMode is enabled, and respective domains
839 * @param[in,out] position The position you wish to wrap
841 void WrapPosition(Vector2& position) const;
844 struct AccessibleImpl : public Scrollable::AccessibleImpl
846 using Scrollable::AccessibleImpl::AccessibleImpl;
848 bool ScrollToChild(Actor child) override;
852 * Construct a new ScrollView.
857 * A reference counted object may only be deleted by calling Unreference()
859 virtual ~ScrollView();
863 * Searches this ScrollView, and attempts to Unbind
864 * systematically this Actor from the ScrollView attached.
866 * @param[in] child The actor to be unbound.
868 void FindAndUnbindActor(Actor child) override;
871 * Gets position property.
873 * @return The current position
875 Vector2 GetPropertyPrePosition() const;
878 * Gets position property.
880 * @return The current position
882 Vector2 GetPropertyPosition() const;
885 * Handles a Stopped animation. Its position properties need to be saved, and the animation flag
888 void HandleStoppedAnimation();
891 * Handles a Stopped animation (whether the animation completed, or was
892 * manually stopped). Its position properties need to be saved, and the
893 * animation flag switched off.
895 void HandleSnapAnimationFinished();
898 * Checks if the property notifications are active and adds them if not
900 void SetScrollUpdateNotification(bool enabled);
903 * Refresh the ScrollView (used when animating to update application developer of changes)
904 * @return True if the refresh timer should be kept running.
906 void OnScrollUpdateNotification(Dali::PropertyNotification& source);
910 ScrollView(const ScrollView&);
913 ScrollView& operator=(const ScrollView& rhs);
916 ScrollViewConstraints mConstraints;
918 unsigned long mTouchDownTime; ///< The touch down time
920 int mGestureStackDepth; ///< How many gestures are currently occuring.
921 Vector2 mPanStartPosition; ///< Where the pan gesture's touch down occured
922 Vector2 mPanDelta; ///< Amount currently panned.
924 unsigned int mScrollStateFlags; ///< flags indicating current state of scrolling
925 // Scroll delegate pre and post position properties...
926 Vector2 mScrollPrePosition; ///< Wrapped scroll position, but not clamped
927 Vector2 mScrollPostPosition; ///< Wrapped and clamped, this is the final scroll position used
928 Vector2 mScrollTargetPosition; ///< Final target position for an animated scroll
929 Vector2 mDomainOffset; ///< Domain offset (this keeps track of the domain boundaries that scroll positions traverses)
931 // Rulers for each axes...
935 // Last property values set to ScrollView
939 Animation mInternalXAnimation; ///< Animates mPropertyX to a snap position or application requested scroll position
940 Animation mInternalYAnimation; ///< Animates mPropertyY to a snap position or application requested scroll position
942 Vector2 mLastVelocity; ///< Record the last velocity from PanGesture (Finish event doesn't have correct velocity)
945 Timer mTouchDownTimer; ///< Used to interrupt snap-animation. This cannot be done in OnTouch without breaking fast flick behavior.
947 float mScrollUpdateDistance; ///< Distance for scrolling to travel for the scroll update notifications
948 Dali::PropertyNotification mScrollXUpdateNotification; ///< scroll x position update notification
949 Dali::PropertyNotification mScrollYUpdateNotification; ///< scroll y position update notification
951 Actor mInternalActor; ///< Internal actor (we keep internal actors in here e.g. scrollbars, so we can ignore it in searches)
953 ScrollViewEffectContainer mEffects; ///< Container keeping track of all the applied effects.
955 Vector2 mMaxOvershoot; ///< Number of scrollable pixels that will take overshoot from 0.0f to 1.0f
956 Vector2 mUserMaxOvershoot; ///< Set by user, allows overriding of default max overshoot for the scroll indicator
957 float mSnapOvershootDuration; ///< Duration for overshoot snapping back to Vector2::ZERO
958 AlphaFunction mSnapOvershootAlphaFunction; ///< AlphaFunction to be used for this overshoot.
960 float mSnapDuration; ///< Time for the snap animation to take (in seconds).
961 AlphaFunction mSnapAlphaFunction; ///< AlphaFunction to be used for the Snap Animation.
963 Vector2 mMinFlickDistance; ///< Minimum pan distance required for a flick
964 float mFlickSpeedThreshold; ///< Minimum pan speed required for a flick in pixels/ms
965 float mFlickDuration; ///< Time for the flick animation to take (in seconds).
966 AlphaFunction mFlickAlphaFunction; ///< AlphaFunction to be used for the Flick Animation.
968 float mAxisAutoLockGradient; ///< Axis Auto-lock gradient threshold. Above this gradient and it will lock scrolling to closest axis.
969 float mFrictionCoefficient; ///< Friction coefficient. Amount of friction to apply to free panning flick animation. in stage.lengths/sec
970 float mFlickSpeedCoefficient; ///< Flick velocity coefficient. Input touch velocity is multiplied by this.
971 float mMaxFlickSpeed; ///< Maximum flick speed. Maximum speed of flick in stage.lengths/sec.
973 Vector2 mWheelScrollDistanceStep; ///< The step of scroll distance in actor coordinates in X and Y axes for each wheel event received.
975 ScrollOvershootIndicatorPtr mOvershootIndicator;
976 WeakHandle<Toolkit::ScrollBar> mScrollBar;
978 Toolkit::ScrollView::SnapStartedSignalType mSnapStartedSignal;
980 bool mInAccessibilityPan : 1; ///< With AccessibilityPan its easier to move between snap positions
981 bool mScrolling : 1; ///< Flag indicating whether the scroll view is being scrolled (by user or animation)
982 bool mScrollInterrupted : 1; ///< Flag set for when a down event interrupts a scroll
983 bool mPanning : 1; ///< Whether scroll view is currently panning or not
984 bool mSensitive : 1; ///< Scroll Sensitivity Flag.
985 bool mTouchDownTimeoutReached : 1; ///< Indicates when down event timeout occured without corresponding up event (touch still down)
986 bool mActorAutoSnapEnabled : 1; ///< Whether to automatically snap to closest actor.
987 bool mAutoResizeContainerEnabled : 1; ///< Whether to automatically resize container (affects RulerDomain's on X/Y axes)
988 bool mWrapMode : 1; ///< Whether to wrap contents based on container size.
989 bool mAxisAutoLock : 1; ///< Whether to automatically lock axis when panning.
990 bool mAlterChild : 1; ///< Internal flag to control behavior of OnChildAdd/OnChildRemove when Adding internal Actors.
991 bool mDefaultMaxOvershoot : 1; ///< Whether to use default max overshoot or application defined one
992 bool mCanScrollHorizontal : 1; ///< Local value of our property to check against
993 bool mCanScrollVertical : 1; ///< Local value of our property to check against
994 bool mTransientScrollBar : 1; ///< True if scroll-bar should be automatically show/hidden during/after panning
996 friend ScrollViewConstraints;
997 friend ScrollViewPropertyHandler;
1001 * Returns whether to lock scrolling to a particular axis
1003 * @param[in] panDelta Distance panned since gesture started
1004 * @param[in] currentLockAxis The current lock axis value
1005 * @param[in] lockGradient How quickly to lock to a particular axis
1007 * @return The new axis lock state
1009 ScrollView::LockAxis GetLockAxis(const Vector2& panDelta, ScrollView::LockAxis currentLockAxis, float lockGradient);
1011 } // namespace Internal
1013 // Helpers for public-api forwarding methods
1015 inline Toolkit::Internal::ScrollView& GetImpl(Toolkit::ScrollView& scrollView)
1017 DALI_ASSERT_ALWAYS(scrollView);
1019 Dali::RefObject& handle = scrollView.GetImplementation();
1021 return static_cast<Toolkit::Internal::ScrollView&>(handle);
1024 inline const Toolkit::Internal::ScrollView& GetImpl(const Toolkit::ScrollView& scrollView)
1026 DALI_ASSERT_ALWAYS(scrollView);
1028 const Dali::RefObject& handle = scrollView.GetImplementation();
1030 return static_cast<const Toolkit::Internal::ScrollView&>(handle);
1033 } // namespace Toolkit
1037 #endif // DALI_TOOLKIT_INTERNAL_SCROLL_VIEW_H