1 #ifndef __DALI_TOOLKIT_SCROLL_VIEW_SLIDE_EFFECT_H__
2 #define __DALI_TOOLKIT_SCROLL_VIEW_SLIDE_EFFECT_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
28 #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-effect.h>
30 namespace Dali DALI_IMPORT_API
38 class ScrollViewEffect;
40 namespace Internal DALI_INTERNAL
42 class ScrollViewSlideEffect;
46 * ScrollView Twist-Effect.
48 class ScrollViewSlideEffect : public ScrollViewEffect
53 static const std::string EFFECT_TIME;
54 static const std::string EFFECT_REFERENCE;
55 static const std::string EFFECT_ACTIVE;
60 * Create an initialized ScrollViewSlideEffect.
61 * @return A handle to a newly allocated Dali resource.
63 static ScrollViewSlideEffect New();
66 * Create an uninitialized ScrollViewSlideEffect; this can be initialized with ScrollViewSlideEffect::New()
67 * Calling member functions with an uninitialized Toolkit::ScrollViewSlideEffect is not allowed.
69 ScrollViewSlideEffect();
72 * Downcast an Object handle to ScrollViewSlideEffect. If handle points to a ScrollViewSlideEffect the
73 * downcast produces valid handle. If not the returned handle is left uninitialized.
74 * @param[in] handle Handle to an object
75 * @return handle to a ScrollViewSlideEffect or an uninitialized handle
77 static ScrollViewSlideEffect DownCast( BaseHandle handle );
80 * Gets the slide direction for this effect.
81 * @return The slide direction (true = vertical, false = horizontal)
83 bool GetSlideDirection() const;
86 * Sets the slide direction for this effect.
87 * If the direction has been set to horizontal (false), then
88 * the user will see the Actors have a delay in horizontal movement
89 * based on the vertical distance the actor is away from the initial drag point.
90 * If the direction has been set to vertical (true), then the
91 * user will experience the opposite effect (i.e. delay in the vertical movement).
92 * @param[in] vertical The slide direction (true = vertical, false = horizontal)
93 * (default is horizontal i.e. false)
95 void SetSlideDirection(bool vertical);
98 * Gets the delay reference offset for this effect.
99 * @return The delay reference offset (Vector3::ZERO - indicates no offset)
101 Vector3 GetDelayReferenceOffset() const;
104 * Sets an offset for where the central delay point on the scroll-view should be
106 * By default the offset is 0. Which means that the point where the user drags
107 * the scroll-view content should have no delay, and the further away from this
108 * point, the delay should increase. Adjusting this offset to for example
109 * 0.0f, -stageSize.height * 0.5f, will mean that dragging the center of the stage
110 * will result in the content at the top of the stage moving with no delay, and
111 * the further away from this point (top of stage), the delay should increase.
112 * @param[in] offset The offset in local coordinates, relative to the ScrollView.
114 void SetDelayReferenceOffset(const Vector3& offset);
117 * Gets the maximum duration of the effect after scrolling completes
118 * @return The duration in seconds
120 float GetMaxDelayDuration() const;
123 * Sets the maximum duration of the effect after scrolling completes
124 * @param[in] duration The duration in seconds (>= 0.0f, default is 0.25 seconds)
126 void SetMaxDelayDuration(float duration);
129 * Manually apply effect to an Actor.
130 * @param[in] child The child Actor to be affected by this effect.
131 * @param[in] delayMin The minimum delay coefficient for Actors at the
132 * scroll-view touch point. Set to 0 for instantaneous, and 1 for infinite delay.
134 * @param[in] delayMax The maximum delay coefficient for Actors at the
135 * scroll-view approx 1 ScrollView size from the touch point. Set to 0 for
136 * instantaneous, and 1 for infinite delay. Default is 0.99f (a noticable delay)
138 void ApplyToActor( Actor child,
139 float delayMin = 0.5f,
140 float delayMax = 0.95f );
145 * This constructor is used by Dali New() methods.
146 * @param [in] impl A pointer to a newly allocated Dali resource
148 ScrollViewSlideEffect(Internal::ScrollViewSlideEffect *impl);
152 } // namespace Toolkit
159 #endif // __DALI_TOOLKIT_SCROLL_VIEW_SLIDE_EFFECT_H__