[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-cube-effect.h
1 #ifndef __DALI_TOOLKIT_SCROLL_VIEW_CUBE_EFFECT_H__
2 #define __DALI_TOOLKIT_SCROLL_VIEW_CUBE_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 ScrollViewCubeEffect;
41 }
42
43 /**
44  * ScrollView Cube-Effect.
45  *
46  * This effect causes Actors to appear to rotate around a 3D cube.
47  * It should be used on the following Actor hierarchy:
48  *
49  * ScrollView
50  * |
51  * Page (1..n)
52  * |
53  * Child (1..m)
54  *
55  * You should ensure ScrollView's default constraints have been removed,
56  * by calling ScrollView::RemoveConstraintsFromChildren() before applying
57  * this effect to ScrollView.
58  *
59  * Manual operation:
60  * upon adding children to pages, the ApplyToActor(...) method should be called.
61  *
62  * Automatic operation:
63  * not implemented.
64  */
65 class ScrollViewCubeEffect : public ScrollViewEffect
66 {
67
68 public:
69
70   /**
71    * Create an initialized ScrollViewCubeEffect.
72    * @return A handle to a newly allocated Dali resource.
73    */
74   static ScrollViewCubeEffect New();
75
76   /**
77    * Create an uninitialized ScrollViewCubeEffect; this can be initialized with ScrollViewCubeEffect::New()
78    * Calling member functions with an uninitialized Toolkit::ScrollViewCubeEffect is not allowed.
79    */
80   ScrollViewCubeEffect();
81
82   /**
83    * Downcast an Object handle to ScrollViewCubeEffect. If handle points to a ScrollViewCubeEffect the
84    * downcast produces valid handle. If not the returned handle is left uninitialized.
85    * @param[in] handle Handle to an object
86    * @return handle to a ScrollViewCubeEffect or an uninitialized handle
87    */
88   static ScrollViewCubeEffect DownCast( BaseHandle handle );
89
90   /**
91    * Manually apply effect to an Actor.
92    * @param[in] child The child Actor to be affected by this effect.
93    * @param[in] anchor The anchor point that the child actor should
94    * rotate around when scrolling
95    * @param[in] angleSwing The maximum amount the child actor should
96    * rotate in radians for each axis (X and Y) as the page is scrolled.
97    * @param[in] positionSwing The maximum amount the child actor should
98    * move for each axis (X and Y) as the page is scrolled.
99    */
100   void ApplyToActor(Actor child,
101                     const Vector3& anchor,
102                     const Vector2& angleSwing,
103                     const Vector2& positionSwing);
104
105   /**
106    * Manually apply effect to an Actor.
107    * @param[in] child The child Actor to be affected by this effect.
108    * @param[in] parentPage The parent page Actor to be used by this effect.
109    * @param[in] anchor The anchor point that the child actor should
110    * rotate around when scrolling
111    * @param[in] angleSwing The maximum amount the child actor should
112    * rotate in radians for each axis (X and Y) as the page is scrolled.
113    * @param[in] positionSwing The maximum amount the child actor should
114    * move for each axis (X and Y) as the page is scrolled.
115    */
116   void ApplyToActor(Actor child,
117                     Actor parentPage,
118                     const Vector3& anchor,
119                     const Vector2& angleSwing,
120                     const Vector2& positionSwing);
121
122 protected:
123
124   /**
125    * This constructor is used by Dali New() methods.
126    * @param [in] impl A pointer to a newly allocated Dali resource
127    */
128   ScrollViewCubeEffect(Internal::ScrollViewCubeEffect *impl);
129
130 };
131
132 } // namespace Toolkit
133
134 } // namespace Dali
135
136 /**
137  * @}
138  */
139 #endif // __DALI_TOOLKIT_SCROLL_VIEW_CUBE_EFFECT_H__