e18eff4484951f67046ef5df831b91057dce4d1f
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / controls / scrollable / scroll-view / scroll-view-page-path-effect.h
1 #ifndef __DALI_TOOLKIT_SCROLL_VIEW_PAGE_PATH_EFFECT_H__
2 #define __DALI_TOOLKIT_SCROLL_VIEW_PAGE_PATH_EFFECT_H__
3
4 /*
5  * Copyright (c) 2018 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 // INTERNAL INCLUDES
25 #include <dali-toolkit/public-api/dali-toolkit-common.h>
26
27 namespace Dali
28 {
29
30 class Actor;
31 class Path;
32
33 namespace Toolkit
34 {
35
36 namespace Internal DALI_INTERNAL
37 {
38 class ScrollViewPagePathEffect;
39 }
40 /**
41  * @addtogroup dali_toolkit_controls_scroll_view
42  * @{
43  */
44
45 /**
46  * @brief ScrollView Page Path Effect.
47  *
48  * This effect causes Actors to follow a given path. The opacity of the actor will be 0.0 at
49  * the beginning of the path and will go to 1.0 as it is approximating to half of the path to return
50  * to 0.0 at the end of the path.
51  *
52  *
53  * ScrollView
54  * |
55  * Page (1..n)
56  *
57  * You should ensure ScrollView's default constraints have been removed,
58  * by calling ScrollView::RemoveConstraintsFromChildren() before applying
59  * this effect to ScrollView.
60  *
61  * Manual operation:
62  * ApplyToPage(...) method should be called on every page.
63  *
64  * Automatic operation:
65  * not implemented.
66  * @SINCE_1_0.0
67  */
68 class DALI_TOOLKIT_API ScrollViewPagePathEffect : public ScrollViewEffect
69 {
70
71 public:
72
73   /**
74    * @brief Creates an initialized ScrollViewPagePathEffect.
75    * @SINCE_1_0.0
76    * @param[in] path The path that will be used by the scroll effect
77    * @param[in] forward Vector in page object space which will be aligned with the tangent of the path
78    * @param[in] inputPropertyIndex Index of a property of the scroll-view which will be used as the input for the path
79    * @param[in] pageSize Size of a page in the scrollview
80    * @param[in] pageCount Total number of pages in the scrollview
81    * @return A handle to a newly allocated Dali resource
82    */
83   static ScrollViewPagePathEffect New(Path path, const Vector3& forward, Dali::Property::Index inputPropertyIndex, const Vector3& pageSize, unsigned int pageCount);
84
85   /**
86    * @brief Creates an uninitialized ScrollViewPagePathEffect; this can be initialized with ScrollViewPagePathEffect::New().
87    * Calling member functions with an uninitialized Toolkit::ScrollViewPagePathEffect is not allowed.
88    * @SINCE_1_0.0
89    */
90   ScrollViewPagePathEffect();
91
92   /**
93    * @brief Downcasts a handle to ScrollViewPagePathEffect handle.
94    *
95    * If handle points to a ScrollViewPagePathEffect, the downcast produces valid handle.
96    * If not, the returned handle is left uninitialized.
97    * @SINCE_1_0.0
98    * @param[in] handle Handle to an object
99    * @return Handle to a ScrollViewPagePathEffect or an uninitialized handle
100    */
101   static ScrollViewPagePathEffect DownCast( BaseHandle handle );
102
103   /**
104    * @brief Manually apply effect to a page in the scroll-view.
105    * @SINCE_1_0.0
106    * @param[in] page The page to be affected by this effect
107    * @param[in] pageOrder The order of the page in the scroll view
108    */
109   void ApplyToPage( Actor page, unsigned int pageOrder );
110
111 protected:
112
113   /// @cond internal
114   /**
115    * @brief This constructor is used by Dali New() methods.
116    * @SINCE_1_0.0
117    * @param[in] impl A pointer to a newly allocated Dali resource
118    */
119   explicit DALI_INTERNAL ScrollViewPagePathEffect( Internal::ScrollViewPagePathEffect *impl );
120   /// @endcond
121
122 };
123
124 /**
125  * @}
126  */
127 } // namespace Toolkit
128
129 } // namespace Dali
130
131 #endif // __DALI_TOOLKIT_SCROLL_VIEW_PAGE_PATH_EFFECT_H__