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>
32 // predefined effect includes
33 #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-custom-effect.h>
45 typedef IntrusivePtr<ScrollView> ScrollViewPtr;
47 class ScrollInternalConstraints;
48 typedef IntrusivePtr<ScrollInternalConstraints> ScrollInternalConstraintsPtr;
50 class ScrollOvershootIndicator;
51 typedef IntrusivePtr<ScrollOvershootIndicator> ScrollOvershootIndicatorPtr;
54 * @copydoc Toolkit::ScrollView
56 class ScrollView : public ScrollBase
61 * FindDirection specifies how searching is conducted within the Find... routines.
65 None = -3, ///< Includes none within the search query.
66 All = -2, ///< Includes all within the search query.
67 Left = -1, ///< Includes only those not right !(>)
68 Right = 1, ///< Includes only those right (>)
69 Up = -1, ///< Includes only those not below !(>)
70 Down = 1, ///< Includes only those below (>)
71 Out = -1, ///< Includes only those not infront !(>)
72 In = 1 ///< Includes only those infront (>)
77 LockPossible = 0, ///< Locking is possible, but not set in stone yet.
78 LockHorizontal, ///< Locking is set to horizontal. (can pan vertically)
79 LockVertical, ///< Locking is set to vertical. (can pan horizontally)
80 LockNone ///< Locking is set to none (free panning).
85 AnimatingInternalX = 0x01, ///< animating mPropertyX due to externally requested ScrollTo or internal snapping operation
86 AnimatingInternalY = 0x02, ///< animating mPropertyY due to externally requested ScrollTo or internal snapping operation
87 SnappingInternalX = 0x04, ///< snapping mPropertyX back to mPropertyPreScroll x value to remove x overshoot over time
88 SnappingInternalY = 0x08, ///< snapping mPropertyY back to mPropertyPreScroll y value to remove y overshoot over time
91 static const unsigned int SCROLL_X_STATE_MASK = AnimatingInternalX | SnappingInternalX;
92 static const unsigned int SCROLL_Y_STATE_MASK = AnimatingInternalY | SnappingInternalY;
93 static const unsigned int SCROLL_ANIMATION_FLAGS = AnimatingInternalX | AnimatingInternalY;
94 static const unsigned int SNAP_ANIMATION_FLAGS = SnappingInternalX | SnappingInternalY;
99 * Create a new ScrollView.
100 * @return A public handle to the newly allocated ScrollView.
102 static Dali::Toolkit::ScrollView New();
107 * @copydoc Toolkit::ScrollView::GetScrollSnapAlphaFunction
109 AlphaFunction GetScrollSnapAlphaFunction() const;
112 * @copydoc Toolkit::ScrollView::SetScrollSnapAlphaFunction
114 void SetScrollSnapAlphaFunction(AlphaFunction alpha);
117 * @copydoc Toolkit::ScrollView::GetScrollFlickAlphaFunction
119 AlphaFunction GetScrollFlickAlphaFunction() const;
122 * @copydoc Toolkit::ScrollView::SetScrollFlickAlphaFunction
124 void SetScrollFlickAlphaFunction(AlphaFunction alpha);
127 * @copydoc Toolkit::ScrollView::GetScrollSnapDuration
129 float GetScrollSnapDuration() const;
132 * @copydoc Toolkit::ScrollView::SetScrollSnapDuration
134 void SetScrollSnapDuration(float time);
137 * @copydoc Toolkit::ScrollView::GetScrollFlickDuration
139 float GetScrollFlickDuration() const;
142 * @copydoc Toolkit::ScrollView::SetScrollFlickDuration
144 void SetScrollFlickDuration(float time);
147 * @copydoc Toolkit::ScrollView::ApplyEffect
149 void ApplyEffect(Toolkit::ScrollViewEffect effect);
152 * @brief ApplyEffect Applies a predefined effect
155 Toolkit::ScrollViewEffect ApplyEffect(Toolkit::ScrollView::PageEffect effect);
158 * @copydoc Toolkit::ScrollView::RemoveEffect
160 void RemoveEffect(Toolkit::ScrollViewEffect effect);
163 * @copydoc Toolkit::ScrollView::RemoveAllEffects
165 void RemoveAllEffects();
168 * @copydoc Toolkit::ScrollView::ApplyConstraintToChildren
170 void ApplyConstraintToChildren(Constraint constraint);
173 * @copydoc Toolkit::ScrollView::RemoveConstraintsFromChildren
175 void RemoveConstraintsFromChildren();
178 * @copydoc Toolkit::ScrollView::GetRulerX
180 const RulerPtr GetRulerX() const;
183 * @copydoc Toolkit::ScrollView::GetRulerY
185 const RulerPtr GetRulerY() const;
188 * @copydoc Toolkit::ScrollView::SetRulerX
190 void SetRulerX(RulerPtr ruler);
193 * @copydoc Toolkit::ScrollView::SetRulerY
195 void SetRulerY(RulerPtr ruler);
198 * @copydoc Toolkit::ScrollView::SetScrollSensitive
200 void SetScrollSensitive(bool sensitive);
203 * @copydoc Toolkit::ScrollView::SetMaxOvershoot
205 void SetMaxOvershoot(float overshootX, float overshootY);
208 * @copydoc Toolkit::ScrollView::SetSnapOvershootAlphaFunction
210 void SetSnapOvershootAlphaFunction(AlphaFunction alpha);
213 * @copydoc Toolkit::ScrollView::SetSnapOvershootDuration
215 void SetSnapOvershootDuration(float duration);
218 * @copydoc Toolkit::ScrollView::SetTouchesRequiredForPanning
220 void SetTouchesRequiredForPanning(unsigned int minTouches, unsigned int maxTouches, bool endOutside);
223 * @copydoc Toolkit::ScrollView::SetActorAutoSnap
225 void SetActorAutoSnap(bool enable);
228 * Enables or Disables Auto Resizing mode for ScrollView contents.
230 * When enabled, the ScrollView's X/Y Domains are restricted to the
231 * dimensions of the content's bounds, which may change as Actors are
232 * Added/Removed, and repositioned.
234 * @note This has been disabled for now, as this requires some fundamental
235 * changes to the way Actors positions and bounds are retrieved.
236 * (currently only constraints have these initial state knowledge)
238 * @param[in] enable Enables (true), or disables (false) Auto Resize.
240 void SetAutoResize(bool enable);
243 * Returns whether the wrap mode has been enabled (true) or not (false).
245 * @return Wrap Mode Enabled flag.
247 bool GetWrapMode() const;
250 * @copydoc Toolkit::ScrollView::SetWrapMode
252 void SetWrapMode(bool enable);
255 * @copydoc Toolkit::ScrollView::GetScrollupdateDistance
257 int GetScrollUpdateDistance() const;
260 * @copydoc Toolkit::ScrollView::SetScrollUpdateDistance
262 void SetScrollUpdateDistance(int distance);
265 * @copydoc Toolkit::ScrollView::GetAxisAutoLock
267 bool GetAxisAutoLock() const;
270 * @copydoc Toolkit::ScrollView::SetAxisAutoLock
272 void SetAxisAutoLock(bool enable);
275 * @copydoc Toolkit::ScrollView::GetAxisAutoLockGradient
277 float GetAxisAutoLockGradient() const;
280 * @copydoc Toolkit::ScrollView::SetAxisAutoLockGradient
282 void SetAxisAutoLockGradient(float gradient);
285 * @copydoc Toolkit::ScrollView::GetFrictionCoefficient
287 float GetFrictionCoefficient() const;
290 * @copydoc Toolkit::ScrollView::SetFrictionCoefficient
292 void SetFrictionCoefficient(float friction);
295 * @copydoc Toolkit::ScrollView::GetFlickSpeedCoefficient
297 float GetFlickSpeedCoefficient() const;
300 * @copydoc Toolkit::ScrollView::SetFlickSpeedCoefficient
302 void SetFlickSpeedCoefficient(float speed);
305 * @copydoc Toolkit::ScrollView::GetMinimumDistanceForFlick
307 Vector2 GetMinimumDistanceForFlick() const;
310 * @copydoc Toolkit::ScrollView::SetMinimumDistanceForFlick
312 void SetMinimumDistanceForFlick( const Vector2& distance );
315 * @copydoc Toolkit::ScrollView::GetMinimumSpeedForFlick
317 float GetMinimumSpeedForFlick() const;
320 * @copydoc Toolkit::ScrollView::SetMinimumSpeedForFlick
322 void SetMinimumSpeedForFlick( float speed );
325 * @copydoc Toolkit::ScrollView::GetMaxFlickSpeed
327 float GetMaxFlickSpeed() const;
330 * @copydoc Toolkit::ScrollView::SetMaxFlickSpeed
332 void SetMaxFlickSpeed(float speed);
335 * @copydoc Toolkit::ScrollView::GetMouseWheelScrollDistanceStep
337 Vector2 GetMouseWheelScrollDistanceStep() const;
340 * @copydoc Toolkit::ScrollView::SetMouseWheelScrollDistanceStep
342 void SetMouseWheelScrollDistanceStep(Vector2 step);
345 * @copydoc Toolkit::ScrollView::GetCurrentPage
347 unsigned int GetCurrentPage() const;
350 * @copydoc Toolkit::ScrollView::GetCurrentScrollPosition
352 Vector3 GetCurrentScrollPosition() const;
355 * @copydoc Toolkit::ScrollView::SetScrollPosition
357 void SetScrollPosition(const Vector3& position);
360 * @copydoc Toolkit::Scrollable::GetDomainSize
362 Vector3 GetDomainSize() const;
365 * @copydoc ScrollTo(const Vector3&)
367 void TransformTo(const Vector3& position,
368 DirectionBias horizontalBias = DirectionBiasNone, DirectionBias verticalBias = DirectionBiasNone);
371 * @copydoc ScrollTo(const Vector3&, float, AlhpaFunction, DirectionBias, DirectionBias)
373 void TransformTo(const Vector3& position, float duration, AlphaFunction alpha,
374 DirectionBias horizontalBias = DirectionBiasNone, DirectionBias verticalBias = DirectionBiasNone);
377 * @copydoc Toolkit::ScrollView::ScrollTo(const Vector3 &position)
379 void ScrollTo(const Vector3 &position);
382 * @copydoc Toolkit::Scrollable::ScrollTo(const Vector3& position, float duration)
384 void ScrollTo(const Vector3& position, float duration);
387 * @copydoc Toolkit::Scrollable::ScrollTo(const Vector3& position, float duration, AlphaFunction alpha)
389 void ScrollTo(const Vector3& position, float duration, AlphaFunction alpha);
392 * @copydoc Toolkit::ScrollView::ScrollTo(const Vector3 &position, float duration, DirectionBias horizontalBias, DirectionBias verticalBias)
394 void ScrollTo(const Vector3& position, float duration,
395 DirectionBias horizontalBias, DirectionBias verticalBias);
398 * @copydoc Toolkit::ScrollView::ScrollTo(const Vector3 &position, float duration, AlphaFunction alpha, DirectionBias horizontalBias, DirectionBias verticalBias)
400 void ScrollTo(const Vector3& position, float duration, AlphaFunction alpha,
401 DirectionBias horizontalBias, DirectionBias verticalBias);
404 * @copydoc Toolkit::ScrollView::ScrollTo(unsigned int page)
406 void ScrollTo(unsigned int page);
409 * @copydoc Toolkit::ScrollView::ScrollTo(unsigned int page, float duration, DirectionBias bias)
411 void ScrollTo(unsigned int page, float duration, DirectionBias bias = DirectionBiasNone);
414 * @copydoc Toolkit::ScrollView::ScrollTo(Actor& actor)
416 void ScrollTo(Actor &actor);
419 * @copydoc Toolkit::ScrollView::ScrollTo(Actor& actor, float duration)
421 void ScrollTo(Actor &actor, float duration);
424 * @copydoc Toolkit::ScrollView::SetScrollingDirection()
426 void SetScrollingDirection( Radian direction, Radian threshold );
429 * @copydoc Toolkit::ScrollView::RemoveScrollingDirection()
431 void RemoveScrollingDirection( Radian angle );
434 * Finds the closest Actor to the current center of the ScrollView.
436 * @return A handle to the actor if found, or an empty handle if not.
438 Actor FindClosestActor();
441 * Finds the closest Actor to position in ScrollView
443 * @param[in] position position within ScrollView.
444 * @param[in] dirX Whether to search only those elements that are Left,Right, or All
445 * @param[in] dirY Whether to search only those elements that are Up,Down, or All
446 * @param[in] dirZ Whether to search only those elements that are Out,In, or All
447 * @return A handle to the actor if found, or an empty handle if not.
449 Actor FindClosestActorToPosition(const Vector3& position, FindDirection dirX = All, FindDirection dirY = All, FindDirection dirZ = All);
452 * @copydoc Toolkit::ScrollView::ScrollToSnapPoint
454 bool ScrollToSnapPoint();
459 void StopAnimation(void);
462 * Stops the input animation
464 * @param[in] the animation to stop
466 void StopAnimation(Animation& animation);
469 * Animates to position transform.
471 * @param[in] position The position to animate to
472 * @param[in] positionDuration The number of seconds this animation should run for in each axis.
473 * @param[in] alpha The easing alpha function to use.
474 * @param[in] findShortcuts (optional) Whether to find the shortest route (in Wrap mode)
475 * @param[in] horizontalBias (optional) Whether to bias animation to left or right (or no biasing)
476 * @param[in] verticalBias (optional) Whether to bias animation to top or bottom (or no biasing)
477 * @return True if animation necessary and taking place to reach desired transform.
479 bool AnimateTo(const Vector3& position, const Vector3& positionDuration,
480 AlphaFunction alpha, bool findShortcuts = true,
481 DirectionBias horizontalBias = DirectionBiasNone, DirectionBias verticalBias = DirectionBiasNone,
482 SnapType snapType = Snap);
485 * @copydoc Toolkit::Scrollable::AddOverlay()
487 void AddOverlay(Actor actor);
490 * @copydoc Toolkit::Scrollable::RemoveOverlay()
492 void RemoveOverlay(Actor actor);
495 * @copydoc Toolkit::Internal::Scrollable::SetOvershootEffectColor
497 void SetOvershootEffectColor( const Vector4& color );
502 * @copydoc Dali::Toolkit::ScrollView::SnapStartedSignal()
504 Toolkit::ScrollView::SnapStartedSignalV2& SnapStartedSignal();
507 * Connects a callback function with the object's signals.
508 * @param[in] object The object providing the signal.
509 * @param[in] tracker Used to disconnect the signal.
510 * @param[in] signalName The signal to connect to.
511 * @param[in] functor A newly allocated FunctorDelegate.
512 * @return True if the signal was connected.
513 * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
515 static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
517 private: // private overriden functions from CustomActorImpl and Controls
520 * @copydoc Dali::CustomActorImpl::OnSizeAnimation(Animation&, const Vector3&)
522 virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize);
525 * @copydoc Dali::Control::OnControlSizeSet(const Vector3&)
527 virtual void OnControlSizeSet( const Vector3& size );
530 * From CustomActorImpl; called after a child has been added to the owning actor.
531 * @param[in] child The child which has been added.
533 virtual void OnChildAdd(Actor& child);
536 * From CustomActorImpl; called shortly before a child is removed from the owning actor.
537 * @param[in] child The child being removed.
539 virtual void OnChildRemove(Actor& child);
542 * @copydoc Dali::CustomActorImpl::OnPropertySet( Property::Index index, Property::Value propertyValue )
544 virtual void OnPropertySet( Property::Index index, Property::Value propertyValue );
547 * From CustomActorImpl; called after a touch-signal is received by the owning actor.
549 * We don't listen to these events as content within the contain may consume events.
551 * @param[in] event The touch event.
552 * @return True if the event should be consumed.
554 virtual bool OnTouchEvent(const TouchEvent& event);
557 * From CustomActorImpl; called after a mouse-wheel-event is received by the owning actor.
558 * @param[in] event The mouse wheel event.
559 * @return True if the event should be consumed.
561 virtual bool OnMouseWheelEvent(const MouseWheelEvent& event);
564 * @copydoc Toolkit::Control::OnInitialize()
566 virtual void OnInitialize();
569 * @copydoc Toolkit::Control::OnControlStageConnection()
571 virtual void OnControlStageConnection();
574 * @copydoc Toolkit::Control::OnControlStageConnection()
576 virtual void OnControlStageDisconnection();
579 * @copydoc Toolkit::Control::OnAccessibilityPan()
581 virtual bool OnAccessibilityPan(PanGesture gesture);
584 * @copydoc Toolkit::Scrollable::SetOvershootEnabled()
586 virtual void SetOvershootEnabled(bool enable);
591 * Start a timer which calls OnTouchDownTimeout()
593 void StartTouchDownTimer();
596 * Stop a timer which calls OnTouchDownTimeout()
598 void StopTouchDownTimer();
601 * Helper to detect when touch-point has been down (outside of pan gesture)
603 bool OnTouchDownTimeout();
606 * Called whenever a snap animation has completed
607 * @param[in] source the Animation instance that has completed.
608 * Resets all scrolling animations and states, leaving current scroll position at mPropertyPosition
610 void ResetScrolling();
613 * Updates mScrollInternalPosition, mScrollPrePosition and mScrollPostPosition from their property counterparts
615 void UpdateLocalScrollProperties();
618 * Makes sure scroll values are ready for animated scrolling
620 void PreAnimatedScrollSetup();
623 * Finish an animated scroll, ensuring all scroll properties are updated
626 void FinaliseAnimatedScroll();
629 * Animates the internal x property to the given value
631 * @param[in] position The X position to animate to
632 * @param[in] duration The time in seconds for animation
633 * @param[in] alpha The alpha function to use for animating
635 void AnimateInternalXTo( float position, float duration, AlphaFunction alpha );
638 * Animates the internal y property to the given value
640 * @param[in] position The Y position to animate to
641 * @param[in] duration The time in seconds for animation
642 * @param[in] alpha The alpha function to use for animating
644 void AnimateInternalYTo( float position, float duration, AlphaFunction alpha );
647 * Called whenever a snap animation on the x-axis has completed
648 * @param[in] source the Animation instance that has completed.
650 void OnScrollAnimationFinished( Animation& source );
653 * Called when either the X or Y internal scroll positions have finished snapping back to mPropertyPrePosition
655 * @param[in] source the Animation instance that has completed.
657 void OnSnapInternalPositionFinished( Animation& source );
660 * Called whenever a snap animation on the x-axis has completed and we need to snap pre scroll
661 * position to our clamped position
662 * @param[in] position The x position to snap pre scroll property to
664 void SnapInternalXTo( float position );
667 * Called whenever a snap animation on the y-axis has completed and we need to snap pre scroll
668 * position to our clamped position
669 * @param[in] position The y position to snap pre scroll property to
671 void SnapInternalYTo( float position );
674 * This is called internally whenever the Scroll Rulers are
675 * modified. This will update the properties: 'scroll-position-min'
676 * and 'scroll-position-max' to reflect the changes.
678 * @param[in] size size of the visible scroll area (ScrollView control size)
680 void UpdatePropertyDomain(const Vector3& size);
683 * Called when the gesture starts.
685 void GestureStarted();
688 * Amalgamated Gesture Continuing event
690 * @param[in] panDelta average panning delta from base position (0)
692 void GestureContinuing(const Vector2& panDelta);
695 * Called upon pan gesture event.
697 * @param[in] gesture The gesture event.
699 void OnPan( const PanGesture& pan);
702 * Extension of the above gestures.
704 * @param[in] gesture The gesture event.
706 void OnGestureEx(Gesture::State state);
709 * Performs snapping while taking into account Velocity of gesture
710 * (velocity in pixels/sec)
712 * @param[in] velocity velocity in pixels/sec
714 bool SnapWithVelocity(Vector2 velocity);
717 * Finishes Container Transform
718 * (occurs upon finishing gesture i.e. releasing)
720 void FinishTransform();
723 * Returns overshoot vector based on current position
725 * Overshoot vector is defined as how far outside of bounds
726 * the viewport is trying to view (prior to being clamped).
728 * an overshoot of (100,50), means user is in bottom right corner,
729 * trying to pan +100 to the right, and +50 below. This can be used
730 * to determine an effect, such as stretching.
732 * @param[in] position The position for which you wish to obtain overshoot vector
734 Vector3 GetOvershoot(Vector3& position) const;
737 * Clamps position within the domain set up by X/Y Rulers
739 * @param[in,out] position The position you wish to clamp
741 void ClampPosition(Vector3& position) const;
744 * Clamps position within the domain set up by X/Y Rulers
746 * @param[in,out] position The position you wish to clamp
747 * @param[out] clamped The results of the clamping.
749 void ClampPosition(Vector3& position, ClampState3 &clamped) const;
752 * Wraps position within the domain set up by X/Y Rulers
754 * @note Only wraps if mWrapMode is enabled, and respective domains
757 * @param[in,out] position The position you wish to wrap
759 void WrapPosition(Vector3& position) const;
762 * Updates the main internal scroll constraints with new ruler and domain
765 void UpdateMainInternalConstraint();
768 * Enables/disables the overshoot constraints
770 * @param[in] enabled whether to enable or disable the overshoot constraints
772 void SetOvershootConstraintsEnabled(bool enabled);
775 * Sets internal constraints for this ScrollView.
776 * Many of these internal constraints are based on properties within
779 void SetInternalConstraints();
784 * Construct a new ScrollView.
789 * A reference counted object may only be deleted by calling Unreference()
791 virtual ~ScrollView();
796 * Searches this ScrollView, and attempts to Unbind
797 * systematically this Actor from the ScrollView attached.
799 * @param[in] child The actor to be unbound.
801 virtual void FindAndUnbindActor(Actor child);
804 * Gets position property.
806 * @return The current position
808 Vector3 GetPropertyPrePosition() const;
811 * Gets position property.
813 * @return The current position
815 Vector3 GetPropertyPosition() const;
818 * Handles a Stopped animation. Its position properties need to be saved, and the animation flag
821 void HandleStoppedAnimation();
824 * Handles a Stopped animation (whether the animation completed, or was
825 * manually stopped). Its position properties need to be saved, and the
826 * animation flag switched off.
828 void HandleSnapAnimationFinished();
831 * Checks if the property notifications are active and adds them if not
833 void SetScrollUpdateNotification( bool enabled );
836 * Refresh the ScrollView (used when animating to update application developer of changes)
837 * @return True if the refresh timer should be kept running.
839 void OnScrollUpdateNotification(Dali::PropertyNotification& source);
844 ScrollView(const ScrollView&);
847 ScrollView& operator=(const ScrollView& rhs);
851 unsigned long mTouchDownTime; ///< The touch down time
853 int mGestureStackDepth; ///< How many gestures are currently occuring.
854 Vector2 mPanStartPosition; ///< Where the pan gesture's touch down occured
855 Vector3 mPanDelta; ///< Amount currently panned.
857 unsigned int mScrollStateFlags; ///< flags indicating current state of scrolling
858 // Scroll delegate pre and post position properties...
859 Vector3 mScrollPrePosition; ///< Wrapped scroll position, but not clamped
860 Vector3 mScrollPostPosition; ///< Wrapped and clamped, this is the final scroll position used
861 Vector3 mScrollTargetPosition; ///< Final target position for an animated scroll
862 Vector3 mDomainOffset; ///< Domain offset (this keeps track of the domain boundaries that scroll positions traverses)
864 // Rulers for each axes...
868 // Last property values set to ScrollView
872 unsigned int mMinTouchesForPanning; ///< Minimum number of touches for panning to be used.
873 unsigned int mMaxTouchesForPanning; ///< Maximum number of touches for panning to be used.
875 Animation mInternalXAnimation; ///< Animates mPropertyX to a snap position or application requested scroll position
876 Animation mInternalYAnimation; ///< Animates mPropertyY to a snap position or application requested scroll position
879 Vector2 mLastVelocity; ///< Record the last velocity from PanGesture (Finish event doesn't have correct velocity)
882 Timer mTouchDownTimer; ///< Used to interrupt snap-animation. This cannot be done in OnTouchEvent without breaking fast flick behavior.
884 float mScrollUpdateDistance; ///< Distance for scrolling to travel for the scroll update notifications
885 Dali::PropertyNotification mScrollXUpdateNotification; ///< scroll x position update notification
886 Dali::PropertyNotification mScrollYUpdateNotification; ///< scroll y position update notification
888 Actor mInternalActor; ///< Internal actor (we keep internal actors in here e.g. scrollbars, so we can ignore it in searches)
890 ScrollViewEffectContainer mEffects; ///< Container keeping track of all the applied effects.
892 float mOvershootDelay; ///< Time to wait for input before reducing overshoot back to 0
893 Vector2 mMaxOvershoot; ///< Number of scrollable pixels that will take overshoot from 0.0f to 1.0f
894 Vector2 mUserMaxOvershoot; ///< Set by user, allows overriding of default max overshoot for the scroll indicator
895 float mSnapOvershootDuration; ///< Duration for overshoot snapping back to Vector3::ZERO
896 AlphaFunction mSnapOvershootAlphaFunction; ///< AlphaFunction to be used for this overshoot.
898 float mSnapDuration; ///< Time for the snap animation to take (in seconds).
899 AlphaFunction mSnapAlphaFunction; ///< AlphaFunction to be used for the Snap Animation.
901 Vector2 mMinFlickDistance; ///< Minimum pan distance required for a flick
902 float mFlickSpeedThreshold; ///< Minimum pan speed required for a flick in pixels/ms
903 float mFlickDuration; ///< Time for the flick animation to take (in seconds).
904 AlphaFunction mFlickAlphaFunction; ///< AlphaFunction to be used for the Flick Animation.
906 float mAxisAutoLockGradient; ///< Axis Auto-lock gradient threshold. Above this gradient and it will lock scrolling to closest axis.
907 float mFrictionCoefficient; ///< Friction coefficient. Amount of friction to apply to free panning flick animation. in stage.lengths/sec
908 float mFlickSpeedCoefficient; ///< Flick velocity coefficient. Input touch velocity is multiplied by this.
909 float mMaxFlickSpeed; ///< Maximum flick speed. Maximum speed of flick in stage.lengths/sec.
911 Vector2 mMouseWheelScrollDistanceStep; ///< The step of scroll distance in actor coordinates in X and Y axes for each mouse wheel event received.
913 //ScrollInternalConstraintsPtr mScrollInternalConstraints;
914 ActiveConstraint mScrollMainInternalPrePositionConstraint;
915 ActiveConstraint mScrollMainInternalPositionConstraint;
916 ActiveConstraint mScrollMainInternalOvershootXConstraint;
917 ActiveConstraint mScrollMainInternalOvershootYConstraint;
918 ActiveConstraint mScrollMainInternalDeltaConstraint;
919 ActiveConstraint mScrollMainInternalFinalConstraint;
920 ActiveConstraint mScrollMainInternalRelativeConstraint;
922 ScrollOvershootIndicatorPtr mOvershootIndicator;
924 Toolkit::ScrollView::SnapStartedSignalV2 mSnapStartedSignalV2;
926 bool mInAccessibilityPan : 1; ///< With AccessibilityPan its easier to move between snap positions
928 bool mScrolling:1; ///< Flag indicating whether the scroll view is being scrolled (by user or animation)
929 bool mScrollInterrupted:1; ///< Flag set for when a down event interrupts a scroll
930 bool mPanning:1; ///< Whether scroll view is currently panning or not
931 bool mSensitive:1; ///< Scroll Sensitivity Flag.
932 bool mTouchDownTimeoutReached:1; ///< Indicates when down event timeout occured without corresponding up event (touch still down)
933 bool mActorAutoSnapEnabled:1; ///< Whether to automatically snap to closest actor.
934 bool mAutoResizeContainerEnabled:1; ///< Whether to automatically resize container (affects RulerDomain's on X/Y axes)
935 bool mWrapMode:1; ///< Whether to wrap contents based on container size.
936 bool mAxisAutoLock:1; ///< Whether to automatically lock axis when panning.
937 bool mAlterChild:1; ///< Internal flag to control behavior of OnChildAdd/OnChildRemove when Adding internal Actors.
938 bool mDefaultMaxOvershoot:1; ///< Whether to use default max overshoot or application defined one
939 bool mCanScrollHorizontal:1; ///< Local value of our property to check against
940 bool mCanScrollVertical:1; ///< Local value of our property to check against
943 } // namespace Internal
945 // Helpers for public-api forwarding methods
947 inline Toolkit::Internal::ScrollView& GetImpl(Toolkit::ScrollView& scrollView)
949 DALI_ASSERT_ALWAYS(scrollView);
951 Dali::RefObject& handle = scrollView.GetImplementation();
953 return static_cast<Toolkit::Internal::ScrollView&>(handle);
956 inline const Toolkit::Internal::ScrollView& GetImpl(const Toolkit::ScrollView& scrollView)
958 DALI_ASSERT_ALWAYS(scrollView);
960 const Dali::RefObject& handle = scrollView.GetImplementation();
962 return static_cast<const Toolkit::Internal::ScrollView&>(handle);
965 } // namespace Toolkit
969 #endif // __DALI_TOOLKIT_INTERNAL_SCROLL_VIEW_H__