98e5665e7e5b50e66cafd83aa14bff78d16a4df3
[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 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 /**
22  * @addtogroup CAPI_DALI_TOOLKIT_SCROLL_VIEW_MODULE
23  * @{
24  */
25
26 // INTERNAL INCLUDES
27 #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-effect.h>
28
29 namespace Dali DALI_IMPORT_API
30 {
31
32 class Actor;
33
34 namespace Toolkit
35 {
36
37 class ScrollViewEffect;
38
39 namespace Internal DALI_INTERNAL
40 {
41 class ScrollViewCubeEffect;
42 }
43
44 /**
45  * @brief This effect causes Actors to appear to rotate around a 3D cube.
46  *
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    * @brief Create an initialized ScrollViewCubeEffect.
72    *
73    * @return A handle to a newly allocated Dali resource.
74    */
75   static ScrollViewCubeEffect New();
76
77   /**
78    * @brief Create an uninitialized ScrollViewCubeEffect; this can be initialized with ScrollViewCubeEffect::New().
79    *
80    * Calling member functions with an uninitialized Toolkit::ScrollViewCubeEffect is not allowed.
81    */
82   ScrollViewCubeEffect();
83
84   /**
85    * @brief Downcast an Object handle to ScrollViewCubeEffect.
86    *
87    * If handle points to a ScrollViewCubeEffect the downcast produces
88    * valid handle. If not the returned handle is left uninitialized.
89    *
90    * @param[in] handle Handle to an object
91    * @return handle to a ScrollViewCubeEffect or an uninitialized handle
92    */
93   static ScrollViewCubeEffect DownCast( BaseHandle handle );
94
95   /**
96    * @brief Manually apply effect to an Actor.
97    *
98    * @param[in] child The child Actor to be affected by this effect.
99    * @param[in] anchor The anchor point that the child actor should
100    * rotate around when scrolling
101    * @param[in] angleSwing The maximum amount the child actor should
102    * rotate in radians for each axis (X and Y) as the page is scrolled.
103    * @param[in] positionSwing The maximum amount the child actor should
104    * move for each axis (X and Y) as the page is scrolled.
105    */
106   void ApplyToActor(Actor child,
107                     const Vector3& anchor,
108                     const Vector2& angleSwing,
109                     const Vector2& positionSwing);
110
111   /**
112    * @brief Manually apply effect to an Actor.
113    *
114    * @param[in] child The child Actor to be affected by this effect.
115    * @param[in] parentPage The parent page Actor to be used by this effect.
116    * @param[in] anchor The anchor point that the child actor should
117    * rotate around when scrolling
118    * @param[in] angleSwing The maximum amount the child actor should
119    * rotate in radians for each axis (X and Y) as the page is scrolled.
120    * @param[in] positionSwing The maximum amount the child actor should
121    * move for each axis (X and Y) as the page is scrolled.
122    */
123   void ApplyToActor(Actor child,
124                     Actor parentPage,
125                     const Vector3& anchor,
126                     const Vector2& angleSwing,
127                     const Vector2& positionSwing);
128
129 protected:
130
131   /**
132    * @brief This constructor is used by Dali New() methods.
133    *
134    * @param [in] impl A pointer to a newly allocated Dali resource
135    */
136   ScrollViewCubeEffect(Internal::ScrollViewCubeEffect *impl);
137
138 };
139
140 } // namespace Toolkit
141
142 } // namespace Dali
143
144 /**
145  * @}
146  */
147 #endif // __DALI_TOOLKIT_SCROLL_VIEW_CUBE_EFFECT_H__