d7b47a1123c9dfffd11f5fc1620744d5028c7bba
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / controls / scrollable / scroll-view / scroll-view-carousel-effect.h
1 #ifndef __DALI_TOOLKIT_SCROLL_VIEW_CAROUSEL_EFFECT_H__
2 #define __DALI_TOOLKIT_SCROLL_VIEW_CAROUSEL_EFFECT_H__
3
4 /*
5  * Copyright (c) 2015 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 ScrollViewCarouselEffect;
37 }
38
39 /**
40  * ScrollView Carousel-Effect.
41  *
42  * This effect causes Actors to appear to move around around a carousel
43  * It should be used on the following Actor hierarchy:
44  *
45  * ScrollView
46  * |
47  * Container
48  * |
49  * Child (1..n)
50  *
51  * You should ensure ScrollView's default constraints have been removed,
52  * by calling ScrollView::RemoveConstraintsFromChildren() before applying
53  * this effect to ScrollView.
54  *
55  * Manual operation:
56  * upon adding children to container, the ApplyToActor(...) method should be called.
57  *
58  * Automatic operation:
59  * not implemented.
60  *
61  * Notes:
62  * * Assumes Actor's AnchorPoint = AnchorPoint::CENTER
63  */
64 class DALI_IMPORT_API ScrollViewCarouselEffect : public ScrollViewEffect
65 {
66
67 public:
68
69   static const std::string EFFECT_ACTIVATE;     ///< Activation property (a value between: 0.0 normal/no effect, 1.0 - full effect)
70
71 public:
72
73   /**
74    * Create an initialized ScrollViewCarouselEffect.
75    * @return A handle to a newly allocated Dali resource.
76    */
77   static ScrollViewCarouselEffect New();
78
79   /**
80    * Create an uninitialized ScrollViewCarouselEffect; this can be initialized with ScrollViewCarouselEffect::New()
81    * Calling member functions with an uninitialized Toolkit::ScrollViewCarouselEffect is not allowed.
82    */
83   ScrollViewCarouselEffect();
84
85   /**
86    * Downcast an Object handle to ScrollViewCarouselEffect. If handle points to a ScrollViewCarouselEffect the
87    * downcast produces valid handle. If not the returned handle is left uninitialized.
88    * @param[in] handle Handle to an object
89    * @return handle to a ScrollViewCarouselEffect or an uninitialized handle
90    */
91   static ScrollViewCarouselEffect DownCast( BaseHandle handle );
92
93   /**
94    * Manually apply effect to an Actor.
95    * @param[in] child The child Actor to be affected by this effect.
96    * @param[in] angleSwing The maximum amount the child actor should
97    * rotate in radians for each axis (X and Y) as the page is scrolled.
98    */
99   void ApplyToActor(Actor child, const Vector2& angleSwing);
100
101 protected:
102
103   /**
104    * This constructor is used by Dali New() methods.
105    * @param [in] impl A pointer to a newly allocated Dali resource
106    */
107   explicit DALI_INTERNAL ScrollViewCarouselEffect(Internal::ScrollViewCarouselEffect *impl);
108
109 };
110
111 } // namespace Toolkit
112
113 } // namespace Dali
114
115 #endif // __DALI_TOOLKIT_SCROLL_VIEW_CAROUSEL_EFFECT_H__