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 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 * @addtogroup CAPI_DALI_TOOLKIT_SCROLL_VIEW_MODULE
29 #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-effect.h>
31 namespace Dali DALI_IMPORT_API
39 class ScrollViewEffect;
41 namespace Internal DALI_INTERNAL
43 class ScrollViewSlideEffect;
47 * @brief ScrollView effect that uses slides for transitioning pages.
49 class ScrollViewSlideEffect : public ScrollViewEffect
52 static const std::string EFFECT_TIME; ///< Effect time property name
53 static const std::string EFFECT_REFERENCE; ///< Effect reference property name
54 static const std::string EFFECT_ACTIVE; ///< Effect active property name
59 * @brief Create an initialized ScrollViewSlideEffect.
61 * @return A handle to a newly allocated Dali resource.
63 static ScrollViewSlideEffect New();
66 * @brief Create an uninitialized ScrollViewSlideEffect; this can be initialized with ScrollViewSlideEffect::New().
68 * Calling member functions with an uninitialized Toolkit::ScrollViewSlideEffect is not allowed.
70 ScrollViewSlideEffect();
73 * @brief Downcast an Object handle to ScrollViewSlideEffect.
75 * If handle points to a ScrollViewSlideEffect the downcast produces
76 * valid handle. If not the returned handle is left uninitialized.
78 * @param[in] handle Handle to an object
79 * @return handle to a ScrollViewSlideEffect or an uninitialized handle
81 static ScrollViewSlideEffect DownCast( BaseHandle handle );
84 * @brief Gets the slide direction for this effect.
86 * @return The slide direction (true = vertical, false = horizontal)
88 bool GetSlideDirection() const;
91 * @brief Sets the slide direction for this effect.
93 * If the direction has been set to horizontal (false), then
94 * the user will see the Actors have a delay in horizontal movement
95 * based on the vertical distance the actor is away from the initial drag point.
96 * If the direction has been set to vertical (true), then the
97 * user will experience the opposite effect (i.e. delay in the vertical movement).
98 * @param[in] vertical The slide direction (true = vertical, false = horizontal)
99 * (default is horizontal i.e. false)
101 void SetSlideDirection(bool vertical);
104 * @brief Gets the delay reference offset for this effect.
106 * @return The delay reference offset (Vector3::ZERO - indicates no offset)
108 Vector3 GetDelayReferenceOffset() const;
111 * @brief Sets an offset for where the central delay point on the scroll-view should be
114 * By default the offset is 0. Which means that the point where the user drags
115 * the scroll-view content should have no delay, and the further away from this
116 * point, the delay should increase. Adjusting this offset to for example
117 * 0.0f, -stageSize.height * 0.5f, will mean that dragging the center of the stage
118 * will result in the content at the top of the stage moving with no delay, and
119 * the further away from this point (top of stage), the delay should increase.
120 * @param[in] offset The offset in local coordinates, relative to the ScrollView.
122 void SetDelayReferenceOffset(const Vector3& offset);
125 * @brief Gets the maximum duration of the effect after scrolling completes.
127 * @return The duration in seconds
129 float GetMaxDelayDuration() const;
132 * @brief Sets the maximum duration of the effect after scrolling completes.
134 * @param[in] duration The duration in seconds (>= 0.0f, default is 0.25 seconds)
136 void SetMaxDelayDuration(float duration);
139 * @brief Manually apply effect to an Actor.
141 * @param[in] child The child Actor to be affected by this effect.
142 * @param[in] delayMin The minimum delay coefficient for Actors at the
143 * scroll-view touch point. Set to 0 for instantaneous, and 1 for infinite delay.
145 * @param[in] delayMax The maximum delay coefficient for Actors at the
146 * scroll-view approx 1 ScrollView size from the touch point. Set to 0 for
147 * instantaneous, and 1 for infinite delay. Default is 0.99f (a noticable delay)
149 void ApplyToActor( Actor child,
150 float delayMin = 0.5f,
151 float delayMax = 0.95f );
156 * @brief This constructor is used by Dali New() methods.
158 * @param [in] impl A pointer to a newly allocated Dali resource
160 ScrollViewSlideEffect(Internal::ScrollViewSlideEffect *impl);
164 } // namespace Toolkit
171 #endif // __DALI_TOOLKIT_SCROLL_VIEW_SLIDE_EFFECT_H__