[SRUK] Initial copy from Tizen 2.2 version
[platform/core/uifw/dali-toolkit.git] / capi / 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 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
10 //
11 //     http://floralicense.org/license/
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  * @addtogroup CAPI_DALI_FRAMEWORK
22  * @{
23  */
24
25 // EXTERNAL INCLUDES
26
27 // INTERNAL INCLUDES
28 #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-effect.h>
29
30 namespace Dali DALI_IMPORT_API
31 {
32
33 class Actor;
34
35 namespace Toolkit
36 {
37
38 class ScrollViewEffect;
39
40 namespace Internal DALI_INTERNAL
41 {
42 class ScrollViewSlideEffect;
43 }
44
45 /**
46  * ScrollView Twist-Effect.
47  */
48 class ScrollViewSlideEffect : public ScrollViewEffect
49 {
50
51 public:
52
53   static const std::string EFFECT_TIME;
54   static const std::string EFFECT_REFERENCE;
55   static const std::string EFFECT_ACTIVE;
56
57 public:
58
59   /**
60    * Create an initialized ScrollViewSlideEffect.
61    * @return A handle to a newly allocated Dali resource.
62    */
63   static ScrollViewSlideEffect New();
64
65   /**
66    * Create an uninitialized ScrollViewSlideEffect; this can be initialized with ScrollViewSlideEffect::New()
67    * Calling member functions with an uninitialized Toolkit::ScrollViewSlideEffect is not allowed.
68    */
69   ScrollViewSlideEffect();
70
71   /**
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
76    */
77   static ScrollViewSlideEffect DownCast( BaseHandle handle );
78
79   /**
80    * Gets the slide direction for this effect.
81    * @return The slide direction (true = vertical, false = horizontal)
82    */
83   bool GetSlideDirection() const;
84
85   /**
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)
94    */
95   void SetSlideDirection(bool vertical);
96
97   /**
98    * Gets the delay reference offset for this effect.
99    * @return The delay reference offset (Vector3::ZERO - indicates no offset)
100    */
101   Vector3 GetDelayReferenceOffset() const;
102
103   /**
104    * Sets an offset for where the central delay point on the scroll-view should be
105    * when dragging.
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.
113    */
114   void SetDelayReferenceOffset(const Vector3& offset);
115
116   /**
117    * Gets the maximum duration of the effect after scrolling completes
118    * @return The duration in seconds
119    */
120   float GetMaxDelayDuration() const;
121
122   /**
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)
125    */
126   void SetMaxDelayDuration(float duration);
127
128   /**
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.
133    * Default is 0.5f
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)
137    */
138   void ApplyToActor( Actor child,
139                      float delayMin = 0.5f,
140                      float delayMax = 0.95f );
141
142 protected:
143
144   /**
145    * This constructor is used by Dali New() methods.
146    * @param [in] impl A pointer to a newly allocated Dali resource
147    */
148   ScrollViewSlideEffect(Internal::ScrollViewSlideEffect *impl);
149
150 };
151
152 } // namespace Toolkit
153
154 } // namespace Dali
155
156 /**
157  * @}
158  */
159 #endif // __DALI_TOOLKIT_SCROLL_VIEW_SLIDE_EFFECT_H__