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>
25 #include <dali/devel-api/object/weak-handle.h>
28 #include <dali-toolkit/public-api/controls/control-impl.h>
29 #include <dali-toolkit/public-api/controls/scroll-bar/scroll-bar.h>
30 #include <dali-toolkit/internal/controls/scrollable/scroll-view/scroll-base-impl.h>
31 #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h>
32 #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-effect.h>
44 typedef IntrusivePtr<ScrollView> ScrollViewPtr;
46 class ScrollInternalConstraints;
47 typedef IntrusivePtr<ScrollInternalConstraints> ScrollInternalConstraintsPtr;
49 class ScrollOvershootIndicator;
50 typedef IntrusivePtr<ScrollOvershootIndicator> ScrollOvershootIndicatorPtr;
53 * @copydoc Toolkit::ScrollView
55 class ScrollView : public ScrollBase
60 * FindDirection specifies how searching is conducted within the Find... routines.
64 None = -3, ///< Includes none within the search query.
65 All = -2, ///< Includes all within the search query.
66 Left = -1, ///< Includes only those not right !(>)
67 Right = 1, ///< Includes only those right (>)
68 Up = -1, ///< Includes only those not below !(>)
69 Down = 1, ///< Includes only those below (>)
70 Out = -1, ///< Includes only those not infront !(>)
71 In = 1 ///< Includes only those infront (>)
76 LockPossible = 0, ///< Locking is possible, but not set in stone yet.
77 LockHorizontal, ///< Locking is set to horizontal. (can pan vertically)
78 LockVertical, ///< Locking is set to vertical. (can pan horizontally)
79 LockNone ///< Locking is set to none (free panning).
84 AnimatingInternalX = 0x01, ///< animating mPropertyX due to externally requested ScrollTo or internal snapping operation
85 AnimatingInternalY = 0x02, ///< animating mPropertyY due to externally requested ScrollTo or internal snapping operation
86 SnappingInternalX = 0x04, ///< snapping mPropertyX back to mPropertyPreScroll x value to remove x overshoot over time
87 SnappingInternalY = 0x08, ///< snapping mPropertyY back to mPropertyPreScroll y value to remove y overshoot over time
90 static const unsigned int SCROLL_X_STATE_MASK = AnimatingInternalX | SnappingInternalX;
91 static const unsigned int SCROLL_Y_STATE_MASK = AnimatingInternalY | SnappingInternalY;
92 static const unsigned int SCROLL_ANIMATION_FLAGS = AnimatingInternalX | AnimatingInternalY;
93 static const unsigned int SNAP_ANIMATION_FLAGS = SnappingInternalX | SnappingInternalY;
97 typedef std::vector<Dali::Toolkit::ScrollViewEffect> ScrollViewEffectContainer; ///< Container of Dali::Toolkit::ScrollViewEffect
98 typedef ScrollViewEffectContainer::iterator ScrollViewEffectIter; ///< Iterator for Dali::Toolkit::ScrollViewEffectContainer
103 * Create a new ScrollView.
104 * @return A public handle to the newly allocated ScrollView.
106 static Dali::Toolkit::ScrollView New();
111 * @copydoc Toolkit::ScrollView::GetScrollSnapAlphaFunction
113 AlphaFunction GetScrollSnapAlphaFunction() const;
116 * @copydoc Toolkit::ScrollView::SetScrollSnapAlphaFunction
118 void SetScrollSnapAlphaFunction(AlphaFunction alpha);
121 * @copydoc Toolkit::ScrollView::GetScrollFlickAlphaFunction
123 AlphaFunction GetScrollFlickAlphaFunction() const;
126 * @copydoc Toolkit::ScrollView::SetScrollFlickAlphaFunction
128 void SetScrollFlickAlphaFunction(AlphaFunction alpha);
131 * @copydoc Toolkit::ScrollView::GetScrollSnapDuration
133 float GetScrollSnapDuration() const;
136 * @copydoc Toolkit::ScrollView::SetScrollSnapDuration
138 void SetScrollSnapDuration(float time);
141 * @copydoc Toolkit::ScrollView::GetScrollFlickDuration
143 float GetScrollFlickDuration() const;
146 * @copydoc Toolkit::ScrollView::SetScrollFlickDuration
148 void SetScrollFlickDuration(float time);
151 * @copydoc Toolkit::ScrollView::ApplyEffect
153 void ApplyEffect(Toolkit::ScrollViewEffect effect);
156 * @copydoc Toolkit::ScrollView::RemoveEffect
158 void RemoveEffect(Toolkit::ScrollViewEffect effect);
161 * @copydoc Toolkit::ScrollView::RemoveAllEffects
163 void RemoveAllEffects();
166 * @copydoc Toolkit::ScrollView::ApplyConstraintToChildren
168 void ApplyConstraintToChildren(Constraint constraint);
171 * @copydoc Toolkit::ScrollView::RemoveConstraintsFromChildren
173 void RemoveConstraintsFromChildren();
176 * @copydoc Toolkit::ScrollView::GetRulerX
178 const RulerPtr GetRulerX() const;
181 * @copydoc Toolkit::ScrollView::GetRulerY
183 const RulerPtr GetRulerY() const;
186 * @copydoc Toolkit::ScrollView::SetRulerX
188 void SetRulerX(RulerPtr ruler);
191 * @copydoc Toolkit::ScrollView::SetRulerY
193 void SetRulerY(RulerPtr ruler);
196 * Retrieve the touch sensitivity.
198 * @return whether the touch sensitivity is true or false.
200 bool GetScrollSensitive();
203 * @copydoc Toolkit::ScrollView::SetScrollSensitive
205 void SetScrollSensitive(bool sensitive);
208 * @copydoc Toolkit::ScrollView::SetMaxOvershoot
210 void SetMaxOvershoot(float overshootX, float overshootY);
213 * @copydoc Toolkit::ScrollView::SetSnapOvershootAlphaFunction
215 void SetSnapOvershootAlphaFunction(AlphaFunction alpha);
218 * Retrieve the duartion of Snap Overshoot animation
220 * @return the duration.
222 float GetSnapOvershootDuration();
225 * @copydoc Toolkit::ScrollView::SetSnapOvershootDuration
227 void SetSnapOvershootDuration(float duration);
230 * Retrieve whether Actor Auto-Snap mode is enabled or not.
232 * @return Actor Auto-Snap mode Enabled flag.
234 bool GetActorAutoSnap();
237 * @copydoc Toolkit::ScrollView::SetActorAutoSnap
239 void SetActorAutoSnap(bool enable);
242 * Enables or Disables Auto Resizing mode for ScrollView contents.
244 * When enabled, the ScrollView's X/Y Domains are restricted to the
245 * dimensions of the content's bounds, which may change as Actors are
246 * Added/Removed, and repositioned.
248 * @note This has been disabled for now, as this requires some fundamental
249 * changes to the way Actors positions and bounds are retrieved.
250 * (currently only constraints have these initial state knowledge)
252 * @param[in] enable Enables (true), or disables (false) Auto Resize.
254 void SetAutoResize(bool enable);
257 * Returns whether the wrap mode has been enabled (true) or not (false).
259 * @return Wrap Mode Enabled flag.
261 bool GetWrapMode() const;
264 * @copydoc Toolkit::ScrollView::SetWrapMode
266 void SetWrapMode(bool enable);
269 * @copydoc Toolkit::ScrollView::GetScrollupdateDistance
271 int GetScrollUpdateDistance() const;
274 * @copydoc Toolkit::ScrollView::SetScrollUpdateDistance
276 void SetScrollUpdateDistance(int distance);
279 * @copydoc Toolkit::ScrollView::GetAxisAutoLock
281 bool GetAxisAutoLock() const;
284 * @copydoc Toolkit::ScrollView::SetAxisAutoLock
286 void SetAxisAutoLock(bool enable);
289 * @copydoc Toolkit::ScrollView::GetAxisAutoLockGradient
291 float GetAxisAutoLockGradient() const;
294 * @copydoc Toolkit::ScrollView::SetAxisAutoLockGradient
296 void SetAxisAutoLockGradient(float gradient);
299 * @copydoc Toolkit::ScrollView::GetFrictionCoefficient
301 float GetFrictionCoefficient() const;
304 * @copydoc Toolkit::ScrollView::SetFrictionCoefficient
306 void SetFrictionCoefficient(float friction);
309 * @copydoc Toolkit::ScrollView::GetFlickSpeedCoefficient
311 float GetFlickSpeedCoefficient() const;
314 * @copydoc Toolkit::ScrollView::SetFlickSpeedCoefficient
316 void SetFlickSpeedCoefficient(float speed);
319 * @copydoc Toolkit::ScrollView::GetMinimumDistanceForFlick
321 Vector2 GetMinimumDistanceForFlick() const;
324 * @copydoc Toolkit::ScrollView::SetMinimumDistanceForFlick
326 void SetMinimumDistanceForFlick( const Vector2& distance );
329 * @copydoc Toolkit::ScrollView::GetMinimumSpeedForFlick
331 float GetMinimumSpeedForFlick() const;
334 * @copydoc Toolkit::ScrollView::SetMinimumSpeedForFlick
336 void SetMinimumSpeedForFlick( float speed );
339 * @copydoc Toolkit::ScrollView::GetMaxFlickSpeed
341 float GetMaxFlickSpeed() const;
344 * @copydoc Toolkit::ScrollView::SetMaxFlickSpeed
346 void SetMaxFlickSpeed(float speed);
349 * @copydoc Toolkit::ScrollView::GetWheelScrollDistanceStep
351 Vector2 GetWheelScrollDistanceStep() const;
354 * @copydoc Toolkit::ScrollView::SetWheelScrollDistanceStep
356 void SetWheelScrollDistanceStep(Vector2 step);
359 * @brief Enables or disables the transient scroll-bar
361 * @param[in] transient True if scroll-bar should be automatically show/hidden during/after panning
363 void SetTransientScrollBar( bool transient );
366 * @copydoc Toolkit::ScrollView::GetCurrentPage
368 unsigned int GetCurrentPage() const;
371 * @copydoc Toolkit::ScrollView::GetCurrentScrollPosition
373 Vector2 GetCurrentScrollPosition() const;
376 * @copydoc ScrollTo(const Vector2&)
378 void TransformTo(const Vector2& position,
379 DirectionBias horizontalBias = DirectionBiasNone, DirectionBias verticalBias = DirectionBiasNone);
382 * @copydoc ScrollTo(const Vector2&, float, AlhpaFunction, DirectionBias, DirectionBias)
384 void TransformTo(const Vector2& position, float duration, AlphaFunction alpha,
385 DirectionBias horizontalBias = DirectionBiasNone, DirectionBias verticalBias = DirectionBiasNone);
388 * @copydoc Toolkit::ScrollView::ScrollTo(const Vector2 &position)
390 void ScrollTo(const Vector2 &position);
393 * @copydoc Toolkit::Scrollable::ScrollTo(const Vector2& position, float duration)
395 void ScrollTo(const Vector2& position, float duration);
398 * @copydoc Toolkit::Scrollable::ScrollTo(const Vector2& position, float duration, AlphaFunction alpha)
400 void ScrollTo(const Vector2& position, float duration, AlphaFunction alpha);
403 * @copydoc Toolkit::ScrollView::ScrollTo(const Vector2 &position, float duration, DirectionBias horizontalBias, DirectionBias verticalBias)
405 void ScrollTo(const Vector2& position, float duration,
406 DirectionBias horizontalBias, DirectionBias verticalBias);
409 * @copydoc Toolkit::ScrollView::ScrollTo(const Vector2 &position, float duration, AlphaFunction alpha, DirectionBias horizontalBias, DirectionBias verticalBias)
411 void ScrollTo(const Vector2& position, float duration, AlphaFunction alpha,
412 DirectionBias horizontalBias, DirectionBias verticalBias);
415 * @copydoc Toolkit::ScrollView::ScrollTo(unsigned int page)
417 void ScrollTo(unsigned int page);
420 * @copydoc Toolkit::ScrollView::ScrollTo(unsigned int page, float duration, DirectionBias bias)
422 void ScrollTo(unsigned int page, float duration, DirectionBias bias = DirectionBiasNone);
425 * @copydoc Toolkit::ScrollView::ScrollTo(Actor& actor)
427 void ScrollTo(Actor &actor);
430 * @copydoc Toolkit::ScrollView::ScrollTo(Actor& actor, float duration)
432 void ScrollTo(Actor &actor, float duration);
435 * @copydoc Toolkit::ScrollView::SetScrollingDirection()
437 void SetScrollingDirection( Radian direction, Radian threshold );
440 * @copydoc Toolkit::ScrollView::RemoveScrollingDirection()
442 void RemoveScrollingDirection( Radian angle );
445 * Finds the closest Actor to the current center of the ScrollView.
447 * @return A handle to the actor if found, or an empty handle if not.
449 Actor FindClosestActor();
452 * Finds the closest Actor to position in ScrollView
454 * @param[in] position position within ScrollView.
455 * @param[in] dirX Whether to search only those elements that are Left,Right, or All
456 * @param[in] dirY Whether to search only those elements that are Up,Down, or All
457 * @param[in] dirZ Whether to search only those elements that are Out,In, or All
458 * @return A handle to the actor if found, or an empty handle if not.
460 Actor FindClosestActorToPosition(const Vector3& position, FindDirection dirX = All, FindDirection dirY = All, FindDirection dirZ = All);
463 * @copydoc Toolkit::ScrollView::ScrollToSnapPoint
465 bool ScrollToSnapPoint();
470 void StopAnimation(void);
473 * Stops the input animation
475 * @param[in] the animation to stop
477 void StopAnimation(Animation& animation);
480 * Animates to position transform.
482 * @param[in] position The position to animate to
483 * @param[in] positionDuration The number of seconds this animation should run for in each axis.
484 * @param[in] alpha The easing alpha function to use.
485 * @param[in] findShortcuts (optional) Whether to find the shortest route (in Wrap mode)
486 * @param[in] horizontalBias (optional) Whether to bias animation to left or right (or no biasing)
487 * @param[in] verticalBias (optional) Whether to bias animation to top or bottom (or no biasing)
488 * @return True if animation necessary and taking place to reach desired transform.
490 bool AnimateTo(const Vector2& position, const Vector2& positionDuration,
491 AlphaFunction alpha, bool findShortcuts = true,
492 DirectionBias horizontalBias = DirectionBiasNone, DirectionBias verticalBias = DirectionBiasNone,
493 SnapType snapType = Snap);
496 * @copydoc Toolkit::Scrollable::AddOverlay()
498 void AddOverlay(Actor actor);
501 * @copydoc Toolkit::Scrollable::RemoveOverlay()
503 void RemoveOverlay(Actor actor);
506 * @copydoc Toolkit::Internal::Scrollable::SetOvershootSize
508 void SetOvershootSize( const Vector2& size );
511 * @copydoc Toolkit::Internal::Scrollable::SetOvershootEffectColor
513 void SetOvershootEffectColor( const Vector4& color );
518 * Called when a property of an object of this type is set.
519 * @param[in] object The object whose property is set.
520 * @param[in] index The property index.
521 * @param[in] value The new property value.
523 static void SetProperty( BaseObject* object, Property::Index index, const Property::Value& value );
526 * Called to retrieve a property of an object of this type.
527 * @param[in] object The object whose property is to be retrieved.
528 * @param[in] index The property index.
529 * @return The current value of the property.
531 static Property::Value GetProperty( BaseObject* object, Property::Index index );
536 * @copydoc Dali::Toolkit::ScrollView::SnapStartedSignal()
538 Toolkit::ScrollView::SnapStartedSignalType& SnapStartedSignal();
541 * Connects a callback function with the object's signals.
542 * @param[in] object The object providing the signal.
543 * @param[in] tracker Used to disconnect the signal.
544 * @param[in] signalName The signal to connect to.
545 * @param[in] functor A newly allocated FunctorDelegate.
546 * @return True if the signal was connected.
547 * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
549 static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
551 private: // private overridden functions from CustomActorImpl and Controls
554 * @copydoc Dali::CustomActorImpl::OnSizeAnimation(Animation&, const Vector3&)
556 virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize);
559 * @copydoc CustomActorImpl::OnSizeSet(const Vector3&)
561 virtual void OnSizeSet( const Vector3& size );
564 * From CustomActorImpl; called after a child has been added to the owning actor.
565 * @param[in] child The child which has been added.
567 virtual void OnChildAdd(Actor& child);
570 * From CustomActorImpl; called shortly before a child is removed from the owning actor.
571 * @param[in] child The child being removed.
573 virtual void OnChildRemove(Actor& child);
576 * From CustomActorImpl; called after a wheelEvent is received by the owning actor.
577 * @param[in] event The wheel event.
578 * @return True if the event should be consumed.
580 virtual bool OnWheelEvent(const WheelEvent& event);
583 * @copydoc Toolkit::Control::OnInitialize()
585 virtual void OnInitialize();
588 * @copydoc CustomActorImpl::OnStageConnection()
590 virtual void OnStageConnection( int depth );
593 * @copydoc CustomActorImpl::OnStageDisconnection()
595 virtual void OnStageDisconnection();
598 * @copydoc Toolkit::Control::OnAccessibilityPan()
600 virtual bool OnAccessibilityPan(PanGesture gesture);
603 * @copydoc Toolkit::Scrollable::EnableScrollOvershoot()
605 virtual void EnableScrollOvershoot(bool enable);
610 * Called after a touchSignal is received by the owning actor.
612 * We don't consume these events as content within the container may consume events.
614 * @param[in] actor The touched actor.
615 * @param[in] touch The touch information.
616 * @return True if the event should be consumed.
618 bool OnTouch( Actor actor, const TouchData& touch );
621 * Start a timer which calls OnTouchDownTimeout()
623 void StartTouchDownTimer();
626 * Stop a timer which calls OnTouchDownTimeout()
628 void StopTouchDownTimer();
631 * Helper to detect when touch-point has been down (outside of pan gesture)
633 bool OnTouchDownTimeout();
636 * Called whenever a snap animation has completed
637 * @param[in] source the Animation instance that has completed.
638 * Resets all scrolling animations and states, leaving current scroll position at SCROLL_POSITION
640 void ResetScrolling();
643 * Updates mScrollInternalPosition, mScrollPrePosition and mScrollPostPosition from their property counterparts
645 void UpdateLocalScrollProperties();
648 * Makes sure scroll values are ready for animated scrolling
650 void PreAnimatedScrollSetup();
653 * Finish an animated scroll, ensuring all scroll properties are updated
656 void FinaliseAnimatedScroll();
659 * Animates the internal x property to the given value
661 * @param[in] position The X position to animate to
662 * @param[in] duration The time in seconds for animation
663 * @param[in] alpha The alpha function to use for animating
665 void AnimateInternalXTo( float position, float duration, AlphaFunction alpha );
668 * Animates the internal y property to the given value
670 * @param[in] position The Y position to animate to
671 * @param[in] duration The time in seconds for animation
672 * @param[in] alpha The alpha function to use for animating
674 void AnimateInternalYTo( float position, float duration, AlphaFunction alpha );
677 * Called whenever a snap animation on the x-axis has completed
678 * @param[in] source the Animation instance that has completed.
680 void OnScrollAnimationFinished( Animation& source );
683 * Called when either the X or Y internal scroll positions have finished snapping back to SCROLL_PRE_POSITION
685 * @param[in] source the Animation instance that has completed.
687 void OnSnapInternalPositionFinished( Animation& source );
690 * Called whenever a snap animation on the x-axis has completed and we need to snap pre scroll
691 * position to our clamped position
692 * @param[in] position The x position to snap pre scroll property to
694 void SnapInternalXTo( float position );
697 * Called whenever a snap animation on the y-axis has completed and we need to snap pre scroll
698 * position to our clamped position
699 * @param[in] position The y position to snap pre scroll property to
701 void SnapInternalYTo( float position );
704 * This is called internally whenever the Scroll Rulers are
705 * modified. This will update the properties: 'scrollPositionMin'
706 * and 'scrollPositionMax' to reflect the changes.
708 void UpdatePropertyDomain();
711 * Called when the gesture starts.
713 void GestureStarted();
716 * Amalgamated Gesture Continuing event
718 * @param[in] panDelta average panning delta from base position (0)
720 void GestureContinuing(const Vector2& panDelta);
723 * Called upon pan gesture event.
725 * @param[in] gesture The gesture event.
727 void OnPan( const PanGesture& pan);
730 * Extension of the above gestures.
732 * @param[in] gesture The gesture event.
734 void OnGestureEx(Gesture::State state);
737 * Performs snapping while taking into account Velocity of gesture
738 * (velocity in pixels/sec)
740 * @param[in] velocity velocity in pixels/sec
742 bool SnapWithVelocity(Vector2 velocity);
745 * Finishes Container Transform
746 * (occurs upon finishing gesture i.e. releasing)
748 void FinishTransform();
751 * Returns overshoot vector based on current position
753 * Overshoot vector is defined as how far outside of bounds
754 * the viewport is trying to view (prior to being clamped).
756 * an overshoot of (100,50), means user is in bottom right corner,
757 * trying to pan +100 to the right, and +50 below. This can be used
758 * to determine an effect, such as stretching.
760 * @param[in] position The position for which you wish to obtain overshoot vector
762 Vector2 GetOvershoot(Vector2& position) const;
765 * Clamps position within the domain set up by X/Y Rulers
767 * @param[in,out] position The position you wish to clamp
769 void ClampPosition(Vector2& position) const;
772 * Clamps position within the domain set up by X/Y Rulers
774 * @param[in,out] position The position you wish to clamp
775 * @param[out] clamped The results of the clamping.
777 void ClampPosition(Vector2& position, ClampState2D &clamped) const;
780 * Wraps position within the domain set up by X/Y Rulers
782 * @note Only wraps if mWrapMode is enabled, and respective domains
785 * @param[in,out] position The position you wish to wrap
787 void WrapPosition(Vector2& position) const;
790 * Updates the main internal scroll constraints with new ruler and domain
793 void UpdateMainInternalConstraint();
796 * Enables/disables the overshoot constraints
798 * @param[in] enabled whether to enable or disable the overshoot constraints
800 void SetOvershootConstraintsEnabled(bool enabled);
803 * Sets internal constraints for this ScrollView.
804 * Many of these internal constraints are based on properties within
807 void SetInternalConstraints();
810 * @brief Querying whether ScrollView is currently panning or scrolling
812 * return True if ScrollView is panning or scrolling
814 bool IsPanningOrScrolling() const;
819 * Construct a new ScrollView.
824 * A reference counted object may only be deleted by calling Unreference()
826 virtual ~ScrollView();
831 * Searches this ScrollView, and attempts to Unbind
832 * systematically this Actor from the ScrollView attached.
834 * @param[in] child The actor to be unbound.
836 virtual void FindAndUnbindActor(Actor child);
839 * Gets position property.
841 * @return The current position
843 Vector2 GetPropertyPrePosition() const;
846 * Gets position property.
848 * @return The current position
850 Vector2 GetPropertyPosition() const;
853 * Handles a Stopped animation. Its position properties need to be saved, and the animation flag
856 void HandleStoppedAnimation();
859 * Handles a Stopped animation (whether the animation completed, or was
860 * manually stopped). Its position properties need to be saved, and the
861 * animation flag switched off.
863 void HandleSnapAnimationFinished();
866 * Checks if the property notifications are active and adds them if not
868 void SetScrollUpdateNotification( bool enabled );
871 * Refresh the ScrollView (used when animating to update application developer of changes)
872 * @return True if the refresh timer should be kept running.
874 void OnScrollUpdateNotification(Dali::PropertyNotification& source);
879 ScrollView(const ScrollView&);
882 ScrollView& operator=(const ScrollView& rhs);
886 unsigned long mTouchDownTime; ///< The touch down time
888 int mGestureStackDepth; ///< How many gestures are currently occuring.
889 Vector2 mPanStartPosition; ///< Where the pan gesture's touch down occured
890 Vector2 mPanDelta; ///< Amount currently panned.
892 unsigned int mScrollStateFlags; ///< flags indicating current state of scrolling
893 // Scroll delegate pre and post position properties...
894 Vector2 mScrollPrePosition; ///< Wrapped scroll position, but not clamped
895 Vector2 mScrollPostPosition; ///< Wrapped and clamped, this is the final scroll position used
896 Vector2 mScrollTargetPosition; ///< Final target position for an animated scroll
897 Vector2 mDomainOffset; ///< Domain offset (this keeps track of the domain boundaries that scroll positions traverses)
899 // Rulers for each axes...
903 // Last property values set to ScrollView
907 Animation mInternalXAnimation; ///< Animates mPropertyX to a snap position or application requested scroll position
908 Animation mInternalYAnimation; ///< Animates mPropertyY to a snap position or application requested scroll position
911 Vector2 mLastVelocity; ///< Record the last velocity from PanGesture (Finish event doesn't have correct velocity)
914 Timer mTouchDownTimer; ///< Used to interrupt snap-animation. This cannot be done in OnTouch without breaking fast flick behavior.
916 float mScrollUpdateDistance; ///< Distance for scrolling to travel for the scroll update notifications
917 Dali::PropertyNotification mScrollXUpdateNotification; ///< scroll x position update notification
918 Dali::PropertyNotification mScrollYUpdateNotification; ///< scroll y position update notification
920 Actor mInternalActor; ///< Internal actor (we keep internal actors in here e.g. scrollbars, so we can ignore it in searches)
922 ScrollViewEffectContainer mEffects; ///< Container keeping track of all the applied effects.
924 Vector2 mMaxOvershoot; ///< Number of scrollable pixels that will take overshoot from 0.0f to 1.0f
925 Vector2 mUserMaxOvershoot; ///< Set by user, allows overriding of default max overshoot for the scroll indicator
926 float mSnapOvershootDuration; ///< Duration for overshoot snapping back to Vector2::ZERO
927 AlphaFunction mSnapOvershootAlphaFunction; ///< AlphaFunction to be used for this overshoot.
929 float mSnapDuration; ///< Time for the snap animation to take (in seconds).
930 AlphaFunction mSnapAlphaFunction; ///< AlphaFunction to be used for the Snap Animation.
932 Vector2 mMinFlickDistance; ///< Minimum pan distance required for a flick
933 float mFlickSpeedThreshold; ///< Minimum pan speed required for a flick in pixels/ms
934 float mFlickDuration; ///< Time for the flick animation to take (in seconds).
935 AlphaFunction mFlickAlphaFunction; ///< AlphaFunction to be used for the Flick Animation.
937 float mAxisAutoLockGradient; ///< Axis Auto-lock gradient threshold. Above this gradient and it will lock scrolling to closest axis.
938 float mFrictionCoefficient; ///< Friction coefficient. Amount of friction to apply to free panning flick animation. in stage.lengths/sec
939 float mFlickSpeedCoefficient; ///< Flick velocity coefficient. Input touch velocity is multiplied by this.
940 float mMaxFlickSpeed; ///< Maximum flick speed. Maximum speed of flick in stage.lengths/sec.
942 Vector2 mWheelScrollDistanceStep; ///< The step of scroll distance in actor coordinates in X and Y axes for each wheel event received.
944 //ScrollInternalConstraintsPtr mScrollInternalConstraints;
945 Constraint mScrollMainInternalPrePositionConstraint;
946 Constraint mScrollMainInternalPositionConstraint;
947 Constraint mScrollMainInternalOvershootXConstraint;
948 Constraint mScrollMainInternalOvershootYConstraint;
949 Constraint mScrollMainInternalDeltaConstraint;
950 Constraint mScrollMainInternalFinalConstraint;
951 Constraint mScrollMainInternalRelativeConstraint;
952 Constraint mScrollMainInternalDomainConstraint;
953 Constraint mScrollMainInternalPrePositionMaxConstraint;
955 ScrollOvershootIndicatorPtr mOvershootIndicator;
956 WeakHandle<Toolkit::ScrollBar> mScrollBar;
958 Toolkit::ScrollView::SnapStartedSignalType mSnapStartedSignal;
960 bool mInAccessibilityPan:1; ///< With AccessibilityPan its easier to move between snap positions
961 bool mScrolling:1; ///< Flag indicating whether the scroll view is being scrolled (by user or animation)
962 bool mScrollInterrupted:1; ///< Flag set for when a down event interrupts a scroll
963 bool mPanning:1; ///< Whether scroll view is currently panning or not
964 bool mSensitive:1; ///< Scroll Sensitivity Flag.
965 bool mTouchDownTimeoutReached:1; ///< Indicates when down event timeout occured without corresponding up event (touch still down)
966 bool mActorAutoSnapEnabled:1; ///< Whether to automatically snap to closest actor.
967 bool mAutoResizeContainerEnabled:1; ///< Whether to automatically resize container (affects RulerDomain's on X/Y axes)
968 bool mWrapMode:1; ///< Whether to wrap contents based on container size.
969 bool mAxisAutoLock:1; ///< Whether to automatically lock axis when panning.
970 bool mAlterChild:1; ///< Internal flag to control behavior of OnChildAdd/OnChildRemove when Adding internal Actors.
971 bool mDefaultMaxOvershoot:1; ///< Whether to use default max overshoot or application defined one
972 bool mCanScrollHorizontal:1; ///< Local value of our property to check against
973 bool mCanScrollVertical:1; ///< Local value of our property to check against
974 bool mTransientScrollBar:1; ///< True if scroll-bar should be automatically show/hidden during/after panning
977 } // namespace Internal
979 // Helpers for public-api forwarding methods
981 inline Toolkit::Internal::ScrollView& GetImpl(Toolkit::ScrollView& scrollView)
983 DALI_ASSERT_ALWAYS(scrollView);
985 Dali::RefObject& handle = scrollView.GetImplementation();
987 return static_cast<Toolkit::Internal::ScrollView&>(handle);
990 inline const Toolkit::Internal::ScrollView& GetImpl(const Toolkit::ScrollView& scrollView)
992 DALI_ASSERT_ALWAYS(scrollView);
994 const Dali::RefObject& handle = scrollView.GetImplementation();
996 return static_cast<const Toolkit::Internal::ScrollView&>(handle);
999 } // namespace Toolkit
1003 #endif // __DALI_TOOLKIT_INTERNAL_SCROLL_VIEW_H__