1 #ifndef __DALI_TOOLKIT_SCROLL_VIEW_H__
2 #define __DALI_TOOLKIT_SCROLL_VIEW_H__
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
7 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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.
21 * @addtogroup CAPI_DALI_FRAMEWORK
26 #include <dali-toolkit/public-api/controls/scrollable/scrollable.h>
28 namespace Dali DALI_IMPORT_API
34 namespace Internal DALI_INTERNAL
50 DirectionBiasLeft = -1, ///< Bias scroll snap to Left
51 DirectionBiasNone = 0, ///< Don't bias scroll snap
52 DirectionBiasRight = 1 ///< Bias scroll snap to Right
58 * Used for specifying minimum/maximum extents of a ruler.
65 * Creates Ruler domain allowing a point to traverse between min and max extents
66 * @param[in] min Minimum extent (point cannot traverse less than this)
67 * @param[in] max Maximum extent (point cannot traverse greater than this)
68 * @param[in] enabled Whether domain has been enabled or not.
70 explicit RulerDomain(float min, float max, bool enabled = true);
79 * Clamps value (x) from (min) to (max), an optional length parameter can be
80 * specifies to suggest that the subject is not a point but a line to that
83 * @param[in] x X point to be clamped between (min) and (max) extents.
84 * @param[in] length (optional) The Length of the line from (x) to (x + length) to be clamped.
85 * @param[in] scale Scaling parameter which treats domain as scaled in calculations.
87 float Clamp(float x, float length = 0.0f, float scale = 1.0f) const;
90 * Clamps value (x) from (min) to (max), an optional length parameter can be
91 * specifies to suggest that the subject is not a point but a line to that
94 * @param[in] x X point to be clamped between (min) and (max) extents.
95 * @param[in] length (optional) The Length of the line from (x) to (x + length) to be clamped.
96 * @param[in] scale Scaling parameter which treats domain as scaled in calculations.
97 * @param[out] clamped Whether clamping occured and which size (None, Min or Max)
99 float Clamp(float x, float length, float scale, ClampState &clamped) const;
102 * Returns (max-min) size of ruler.
104 * @return The size of the ruler from min to max.
106 float GetSize() const;
111 * Ruler abstract class.
113 * Rulers are used to define axes, specifying whether they are traversable,
114 * where their snap points are, and their domain.
116 class Ruler : public RefObject
128 * Constructs ruler, defaulty enabled, with limitless domain.
133 * Destructor - A reference counted object may only be deleted by calling Unreference()
138 * Snaps (x) in accordance to the ruler settings.
140 * @param[in] x The input value on the ruler to be snapped.
141 * @param[in] bias (optional) The biasing employed for snapping
142 * 0 floor input (floor x) "Used for Flick Left"
143 * 0.5 round input (floor x + 0.5) "Used for Release"
144 * 1 ceil input (floor x + 1.0) "Used for Flick Right"
145 * @return The position of the one dimensional point passed in once snapped.
147 virtual float Snap(float x, float bias = 0.5f) const = 0;
150 * Returns position from page, based on whatever the ruler
153 * If (wrap) is true, then will set volume to the number of
154 * times page has exceeded the domain's volume (volume being the
155 * number of pages within the domain), while wrapping the position
158 * @param[in] page The page index
159 * @param[out] volume The overflow volume when the page exceeds the domain (wrap must be enabled)
160 * @param[in] wrap Enable wrap mode
161 * @return The position representing this page point.
163 virtual float GetPositionFromPage(unsigned int page, unsigned int &volume, bool wrap) const = 0;
166 * Returns page from position, based on whatever the ruler
169 * If (wrap) is true, then will return a page wrapped within the domain.
171 * @param[in] position The position on the domain
172 * @param[in] wrap Enable wrap mode
173 * @return The page where this position resides.
175 virtual unsigned int GetPageFromPosition(float position, bool wrap) const = 0;
178 * Returns the total number of pages within this Ruler
180 * @return The number of pages in the Ruler.
182 virtual unsigned int GetTotalPages() const = 0;
186 Ruler::RulerType GetType() const;
188 * Returns whether this axis has been enabled or not.
189 * @return true if axis is enabled
191 bool IsEnabled() const;
194 * Enables ruler (ruler must be enabled in order to traverse along it)
205 * @param[in] domain Ruler domain object.
207 void SetDomain(RulerDomain domain);
213 const RulerDomain &GetDomain() const;
216 * Disables Domain (minimum/maximum extents for this axis)
218 void DisableDomain();
221 * Clamps value (x) from (min) to (max), an optional length parameter can be
222 * specifies to suggest that the subject is not a point but a line to that
225 * @param[in] x X point to be clamped between (min) and (max) extents.
226 * @param[in] length (optional) The Length of the line from (x) to (x + length) to be clamped.
227 * @param[in] scale Scaling parameter which treats domain as scaled in calculations.
229 float Clamp(float x, float length = 0.0f, float scale = 1.0f) const;
233 * Clamps value (x) from (min) to (max), an optional length parameter can be
234 * specifies to suggest that the subject is not a point but a line to that
237 * @param[in] x X point to be clamped between (min) and (max) extents.
238 * @param[in] length (optional) The Length of the line from (x) to (x + length) to be clamped.
239 * @param[in] scale Scaling parameter which treats domain as scaled in calculations.
240 * @param[out] clamped Whether clamping occured and which size (None, Min or Max)
242 float Clamp(float x, float length, float scale, ClampState &clamped) const;
245 * Snaps and Clamps (x) in accordance to ruler settings.
247 * @param[in] x value to be snapped in accordance to ruler snap value,
248 * and clamped in accordance to the ruler's domain (if set).
249 * @param[in] bias (optional) The biasing employed for snapping
250 * 0 floor input (floor x) "Used for Flick Left"
251 * 0.5 round input (floor x + 0.5) "Used for Release"
252 * 1 ceil input (floor x + 1.0) "Used for Flick Right"
253 * @param[in] length (optional) The Length of the line from (x) to (x + length)
255 * @param[in] scale Scaling parameter which treats domain as scaled in calculations.
257 float SnapAndClamp(float x, float bias = 0.5f, float length = 0.0f, float scale = 1.0f) const;
260 * Snaps and Clamps (x) in accordance to ruler settings.
262 * @param[in] x value to be snapped in accordance to ruler snap value,
263 * and clamped in accordance to the ruler's domain (if set).
264 * @param[in] bias (optional) The biasing employed for snapping
265 * 0 floor input (floor x) "Used for Flick Left"
266 * 0.5 round input (floor x + 0.5) "Used for Release"
267 * 1 ceil input (floor x + 1.0) "Used for Flick Right"
268 * @param[in] length (optional) The Length of the line from (x) to (x + length)
270 * @param[in] scale Scaling parameter which treats domain as scaled in calculations.
271 * @param[out] clamped Whether clamping occured and which size (None, Min or Max)
273 float SnapAndClamp(float x, float bias, float length, float scale, ClampState &clamped) const;
277 RulerType mType; ///< Type of Ruler (Fixed or Free)
283 typedef IntrusivePtr<Ruler> RulerPtr;
286 * DefaultRuler has no snapping, and has one single page.
288 class DefaultRuler : public Ruler
292 * DefaultRuler constructor
297 * @copydoc Toolkit::Ruler::Snap
299 virtual float Snap(float x, float bias) const;
302 * @copydoc Toolkit::Ruler::GetPositionFromPage
304 virtual float GetPositionFromPage(unsigned int page, unsigned int &volume, bool wrap) const;
307 * @copydoc Toolkit::Ruler::GetPageFromPosition
309 virtual unsigned int GetPageFromPosition(float position, bool wrap) const;
312 * @copydoc Toolkit::Ruler::GetTotalPages
314 virtual unsigned int GetTotalPages() const;
318 * FixedRuler has fixed snapping, and contains
320 class FixedRuler : public Ruler
324 *@param[in] spacing The spacing between each interval on this ruler
326 FixedRuler(float spacing = 1.0f);
329 * @copydoc Toolkit::Ruler::Snap
331 virtual float Snap(float x, float bias) const;
334 * @copydoc Toolkit::Ruler::GetPositionFromPage
336 virtual float GetPositionFromPage(unsigned int page, unsigned int &volume, bool wrap) const;
339 * @copydoc Toolkit::Ruler::GetPageFromPosition
341 virtual unsigned int GetPageFromPosition(float position, bool wrap) const;
344 * @copydoc Toolkit::Ruler::GetTotalPages
346 virtual unsigned int GetTotalPages() const;
352 class ScrollViewEffect;
356 * ScrollView contains actors that can be scrolled manually (via touch)
359 class ScrollView : public Scrollable
364 PageEffectNone, ///< No Effect (Standard ScrollView)
365 PageEffectOuterCube, ///< 3D Rotating Cube Effect
366 PageEffectDepth, ///< Depth Effect
367 PageEffectInnerCube, ///< Page Cube Effect
368 PageEffectCarousel, ///< Page Carousel Effect
369 PageEffectSpiral, ///< Page Spiral Effect
376 static const std::string SCROLL_PAGE_CURRENT; ///< Property, name "scroll-page-current", type INT
377 static const std::string SCROLL_TIME_PROPERTY_NAME; ///< Property, name "scroll-time", type FLOAT
378 static const std::string SCROLL_POSITION_PROPERTY_NAME; ///< Property, name "scroll-position", type VECTOR3
379 static const std::string SCROLL_PRE_POSITION_PROPERTY_NAME; ///< Property, name "scroll-pre-position", type VECTOR3
380 static const std::string SCROLL_OVERSHOOT_X_PROPERTY_NAME; ///< Property, name "scroll-overshoot-x", type float
381 static const std::string SCROLL_OVERSHOOT_Y_PROPERTY_NAME; ///< Property, name "scroll-overshoot-y", type float
382 static const std::string SCROLL_FINAL_PROPERTY_NAME; ///< Property, name "scroll-final", type VECTOR3
383 static const std::string SCROLL_X_PROPERTY_NAME; ///< Property, name "scroll-x", type FLOAT
384 static const std::string SCROLL_Y_PROPERTY_NAME; ///< Property, name "scroll-y", type FLOAT
385 static const std::string SCROLL_SCALE_PROPERTY_NAME; ///< Property, name "scroll-scale", type VECTOR3
386 static const std::string SCROLL_WRAP_PROPERTY_NAME; ///< Property, name "scroll-wrap", type BOOLEAN
387 static const std::string SCROLL_PANNING_PROPERTY_NAME; ///< Property, name "scroll-panning", type BOOLEAN
388 static const std::string SCROLL_SCROLLING_PROPERTY_NAME; ///< Property, name "scroll-scrolling", type BOOLEAN
389 static const std::string SCROLL_POSITION_DELTA_PROPERTY_NAME; ///< Property, name "scroll-position-delta" type VECTOR3
390 static const std::string SCROLL_START_PAGE_POSITION_PROPERTY_NAME; ///< Property, name "scroll-start-page-position" type VECTOR3
394 static const float DEFAULT_SLOW_SNAP_ANIMATION_DURATION; ///< Default Drag-Release animation time.
395 static const float DEFAULT_FAST_SNAP_ANIMATION_DURATION; ///< Default Drag-Flick animation time.
396 static const float DEFAULT_SNAP_OVERSHOOT_DURATION; ///< Default Overshoot snapping animation time.
397 static const float DEFAULT_MAX_OVERSHOOT; ///< Default maximum allowed overshoot
399 static const float DEFAULT_AXIS_AUTO_LOCK_GRADIENT; ///< Default Axis-AutoLock gradient threshold. default is 0.36:1 (20 degrees)
400 static const float DEFAULT_FRICTION_COEFFICIENT; ///< Default Friction Co-efficient. (in stage diagonals per second)
401 static const float DEFAULT_FLICK_SPEED_COEFFICIENT; ///< Default Flick speed coefficient (multiples input touch velocity)
402 static const float DEFAULT_MAX_FLICK_SPEED; ///< Default Maximum flick speed. (in stage diagonals per second)
405 static const char* const SIGNAL_SNAP_STARTED;
409 DirectionFlagLeft = 0x01,
410 DirectionFlagRight = 0x02,
411 DirectionFlagUp = 0x04,
412 DirectionFlagDown = 0x08,
413 DirectionFlagTransitionOn = 0x10, ///< doesnt mean a page is moving towards centre, it affects whether the current page is using values for moving onto screen or off screen, if the user changes scroll direction we dont want things to flip over when in view
414 DirectionFlagTransitionOff = 0x20,
415 DirectionFlagMask_Direction = DirectionFlagLeft | DirectionFlagRight | DirectionFlagUp | DirectionFlagDown,
416 DirectionFlagMask_Transition = DirectionFlagTransitionOn | DirectionFlagTransitionOff
422 * Snap signal event's data.
426 SnapType type; ///< Current snap commencing
427 Vector3 position; ///< Target snap position
428 Vector3 scale; ///< Target snap scale
429 float rotation; ///< Target snap rotation
430 float duration; ///< Duration of snap animation.
433 typedef SignalV2< void ( const SnapEvent& ) > SnapStartedSignalV2;
436 * Signal emitted when the ScrollView has started to snap or flick (it tells the target
437 * position, scale, rotation for the snap or flick)
439 SnapStartedSignalV2& SnapStartedSignal();
444 * Creates an empty ScrollView handle
449 * Copy constructor. Creates another handle that points to the same real object
450 * @param handle to copy from
452 ScrollView( const ScrollView& handle );
455 * Assignment operator. Changes this handle to point to another real object
457 ScrollView& operator=( const ScrollView& handle );
460 * Virtual destructor.
461 * Dali::Object derived classes typically do not contain member data.
463 virtual ~ScrollView();
466 * Create an initialized ScrollView.
467 * @return A handle to a newly allocated Dali resource.
469 static ScrollView New();
472 * Downcast an Object handle to ScrollView. If handle points to a ScrollView the
473 * downcast produces valid handle. If not the returned handle is left uninitialized.
474 * @param[in] handle Handle to an object
475 * @return handle to a ScrollView or an uninitialized handle
477 static ScrollView DownCast( BaseHandle handle );
482 * Get snap-animation's AlphaFunction
484 * @return Current easing alpha function of the snap animation.
486 AlphaFunction GetScrollSnapAlphaFunction() const;
489 * Set snap-animation's AlphaFunction
491 * @param[in] alpha Easing alpha function of the snap animation.
493 void SetScrollSnapAlphaFunction(AlphaFunction alpha);
496 * Get flick-animation's AlphaFunction
498 * @return Current easing alpha function of the flick animation.
500 AlphaFunction GetScrollFlickAlphaFunction() const;
503 * Set flick-animation's AlphaFunction
505 * @param[in] alpha Easing alpha function of the flick animation.
507 void SetScrollFlickAlphaFunction(AlphaFunction alpha);
510 * Gets the time for the scroll snap-animation
511 * This animation occurs when the user drags, and releases.
513 * @return The time in seconds for the animation to take.
515 float GetScrollSnapDuration() const;
518 * Sets the time for the scroll snap-animation
519 * This animation occurs when the user drags, and releases.
521 * @param[in] time The time in seconds for the animation to take.
523 void SetScrollSnapDuration(float time);
526 * Gets the time for the scroll flick-animation
527 * This animation occurs when the user flicks scroll view.
529 * @return The time in seconds for the animation to take.
531 float GetScrollFlickDuration() const;
534 * Sets the time for the scroll flick-animation
535 * This animation occurs when the user flicks scroll view.
537 * @param[in] time The time in seconds for the animation to take.
539 void SetScrollFlickDuration(float time);
542 * Set X axis ruler. Defines how scrolling horizontally is snapped, and
543 * the boundary (domain) in which the ScrollView can pan.
545 * @param[in] ruler The ruler to be used for the X axis
547 void SetRulerX(RulerPtr ruler);
550 * Set Y axis ruler. Defines how scrolling vertically is snapped, and
551 * the boundary (domain) in which the ScrollView can pan.
553 * @param[in] ruler The ruler to be used for the Y axis
555 void SetRulerY(RulerPtr ruler);
558 * Set Scale-X axis ruler. Defines how scaling horizontally is snapped, and
559 * the extent (domain) to which scaling can be performed e.g. 10% to 200%
561 * @param[in] ruler The ruler to be used for the Scale-X axis
563 void SetRulerScaleX(RulerPtr ruler);
566 * Set Scale-Y axis ruler. Defines how scaling vertically is snapped, and
567 * the extent (domain) to which scaling can be performed e.g. 10% to 200%
569 * @param[in] ruler The ruler to be used for the Scale-Y axis
571 void SetRulerScaleY(RulerPtr ruler);
574 * Set Scroll's touch sensitivity.
576 * @note Unlike SetSensitive(), this determines whether this ScrollView
577 * should react (e.g. pan), without disrupting the sensitivity of it's children.
579 * @param[in] sensitive true to enable scroll, false to disable scrolling
581 void SetScrollSensitive(bool sensitive);
584 * Set maximum overshoot amount. The final overshoot value is within 0.0f to 1.0f,
585 * but the maximum overshoot is in pixels (e.g. if you scroll 75 pixels beyond the edge of a scrollable
586 * area and the maximum overshoot is 100 then the final overshoot value will be 0.75f)
588 * @param[in] overshootX the maximum number of horizontally scrolled pixels before overshoot X reaches 1.0f
589 * @param[in] overshootY the maximum number of vertically scrolled pixels before overshoot Y reaches 1.0f
591 void SetMaxOvershoot(float overshootX, float overshootY);
594 * Set Snap Overshoot animation's AlphaFunction
596 * @param[in] alpha Easing alpha function of the overshoot snap animation.
598 void SetSnapOvershootAlphaFunction(AlphaFunction alpha);
601 * Set Snap Overshoot animation's Duration
603 * @note Set duration to 0 seconds, to disable Animation.
605 * @param[in] duration The duration of the overshoot snap animation.
607 void SetSnapOvershootDuration(float duration);
610 * Sets Touches required for pan gestures.
612 * Panning requires number of touches to be within (minTouches) and
615 * If (endOutside) is true, then outside this range of touches,
616 * the pan gesture will end and thus will snap.
618 * If (endOutside) is false, then outside this range of touches,
619 * the pan gesture will pause. but will not end until touches = 0.
621 * @param[in] minTouches Minimum touches for panning to occur.
622 * @param[out] maxTouches Maxiumum touches for panning to occur.
623 * @param[in] endOutside Whether to end the panning gesture outside of touch range
625 void SetTouchesRequiredForPanning(unsigned int minTouches = 1, unsigned int maxTouches = 1, bool endOutside = true);
628 * Enables or Disables Actor Auto-Snap mode.
630 * When Actor Auto-Snap mode has been enabled, ScrollView will automatically
631 * snap to the closest actor (The closest actor will appear in the center of
634 * @param[in] enable Enables (true), or disables (false) Actor AutoSnap
636 void SetActorAutoSnap(bool enable);
639 * Enables or Disables Wrap mode for ScrollView contents.
641 * When enabled, the ScrollView contents are wrapped over the X/Y Domain.
643 * @note You must apply a position constraint that causes Wrapping
646 * @param[in] enable Enables (true), or disables (false) Wrap Mode.
648 void SetWrapMode(bool enable);
651 * Gets the current refresh interval in milliseconds.
653 * @return Current refresh interval in milliseconds
655 int GetRefreshInterval() const;
658 * Sets the refresh interval in milliseconds.
660 * The refresh interval is a notification signal
661 * (SignalScrollUpdate), that is periodically fired
662 * when scrolling animation is occuring.
664 * When set to 0. No update signals are sent.
666 * @param[in] milliseconds The frequency of the event in milliseconds
668 void SetRefreshInterval(int milliseconds);
671 * Returns state of Axis Auto Lock mode.
673 * @return Whether Axis Auto Lock mode has been enabled or not.
675 bool GetAxisAutoLock() const;
678 * Enables or Disables Axis Auto Lock mode for panning within the ScrollView
680 * When enabled, any pan gesture that appears mostly horizontal or mostly
681 * vertical, will be automatically restricted to horizontal only or vertical
682 * only panning, until the pan gesture has completed.
684 * @param[in] enable Enables (true), or disables (false) AxisAutoLock mode.
686 void SetAxisAutoLock(bool enable);
689 * Gets the gradient threshold at which a panning gesture should be locked to the
690 * Horizontal or Vertical axis.
691 * @return The gradient, a value between 0.0 and 1.0f.
693 float GetAxisAutoLockGradient() const;
696 * Sets the gradient threshold at which a panning gesture should be locked to the
697 * Horizontal or Vertical axis. by default this is 0.36 (0.36:1) which means angles
698 * less than 20 degrees to an axis will lock to that axis.
700 * @note: Specifying a value of 1.0 (the maximum value accepted) indicates that
701 * all panning gestures will auto-lock. Either to the horizontal or vertical axis.
703 * @param[in] gradient A value between 0.0 and 1.0 (auto-lock for all angles)
705 void SetAxisAutoLockGradient(float gradient);
708 * Gets the friction coefficient setting for ScrollView when
709 * flicking in free panning mode.
710 * This is a value in stage-diagonals per second^2.
711 * stage-diagonal = Length( stage.width, stage.height )
712 * @return Friction coefficient is returned.
714 float GetFrictionCoefficient() const;
717 * Sets the friction coefficient for ScrollView when
718 * flicking in free panning mode.
719 * This is a value in stage-diagonals per second^2.
720 * stage-diagonal = Length( stage.width, stage.height ).
722 * A stage 480x800 in size has a diagonal length of 933.
723 * Friction coefficient of 1.0 means the swipe velocity will
724 * reduce by 1.0 * 933 pixels/sec^2.
725 * @param[in] friction Friction coefficient, must be greater than 0.0 (default = 1.0)
727 void SetFrictionCoefficient(float friction);
730 * Gets the flick speed coefficient for ScrollView when
731 * flicking in free panning mode.
732 * This is a constant which multiplies the input touch
733 * flick velocity to determine the actual velocity at
734 * which to move the scrolling area.
735 * @return The flick speed coefficient is returned.
737 float GetFlickSpeedCoefficient() const;
740 * Sets the flick speed coefficient for ScrollView when
741 * flicking in free panning mode.
742 * This is a constant which multiplies the input touch
743 * flick velocity to determine the actual velocity at
744 * which to move the scrolling area.
745 * @param[in] speed The flick speed coefficient (default = 1.0).
747 void SetFlickSpeedCoefficient(float speed);
750 * Gets the maximum flick speed setting for ScrollView when
751 * flicking in free panning mode.
752 * This is a value in stage-diagonals per second.
753 * stage-diagonal = Length( stage.width, stage.height )
754 * @return Maximum flick speed is returned
756 float GetMaxFlickSpeed() const;
759 * Sets the maximum flick speed for the ScrollView when
760 * flicking in free panning mode.
761 * This is a value in stage-diagonals per second.
762 * stage-diagonal = Length( stage.width, stage.height )
764 * A stage 480x800 in size has a diagonal length of 933.
765 * Max Flick speed of 1.0 means the maximum velocity of
766 * a swipe can be 1.0 * 933 pixels/sec.
767 * @param[in] speed Maximum flick speed (default = 3.0)
769 void SetMaxFlickSpeed(float speed);
772 * Gets the step of scroll distance in actor coordinates for
773 * each mouse wheel event received in free panning mode.
774 * @return The step of scroll distance(pixel) in X and Y axes.
776 Vector2 GetMouseWheelScrollDistanceStep() const;
779 * Sets the step of scroll distance in actor coordinates for
780 * each mouse wheel event received in free panning mode.
781 * @param[in] step The step of scroll distance(pixel) in X and Y axes.
783 * @note: If snap points are defined in the rulers, it will always
784 * scroll to the next snap point towards the scroll direction while
785 * receiving the mouse wheel events.
788 void SetMouseWheelScrollDistanceStep(Vector2 step);
791 * Retrieves current scroll position.
793 * @returns The current scroll position.
795 Vector3 GetCurrentScrollPosition() const;
798 * Retrieves current scroll scale.
800 * @returns The current scroll scale.
802 Vector3 GetCurrentScrollScale() const;
805 * Retrieves current scroll page based on ScrollView dimensions being
806 * the size of one page, and all pages laid out in a grid fashion,
807 * increasing from left to right until the end of the X-domain.
809 * @note: Pages start from 0 as the first page, not 1.
811 * @returns The Current page.
813 unsigned int GetCurrentPage() const;
816 * Transforms View to position, scale and rotation specified
818 * @param[in] position The position to transform to.
819 * @param[in] scale The scale to transform to.
820 * @param[in] rotation The rotation to transform to.
822 void TransformTo(const Vector3& position, const Vector3& scale, float rotation);
825 * Transforms View to position, scale and rotation specified
827 * @param[in] position The position to transform to.
828 * @param[in] scale The scale to transform to.
829 * @param[in] rotation The rotation to transform to.
830 * @param[in] duration The duration for this animation in seconds.
832 void TransformTo(const Vector3& position, const Vector3& scale, float rotation, float duration);
835 * Scrolls View to position specified (contents will scroll to this position)
836 * Position 0,0 is the origin. Increasing X scrolls contents left, while
837 * increasing Y scrolls contents up.
838 * - If Rulers have been applied to the axes, then the contents will scroll until
839 * reaching the domain boundary.
840 * @note Contents will not snap to ruler snap points.
842 * @param[in] position The position to scroll to.
844 void ScrollTo(const Vector3 &position);
847 * Scrolls View to position specified (contents will scroll to this position)
848 * Position 0,0 is the origin. Increasing X scrolls contents left, while
849 * increasing Y scrolls contents up.
850 * - If Rulers have been applied to the axes, then the contents will scroll until
851 * reaching the domain boundary.
852 * @note Contents will not snap to ruler snap points.
854 * @param[in] position The position to scroll to.
855 * @param[in] duration The duration of the animation in seconds
857 void ScrollTo(const Vector3 &position, float duration);
860 * Scrolls View to position specified (contents will scroll to this position)
861 * Position 0,0 is the origin. Increasing X scrolls contents left, while
862 * increasing Y scrolls contents up.
863 * - If Rulers have been applied to the axes, then the contents will scroll until
864 * reaching the domain boundary.
865 * @note Contents will not snap to ruler snap points.
866 * Biasing parameters are provided such that in scenarios with 2 or 2x2 pages in
867 * wrap mode, the application developer can decide whether to scroll left or right
868 * to get to the target page
870 * @param[in] position The position to scroll to.
871 * @param[in] duration The duration of the animation in seconds
872 * @param[in] horizontalBias Whether to bias scrolling to left or right.
873 * @param[in] verticalBias Whether to bias scrolling to top or bottom.
875 void ScrollTo(const Vector3 &position, float duration,
876 DirectionBias horizontalBias, DirectionBias verticalBias);
879 * Scrolls View to page currently based on assumption that each page is
880 * "(page) * ScrollViewSize.width, 0".
881 * @note Should probably be upgraded so that page is an abstract class, that can be
882 * a function of ScrollViewSize, ruler domain, ruler snap points etc. as pages may be
883 * orchestrated in a 2D grid fashion, or variable width.
885 * @param[in] page to scroll to
887 void ScrollTo(unsigned int page);
890 * Scrolls View to page currently based on assumption that each page is
891 * "(page) * ScrollViewSize.width, 0".
892 * @note Should probably be upgraded so that page is an abstract class, that can be
893 * a function of ScrollViewSize, ruler domain, ruler snap points etc. as pages may be
894 * orchestrated in a 2D grid fashion, or variable width.
896 * @param[in] page to scroll to
897 * @param[in] duration The duration of the animation in seconds
899 void ScrollTo(unsigned int page, float duration);
902 * Scrolls View to page currently based on assumption that each page is
903 * "(page) * ScrollViewSize.width, 0".
904 * @note Should probably be upgraded so that page is an abstract class, that can be
905 * a function of ScrollViewSize, ruler domain, ruler snap points etc. as pages may be
906 * orchestrated in a 2D grid fashion, or variable width.
907 * A biasing parameter is provided such that in scenarios with 2 pages in wrap mode,
908 * the application developer can decide whether to scroll left or right to get to
911 * @param[in] page to scroll to
912 * @param[in] duration The duration of the animation in seconds
913 * @param[in] bias Whether to bias scrolling to left or right.
915 void ScrollTo(unsigned int page, float duration, DirectionBias bias);
918 * Scrolls View such that actor appears in the center of the ScrollView.
920 * @note Actor must be a direct child of ScrollView, otherwise will
921 * cause an assertion failure.
922 * @param[in] actor The actor to center in on (via Scrolling).
924 void ScrollTo(Actor& actor);
927 * Scrolls View such that actor appears in the center of the ScrollView.
929 * @note Actor must be a direct child of ScrollView, otherwise will
930 * cause an assertion failure.
931 * @param[in] actor The actor to center in on (via Scrolling).
932 * @param[in] duration The duration of the animation in seconds
934 void ScrollTo(Actor& actor, float duration);
937 * Scrolls View to the nearest snap points as specified by the Rulers.
939 * If already at snap points, then will return false, and not scroll.
941 * @return True if Snapping necessary.
943 bool ScrollToSnapPoint();
946 * Scales View to (scale)
948 * @param[in] scale The scale factor the animate to.
950 void ScaleTo(const Vector3& scale);
953 * Scales View to (scale)
955 * @param[in] scale The scale factor the animate to.
956 * @param[in] duration The duration of the animation in seconds.
958 void ScaleTo(const Vector3& scale, float duration);
961 * Applies a constraint that will affect the children of ScrollView
963 * @note this affects all existing, and future Actors that are added to
966 void ApplyConstraintToChildren(Constraint constraint);
969 * Removes all constraints that will affect the children of ScrollView
971 * @note this removes all constraints from actors that have been added
974 void RemoveConstraintsFromChildren();
977 * Apply Effect to ScrollView
978 * @param[in] effect The effect to apply to scroll view
980 void ApplyEffect(ScrollViewEffect effect);
983 * ApplyEffect Applies a predefined effect
984 * @param[in] effect enum for the predefined effect
986 ScrollViewEffect ApplyEffect(ScrollView::PageEffect effect);
989 * Remove Effect from ScrollView
990 * @param[in] effect The effect to remove.
992 void RemoveEffect(ScrollViewEffect effect);
995 * Remove All Effects from ScrollView
997 void RemoveAllEffects();
1000 * Binds actor to this ScrollView, once an actor is bound to a ScrollView,
1001 * it'll be subject to that ScrollView's properties.
1003 * @param[in] child The actor to add to this ScrollView.
1005 void BindActor(Actor child);
1008 * Unbind Actor from this ScrollView
1009 * Once Unbound, this ScrollView will not affect the actor.
1011 * @note this does not remove the child from the ScrollView container
1013 * @param[in] child The actor to be unbound.
1015 void UnbindActor(Actor child);
1018 * Allows the user to constrain the scroll view in a particular direction.
1019 * @param[in] direction The axis to constrain the scroll-view to.
1020 * Usually set to PanGestureDetector::DIRECTION_VERTICAL or PanGestureDetector::DIRECTION_HORIZONTAL (but can be any other angle if desired).
1021 * @param[in] threshold The threshold to apply around the axis.
1022 * @note If no threshold is specified, then the default threshold of PI * 0.25 radians (or 45 degrees) is used.
1024 void SetScrollingDirection( Radian direction, Radian threshold = PanGestureDetector::DEFAULT_THRESHOLD );
1027 * Remove a direction constraint from the scroll view.
1028 * @param[in] direction The axis to stop constraining to.
1029 * Usually will be PanGestureDetector::DIRECTION_VERTICAL or PanGestureDetector::DIRECTION_HORIZONTAL (but can be any other angle if desired).
1031 void RemoveScrollingDirection( Radian direction );
1033 public: // Not intended for application developers
1036 * Creates a handle using the Toolkit::Internal implementation.
1037 * @param[in] implementation The Control implementation.
1039 ScrollView(Internal::ScrollView& implementation);
1042 * Allows the creation of this Control from an Internal::CustomActor pointer.
1043 * @param[in] internal A pointer to the internal CustomActor.
1045 ScrollView( Dali::Internal::CustomActor* internal );
1048 } // namespace Toolkit
1055 #endif // __DALI_TOOLKIT_SCROLL_VIEW_H__