[dali_1.4.20] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / scrollable / scroll-view / scroll-view-page-path-effect-impl.h
1 #ifndef __DALI_TOOLKIT_INTERNAL_SCROLL_VIEW_PAGE_PATH_EFFECT_H__
2 #define __DALI_TOOLKIT_INTERNAL_SCROLL_VIEW_PAGE_PATH_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 // EXTERNAL INCLUDES
22 #include <dali/public-api/animation/linear-constrainer.h>
23 #include <dali/devel-api/animation/path-constrainer.h>
24
25 // INTERNAL INCLUDES
26 #include <dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-effect-impl.h>
27 #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-page-path-effect.h>
28
29 namespace Dali
30 {
31
32 namespace Toolkit
33 {
34
35 namespace Internal
36 {
37
38 /**
39  * @copydoc Toolkit::ScrollViewPagePathEffect
40  */
41 class ScrollViewPagePathEffect : public ScrollViewEffect
42 {
43
44 public:
45
46   /**
47    * Constructor
48    * @param[in] path Pages will follow this path
49    * @param[in] forward Vector in page local space which will be aligned with tangent of the path
50    * @param[in] inputPropertyIndex index of the property in the scrollview used to drivce the path
51    * @param[in] pageSize size of a page in the scrollview
52    * @param[in] pageCount total number of pages in the scrollview
53    */
54   ScrollViewPagePathEffect(Path path, const Vector3& forward, Dali::Property::Index inputPropertyIndex, const Vector3& pageSize, unsigned int pageCount );
55
56 public:
57
58   /**
59    * @copydoc ScrollViewEffect::ApplyToActor
60    */
61   void ApplyToPage( Actor child, unsigned int pageOrder );
62
63 public:
64
65   /**
66    * @copydoc ScrollViewEffect::OnAttach
67    */
68   virtual void OnAttach( Toolkit::ScrollView& scrollView );
69
70   /**
71    * @copydoc ScrollViewEffect::OnDetach
72    */
73   virtual void OnDetach( Toolkit::ScrollView& scrollView );
74
75 protected:
76
77   /**
78    * A reference counted object may only be deleted by calling Unreference()
79    */
80   virtual ~ScrollViewPagePathEffect();
81
82 private:
83
84   Vector3               mPageSize;            ///< The logical page size for the 3D effect.
85   PathConstrainer       mPathConstrainer;     ///< PathConstrainer used to constraint position and orientation
86   LinearConstrainer     mLinearConstrainer;   ///< LinearConstrainer used to constraint opacity
87   Dali::Property::Index mInputPropertyIndex;  ///< Index of the property in the scrollview used as the parameter for the path
88   unsigned int          mPageCount;           ///< Total number of pages (Needed for wrapping)
89 };
90
91 } // namespace Internal
92
93 // Helpers for public-api forwarding methods
94
95 inline Internal::ScrollViewPagePathEffect& GetImpl(Dali::Toolkit::ScrollViewPagePathEffect& obj)
96 {
97   DALI_ASSERT_ALWAYS(obj);
98
99   Dali::RefObject& handle = obj.GetBaseObject();
100
101   return static_cast<Internal::ScrollViewPagePathEffect&>(handle);
102 }
103
104 inline const Internal::ScrollViewPagePathEffect& GetImpl(const Dali::Toolkit::ScrollViewPagePathEffect& obj)
105 {
106   DALI_ASSERT_ALWAYS(obj);
107
108   const Dali::RefObject& handle = obj.GetBaseObject();
109
110   return static_cast<const Internal::ScrollViewPagePathEffect&>(handle);
111 }
112
113 } // namespace Toolkit
114
115 } // namespace Dali
116
117 #endif // __DALI_TOOLKIT_INTERNAL_SCROLL_VIEW_PAGE_CAROUSEL_EFFECT_H__