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/dali.h>
25 #include <dali-toolkit/public-api/controls/control-impl.h>
26 #include <dali-toolkit/internal/controls/scrollable/scroll-view/scroll-base-impl.h>
27 #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h>
28 #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-effect.h>
30 // predefined effect includes
31 #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-custom-effect.h>
43 typedef IntrusivePtr<ScrollView> ScrollViewPtr;
45 class ScrollInternalConstraints;
46 typedef IntrusivePtr<ScrollInternalConstraints> ScrollInternalConstraintsPtr;
48 class ScrollOvershootIndicator;
49 typedef IntrusivePtr<ScrollOvershootIndicator> ScrollOvershootIndicatorPtr;
52 * @copydoc Toolkit::ScrollView
54 class ScrollView : public ScrollBase
59 * FindDirection specifies how searching is conducted within the Find... routines.
63 None = -3, ///< Includes none within the search query.
64 All = -2, ///< Includes all within the search query.
65 Left = -1, ///< Includes only those not right !(>)
66 Right = 1, ///< Includes only those right (>)
67 Up = -1, ///< Includes only those not below !(>)
68 Down = 1, ///< Includes only those below (>)
69 Out = -1, ///< Includes only those not infront !(>)
70 In = 1 ///< Includes only those infront (>)
75 LockPossible = 0, ///< Locking is possible, but not set in stone yet.
76 LockHorizontal, ///< Locking is set to horizontal. (can pan vertically)
77 LockVertical, ///< Locking is set to vertical. (can pan horizontally)
78 LockNone ///< Locking is set to none (free panning).
83 AnimatingInternalX = 0x01, ///< animating mPropertyX due to externally requested ScrollTo or internal snapping operation
84 AnimatingInternalY = 0x02, ///< animating mPropertyY due to externally requested ScrollTo or internal snapping operation
85 SnappingInternalX = 0x04, ///< snapping mPropertyX back to mPropertyPreScroll x value to remove x overshoot over time
86 SnappingInternalY = 0x08, ///< snapping mPropertyY back to mPropertyPreScroll y value to remove y overshoot over time
89 static const unsigned int SCROLL_X_STATE_MASK = AnimatingInternalX | SnappingInternalX;
90 static const unsigned int SCROLL_Y_STATE_MASK = AnimatingInternalY | SnappingInternalY;
91 static const unsigned int SCROLL_ANIMATION_FLAGS = AnimatingInternalX | AnimatingInternalY;
92 static const unsigned int SNAP_ANIMATION_FLAGS = SnappingInternalX | SnappingInternalY;
97 * Create a new ScrollView.
98 * @return A public handle to the newly allocated ScrollView.
100 static Dali::Toolkit::ScrollView New();
105 * @copydoc Toolkit::ScrollView::GetScrollSnapAlphaFunction
107 AlphaFunction GetScrollSnapAlphaFunction() const;
110 * @copydoc Toolkit::ScrollView::SetScrollSnapAlphaFunction
112 void SetScrollSnapAlphaFunction(AlphaFunction alpha);
115 * @copydoc Toolkit::ScrollView::GetScrollFlickAlphaFunction
117 AlphaFunction GetScrollFlickAlphaFunction() const;
120 * @copydoc Toolkit::ScrollView::SetScrollFlickAlphaFunction
122 void SetScrollFlickAlphaFunction(AlphaFunction alpha);
125 * @copydoc Toolkit::ScrollView::GetScrollSnapDuration
127 float GetScrollSnapDuration() const;
130 * @copydoc Toolkit::ScrollView::SetScrollSnapDuration
132 void SetScrollSnapDuration(float time);
135 * @copydoc Toolkit::ScrollView::GetScrollFlickDuration
137 float GetScrollFlickDuration() const;
140 * @copydoc Toolkit::ScrollView::SetScrollFlickDuration
142 void SetScrollFlickDuration(float time);
145 * @copydoc Toolkit::ScrollView::ApplyEffect
147 void ApplyEffect(Toolkit::ScrollViewEffect effect);
150 * @brief ApplyEffect Applies a predefined effect
153 Toolkit::ScrollViewEffect ApplyEffect(Toolkit::ScrollView::PageEffect 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 * @copydoc Toolkit::ScrollView::SetRulerScaleX
198 void SetRulerScaleX(RulerPtr ruler);
201 * @copydoc Toolkit::ScrollView::SetRulerScaleY
203 void SetRulerScaleY(RulerPtr ruler);
206 * Set Rotation axis ruler (defines how rotating is snapped in radians)
207 * @param[in] ruler The ruler to be used for the Rotation axis
209 void SetRulerRotation(RulerPtr ruler);
212 * @copydoc Toolkit::ScrollView::SetScrollSensitive
214 void SetScrollSensitive(bool sensitive);
217 * @copydoc Toolkit::ScrollView::SetMaxOvershoot
219 void SetMaxOvershoot(float overshootX, float overshootY);
222 * @copydoc Toolkit::ScrollView::SetSnapOvershootAlphaFunction
224 void SetSnapOvershootAlphaFunction(AlphaFunction alpha);
227 * @copydoc Toolkit::ScrollView::SetSnapOvershootDuration
229 void SetSnapOvershootDuration(float duration);
232 * @copydoc Toolkit::ScrollView::SetTouchesRequiredForPanning
234 void SetTouchesRequiredForPanning(unsigned int minTouches, unsigned int maxTouches, bool endOutside);
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::GetRefreshInterval
271 int GetRefreshInterval() const;
274 * @copydoc Toolkit::ScrollView::SetRefreshInterval
276 void SetRefreshInterval(int milliseconds);
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::GetMaxFlickSpeed
321 float GetMaxFlickSpeed() const;
324 * @copydoc Toolkit::ScrollView::SetMaxFlickSpeed
326 void SetMaxFlickSpeed(float speed);
329 * @copydoc Toolkit::ScrollView::GetMouseWheelScrollDistanceStep
331 Vector2 GetMouseWheelScrollDistanceStep() const;
334 * @copydoc Toolkit::ScrollView::SetMouseWheelScrollDistanceStep
336 void SetMouseWheelScrollDistanceStep(Vector2 step);
339 * @copydoc Toolkit::ScrollView::GetCurrentPage
341 unsigned int GetCurrentPage() const;
344 * @copydoc Toolkit::ScrollView::GetCurrentScrollPosition
346 Vector3 GetCurrentScrollPosition() const;
349 * @copydoc Toolkit::ScrollView::SetScrollPosition
351 void SetScrollPosition(const Vector3& position);
354 * @copydoc Toolkit::ScrollView::GetCurrentScrollScale
356 Vector3 GetCurrentScrollScale() const;
359 * @copydoc Toolkit::Scrollable::GetDomainSize
361 Vector3 GetDomainSize() const;
364 * @copydoc Toolkit::ScrollView::TransformTo(const Vector3& position, const Vector3& scale, float rotation)
366 void TransformTo(const Vector3& position, const Vector3& scale, float rotation,
367 DirectionBias horizontalBias = DirectionBiasNone, DirectionBias verticalBias = DirectionBiasNone);
370 * @copydoc Toolkit::ScrollView::TransformTo(const Vector3& position, const Vector3& scale, float rotation, float duration)
372 void TransformTo(const Vector3& position, const Vector3& scale, float rotation, float duration,
373 DirectionBias horizontalBias = DirectionBiasNone, DirectionBias verticalBias = DirectionBiasNone);
376 * @copydoc Toolkit::ScrollView::ScrollTo(const Vector3 &position)
378 void ScrollTo(const Vector3 &position);
381 * @copydoc Toolkit::Scrollable::ScrollTo(const Vector3& position, float duration)
383 void ScrollTo(const Vector3& position, float duration);
386 * @copydoc Toolkit::ScrollView::ScrollTo(const Vector3 &position, float duration, DirectionBias horizontalBias, DirectionBias verticalBias)
388 void ScrollTo(const Vector3& position, float duration,
389 DirectionBias horizontalBias, DirectionBias verticalBias);
392 * @copydoc Toolkit::ScrollView::ScrollTo(unsigned int page)
394 void ScrollTo(unsigned int page);
397 * @copydoc Toolkit::ScrollView::ScrollTo(unsigned int page, float duration, DirectionBias bias)
399 void ScrollTo(unsigned int page, float duration, DirectionBias bias = DirectionBiasNone);
402 * @copydoc Toolkit::ScrollView::ScrollTo(Actor& actor)
404 void ScrollTo(Actor &actor);
407 * @copydoc Toolkit::ScrollView::ScrollTo(Actor& actor, float duration)
409 void ScrollTo(Actor &actor, float duration);
412 * @copydoc Toolkit::ScrollView::SetScrollingDirection()
414 void SetScrollingDirection( Radian direction, Radian threshold );
417 * @copydoc Toolkit::ScrollView::RemoveScrollingDirection()
419 void RemoveScrollingDirection( Radian angle );
422 * Finds the closest Actor to the current center of the ScrollView.
424 * @return A handle to the actor if found, or an empty handle if not.
426 Actor FindClosestActor();
429 * Finds the closest Actor to position in ScrollView
431 * @param[in] position position within ScrollView.
432 * @param[in] dirX Whether to search only those elements that are Left,Right, or All
433 * @param[in] dirY Whether to search only those elements that are Up,Down, or All
434 * @param[in] dirZ Whether to search only those elements that are Out,In, or All
435 * @return A handle to the actor if found, or an empty handle if not.
437 Actor FindClosestActorToPosition(const Vector3& position, FindDirection dirX = All, FindDirection dirY = All, FindDirection dirZ = All);
440 * @copydoc Toolkit::ScrollView::ScrollToSnapPoint
442 bool ScrollToSnapPoint();
445 * @copydoc Toolkit::ScrollView::ScaleTo(const Vector3& scale)
447 void ScaleTo(const Vector3& scale);
450 * @copydoc Toolkit::ScrollView::ScaleTo(const Vector3& scale, float duration)
452 void ScaleTo(const Vector3& scale, float duration);
457 void StopAnimation(void);
460 * Stops the input animation
462 * @param[in] the animation to stop
464 void StopAnimation(Animation& animation);
467 * Animates to position/scale/rotation transform.
469 * @param[in] position The position to animate to
470 * @param[in] positionDuration The number of seconds this animation should run for in each axis.
471 * @param[in] scale The scale to animate to
472 * @param[in] scaleDuration The number of seconds this animation should run for in each axis.
473 * @param[in] rotation The angle to animate to
474 * @param[in] rotationDuration The number of seconds this animation should run for in each axis.
475 * @param[in] alpha The easing alpha function to use.
476 * @param[in] findShortcuts (optional) Whether to find the shortest route (in Wrap mode)
477 * @param[in] horizontalBias (optional) Whether to bias animation to left or right (or no biasing)
478 * @param[in] verticalBias (optional) Whether to bias animation to top or bottom (or no biasing)
479 * @return True if animation necessary and taking place to reach desired transform.
481 bool AnimateTo(const Vector3& position, const Vector3& positionDuration,
482 const Vector3& scale, const Vector3& scaleDuration,
483 float rotation, float rotationDuration,
484 AlphaFunction alpha, bool findShortcuts = true,
485 DirectionBias horizontalBias = DirectionBiasNone, DirectionBias verticalBias = DirectionBiasNone,
486 SnapType snapType = Snap);
489 * @copydoc Toolkit::Scrollable::AddOverlay()
491 void AddOverlay(Actor actor);
494 * @copydoc Toolkit::Scrollable::RemoveOverlay()
496 void RemoveOverlay(Actor actor);
501 * @copydoc Dali::Toolkit::ScrollView::SnapStartedSignal()
503 Toolkit::ScrollView::SnapStartedSignalV2& SnapStartedSignal();
506 * Connects a callback function with the object's signals.
507 * @param[in] object The object providing the signal.
508 * @param[in] tracker Used to disconnect the signal.
509 * @param[in] signalName The signal to connect to.
510 * @param[in] functor A newly allocated FunctorDelegate.
511 * @return True if the signal was connected.
512 * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
514 static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
516 private: // private overriden functions from CustomActorImpl and Controls
519 * @copydoc Dali::CustomActorImpl::OnSizeAnimation(Animation&, const Vector3&)
521 virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize);
524 * @copydoc Dali::Control::OnControlSizeSet(const Vector3&)
526 virtual void OnControlSizeSet( const Vector3& size );
529 * From CustomActorImpl; called after a child has been added to the owning actor.
530 * @param[in] child The child which has been added.
532 virtual void OnChildAdd(Actor& child);
535 * From CustomActorImpl; called shortly before a child is removed from the owning actor.
536 * @param[in] child The child being removed.
538 virtual void OnChildRemove(Actor& child);
541 * @copydoc Dali::CustomActorImpl::OnPropertySet( Property::Index index, Property::Value propertyValue )
543 virtual void OnPropertySet( Property::Index index, Property::Value propertyValue );
546 * From CustomActorImpl; called after a touch-signal is received by the owning actor.
548 * We don't listen to these events as content within the contain may consume events.
550 * @param[in] event The touch event.
551 * @return True if the event should be consumed.
553 virtual bool OnTouchEvent(const TouchEvent& event);
556 * From CustomActorImpl; called after a mouse-wheel-event is received by the owning actor.
557 * @param[in] event The mouse wheel event.
558 * @return True if the event should be consumed.
560 virtual bool OnMouseWheelEvent(const MouseWheelEvent& event);
563 * @copydoc Toolkit::Control::OnInitialize()
565 virtual void OnInitialize();
568 * @copydoc Toolkit::Control::OnControlStageConnection()
570 virtual void OnControlStageConnection();
573 * @copydoc Toolkit::Control::OnControlStageConnection()
575 virtual void OnControlStageDisconnection();
578 * @copydoc Toolkit::Control::OnAccessibilityPan()
580 virtual bool OnAccessibilityPan(PanGesture gesture);
583 * @copydoc Toolkit::Scrollable::SetOvershootEnabled()
585 virtual void SetOvershootEnabled(bool enable);
590 * Start a timer which calls OnTouchDownTimeout()
592 void StartTouchDownTimer();
595 * Stop a timer which calls OnTouchDownTimeout()
597 void StopTouchDownTimer();
600 * Helper to detect when touch-point has been down (outside of pan gesture)
602 bool OnTouchDownTimeout();
605 * Called whenever a snap animation has completed
606 * @param[in] source the Animation instance that has completed.
607 * Resets all scrolling animations and states, leaving current scroll position at mPropertyPosition
609 void ResetScrolling();
612 * Updates mScrollInternalPosition, mScrollPrePosition and mScrollPostPosition from their property counterparts
614 void UpdateLocalScrollProperties();
617 * Makes sure scroll values are ready for animated scrolling
619 void PreAnimatedScrollSetup();
622 * Finish an animated scroll, ensuring all scroll properties are updated
625 void FinaliseAnimatedScroll();
628 * Animates the internal x property to the given value
630 * @param[in] position The X position to animate to
631 * @param[in] duration The time in seconds for animation
632 * @param[in] alpha The alpha function to use for animating
634 void AnimateInternalXTo( float position, float duration, AlphaFunction alpha );
637 * Animates the internal y property to the given value
639 * @param[in] position The Y position to animate to
640 * @param[in] duration The time in seconds for animation
641 * @param[in] alpha The alpha function to use for animating
643 void AnimateInternalYTo( float position, float duration, AlphaFunction alpha );
646 * Called whenever a snap animation on the x-axis has completed
647 * @param[in] source the Animation instance that has completed.
649 void OnScrollAnimationFinished( Animation& source );
652 * This is called internally whenever the Scroll Rulers are
653 * modified. This will update the properties: 'scroll-position-min'
654 * and 'scroll-position-max' to reflect the changes.
656 * @param[in] size size of the visible scroll area (ScrollView control size)
658 void UpdatePropertyDomain(const Vector3& size);
661 * Called when the gesture starts.
663 void GestureStarted();
666 * Amalgamated Gesture Continuing event
668 * @param[in] panDelta average panning delta from base position (0)
669 * @param[in] scaleDelta average scale delta from base scale (1)
670 * @param[in] rotationDelta average rotation delta from base angle (0)
672 void GestureContinuing(const Vector2& panDelta, const Vector2& scaleDelta, float rotationDelta);
675 * Called upon pan gesture event.
677 * @param[in] gesture The gesture event.
679 void OnPan(PanGesture pan);
682 * Extension of the above gestures.
684 * @param[in] gesture The gesture event.
686 void OnGestureEx(Gesture::State state);
689 * Performs snapping while taking into account Velocity of gesture
690 * (velocity in pixels/sec)
692 * @param[in] velocity velocity in pixels/sec
694 bool SnapWithVelocity(Vector2 velocity);
697 * Updates Container Transform based on Pan, Scale, and Rotation props.
698 * (occurs when continuing gesture i.e. dragging/pinching.)
700 void UpdateTransform();
703 * Finishes Container Transform
704 * (occurs upon finishing gesture i.e. releasing)
706 void FinishTransform();
709 * Returns overshoot vector based on current position
711 * Overshoot vector is defined as how far outside of bounds
712 * the viewport is trying to view (prior to being clamped).
714 * an overshoot of (100,50), means user is in bottom right corner,
715 * trying to pan +100 to the right, and +50 below. This can be used
716 * to determine an effect, such as stretching.
718 * @param[in] position The position for which you wish to obtain overshoot vector
720 Vector3 GetOvershoot(Vector3& position) const;
723 * Clamps position within the domain set up by X/Y Rulers
725 * @param[in,out] position The position you wish to clamp
727 void ClampPosition(Vector3& position) const;
730 * Clamps position within the domain set up by X/Y Rulers
732 * @param[in,out] position The position you wish to clamp
733 * @param[out] clamped The results of the clamping.
735 void ClampPosition(Vector3& position, ClampState3 &clamped) const;
738 * Wraps position within the domain set up by X/Y Rulers
740 * @note Only wraps if mWrapMode is enabled, and respective domains
743 * @param[in,out] position The position you wish to wrap
745 void WrapPosition(Vector3& position) const;
748 * Clamps scale within the domain set up by Scale-X/Scale-Y Rulers
750 * @param[in,out] scale The scale you wish to clamp
752 void ClampScale(Vector3& scale) const;
755 * Clamps scale within the domain set up by Scale-X/Scale-Y Rulers
757 * @param[in,out] scale The scale you wish to clamp
758 * @param[out] clamped The results of the clamping.
760 void ClampScale(Vector3& scale, ClampState3 &clamped) const;
763 * Updates the main internal scroll constraints with new ruler and domain
766 void UpdateMainInternalConstraint();
769 * Enables/disables the overshoot constraints
771 * @param[in] enabled whether to enable or disable the overshoot constraints
773 void SetOvershootConstraintsEnabled(bool enabled);
776 * Sets internal constraints for this ScrollView.
777 * Many of these internal constraints are based on properties within
780 void SetInternalConstraints();
785 * Construct a new ScrollView.
790 * A reference counted object may only be deleted by calling Unreference()
792 virtual ~ScrollView();
797 * Searches this ScrollView, and attempts to Unbind
798 * systematically this Actor from the ScrollView attached.
800 * @param[in] child The actor to be unbound.
802 virtual void FindAndUnbindActor(Actor child);
805 * Gets position property.
807 * @return The current position
809 Vector3 GetPropertyPrePosition() const;
812 * Gets position property.
814 * @return The current position
816 Vector3 GetPropertyPosition() const;
819 * Gets scale property.
821 * @return The current scale
823 Vector3 GetPropertyScale() const;
826 * Handles a Stopped animation. Its position/scale/rotation properties need to be
827 * saved, and the animation flag switched off.
829 void HandleStoppedAnimation();
832 * Handles a Stopped animation (whether the animation completed, or was
833 * manually stopped). Its position/scale/rotation properties need to be
834 * saved, and the animation flag switched off.
836 void HandleSnapAnimationFinished();
839 * Helper to start the refresh timer.
841 void StartRefreshTimer();
844 * Helper to cancel the refresh timer.
846 void CancelRefreshTimer();
849 * Refresh the ScrollView (used when animating to update application developer of changes)
850 * @return True if the refresh timer should be kept running.
852 bool OnRefreshTick();
857 ScrollView(const ScrollView&);
860 ScrollView& operator=(const ScrollView& rhs);
864 unsigned long mTouchDownTime; ///< The touch down time
866 int mGestureStackDepth; ///< How many gestures are currently occuring.
867 Vector2 mGestureReferencePosition; ///< Point where scaling should occur from.
868 Vector2 mPinchGestureLastPosition;
869 Vector2 mPinchGestureLastScale;
871 Vector3 mPanDelta; ///< Amount currently panned.
872 Vector3 mScaleDelta; ///< Amount currently scaled.
873 float mRotationDelta; ///< Amount currently rotated.
875 unsigned int mScrollStateFlags; ///< flags indicating current state of scrolling
876 // Scroll delegate pre and post position/scale/rotation properties...
877 Vector3 mScrollPrePosition; ///< Wrapped scroll position, but not clamped
878 Vector3 mScrollPostPosition; ///< Wrapped and clamped, this is the final scroll position used
879 Vector3 mScrollTargetPosition; ///< Final target position for an animated scroll
880 Vector3 mScrollPreScale; ///< Scroll delegate pre-scale
881 Vector3 mScrollPostScale; ///< Scroll delegate post-scale (affected by current touch)
882 float mScrollPreRotation; ///< Scroll delegate pre-rotation
883 float mScrollPostRotation; ///< Scroll delegate post-rotation (affected by current touch)
884 Vector3 mDomainOffset; ///< Domain offset (this keeps track of the domain boundaries that scroll positions traverses)
886 // Rulers for each axes...
889 RulerPtr mRulerScaleX;
890 RulerPtr mRulerScaleY;
891 RulerPtr mRulerRotation;
893 unsigned int mMinTouchesForPanning; ///< Minimum number of touches for panning to be used.
894 unsigned int mMaxTouchesForPanning; ///< Maximum number of touches for panning to be used.
896 Animation mSnapAnimation; ///< Used to animate rotation and scaling of scroll properties
897 Animation mInternalXAnimation; ///< Animates mPropertyX to a snap position or application requested scroll position
898 Animation mInternalYAnimation; ///< Animates mPropertyY to a snap position or application requested scroll position
901 Vector2 mLastVelocity; ///< Record the last velocity from PanGesture (Finish event doesn't have correct velocity)
904 Timer mTouchDownTimer; ///< Used to interrupt snap-animation. This cannot be done in OnTouchEvent without breaking fast flick behavior.
905 Timer mOvershootRefreshTimer;
906 Timer mRefreshTimer; ///< Refresh timer is used to provide the Application developer with updates as animations run.
907 int mRefreshIntervalMilliseconds; ///< Refresh timer interval.
909 Actor mInternalActor; ///< Internal actor (we keep internal actors in here e.g. scrollbars, so we can ignore it in searches)
911 ScrollViewEffectContainer mEffects; ///< Container keeping track of all the applied effects.
913 float mOvershootDelay; ///< Time to wait for input before reducing overshoot back to 0
914 Vector2 mMaxOvershoot; ///< Number of scrollable pixels that will take overshoot from 0.0f to 1.0f
915 Vector2 mUserMaxOvershoot; ///< Set by user, allows overriding of default max overshoot for the scroll indicator
916 float mSnapOvershootDuration; ///< Duration for overshoot snapping back to Vector3::ZERO
917 AlphaFunction mSnapOvershootAlphaFunction; ///< AlphaFunction to be used for this overshoot.
919 float mSnapDuration; ///< Time for the snap animation to take (in seconds).
920 AlphaFunction mSnapAlphaFunction; ///< AlphaFunction to be used for the Snap Animation.
922 float mFlickDuration; ///< Time for the flick animation to take (in seconds).
923 AlphaFunction mFlickAlphaFunction; ///< AlphaFunction to be used for the Flick Animation.
925 float mAxisAutoLockGradient; ///< Axis Auto-lock gradient threshold. Above this gradient and it will lock scrolling to closest axis.
926 float mFrictionCoefficient; ///< Friction coefficient. Amount of friction to apply to free panning flick animation. in stage.lengths/sec
927 float mFlickSpeedCoefficient; ///< Flick velocity coefficient. Input touch velocity is multiplied by this.
928 float mMaxFlickSpeed; ///< Maximum flick speed. Maximum speed of flick in stage.lengths/sec.
930 Vector2 mMouseWheelScrollDistanceStep; ///< The step of scroll distance in actor coordinates in X and Y axes for each mouse wheel event received.
932 //ScrollInternalConstraintsPtr mScrollInternalConstraints;
933 ActiveConstraint mScrollMainInternalPrePositionConstraint;
934 ActiveConstraint mScrollMainInternalPositionConstraint;
935 ActiveConstraint mScrollMainInternalXConstraint;
936 ActiveConstraint mScrollMainInternalYConstraint;
937 ActiveConstraint mScrollMainInternalOvershootXConstraint;
938 ActiveConstraint mScrollMainInternalOvershootYConstraint;
939 ActiveConstraint mScrollMainInternalDeltaConstraint;
940 ActiveConstraint mScrollMainInternalFinalConstraint;
941 ActiveConstraint mScrollMainInternalRelativeConstraint;
943 ScrollOvershootIndicatorPtr mOvershootIndicator;
945 Toolkit::ScrollView::SnapStartedSignalV2 mSnapStartedSignalV2;
947 bool mInAccessibilityPan : 1; ///< With AccessibilityPan its easier to move between snap positions
949 bool mScrolling:1; ///< Flag indicating whether the scroll view is being scrolled (by user or animation)
950 bool mScrollInterrupted:1; ///< Flag set for when a down event interrupts a scroll
951 bool mPanning:1; ///< Whether scroll view is currently panning or not
952 bool mSensitive:1; ///< Scroll Sensitivity Flag.
953 bool mTouchDownTimeoutReached:1; ///< Indicates when down event timeout occured without corresponding up event (touch still down)
954 bool mActorAutoSnapEnabled:1; ///< Whether to automatically snap to closest actor.
955 bool mAutoResizeContainerEnabled:1; ///< Whether to automatically resize container (affects RulerDomain's on X/Y axes)
956 bool mWrapMode:1; ///< Whether to wrap contents based on container size.
957 bool mAxisAutoLock:1; ///< Whether to automatically lock axis when panning.
958 bool mAlterChild:1; ///< Internal flag to control behavior of OnChildAdd/OnChildRemove when Adding internal Actors.
959 bool mDefaultMaxOvershoot:1; ///< Whether to use default max overshoot or application defined one
960 bool mUserSetPosition:1; ///< SetScrollPosition has been called, return this position until internals get control of scroll position again
963 } // namespace Internal
965 // Helpers for public-api forwarding methods
967 inline Toolkit::Internal::ScrollView& GetImpl(Toolkit::ScrollView& scrollView)
969 DALI_ASSERT_ALWAYS(scrollView);
971 Dali::RefObject& handle = scrollView.GetImplementation();
973 return static_cast<Toolkit::Internal::ScrollView&>(handle);
976 inline const Toolkit::Internal::ScrollView& GetImpl(const Toolkit::ScrollView& scrollView)
978 DALI_ASSERT_ALWAYS(scrollView);
980 const Dali::RefObject& handle = scrollView.GetImplementation();
982 return static_cast<const Toolkit::Internal::ScrollView&>(handle);
985 } // namespace Toolkit
989 #endif // __DALI_TOOLKIT_INTERNAL_SCROLL_VIEW_H__