1 #ifndef __DALI_TOOLKIT_INTERNAL_SCROLL_VIEW_H__
2 #define __DALI_TOOLKIT_INTERNAL_SCROLL_VIEW_H__
5 * Copyright (c) 2015 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>
27 #include <dali-toolkit/public-api/controls/control-impl.h>
28 #include <dali-toolkit/internal/controls/scrollable/scroll-view/scroll-base-impl.h>
29 #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h>
30 #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-effect.h>
42 typedef IntrusivePtr<ScrollView> ScrollViewPtr;
44 class ScrollInternalConstraints;
45 typedef IntrusivePtr<ScrollInternalConstraints> ScrollInternalConstraintsPtr;
47 class ScrollOvershootIndicator;
48 typedef IntrusivePtr<ScrollOvershootIndicator> ScrollOvershootIndicatorPtr;
51 * @copydoc Toolkit::ScrollView
53 class ScrollView : public ScrollBase
58 * FindDirection specifies how searching is conducted within the Find... routines.
62 None = -3, ///< Includes none within the search query.
63 All = -2, ///< Includes all within the search query.
64 Left = -1, ///< Includes only those not right !(>)
65 Right = 1, ///< Includes only those right (>)
66 Up = -1, ///< Includes only those not below !(>)
67 Down = 1, ///< Includes only those below (>)
68 Out = -1, ///< Includes only those not infront !(>)
69 In = 1 ///< Includes only those infront (>)
74 LockPossible = 0, ///< Locking is possible, but not set in stone yet.
75 LockHorizontal, ///< Locking is set to horizontal. (can pan vertically)
76 LockVertical, ///< Locking is set to vertical. (can pan horizontally)
77 LockNone ///< Locking is set to none (free panning).
82 AnimatingInternalX = 0x01, ///< animating mPropertyX due to externally requested ScrollTo or internal snapping operation
83 AnimatingInternalY = 0x02, ///< animating mPropertyY due to externally requested ScrollTo or internal snapping operation
84 SnappingInternalX = 0x04, ///< snapping mPropertyX back to mPropertyPreScroll x value to remove x overshoot over time
85 SnappingInternalY = 0x08, ///< snapping mPropertyY back to mPropertyPreScroll y value to remove y overshoot over time
88 static const unsigned int SCROLL_X_STATE_MASK = AnimatingInternalX | SnappingInternalX;
89 static const unsigned int SCROLL_Y_STATE_MASK = AnimatingInternalY | SnappingInternalY;
90 static const unsigned int SCROLL_ANIMATION_FLAGS = AnimatingInternalX | AnimatingInternalY;
91 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
101 * Create a new ScrollView.
102 * @return A public handle to the newly allocated ScrollView.
104 static Dali::Toolkit::ScrollView New();
109 * @copydoc Toolkit::ScrollView::GetScrollSnapAlphaFunction
111 AlphaFunction GetScrollSnapAlphaFunction() const;
114 * @copydoc Toolkit::ScrollView::SetScrollSnapAlphaFunction
116 void SetScrollSnapAlphaFunction(AlphaFunction alpha);
119 * @copydoc Toolkit::ScrollView::GetScrollFlickAlphaFunction
121 AlphaFunction GetScrollFlickAlphaFunction() const;
124 * @copydoc Toolkit::ScrollView::SetScrollFlickAlphaFunction
126 void SetScrollFlickAlphaFunction(AlphaFunction alpha);
129 * @copydoc Toolkit::ScrollView::GetScrollSnapDuration
131 float GetScrollSnapDuration() const;
134 * @copydoc Toolkit::ScrollView::SetScrollSnapDuration
136 void SetScrollSnapDuration(float time);
139 * @copydoc Toolkit::ScrollView::GetScrollFlickDuration
141 float GetScrollFlickDuration() const;
144 * @copydoc Toolkit::ScrollView::SetScrollFlickDuration
146 void SetScrollFlickDuration(float time);
149 * @copydoc Toolkit::ScrollView::ApplyEffect
151 void ApplyEffect(Toolkit::ScrollViewEffect effect);
154 * @copydoc Toolkit::ScrollView::RemoveEffect
156 void RemoveEffect(Toolkit::ScrollViewEffect effect);
159 * @copydoc Toolkit::ScrollView::RemoveAllEffects
161 void RemoveAllEffects();
164 * @copydoc Toolkit::ScrollView::ApplyConstraintToChildren
166 void ApplyConstraintToChildren(Constraint constraint);
169 * @copydoc Toolkit::ScrollView::RemoveConstraintsFromChildren
171 void RemoveConstraintsFromChildren();
174 * @copydoc Toolkit::ScrollView::GetRulerX
176 const RulerPtr GetRulerX() const;
179 * @copydoc Toolkit::ScrollView::GetRulerY
181 const RulerPtr GetRulerY() const;
184 * @copydoc Toolkit::ScrollView::SetRulerX
186 void SetRulerX(RulerPtr ruler);
189 * @copydoc Toolkit::ScrollView::SetRulerY
191 void SetRulerY(RulerPtr ruler);
194 * Retrieve the touch sensitivity.
196 * @return whether the touch sensitivity is true or false.
198 bool GetScrollSensitive();
201 * @copydoc Toolkit::ScrollView::SetScrollSensitive
203 void SetScrollSensitive(bool sensitive);
206 * @copydoc Toolkit::ScrollView::SetMaxOvershoot
208 void SetMaxOvershoot(float overshootX, float overshootY);
211 * @copydoc Toolkit::ScrollView::SetSnapOvershootAlphaFunction
213 void SetSnapOvershootAlphaFunction(AlphaFunction alpha);
216 * Retrieve the duartion of Snap Overshoot animation
218 * @return the duration.
220 float GetSnapOvershootDuration();
223 * @copydoc Toolkit::ScrollView::SetSnapOvershootDuration
225 void SetSnapOvershootDuration(float duration);
228 * Retrieve whether Actor Auto-Snap mode is enabled or not.
230 * @return Actor Auto-Snap mode Enabled flag.
232 bool GetActorAutoSnap();
235 * @copydoc Toolkit::ScrollView::SetActorAutoSnap
237 void SetActorAutoSnap(bool enable);
240 * Enables or Disables Auto Resizing mode for ScrollView contents.
242 * When enabled, the ScrollView's X/Y Domains are restricted to the
243 * dimensions of the content's bounds, which may change as Actors are
244 * Added/Removed, and repositioned.
246 * @note This has been disabled for now, as this requires some fundamental
247 * changes to the way Actors positions and bounds are retrieved.
248 * (currently only constraints have these initial state knowledge)
250 * @param[in] enable Enables (true), or disables (false) Auto Resize.
252 void SetAutoResize(bool enable);
255 * Returns whether the wrap mode has been enabled (true) or not (false).
257 * @return Wrap Mode Enabled flag.
259 bool GetWrapMode() const;
262 * @copydoc Toolkit::ScrollView::SetWrapMode
264 void SetWrapMode(bool enable);
267 * @copydoc Toolkit::ScrollView::GetScrollupdateDistance
269 int GetScrollUpdateDistance() const;
272 * @copydoc Toolkit::ScrollView::SetScrollUpdateDistance
274 void SetScrollUpdateDistance(int distance);
277 * @copydoc Toolkit::ScrollView::GetAxisAutoLock
279 bool GetAxisAutoLock() const;
282 * @copydoc Toolkit::ScrollView::SetAxisAutoLock
284 void SetAxisAutoLock(bool enable);
287 * @copydoc Toolkit::ScrollView::GetAxisAutoLockGradient
289 float GetAxisAutoLockGradient() const;
292 * @copydoc Toolkit::ScrollView::SetAxisAutoLockGradient
294 void SetAxisAutoLockGradient(float gradient);
297 * @copydoc Toolkit::ScrollView::GetFrictionCoefficient
299 float GetFrictionCoefficient() const;
302 * @copydoc Toolkit::ScrollView::SetFrictionCoefficient
304 void SetFrictionCoefficient(float friction);
307 * @copydoc Toolkit::ScrollView::GetFlickSpeedCoefficient
309 float GetFlickSpeedCoefficient() const;
312 * @copydoc Toolkit::ScrollView::SetFlickSpeedCoefficient
314 void SetFlickSpeedCoefficient(float speed);
317 * @copydoc Toolkit::ScrollView::GetMinimumDistanceForFlick
319 Vector2 GetMinimumDistanceForFlick() const;
322 * @copydoc Toolkit::ScrollView::SetMinimumDistanceForFlick
324 void SetMinimumDistanceForFlick( const Vector2& distance );
327 * @copydoc Toolkit::ScrollView::GetMinimumSpeedForFlick
329 float GetMinimumSpeedForFlick() const;
332 * @copydoc Toolkit::ScrollView::SetMinimumSpeedForFlick
334 void SetMinimumSpeedForFlick( float speed );
337 * @copydoc Toolkit::ScrollView::GetMaxFlickSpeed
339 float GetMaxFlickSpeed() const;
342 * @copydoc Toolkit::ScrollView::SetMaxFlickSpeed
344 void SetMaxFlickSpeed(float speed);
347 * @copydoc Toolkit::ScrollView::GetWheelScrollDistanceStep
349 Vector2 GetWheelScrollDistanceStep() const;
352 * @copydoc Toolkit::ScrollView::SetWheelScrollDistanceStep
354 void SetWheelScrollDistanceStep(Vector2 step);
357 * @copydoc Toolkit::ScrollView::GetCurrentPage
359 unsigned int GetCurrentPage() const;
362 * @copydoc Toolkit::ScrollView::GetCurrentScrollPosition
364 Vector2 GetCurrentScrollPosition() const;
367 * @copydoc Toolkit::Scrollable::GetDomainSize
369 Vector2 GetDomainSize() const;
372 * @copydoc ScrollTo(const Vector2&)
374 void TransformTo(const Vector2& position,
375 DirectionBias horizontalBias = DirectionBiasNone, DirectionBias verticalBias = DirectionBiasNone);
378 * @copydoc ScrollTo(const Vector2&, float, AlhpaFunction, DirectionBias, DirectionBias)
380 void TransformTo(const Vector2& position, float duration, AlphaFunction alpha,
381 DirectionBias horizontalBias = DirectionBiasNone, DirectionBias verticalBias = DirectionBiasNone);
384 * @copydoc Toolkit::ScrollView::ScrollTo(const Vector2 &position)
386 void ScrollTo(const Vector2 &position);
389 * @copydoc Toolkit::Scrollable::ScrollTo(const Vector2& position, float duration)
391 void ScrollTo(const Vector2& position, float duration);
394 * @copydoc Toolkit::Scrollable::ScrollTo(const Vector2& position, float duration, AlphaFunction alpha)
396 void ScrollTo(const Vector2& position, float duration, AlphaFunction alpha);
399 * @copydoc Toolkit::ScrollView::ScrollTo(const Vector2 &position, float duration, DirectionBias horizontalBias, DirectionBias verticalBias)
401 void ScrollTo(const Vector2& position, float duration,
402 DirectionBias horizontalBias, DirectionBias verticalBias);
405 * @copydoc Toolkit::ScrollView::ScrollTo(const Vector2 &position, float duration, AlphaFunction alpha, DirectionBias horizontalBias, DirectionBias verticalBias)
407 void ScrollTo(const Vector2& position, float duration, AlphaFunction alpha,
408 DirectionBias horizontalBias, DirectionBias verticalBias);
411 * @copydoc Toolkit::ScrollView::ScrollTo(unsigned int page)
413 void ScrollTo(unsigned int page);
416 * @copydoc Toolkit::ScrollView::ScrollTo(unsigned int page, float duration, DirectionBias bias)
418 void ScrollTo(unsigned int page, float duration, DirectionBias bias = DirectionBiasNone);
421 * @copydoc Toolkit::ScrollView::ScrollTo(Actor& actor)
423 void ScrollTo(Actor &actor);
426 * @copydoc Toolkit::ScrollView::ScrollTo(Actor& actor, float duration)
428 void ScrollTo(Actor &actor, float duration);
431 * @copydoc Toolkit::ScrollView::SetScrollingDirection()
433 void SetScrollingDirection( Radian direction, Radian threshold );
436 * @copydoc Toolkit::ScrollView::RemoveScrollingDirection()
438 void RemoveScrollingDirection( Radian angle );
441 * Finds the closest Actor to the current center of the ScrollView.
443 * @return A handle to the actor if found, or an empty handle if not.
445 Actor FindClosestActor();
448 * Finds the closest Actor to position in ScrollView
450 * @param[in] position position within ScrollView.
451 * @param[in] dirX Whether to search only those elements that are Left,Right, or All
452 * @param[in] dirY Whether to search only those elements that are Up,Down, or All
453 * @param[in] dirZ Whether to search only those elements that are Out,In, or All
454 * @return A handle to the actor if found, or an empty handle if not.
456 Actor FindClosestActorToPosition(const Vector3& position, FindDirection dirX = All, FindDirection dirY = All, FindDirection dirZ = All);
459 * @copydoc Toolkit::ScrollView::ScrollToSnapPoint
461 bool ScrollToSnapPoint();
466 void StopAnimation(void);
469 * Stops the input animation
471 * @param[in] the animation to stop
473 void StopAnimation(Animation& animation);
476 * Animates to position transform.
478 * @param[in] position The position to animate to
479 * @param[in] positionDuration The number of seconds this animation should run for in each axis.
480 * @param[in] alpha The easing alpha function to use.
481 * @param[in] findShortcuts (optional) Whether to find the shortest route (in Wrap mode)
482 * @param[in] horizontalBias (optional) Whether to bias animation to left or right (or no biasing)
483 * @param[in] verticalBias (optional) Whether to bias animation to top or bottom (or no biasing)
484 * @return True if animation necessary and taking place to reach desired transform.
486 bool AnimateTo(const Vector2& position, const Vector2& positionDuration,
487 AlphaFunction alpha, bool findShortcuts = true,
488 DirectionBias horizontalBias = DirectionBiasNone, DirectionBias verticalBias = DirectionBiasNone,
489 SnapType snapType = Snap);
492 * @copydoc Toolkit::Scrollable::AddOverlay()
494 void AddOverlay(Actor actor);
497 * @copydoc Toolkit::Scrollable::RemoveOverlay()
499 void RemoveOverlay(Actor actor);
502 * @copydoc Toolkit::Internal::Scrollable::SetOvershootEffectColor
504 void SetOvershootEffectColor( const Vector4& color );
509 * Called when a property of an object of this type is set.
510 * @param[in] object The object whose property is set.
511 * @param[in] index The property index.
512 * @param[in] value The new property value.
514 static void SetProperty( BaseObject* object, Property::Index index, const Property::Value& value );
517 * Called to retrieve a property of an object of this type.
518 * @param[in] object The object whose property is to be retrieved.
519 * @param[in] index The property index.
520 * @return The current value of the property.
522 static Property::Value GetProperty( BaseObject* object, Property::Index index );
527 * @copydoc Dali::Toolkit::ScrollView::SnapStartedSignal()
529 Toolkit::ScrollView::SnapStartedSignalType& SnapStartedSignal();
532 * Connects a callback function with the object's signals.
533 * @param[in] object The object providing the signal.
534 * @param[in] tracker Used to disconnect the signal.
535 * @param[in] signalName The signal to connect to.
536 * @param[in] functor A newly allocated FunctorDelegate.
537 * @return True if the signal was connected.
538 * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
540 static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
542 private: // private overriden functions from CustomActorImpl and Controls
545 * @copydoc Dali::CustomActorImpl::OnSizeAnimation(Animation&, const Vector3&)
547 virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize);
550 * @copydoc CustomActorImpl::OnSizeSet(const Vector3&)
552 virtual void OnSizeSet( const Vector3& size );
555 * From CustomActorImpl; called after a child has been added to the owning actor.
556 * @param[in] child The child which has been added.
558 virtual void OnChildAdd(Actor& child);
561 * From CustomActorImpl; called shortly before a child is removed from the owning actor.
562 * @param[in] child The child being removed.
564 virtual void OnChildRemove(Actor& child);
567 * From CustomActorImpl; called after a touchSignal is received by the owning actor.
569 * We don't listen to these events as content within the contain may consume events.
571 * @param[in] event The touch event.
572 * @return True if the event should be consumed.
574 virtual bool OnTouchEvent(const TouchEvent& event);
577 * From CustomActorImpl; called after a wheelEvent is received by the owning actor.
578 * @param[in] event The wheel event.
579 * @return True if the event should be consumed.
581 virtual bool OnWheelEvent(const WheelEvent& event);
584 * @copydoc Toolkit::Control::OnInitialize()
586 virtual void OnInitialize();
589 * @copydoc CustomActorImpl::OnStageConnection()
591 virtual void OnStageConnection( int depth );
594 * @copydoc CustomActorImpl::OnStageDisconnection()
596 virtual void OnStageDisconnection();
599 * @copydoc Toolkit::Control::OnAccessibilityPan()
601 virtual bool OnAccessibilityPan(PanGesture gesture);
604 * @copydoc Toolkit::Scrollable::EnableScrollOvershoot()
606 virtual void EnableScrollOvershoot(bool enable);
611 * Start a timer which calls OnTouchDownTimeout()
613 void StartTouchDownTimer();
616 * Stop a timer which calls OnTouchDownTimeout()
618 void StopTouchDownTimer();
621 * Helper to detect when touch-point has been down (outside of pan gesture)
623 bool OnTouchDownTimeout();
626 * Called whenever a snap animation has completed
627 * @param[in] source the Animation instance that has completed.
628 * Resets all scrolling animations and states, leaving current scroll position at SCROLL_POSITION
630 void ResetScrolling();
633 * Updates mScrollInternalPosition, mScrollPrePosition and mScrollPostPosition from their property counterparts
635 void UpdateLocalScrollProperties();
638 * Makes sure scroll values are ready for animated scrolling
640 void PreAnimatedScrollSetup();
643 * Finish an animated scroll, ensuring all scroll properties are updated
646 void FinaliseAnimatedScroll();
649 * Animates the internal x property to the given value
651 * @param[in] position The X position to animate to
652 * @param[in] duration The time in seconds for animation
653 * @param[in] alpha The alpha function to use for animating
655 void AnimateInternalXTo( float position, float duration, AlphaFunction alpha );
658 * Animates the internal y property to the given value
660 * @param[in] position The Y position to animate to
661 * @param[in] duration The time in seconds for animation
662 * @param[in] alpha The alpha function to use for animating
664 void AnimateInternalYTo( float position, float duration, AlphaFunction alpha );
667 * Called whenever a snap animation on the x-axis has completed
668 * @param[in] source the Animation instance that has completed.
670 void OnScrollAnimationFinished( Animation& source );
673 * Called when either the X or Y internal scroll positions have finished snapping back to SCROLL_PRE_POSITION
675 * @param[in] source the Animation instance that has completed.
677 void OnSnapInternalPositionFinished( Animation& source );
680 * Called whenever a snap animation on the x-axis has completed and we need to snap pre scroll
681 * position to our clamped position
682 * @param[in] position The x position to snap pre scroll property to
684 void SnapInternalXTo( float position );
687 * Called whenever a snap animation on the y-axis has completed and we need to snap pre scroll
688 * position to our clamped position
689 * @param[in] position The y position to snap pre scroll property to
691 void SnapInternalYTo( float position );
694 * This is called internally whenever the Scroll Rulers are
695 * modified. This will update the properties: 'scrollPositionMin'
696 * and 'scrollPositionMax' to reflect the changes.
698 void UpdatePropertyDomain();
701 * Called when the gesture starts.
703 void GestureStarted();
706 * Amalgamated Gesture Continuing event
708 * @param[in] panDelta average panning delta from base position (0)
710 void GestureContinuing(const Vector2& panDelta);
713 * Called upon pan gesture event.
715 * @param[in] gesture The gesture event.
717 void OnPan( const PanGesture& pan);
720 * Extension of the above gestures.
722 * @param[in] gesture The gesture event.
724 void OnGestureEx(Gesture::State state);
727 * Performs snapping while taking into account Velocity of gesture
728 * (velocity in pixels/sec)
730 * @param[in] velocity velocity in pixels/sec
732 bool SnapWithVelocity(Vector2 velocity);
735 * Finishes Container Transform
736 * (occurs upon finishing gesture i.e. releasing)
738 void FinishTransform();
741 * Returns overshoot vector based on current position
743 * Overshoot vector is defined as how far outside of bounds
744 * the viewport is trying to view (prior to being clamped).
746 * an overshoot of (100,50), means user is in bottom right corner,
747 * trying to pan +100 to the right, and +50 below. This can be used
748 * to determine an effect, such as stretching.
750 * @param[in] position The position for which you wish to obtain overshoot vector
752 Vector2 GetOvershoot(Vector2& position) const;
755 * Clamps position within the domain set up by X/Y Rulers
757 * @param[in,out] position The position you wish to clamp
759 void ClampPosition(Vector2& position) const;
762 * Clamps position within the domain set up by X/Y Rulers
764 * @param[in,out] position The position you wish to clamp
765 * @param[out] clamped The results of the clamping.
767 void ClampPosition(Vector2& position, ClampState2D &clamped) const;
770 * Wraps position within the domain set up by X/Y Rulers
772 * @note Only wraps if mWrapMode is enabled, and respective domains
775 * @param[in,out] position The position you wish to wrap
777 void WrapPosition(Vector2& position) const;
780 * Updates the main internal scroll constraints with new ruler and domain
783 void UpdateMainInternalConstraint();
786 * Enables/disables the overshoot constraints
788 * @param[in] enabled whether to enable or disable the overshoot constraints
790 void SetOvershootConstraintsEnabled(bool enabled);
793 * Sets internal constraints for this ScrollView.
794 * Many of these internal constraints are based on properties within
797 void SetInternalConstraints();
802 * Construct a new ScrollView.
807 * A reference counted object may only be deleted by calling Unreference()
809 virtual ~ScrollView();
814 * Searches this ScrollView, and attempts to Unbind
815 * systematically this Actor from the ScrollView attached.
817 * @param[in] child The actor to be unbound.
819 virtual void FindAndUnbindActor(Actor child);
822 * Gets position property.
824 * @return The current position
826 Vector2 GetPropertyPrePosition() const;
829 * Gets position property.
831 * @return The current position
833 Vector2 GetPropertyPosition() const;
836 * Handles a Stopped animation. Its position properties need to be saved, and the animation flag
839 void HandleStoppedAnimation();
842 * Handles a Stopped animation (whether the animation completed, or was
843 * manually stopped). Its position properties need to be saved, and the
844 * animation flag switched off.
846 void HandleSnapAnimationFinished();
849 * Checks if the property notifications are active and adds them if not
851 void SetScrollUpdateNotification( bool enabled );
854 * Refresh the ScrollView (used when animating to update application developer of changes)
855 * @return True if the refresh timer should be kept running.
857 void OnScrollUpdateNotification(Dali::PropertyNotification& source);
862 ScrollView(const ScrollView&);
865 ScrollView& operator=(const ScrollView& rhs);
869 unsigned long mTouchDownTime; ///< The touch down time
871 int mGestureStackDepth; ///< How many gestures are currently occuring.
872 Vector2 mPanStartPosition; ///< Where the pan gesture's touch down occured
873 Vector2 mPanDelta; ///< Amount currently panned.
875 unsigned int mScrollStateFlags; ///< flags indicating current state of scrolling
876 // Scroll delegate pre and post position properties...
877 Vector2 mScrollPrePosition; ///< Wrapped scroll position, but not clamped
878 Vector2 mScrollPostPosition; ///< Wrapped and clamped, this is the final scroll position used
879 Vector2 mScrollTargetPosition; ///< Final target position for an animated scroll
880 Vector2 mDomainOffset; ///< Domain offset (this keeps track of the domain boundaries that scroll positions traverses)
882 // Rulers for each axes...
886 // Last property values set to ScrollView
890 Animation mInternalXAnimation; ///< Animates mPropertyX to a snap position or application requested scroll position
891 Animation mInternalYAnimation; ///< Animates mPropertyY to a snap position or application requested scroll position
894 Vector2 mLastVelocity; ///< Record the last velocity from PanGesture (Finish event doesn't have correct velocity)
897 Timer mTouchDownTimer; ///< Used to interrupt snap-animation. This cannot be done in OnTouchEvent without breaking fast flick behavior.
899 float mScrollUpdateDistance; ///< Distance for scrolling to travel for the scroll update notifications
900 Dali::PropertyNotification mScrollXUpdateNotification; ///< scroll x position update notification
901 Dali::PropertyNotification mScrollYUpdateNotification; ///< scroll y position update notification
903 Actor mInternalActor; ///< Internal actor (we keep internal actors in here e.g. scrollbars, so we can ignore it in searches)
905 ScrollViewEffectContainer mEffects; ///< Container keeping track of all the applied effects.
907 Vector2 mMaxOvershoot; ///< Number of scrollable pixels that will take overshoot from 0.0f to 1.0f
908 Vector2 mUserMaxOvershoot; ///< Set by user, allows overriding of default max overshoot for the scroll indicator
909 float mSnapOvershootDuration; ///< Duration for overshoot snapping back to Vector2::ZERO
910 AlphaFunction mSnapOvershootAlphaFunction; ///< AlphaFunction to be used for this overshoot.
912 float mSnapDuration; ///< Time for the snap animation to take (in seconds).
913 AlphaFunction mSnapAlphaFunction; ///< AlphaFunction to be used for the Snap Animation.
915 Vector2 mMinFlickDistance; ///< Minimum pan distance required for a flick
916 float mFlickSpeedThreshold; ///< Minimum pan speed required for a flick in pixels/ms
917 float mFlickDuration; ///< Time for the flick animation to take (in seconds).
918 AlphaFunction mFlickAlphaFunction; ///< AlphaFunction to be used for the Flick Animation.
920 float mAxisAutoLockGradient; ///< Axis Auto-lock gradient threshold. Above this gradient and it will lock scrolling to closest axis.
921 float mFrictionCoefficient; ///< Friction coefficient. Amount of friction to apply to free panning flick animation. in stage.lengths/sec
922 float mFlickSpeedCoefficient; ///< Flick velocity coefficient. Input touch velocity is multiplied by this.
923 float mMaxFlickSpeed; ///< Maximum flick speed. Maximum speed of flick in stage.lengths/sec.
925 Vector2 mWheelScrollDistanceStep; ///< The step of scroll distance in actor coordinates in X and Y axes for each wheel event received.
927 //ScrollInternalConstraintsPtr mScrollInternalConstraints;
928 Constraint mScrollMainInternalPrePositionConstraint;
929 Constraint mScrollMainInternalPositionConstraint;
930 Constraint mScrollMainInternalOvershootXConstraint;
931 Constraint mScrollMainInternalOvershootYConstraint;
932 Constraint mScrollMainInternalDeltaConstraint;
933 Constraint mScrollMainInternalFinalConstraint;
934 Constraint mScrollMainInternalRelativeConstraint;
935 Constraint mScrollMainInternalDomainConstraint;
936 Constraint mScrollMainInternalPrePositionMaxConstraint;
938 ScrollOvershootIndicatorPtr mOvershootIndicator;
940 Toolkit::ScrollView::SnapStartedSignalType mSnapStartedSignal;
942 bool mInAccessibilityPan:1; ///< With AccessibilityPan its easier to move between snap positions
943 bool mScrolling:1; ///< Flag indicating whether the scroll view is being scrolled (by user or animation)
944 bool mScrollInterrupted:1; ///< Flag set for when a down event interrupts a scroll
945 bool mPanning:1; ///< Whether scroll view is currently panning or not
946 bool mSensitive:1; ///< Scroll Sensitivity Flag.
947 bool mTouchDownTimeoutReached:1; ///< Indicates when down event timeout occured without corresponding up event (touch still down)
948 bool mActorAutoSnapEnabled:1; ///< Whether to automatically snap to closest actor.
949 bool mAutoResizeContainerEnabled:1; ///< Whether to automatically resize container (affects RulerDomain's on X/Y axes)
950 bool mWrapMode:1; ///< Whether to wrap contents based on container size.
951 bool mAxisAutoLock:1; ///< Whether to automatically lock axis when panning.
952 bool mAlterChild:1; ///< Internal flag to control behavior of OnChildAdd/OnChildRemove when Adding internal Actors.
953 bool mDefaultMaxOvershoot:1; ///< Whether to use default max overshoot or application defined one
954 bool mCanScrollHorizontal:1; ///< Local value of our property to check against
955 bool mCanScrollVertical:1; ///< Local value of our property to check against
958 } // namespace Internal
960 // Helpers for public-api forwarding methods
962 inline Toolkit::Internal::ScrollView& GetImpl(Toolkit::ScrollView& scrollView)
964 DALI_ASSERT_ALWAYS(scrollView);
966 Dali::RefObject& handle = scrollView.GetImplementation();
968 return static_cast<Toolkit::Internal::ScrollView&>(handle);
971 inline const Toolkit::Internal::ScrollView& GetImpl(const Toolkit::ScrollView& scrollView)
973 DALI_ASSERT_ALWAYS(scrollView);
975 const Dali::RefObject& handle = scrollView.GetImplementation();
977 return static_cast<const Toolkit::Internal::ScrollView&>(handle);
980 } // namespace Toolkit
984 #endif // __DALI_TOOLKIT_INTERNAL_SCROLL_VIEW_H__