[SRUK] Initial copy from Tizen 2.2 version
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / controls / scrollable / scroll-view / scroll-view-depth-effect.h
1 #ifndef __DALI_TOOLKIT_SCROLL_VIEW_DEPTH_EFFECT_H__
2 #define __DALI_TOOLKIT_SCROLL_VIEW_DEPTH_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 // INTERNAL INCLUDES
21 #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-effect.h>
22
23 namespace Dali DALI_IMPORT_API
24 {
25
26 class Actor;
27
28 namespace Toolkit
29 {
30
31 class ScrollViewEffect;
32
33 namespace Internal DALI_INTERNAL
34 {
35 class ScrollViewDepthEffect;
36 }
37
38 /**
39  * ScrollView Depth-Effect.
40  *
41  * This effect causes Actors to appear to scroll off the page
42  * at different speeds.
43  *
44  * It should be used on the following Actor hierarchy:
45  *
46  * ScrollView
47  * |
48  * Page (1..n)
49  * |
50  * Child (1..m)
51  *
52  * You should ensure ScrollView's default constraints have been removed,
53  * by calling ScrollView::RemoveConstraintsFromChildren() before applying
54  * this effect to ScrollView.
55  *
56  * Manual operation:
57  * upon adding children to pages, the ApplyToActor(...) method should be called.
58  *
59  * Automatic operation:
60  * not implemented.
61  */
62 class ScrollViewDepthEffect : public ScrollViewEffect
63 {
64
65 public:
66
67   /**
68    * Create an initialized ScrollViewDepthEffect.
69    * @return A handle to a newly allocated Dali resource.
70    */
71   static ScrollViewDepthEffect New();
72
73   /**
74    * Create an uninitialized ScrollViewDepthEffect; this can be initialized with ScrollViewDepthEffect::New()
75    * Calling member functions with an uninitialized Toolkit::ScrollViewDepthEffect is not allowed.
76    */
77   ScrollViewDepthEffect();
78
79   /**
80    * Downcast an Object handle to ScrollViewDepthEffect. If handle points to a ScrollViewDepthEffect the
81    * downcast produces valid handle. If not the returned handle is left uninitialized.
82    * @param[in] handle Handle to an object
83    * @return handle to a ScrollViewCubeEffect or an uninitialized handle
84    */
85   static ScrollViewDepthEffect DownCast( BaseHandle handle );
86
87   /**
88    * Manually apply effect to an Actor.
89    * @param[in] child The child Actor to be affected by this effect.
90    * @param[in] positionExtent Controls how much Actor's X and Y
91    * position affects their alpha function's exponent value
92    * @param[in] offsetExtent exponent offset for X and Y scrolling
93    * axes.
94    * @param[in] positionScale Changes the amount the page as a whole
95    * moves by.
96    * @param[in] scaleExtent Scale factor to reach when page is one whole
97    * page away from screen.
98    */
99   void ApplyToActor(Actor child,
100                     const Vector2& positionExtent,
101                     const Vector2& offsetExtent,
102                     float positionScale,
103                     float scaleExtent);
104
105 protected:
106
107   /**
108    * This constructor is used by Dali New() methods.
109    * @param [in] impl A pointer to a newly allocated Dali resource
110    */
111   ScrollViewDepthEffect(Internal::ScrollViewDepthEffect *impl);
112
113 };
114
115 } // namespace Toolkit
116
117 } // namespace Dali
118
119 #endif // __DALI_TOOLKIT_SCROLL_VIEW_DEPTH_EFFECT_H__