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/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;
96 * Create a new ScrollView.
97 * @return A public handle to the newly allocated ScrollView.
99 static Dali::Toolkit::ScrollView New();
104 * @copydoc Toolkit::ScrollView::GetScrollSnapAlphaFunction
106 AlphaFunction GetScrollSnapAlphaFunction() const;
109 * @copydoc Toolkit::ScrollView::SetScrollSnapAlphaFunction
111 void SetScrollSnapAlphaFunction(AlphaFunction alpha);
114 * @copydoc Toolkit::ScrollView::GetScrollFlickAlphaFunction
116 AlphaFunction GetScrollFlickAlphaFunction() const;
119 * @copydoc Toolkit::ScrollView::SetScrollFlickAlphaFunction
121 void SetScrollFlickAlphaFunction(AlphaFunction alpha);
124 * @copydoc Toolkit::ScrollView::GetScrollSnapDuration
126 float GetScrollSnapDuration() const;
129 * @copydoc Toolkit::ScrollView::SetScrollSnapDuration
131 void SetScrollSnapDuration(float time);
134 * @copydoc Toolkit::ScrollView::GetScrollFlickDuration
136 float GetScrollFlickDuration() const;
139 * @copydoc Toolkit::ScrollView::SetScrollFlickDuration
141 void SetScrollFlickDuration(float time);
144 * @copydoc Toolkit::ScrollView::ApplyEffect
146 void ApplyEffect(Toolkit::ScrollViewEffect effect);
149 * @copydoc Toolkit::ScrollView::RemoveEffect
151 void RemoveEffect(Toolkit::ScrollViewEffect effect);
154 * @copydoc Toolkit::ScrollView::RemoveAllEffects
156 void RemoveAllEffects();
159 * @copydoc Toolkit::ScrollView::ApplyConstraintToChildren
161 void ApplyConstraintToChildren(Constraint constraint);
164 * @copydoc Toolkit::ScrollView::RemoveConstraintsFromChildren
166 void RemoveConstraintsFromChildren();
169 * @copydoc Toolkit::ScrollView::GetRulerX
171 const RulerPtr GetRulerX() const;
174 * @copydoc Toolkit::ScrollView::GetRulerY
176 const RulerPtr GetRulerY() const;
179 * @copydoc Toolkit::ScrollView::SetRulerX
181 void SetRulerX(RulerPtr ruler);
184 * @copydoc Toolkit::ScrollView::SetRulerY
186 void SetRulerY(RulerPtr ruler);
189 * @copydoc Toolkit::ScrollView::SetScrollSensitive
191 void SetScrollSensitive(bool sensitive);
194 * @copydoc Toolkit::ScrollView::SetMaxOvershoot
196 void SetMaxOvershoot(float overshootX, float overshootY);
199 * @copydoc Toolkit::ScrollView::SetSnapOvershootAlphaFunction
201 void SetSnapOvershootAlphaFunction(AlphaFunction alpha);
204 * @copydoc Toolkit::ScrollView::SetSnapOvershootDuration
206 void SetSnapOvershootDuration(float duration);
209 * @copydoc Toolkit::ScrollView::SetActorAutoSnap
211 void SetActorAutoSnap(bool enable);
214 * Enables or Disables Auto Resizing mode for ScrollView contents.
216 * When enabled, the ScrollView's X/Y Domains are restricted to the
217 * dimensions of the content's bounds, which may change as Actors are
218 * Added/Removed, and repositioned.
220 * @note This has been disabled for now, as this requires some fundamental
221 * changes to the way Actors positions and bounds are retrieved.
222 * (currently only constraints have these initial state knowledge)
224 * @param[in] enable Enables (true), or disables (false) Auto Resize.
226 void SetAutoResize(bool enable);
229 * Returns whether the wrap mode has been enabled (true) or not (false).
231 * @return Wrap Mode Enabled flag.
233 bool GetWrapMode() const;
236 * @copydoc Toolkit::ScrollView::SetWrapMode
238 void SetWrapMode(bool enable);
241 * @copydoc Toolkit::ScrollView::GetScrollupdateDistance
243 int GetScrollUpdateDistance() const;
246 * @copydoc Toolkit::ScrollView::SetScrollUpdateDistance
248 void SetScrollUpdateDistance(int distance);
251 * @copydoc Toolkit::ScrollView::GetAxisAutoLock
253 bool GetAxisAutoLock() const;
256 * @copydoc Toolkit::ScrollView::SetAxisAutoLock
258 void SetAxisAutoLock(bool enable);
261 * @copydoc Toolkit::ScrollView::GetAxisAutoLockGradient
263 float GetAxisAutoLockGradient() const;
266 * @copydoc Toolkit::ScrollView::SetAxisAutoLockGradient
268 void SetAxisAutoLockGradient(float gradient);
271 * @copydoc Toolkit::ScrollView::GetFrictionCoefficient
273 float GetFrictionCoefficient() const;
276 * @copydoc Toolkit::ScrollView::SetFrictionCoefficient
278 void SetFrictionCoefficient(float friction);
281 * @copydoc Toolkit::ScrollView::GetFlickSpeedCoefficient
283 float GetFlickSpeedCoefficient() const;
286 * @copydoc Toolkit::ScrollView::SetFlickSpeedCoefficient
288 void SetFlickSpeedCoefficient(float speed);
291 * @copydoc Toolkit::ScrollView::GetMinimumDistanceForFlick
293 Vector2 GetMinimumDistanceForFlick() const;
296 * @copydoc Toolkit::ScrollView::SetMinimumDistanceForFlick
298 void SetMinimumDistanceForFlick( const Vector2& distance );
301 * @copydoc Toolkit::ScrollView::GetMinimumSpeedForFlick
303 float GetMinimumSpeedForFlick() const;
306 * @copydoc Toolkit::ScrollView::SetMinimumSpeedForFlick
308 void SetMinimumSpeedForFlick( float speed );
311 * @copydoc Toolkit::ScrollView::GetMaxFlickSpeed
313 float GetMaxFlickSpeed() const;
316 * @copydoc Toolkit::ScrollView::SetMaxFlickSpeed
318 void SetMaxFlickSpeed(float speed);
321 * @copydoc Toolkit::ScrollView::GetMouseWheelScrollDistanceStep
323 Vector2 GetMouseWheelScrollDistanceStep() const;
326 * @copydoc Toolkit::ScrollView::SetMouseWheelScrollDistanceStep
328 void SetMouseWheelScrollDistanceStep(Vector2 step);
331 * @copydoc Toolkit::ScrollView::GetCurrentPage
333 unsigned int GetCurrentPage() const;
336 * @copydoc Toolkit::ScrollView::GetCurrentScrollPosition
338 Vector3 GetCurrentScrollPosition() const;
341 * @copydoc Toolkit::ScrollView::SetScrollPosition
343 void SetScrollPosition(const Vector3& position);
346 * @copydoc Toolkit::Scrollable::GetDomainSize
348 Vector3 GetDomainSize() const;
351 * @copydoc ScrollTo(const Vector3&)
353 void TransformTo(const Vector3& position,
354 DirectionBias horizontalBias = DirectionBiasNone, DirectionBias verticalBias = DirectionBiasNone);
357 * @copydoc ScrollTo(const Vector3&, float, AlhpaFunction, DirectionBias, DirectionBias)
359 void TransformTo(const Vector3& position, float duration, AlphaFunction alpha,
360 DirectionBias horizontalBias = DirectionBiasNone, DirectionBias verticalBias = DirectionBiasNone);
363 * @copydoc Toolkit::ScrollView::ScrollTo(const Vector3 &position)
365 void ScrollTo(const Vector3 &position);
368 * @copydoc Toolkit::Scrollable::ScrollTo(const Vector3& position, float duration)
370 void ScrollTo(const Vector3& position, float duration);
373 * @copydoc Toolkit::Scrollable::ScrollTo(const Vector3& position, float duration, AlphaFunction alpha)
375 void ScrollTo(const Vector3& position, float duration, AlphaFunction alpha);
378 * @copydoc Toolkit::ScrollView::ScrollTo(const Vector3 &position, float duration, DirectionBias horizontalBias, DirectionBias verticalBias)
380 void ScrollTo(const Vector3& position, float duration,
381 DirectionBias horizontalBias, DirectionBias verticalBias);
384 * @copydoc Toolkit::ScrollView::ScrollTo(const Vector3 &position, float duration, AlphaFunction alpha, DirectionBias horizontalBias, DirectionBias verticalBias)
386 void ScrollTo(const Vector3& position, float duration, AlphaFunction alpha,
387 DirectionBias horizontalBias, DirectionBias verticalBias);
390 * @copydoc Toolkit::ScrollView::ScrollTo(unsigned int page)
392 void ScrollTo(unsigned int page);
395 * @copydoc Toolkit::ScrollView::ScrollTo(unsigned int page, float duration, DirectionBias bias)
397 void ScrollTo(unsigned int page, float duration, DirectionBias bias = DirectionBiasNone);
400 * @copydoc Toolkit::ScrollView::ScrollTo(Actor& actor)
402 void ScrollTo(Actor &actor);
405 * @copydoc Toolkit::ScrollView::ScrollTo(Actor& actor, float duration)
407 void ScrollTo(Actor &actor, float duration);
410 * @copydoc Toolkit::ScrollView::SetScrollingDirection()
412 void SetScrollingDirection( Radian direction, Radian threshold );
415 * @copydoc Toolkit::ScrollView::RemoveScrollingDirection()
417 void RemoveScrollingDirection( Radian angle );
420 * Finds the closest Actor to the current center of the ScrollView.
422 * @return A handle to the actor if found, or an empty handle if not.
424 Actor FindClosestActor();
427 * Finds the closest Actor to position in ScrollView
429 * @param[in] position position within ScrollView.
430 * @param[in] dirX Whether to search only those elements that are Left,Right, or All
431 * @param[in] dirY Whether to search only those elements that are Up,Down, or All
432 * @param[in] dirZ Whether to search only those elements that are Out,In, or All
433 * @return A handle to the actor if found, or an empty handle if not.
435 Actor FindClosestActorToPosition(const Vector3& position, FindDirection dirX = All, FindDirection dirY = All, FindDirection dirZ = All);
438 * @copydoc Toolkit::ScrollView::ScrollToSnapPoint
440 bool ScrollToSnapPoint();
445 void StopAnimation(void);
448 * Stops the input animation
450 * @param[in] the animation to stop
452 void StopAnimation(Animation& animation);
455 * Animates to position transform.
457 * @param[in] position The position to animate to
458 * @param[in] positionDuration The number of seconds this animation should run for in each axis.
459 * @param[in] alpha The easing alpha function to use.
460 * @param[in] findShortcuts (optional) Whether to find the shortest route (in Wrap mode)
461 * @param[in] horizontalBias (optional) Whether to bias animation to left or right (or no biasing)
462 * @param[in] verticalBias (optional) Whether to bias animation to top or bottom (or no biasing)
463 * @return True if animation necessary and taking place to reach desired transform.
465 bool AnimateTo(const Vector3& position, const Vector3& positionDuration,
466 AlphaFunction alpha, bool findShortcuts = true,
467 DirectionBias horizontalBias = DirectionBiasNone, DirectionBias verticalBias = DirectionBiasNone,
468 SnapType snapType = Snap);
471 * @copydoc Toolkit::Scrollable::AddOverlay()
473 void AddOverlay(Actor actor);
476 * @copydoc Toolkit::Scrollable::RemoveOverlay()
478 void RemoveOverlay(Actor actor);
481 * @copydoc Toolkit::Internal::Scrollable::SetOvershootEffectColor
483 void SetOvershootEffectColor( const Vector4& color );
488 * @copydoc Dali::Toolkit::ScrollView::SnapStartedSignal()
490 Toolkit::ScrollView::SnapStartedSignalType& SnapStartedSignal();
493 * Connects a callback function with the object's signals.
494 * @param[in] object The object providing the signal.
495 * @param[in] tracker Used to disconnect the signal.
496 * @param[in] signalName The signal to connect to.
497 * @param[in] functor A newly allocated FunctorDelegate.
498 * @return True if the signal was connected.
499 * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
501 static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
503 private: // private overriden functions from CustomActorImpl and Controls
506 * @copydoc Dali::CustomActorImpl::OnSizeAnimation(Animation&, const Vector3&)
508 virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize);
511 * @copydoc Dali::Control::OnControlSizeSet(const Vector3&)
513 virtual void OnControlSizeSet( const Vector3& size );
516 * From CustomActorImpl; called after a child has been added to the owning actor.
517 * @param[in] child The child which has been added.
519 virtual void OnChildAdd(Actor& child);
522 * From CustomActorImpl; called shortly before a child is removed from the owning actor.
523 * @param[in] child The child being removed.
525 virtual void OnChildRemove(Actor& child);
528 * From CustomActorImpl; called after a touch-signal is received by the owning actor.
530 * We don't listen to these events as content within the contain may consume events.
532 * @param[in] event The touch event.
533 * @return True if the event should be consumed.
535 virtual bool OnTouchEvent(const TouchEvent& event);
538 * From CustomActorImpl; called after a mouse-wheel-event is received by the owning actor.
539 * @param[in] event The mouse wheel event.
540 * @return True if the event should be consumed.
542 virtual bool OnMouseWheelEvent(const MouseWheelEvent& event);
545 * @copydoc Toolkit::Control::OnInitialize()
547 virtual void OnInitialize();
550 * @copydoc Toolkit::Control::OnControlStageConnection()
552 virtual void OnControlStageConnection();
555 * @copydoc Toolkit::Control::OnControlStageConnection()
557 virtual void OnControlStageDisconnection();
560 * @copydoc Toolkit::Control::OnAccessibilityPan()
562 virtual bool OnAccessibilityPan(PanGesture gesture);
565 * @copydoc Toolkit::Scrollable::SetOvershootEnabled()
567 virtual void SetOvershootEnabled(bool enable);
572 * Start a timer which calls OnTouchDownTimeout()
574 void StartTouchDownTimer();
577 * Stop a timer which calls OnTouchDownTimeout()
579 void StopTouchDownTimer();
582 * Helper to detect when touch-point has been down (outside of pan gesture)
584 bool OnTouchDownTimeout();
587 * Called whenever a snap animation has completed
588 * @param[in] source the Animation instance that has completed.
589 * Resets all scrolling animations and states, leaving current scroll position at SCROLL_POSITION
591 void ResetScrolling();
594 * Updates mScrollInternalPosition, mScrollPrePosition and mScrollPostPosition from their property counterparts
596 void UpdateLocalScrollProperties();
599 * Makes sure scroll values are ready for animated scrolling
601 void PreAnimatedScrollSetup();
604 * Finish an animated scroll, ensuring all scroll properties are updated
607 void FinaliseAnimatedScroll();
610 * Animates the internal x property to the given value
612 * @param[in] position The X position to animate to
613 * @param[in] duration The time in seconds for animation
614 * @param[in] alpha The alpha function to use for animating
616 void AnimateInternalXTo( float position, float duration, AlphaFunction alpha );
619 * Animates the internal y property to the given value
621 * @param[in] position The Y position to animate to
622 * @param[in] duration The time in seconds for animation
623 * @param[in] alpha The alpha function to use for animating
625 void AnimateInternalYTo( float position, float duration, AlphaFunction alpha );
628 * Called whenever a snap animation on the x-axis has completed
629 * @param[in] source the Animation instance that has completed.
631 void OnScrollAnimationFinished( Animation& source );
634 * Called when either the X or Y internal scroll positions have finished snapping back to SCROLL_PRE_POSITION
636 * @param[in] source the Animation instance that has completed.
638 void OnSnapInternalPositionFinished( Animation& source );
641 * Called whenever a snap animation on the x-axis has completed and we need to snap pre scroll
642 * position to our clamped position
643 * @param[in] position The x position to snap pre scroll property to
645 void SnapInternalXTo( float position );
648 * Called whenever a snap animation on the y-axis has completed and we need to snap pre scroll
649 * position to our clamped position
650 * @param[in] position The y position to snap pre scroll property to
652 void SnapInternalYTo( float position );
655 * This is called internally whenever the Scroll Rulers are
656 * modified. This will update the properties: 'scroll-position-min'
657 * and 'scroll-position-max' to reflect the changes.
659 * @param[in] size size of the visible scroll area (ScrollView control size)
661 void UpdatePropertyDomain(const Vector3& size);
664 * Called when the gesture starts.
666 void GestureStarted();
669 * Amalgamated Gesture Continuing event
671 * @param[in] panDelta average panning delta from base position (0)
673 void GestureContinuing(const Vector2& panDelta);
676 * Called upon pan gesture event.
678 * @param[in] gesture The gesture event.
680 void OnPan( const PanGesture& pan);
683 * Extension of the above gestures.
685 * @param[in] gesture The gesture event.
687 void OnGestureEx(Gesture::State state);
690 * Performs snapping while taking into account Velocity of gesture
691 * (velocity in pixels/sec)
693 * @param[in] velocity velocity in pixels/sec
695 bool SnapWithVelocity(Vector2 velocity);
698 * Finishes Container Transform
699 * (occurs upon finishing gesture i.e. releasing)
701 void FinishTransform();
704 * Returns overshoot vector based on current position
706 * Overshoot vector is defined as how far outside of bounds
707 * the viewport is trying to view (prior to being clamped).
709 * an overshoot of (100,50), means user is in bottom right corner,
710 * trying to pan +100 to the right, and +50 below. This can be used
711 * to determine an effect, such as stretching.
713 * @param[in] position The position for which you wish to obtain overshoot vector
715 Vector3 GetOvershoot(Vector3& position) const;
718 * Clamps position within the domain set up by X/Y Rulers
720 * @param[in,out] position The position you wish to clamp
722 void ClampPosition(Vector3& position) const;
725 * Clamps position within the domain set up by X/Y Rulers
727 * @param[in,out] position The position you wish to clamp
728 * @param[out] clamped The results of the clamping.
730 void ClampPosition(Vector3& position, ClampState3D &clamped) const;
733 * Wraps position within the domain set up by X/Y Rulers
735 * @note Only wraps if mWrapMode is enabled, and respective domains
738 * @param[in,out] position The position you wish to wrap
740 void WrapPosition(Vector3& position) const;
743 * Updates the main internal scroll constraints with new ruler and domain
746 void UpdateMainInternalConstraint();
749 * Enables/disables the overshoot constraints
751 * @param[in] enabled whether to enable or disable the overshoot constraints
753 void SetOvershootConstraintsEnabled(bool enabled);
756 * Sets internal constraints for this ScrollView.
757 * Many of these internal constraints are based on properties within
760 void SetInternalConstraints();
765 * Construct a new ScrollView.
770 * A reference counted object may only be deleted by calling Unreference()
772 virtual ~ScrollView();
777 * Searches this ScrollView, and attempts to Unbind
778 * systematically this Actor from the ScrollView attached.
780 * @param[in] child The actor to be unbound.
782 virtual void FindAndUnbindActor(Actor child);
785 * Gets position property.
787 * @return The current position
789 Vector3 GetPropertyPrePosition() const;
792 * Gets position property.
794 * @return The current position
796 Vector3 GetPropertyPosition() const;
799 * Handles a Stopped animation. Its position properties need to be saved, and the animation flag
802 void HandleStoppedAnimation();
805 * Handles a Stopped animation (whether the animation completed, or was
806 * manually stopped). Its position properties need to be saved, and the
807 * animation flag switched off.
809 void HandleSnapAnimationFinished();
812 * Checks if the property notifications are active and adds them if not
814 void SetScrollUpdateNotification( bool enabled );
817 * Refresh the ScrollView (used when animating to update application developer of changes)
818 * @return True if the refresh timer should be kept running.
820 void OnScrollUpdateNotification(Dali::PropertyNotification& source);
825 ScrollView(const ScrollView&);
828 ScrollView& operator=(const ScrollView& rhs);
832 unsigned long mTouchDownTime; ///< The touch down time
834 int mGestureStackDepth; ///< How many gestures are currently occuring.
835 Vector2 mPanStartPosition; ///< Where the pan gesture's touch down occured
836 Vector3 mPanDelta; ///< Amount currently panned.
838 unsigned int mScrollStateFlags; ///< flags indicating current state of scrolling
839 // Scroll delegate pre and post position properties...
840 Vector3 mScrollPrePosition; ///< Wrapped scroll position, but not clamped
841 Vector3 mScrollPostPosition; ///< Wrapped and clamped, this is the final scroll position used
842 Vector3 mScrollTargetPosition; ///< Final target position for an animated scroll
843 Vector3 mDomainOffset; ///< Domain offset (this keeps track of the domain boundaries that scroll positions traverses)
845 // Rulers for each axes...
849 // Last property values set to ScrollView
853 Animation mInternalXAnimation; ///< Animates mPropertyX to a snap position or application requested scroll position
854 Animation mInternalYAnimation; ///< Animates mPropertyY to a snap position or application requested scroll position
857 Vector2 mLastVelocity; ///< Record the last velocity from PanGesture (Finish event doesn't have correct velocity)
860 Timer mTouchDownTimer; ///< Used to interrupt snap-animation. This cannot be done in OnTouchEvent without breaking fast flick behavior.
862 float mScrollUpdateDistance; ///< Distance for scrolling to travel for the scroll update notifications
863 Dali::PropertyNotification mScrollXUpdateNotification; ///< scroll x position update notification
864 Dali::PropertyNotification mScrollYUpdateNotification; ///< scroll y position update notification
866 Actor mInternalActor; ///< Internal actor (we keep internal actors in here e.g. scrollbars, so we can ignore it in searches)
868 ScrollViewEffectContainer mEffects; ///< Container keeping track of all the applied effects.
870 Vector2 mMaxOvershoot; ///< Number of scrollable pixels that will take overshoot from 0.0f to 1.0f
871 Vector2 mUserMaxOvershoot; ///< Set by user, allows overriding of default max overshoot for the scroll indicator
872 float mSnapOvershootDuration; ///< Duration for overshoot snapping back to Vector3::ZERO
873 AlphaFunction mSnapOvershootAlphaFunction; ///< AlphaFunction to be used for this overshoot.
875 float mSnapDuration; ///< Time for the snap animation to take (in seconds).
876 AlphaFunction mSnapAlphaFunction; ///< AlphaFunction to be used for the Snap Animation.
878 Vector2 mMinFlickDistance; ///< Minimum pan distance required for a flick
879 float mFlickSpeedThreshold; ///< Minimum pan speed required for a flick in pixels/ms
880 float mFlickDuration; ///< Time for the flick animation to take (in seconds).
881 AlphaFunction mFlickAlphaFunction; ///< AlphaFunction to be used for the Flick Animation.
883 float mAxisAutoLockGradient; ///< Axis Auto-lock gradient threshold. Above this gradient and it will lock scrolling to closest axis.
884 float mFrictionCoefficient; ///< Friction coefficient. Amount of friction to apply to free panning flick animation. in stage.lengths/sec
885 float mFlickSpeedCoefficient; ///< Flick velocity coefficient. Input touch velocity is multiplied by this.
886 float mMaxFlickSpeed; ///< Maximum flick speed. Maximum speed of flick in stage.lengths/sec.
888 Vector2 mMouseWheelScrollDistanceStep; ///< The step of scroll distance in actor coordinates in X and Y axes for each mouse wheel event received.
890 //ScrollInternalConstraintsPtr mScrollInternalConstraints;
891 Constraint mScrollMainInternalPrePositionConstraint;
892 Constraint mScrollMainInternalPositionConstraint;
893 Constraint mScrollMainInternalOvershootXConstraint;
894 Constraint mScrollMainInternalOvershootYConstraint;
895 Constraint mScrollMainInternalDeltaConstraint;
896 Constraint mScrollMainInternalFinalConstraint;
897 Constraint mScrollMainInternalRelativeConstraint;
899 ScrollOvershootIndicatorPtr mOvershootIndicator;
901 Toolkit::ScrollView::SnapStartedSignalType mSnapStartedSignal;
903 bool mInAccessibilityPan : 1; ///< With AccessibilityPan its easier to move between snap positions
905 bool mScrolling:1; ///< Flag indicating whether the scroll view is being scrolled (by user or animation)
906 bool mScrollInterrupted:1; ///< Flag set for when a down event interrupts a scroll
907 bool mPanning:1; ///< Whether scroll view is currently panning or not
908 bool mSensitive:1; ///< Scroll Sensitivity Flag.
909 bool mTouchDownTimeoutReached:1; ///< Indicates when down event timeout occured without corresponding up event (touch still down)
910 bool mActorAutoSnapEnabled:1; ///< Whether to automatically snap to closest actor.
911 bool mAutoResizeContainerEnabled:1; ///< Whether to automatically resize container (affects RulerDomain's on X/Y axes)
912 bool mWrapMode:1; ///< Whether to wrap contents based on container size.
913 bool mAxisAutoLock:1; ///< Whether to automatically lock axis when panning.
914 bool mAlterChild:1; ///< Internal flag to control behavior of OnChildAdd/OnChildRemove when Adding internal Actors.
915 bool mDefaultMaxOvershoot:1; ///< Whether to use default max overshoot or application defined one
916 bool mCanScrollHorizontal:1; ///< Local value of our property to check against
917 bool mCanScrollVertical:1; ///< Local value of our property to check against
920 } // namespace Internal
922 // Helpers for public-api forwarding methods
924 inline Toolkit::Internal::ScrollView& GetImpl(Toolkit::ScrollView& scrollView)
926 DALI_ASSERT_ALWAYS(scrollView);
928 Dali::RefObject& handle = scrollView.GetImplementation();
930 return static_cast<Toolkit::Internal::ScrollView&>(handle);
933 inline const Toolkit::Internal::ScrollView& GetImpl(const Toolkit::ScrollView& scrollView)
935 DALI_ASSERT_ALWAYS(scrollView);
937 const Dali::RefObject& handle = scrollView.GetImplementation();
939 return static_cast<const Toolkit::Internal::ScrollView&>(handle);
942 } // namespace Toolkit
946 #endif // __DALI_TOOLKIT_INTERNAL_SCROLL_VIEW_H__