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