Controls no longer have property names.
[platform/core/uifw/dali-toolkit.git] / capi / dali-toolkit / public-api / controls / scrollable / scroll-view / scroll-view-twist-effect.h
1 #ifndef __DALI_TOOLKIT_SCROLL_VIEW_TWIST_EFFECT_H__
2 #define __DALI_TOOLKIT_SCROLL_VIEW_TWIST_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 // INTERNAL INCLUDES
26 #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-effect.h>
27
28 namespace Dali DALI_IMPORT_API
29 {
30
31 class Actor;
32
33 namespace Toolkit
34 {
35
36 class ScrollViewEffect;
37
38 namespace Internal DALI_INTERNAL
39 {
40 class ScrollViewTwistEffect;
41 }
42
43 /**
44  * ScrollView Twist-Effect.
45  */
46 class ScrollViewTwistEffect : public ScrollViewEffect
47 {
48
49 public:
50
51   static const float DEFAULT_MINIMUM_DISTANCE_FOR_SHRINK;
52
53 public:
54
55   /**
56    * Create an initialized ScrollViewTwistEffect.
57    * @return A handle to a newly allocated Dali resource.
58    */
59   static ScrollViewTwistEffect New();
60
61   /**
62    * Create an uninitialized ScrollViewTwistEffect; this can be initialized with ScrollViewTwistEffect::New()
63    * Calling member functions with an uninitialized Toolkit::ScrollViewTwistEffect is not allowed.
64    */
65   ScrollViewTwistEffect();
66
67   /**
68    * Downcast an Object handle to ScrollViewTwistEffect. If handle points to a ScrollViewTwistEffect the
69    * downcast produces valid handle. If not the returned handle is left uninitialized.
70    * @param[in] handle Handle to an object
71    * @return handle to a ScrollViewTwistEffect or an uninitialized handle
72    */
73   static ScrollViewTwistEffect DownCast( BaseHandle handle );
74
75   /**
76    * Gets the minimum animation distance for the shrink effect to
77    * occur
78    * @return The minimum distance in seconds is returned.
79    */
80   float GetMinimumDistanceForShrink() const;
81
82   /**
83    * Sets the minimum animation distance for the shrink effect
84    * to occur.
85    * @param[in] distance The minimum distance in pixels (default = 0.0)
86    * i.e. any flick will result in shrinking.
87    */
88   void SetMinimumDistanceForShrink(float distance);
89
90   /**
91    * Enable or disable this effect.
92    * @param[in] enableFlag Set to true if the effect should be enabled.
93    */
94   void EnableEffect(bool enableFlag);
95
96   /**
97    * Manually apply effect to an Actor.
98    * @param[in] child The child Actor to be affected by this effect.
99    * @param[in] additionalEffects Whether just the basic effect (delay)
100    * should be applied. Or all effects (delay, rotation, scaling).
101    * For all effects set to true. Default is true i.e. apply all effects.
102    * @param[in] angleSwing The maximum amount the child actor should
103    * rotate in radians for each axis (X and Y) if the scrollview reaches
104    * overshoot. Default is PI/2 i.e. 90 degrees rotation.
105    * @param[in] scaleAmount The relative amount to shrink Actors as they
106    * are panned fast (flick animation). default is 0.125 (12.5% shrinkage)
107    * @param[in] delayMin The minimum delay coefficient for Actors at the
108    * scroll-view center. Set to 0 for instantaneous, and 1 for infinite delay.
109    * Default is 0.0f
110    * @param[in] delayMax The maximum delay coefficient for Actors at the
111    * scroll-view approx 1 ScrollView size from the center. Set to 0 for
112    * instantaneous, and 1 for infinite delay. Default is 0.9f (a slight delay)
113    */
114   void ApplyToActor( Actor child,
115                      bool additionalEffects = true,
116                      const Vector2& angleSwing = Vector2( Math::PI_4, Math::PI_4 ),
117                      float scaleAmount = 0.125f,
118                      float delayMin = 0.0f,
119                      float delayMax = 0.9f );
120
121   /**
122    * Set the maximum swing angle when at zero drop off
123    *
124    * @param[in] maxSwingAngle maximum swing angle for x and y axes
125    */
126   void SetMaxSwingAngle(const Vector2& maxSwingAngle);
127
128   /**
129    * Set the drop off values to affect the amount of swing angle applied to an actor the further it is from
130    * the scroll position. A drop off of 0.0f means no angle drop off while 1.0f will reduce the angle to zero
131    * over the distance supplied for that axis.
132    *
133    * Example maxSwingAngle.x is Pi, dropOff.x is 0.5f and distance.x is 100.0f:
134    *    The angle on the x axis will reduce to (0.5f * Pi) over 100 pixels
135    *
136    * @param[in] dropOff amount to reduce swing angle by in the range [0.0f, 1.0f]. 0.0f
137    * @param[in] distance distance to apply dropOff in pixels
138    * @param[in] function Alpha Function to affect how drop off is applied over distance, NULL for linear application
139    */
140   void SetSwingDropOff(const Vector2& dropOff, const Vector2& distance, AlphaFunction function = NULL);
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   ScrollViewTwistEffect(Internal::ScrollViewTwistEffect *impl);
149
150 };
151
152 } // namespace Toolkit
153
154 } // namespace Dali
155
156 /**
157  * @}
158  */
159 #endif // __DALI_TOOLKIT_SCROLL_VIEW_TWIST_EFFECT_H__