Stop exporting Internal symbols
[platform/core/uifw/dali-toolkit.git] / base / dali-toolkit / public-api / controls / scrollable / scroll-view / scroll-view-slide-effect.h
1 #ifndef __DALI_TOOLKIT_SCROLL_VIEW_SLIDE_EFFECT_H__
2 #define __DALI_TOOLKIT_SCROLL_VIEW_SLIDE_EFFECT_H__
3
4 /*
5  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22
23 // INTERNAL INCLUDES
24 #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-effect.h>
25
26 namespace Dali
27 {
28
29 class Actor;
30
31 namespace Toolkit
32 {
33
34 class ScrollViewEffect;
35
36 namespace Internal DALI_INTERNAL
37 {
38 class ScrollViewSlideEffect;
39 }
40
41 /**
42  * @brief ScrollView effect that uses slides for transitioning pages.
43  */
44 class DALI_IMPORT_API ScrollViewSlideEffect : public ScrollViewEffect
45 {
46 public:
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
50
51 public:
52
53   /**
54    * @brief Create an initialized ScrollViewSlideEffect.
55    *
56    * @return A handle to a newly allocated Dali resource.
57    */
58   static ScrollViewSlideEffect New();
59
60   /**
61    * @brief Create an uninitialized ScrollViewSlideEffect; this can be initialized with ScrollViewSlideEffect::New().
62    *
63    * Calling member functions with an uninitialized Toolkit::ScrollViewSlideEffect is not allowed.
64    */
65   ScrollViewSlideEffect();
66
67   /**
68    * @brief Downcast an Object handle to ScrollViewSlideEffect.
69    *
70    * If handle points to a ScrollViewSlideEffect the downcast produces
71    * valid handle. If not the returned handle is left uninitialized.
72    *
73    * @param[in] handle Handle to an object
74    * @return handle to a ScrollViewSlideEffect or an uninitialized handle
75    */
76   static ScrollViewSlideEffect DownCast( BaseHandle handle );
77
78   /**
79    * @brief Gets the slide direction for this effect.
80    *
81    * @return The slide direction (true = vertical, false = horizontal)
82    */
83   bool GetSlideDirection() const;
84
85   /**
86    * @brief Sets the slide direction for this effect.
87    *
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)
95    */
96   void SetSlideDirection(bool vertical);
97
98   /**
99    * @brief Gets the delay reference offset for this effect.
100    *
101    * @return The delay reference offset (Vector3::ZERO - indicates no offset)
102    */
103   Vector3 GetDelayReferenceOffset() const;
104
105   /**
106    * @brief Sets an offset for where the central delay point on the scroll-view should be
107    * when dragging.
108    *
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.
116    */
117   void SetDelayReferenceOffset(const Vector3& offset);
118
119   /**
120    * @brief Gets the maximum duration of the effect after scrolling completes.
121    *
122    * @return The duration in seconds
123    */
124   float GetMaxDelayDuration() const;
125
126   /**
127    * @brief Sets the maximum duration of the effect after scrolling completes.
128    *
129    * @param[in] duration The duration in seconds (>= 0.0f, default is 0.25 seconds)
130    */
131   void SetMaxDelayDuration(float duration);
132
133   /**
134    * @brief Manually apply effect to an Actor.
135    *
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.
139    * Default is 0.5f
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)
143    */
144   void ApplyToActor( Actor child,
145                      float delayMin = 0.5f,
146                      float delayMax = 0.95f );
147
148 protected:
149
150   /**
151    * @brief This constructor is used by Dali New() methods.
152    *
153    * @param [in] impl A pointer to a newly allocated Dali resource
154    */
155   explicit DALI_INTERNAL ScrollViewSlideEffect(Internal::ScrollViewSlideEffect *impl);
156
157 };
158
159 } // namespace Toolkit
160
161 } // namespace Dali
162
163 #endif // __DALI_TOOLKIT_SCROLL_VIEW_SLIDE_EFFECT_H__