Fix VD prevent issues
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / scrollable / item-view / spiral-layout.h
1 #ifndef __DALI_TOOLKIT_SPIRAL_LAYOUT_H__
2 #define __DALI_TOOLKIT_SPIRAL_LAYOUT_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
23 #include <dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h>
24
25 namespace Dali
26 {
27
28 namespace Toolkit
29 {
30
31 namespace Internal
32 {
33
34 class SpiralLayout;
35
36 typedef IntrusivePtr<SpiralLayout> SpiralLayoutPtr;
37
38 /**
39  * An ItemView layout which arranges items in a spiral.
40  */
41 class SpiralLayout : public ItemLayout
42 {
43 public:
44
45   /**
46    * Create a new spiral layout
47    */
48   static SpiralLayoutPtr New();
49
50   /**
51    * Virtual destructor.
52    */
53   virtual ~SpiralLayout();
54
55   /**
56    * Set spacing angle between items.
57    * @param[in] itemSpacing The angle in radians.
58    */
59   void SetItemSpacing(Radian itemSpacing);
60
61   /**
62    * Get spacing angle between items.
63    * @return The angle in radians.
64    */
65   Radian GetItemSpacing() const;
66
67   /**
68    * Set the vertical distance for one revolution of the spiral.
69    * @param[in] distance The revolution distance.
70    */
71   void SetRevolutionDistance(float distance);
72
73   /**
74    * Get the vertical distance for one revolution of the spiral.
75    * @return The revolution distance.
76    */
77   float GetRevolutionDistance() const;
78
79   /**
80    * Set the alignment of the top-item, when at the beginning of the spiral (with a first-item layout-position of zero).
81    * A value of 0 indicates that the top-item is centered in the middle of the layout. A value of -0.5 or 0.5 indicates
82    * that the top-item is centred at the top or bottom of the layout respectively.
83    * @param[in] alignment The top-item alignment.
84    */
85   void SetTopItemAlignment(float alignment);
86
87   /**
88    * Get the alignment of the top-item, when at the beginning of the spiral
89    * @return The top-item alignment.
90    */
91   float GetTopItemAlignment() const;
92
93   /**
94    * Set the factor used to customise the scroll speed while dragging and swiping the layout.
95    * @param[in] scrollSpeed The scroll speed factor.
96    */
97   void SetScrollSpeedFactor(float scrollSpeed);
98
99   /**
100    * Set the maximum swipe speed in pixels per second.
101    * @param[in] speed The maximum swipe speed.
102    */
103   void SetMaximumSwipeSpeed(float speed);
104
105   /**
106    * Set the duration of the flick animation in second. This is the time taken to animate each
107    * item to its next layout position (e.g. from 1.0 to 2.0) when a flick animation is triggered
108    * by a swipe gesture.
109    * @pre durationSeconds must be greater than zero.
110    * @param[in] durationSeconds The duration of flick animation in seconds.
111    */
112   void SetItemFlickAnimationDuration(float durationSeconds);
113
114   /**
115    * @copydoc ItemLayout::GetScrollSpeedFactor()
116    */
117   virtual float GetScrollSpeedFactor() const;
118
119   /**
120    * @copydoc ItemLayout::GetMaximumSwipeSpeed()
121    */
122   virtual float GetMaximumSwipeSpeed() const;
123
124   /**
125    * @copydoc ItemLayout::GetItemFlickAnimationDuration()
126    */
127   virtual float GetItemFlickAnimationDuration() const;
128
129   /**
130    * @copydoc ItemLayout::GetClosestOnScreenLayoutPosition()
131    */
132   virtual float GetClosestOnScreenLayoutPosition(int itemID, float currentLayoutPosition, const Vector3& layoutSize);
133
134 private:
135
136   /**
137    * @copydoc ItemLayout::GetMinimumLayoutPosition()
138    */
139   virtual float GetMinimumLayoutPosition(unsigned int numberOfItems, Vector3 layoutSize) const;
140
141   /**
142    * @copydoc ItemLayout::GetClosestAnchorPosition()
143    */
144   virtual float GetClosestAnchorPosition(float layoutPosition) const;
145
146   /**
147    * @copydoc ItemLayout::GetItemScrollToPosition()
148    */
149   virtual float GetItemScrollToPosition(unsigned int itemId) const;
150
151   /**
152    * @copydoc ItemLayout::GetItemsWithinArea()
153    */
154   virtual ItemRange GetItemsWithinArea(float firstItemPosition, Vector3 layoutSize) const;
155
156   /**
157    * @copydoc ItemLayout::GetReserveItemCount()
158    */
159   virtual unsigned int GetReserveItemCount(Vector3 layoutSize) const;
160
161   /**
162    * @copydoc ItemLayout::GetDefaultItemSize()
163    */
164   virtual void GetDefaultItemSize( unsigned int itemId, const Vector3& layoutSize, Vector3& itemSize ) const;
165
166   /**
167    * @copydoc ItemLayout::GetScrollDirection()
168    */
169   virtual Degree GetScrollDirection() const;
170
171   /**
172    * @copydoc ItemLayout::ApplyConstraints()
173    */
174   virtual void ApplyConstraints( Actor& actor, const int itemId, const Vector3& layoutSize, const Actor& itemViewActor );
175
176   /**
177    * @copydoc ItemLayout::GetItemPosition()
178    */
179   virtual Vector3 GetItemPosition( int itemID, float currentLayoutPosition, const Vector3& layoutSize ) const;
180
181 protected:
182
183   /**
184    * Protected constructor; see also SpiralLayout::New()
185    */
186   SpiralLayout();
187
188 private:
189
190   // Undefined
191   SpiralLayout( const SpiralLayout& spiralLayout );
192
193   // Undefined
194   SpiralLayout& operator=( const SpiralLayout& spiralLayout );
195
196 private:
197
198   struct Impl;
199   Impl* mImpl;
200 };
201
202 } // namespace Internal
203
204 } // namespace Toolkit
205
206 } // namespace Dali
207
208 #endif // __DALI_TOOLKIT_SPIRAL_LAYOUT_H__