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