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.
24 #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-effect.h>
26 namespace Dali DALI_IMPORT_API
34 class ScrollViewEffect;
36 namespace Internal DALI_INTERNAL
38 class ScrollViewSlideEffect;
42 * @brief ScrollView effect that uses slides for transitioning pages.
44 class ScrollViewSlideEffect : public ScrollViewEffect
47 static const std::string EFFECT_TIME; ///< Effect time property name
48 static const std::string EFFECT_REFERENCE; ///< Effect reference property name
49 static const std::string EFFECT_ACTIVE; ///< Effect active property name
54 * @brief Create an initialized ScrollViewSlideEffect.
56 * @return A handle to a newly allocated Dali resource.
58 static ScrollViewSlideEffect New();
61 * @brief Create an uninitialized ScrollViewSlideEffect; this can be initialized with ScrollViewSlideEffect::New().
63 * Calling member functions with an uninitialized Toolkit::ScrollViewSlideEffect is not allowed.
65 ScrollViewSlideEffect();
68 * @brief Downcast an Object handle to ScrollViewSlideEffect.
70 * If handle points to a ScrollViewSlideEffect the downcast produces
71 * valid handle. If not the returned handle is left uninitialized.
73 * @param[in] handle Handle to an object
74 * @return handle to a ScrollViewSlideEffect or an uninitialized handle
76 static ScrollViewSlideEffect DownCast( BaseHandle handle );
79 * @brief Gets the slide direction for this effect.
81 * @return The slide direction (true = vertical, false = horizontal)
83 bool GetSlideDirection() const;
86 * @brief Sets the slide direction for this effect.
88 * If the direction has been set to horizontal (false), then
89 * the user will see the Actors have a delay in horizontal movement
90 * based on the vertical distance the actor is away from the initial drag point.
91 * If the direction has been set to vertical (true), then the
92 * user will experience the opposite effect (i.e. delay in the vertical movement).
93 * @param[in] vertical The slide direction (true = vertical, false = horizontal)
94 * (default is horizontal i.e. false)
96 void SetSlideDirection(bool vertical);
99 * @brief Gets the delay reference offset for this effect.
101 * @return The delay reference offset (Vector3::ZERO - indicates no offset)
103 Vector3 GetDelayReferenceOffset() const;
106 * @brief Sets an offset for where the central delay point on the scroll-view should be
109 * By default the offset is 0. Which means that the point where the user drags
110 * the scroll-view content should have no delay, and the further away from this
111 * point, the delay should increase. Adjusting this offset to for example
112 * 0.0f, -stageSize.height * 0.5f, will mean that dragging the center of the stage
113 * will result in the content at the top of the stage moving with no delay, and
114 * the further away from this point (top of stage), the delay should increase.
115 * @param[in] offset The offset in local coordinates, relative to the ScrollView.
117 void SetDelayReferenceOffset(const Vector3& offset);
120 * @brief Gets the maximum duration of the effect after scrolling completes.
122 * @return The duration in seconds
124 float GetMaxDelayDuration() const;
127 * @brief Sets the maximum duration of the effect after scrolling completes.
129 * @param[in] duration The duration in seconds (>= 0.0f, default is 0.25 seconds)
131 void SetMaxDelayDuration(float duration);
134 * @brief Manually apply effect to an Actor.
136 * @param[in] child The child Actor to be affected by this effect.
137 * @param[in] delayMin The minimum delay coefficient for Actors at the
138 * scroll-view touch point. Set to 0 for instantaneous, and 1 for infinite delay.
140 * @param[in] delayMax The maximum delay coefficient for Actors at the
141 * scroll-view approx 1 ScrollView size from the touch point. Set to 0 for
142 * instantaneous, and 1 for infinite delay. Default is 0.99f (a noticable delay)
144 void ApplyToActor( Actor child,
145 float delayMin = 0.5f,
146 float delayMax = 0.95f );
151 * @brief This constructor is used by Dali New() methods.
153 * @param [in] impl A pointer to a newly allocated Dali resource
155 ScrollViewSlideEffect(Internal::ScrollViewSlideEffect *impl);
159 } // namespace Toolkit
163 #endif // __DALI_TOOLKIT_SCROLL_VIEW_SLIDE_EFFECT_H__