Remove Deprecated APIs
[platform/core/uifw/dali-toolkit.git] / base / dali-toolkit / public-api / controls / scrollable / item-view / navigation-layout.h
1 #ifndef __DALI_TOOLKIT_NAVIGATION_LAYOUT_H__
2 #define __DALI_TOOLKIT_NAVIGATION_LAYOUT_H__
3
4 /*
5  * Copyright (c) 2014 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/dali.h>
23 #include <dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h>
24
25 namespace Dali DALI_IMPORT_API
26 {
27 namespace Toolkit
28 {
29 class NavigationLayout;
30
31 typedef IntrusivePtr<NavigationLayout> NavigationLayoutPtr;
32
33 /**
34  * An ItemView layout which arranges items in navigation mode.
35  */
36 class NavigationLayout: public ItemLayout
37 {
38 public:
39
40   typedef boost::function<Vector3 (const Vector3& layoutSize,
41                                    const unsigned int orientation,
42                                    const unsigned int numberOfColumns,
43                                    const float columnSpacing,
44                                    const float sideMargin)>  ResizeFunction;
45
46   /**
47    * Create a new navigation layout
48    */
49   static NavigationLayoutPtr New();
50
51   /**
52    * Virtual destructor.
53    */
54   virtual ~NavigationLayout();
55
56   /**
57    * Set the number of columns in the layout.
58    * @param[in] columns  The number of columns.
59    */
60   void SetNumberOfColumns(unsigned int columns);
61
62   /**
63    * Get the number of columns in the layout.
64    * @return The number of columns.
65    */
66   unsigned int GetNumberOfColumns() const;
67
68   /**
69    * Set the spacing between columns.
70    * @param[in] spacing The spacing.
71    */
72   void SetColumnSpacing(float spacing);
73
74   /**
75    * Get the spacing between columns.
76    * @return The spacing.
77    */
78   float GetColumnSpacing() const;
79
80   /**
81    * Set the margin in the top of the layout
82    * @param[in] margin The layout top margin.
83    */
84   void SetTopMargin(float margin);
85
86   /**
87    * Get the margin in the top of the layout
88    * @return The layout top margin.
89    */
90   float GetTopMargin() const;
91
92   /**
93    * Set the margin in the bottom of the layout
94    * @param[in] margin The layout bottom margin.
95    */
96   void SetBottomMargin(float margin);
97
98   /**
99    * Get the margin in the bottom of the layout
100    * @return The layout bottom margin.
101    */
102   float GetBottomMargin() const;
103
104   /**
105    * Set the margin in the left and right of the layout
106    * @param[in] margin The layout side margin.
107    */
108   void SetSideMargin(float margin);
109
110   /**
111    * Get the margin in the left and right of the layout
112    * @return The layout side margin.
113    */
114   float GetSideMargin() const;
115
116   /**
117    * Set the factor used to customise the scroll speed while dragging and swiping the layout.
118    * @param[in] scrollSpeed The scroll speed factor.
119    */
120   void SetScrollSpeedFactor(float scrollSpeed);
121
122   /**
123    * Set the maximum swipe speed in pixels per second.
124    * @param[in] speed The maximum swipe speed.
125    */
126   void SetMaximumSwipeSpeed(float speed);
127
128   /**
129    * Set the duration of the flick animation in second. This is the time taken to animate each
130    * item to its next layout position (e.g. from 1.0 to 2.0) when a flick animation is triggered
131    * by a swipe gesture.
132    * @pre durationSeconds must be greater than zero.
133    * @param[in] durationSeconds The duration of flick animation in seconds.
134    */
135   void SetItemFlickAnimationDuration(float durationSeconds);
136
137   /**
138    * @copydoc ItemLayout::GetScrollSpeedFactor()
139    */
140   virtual float GetScrollSpeedFactor() const;
141
142   /**
143    * @copydoc ItemLayout::GetMaximumSwipeSpeed()
144    */
145   virtual float GetMaximumSwipeSpeed() const;
146
147   /**
148    * @copydoc ItemLayout::GetItemFlickAnimationDuration()
149    */
150   virtual float GetItemFlickAnimationDuration() const;
151
152 private:
153
154   /**
155    * @copydoc ItemLayout::GetMinimumLayoutPosition()
156    */
157   virtual float GetMinimumLayoutPosition(unsigned int numberOfItems, Vector3 layoutSize) const;
158
159   /**
160    * @copydoc ItemLayout::GetClosestAnchorPosition()
161    */
162   virtual float GetClosestAnchorPosition(float layoutPosition) const;
163
164   /**
165    * @copydoc ItemLayout::GetItemScrollToPosition()
166    */
167   virtual float GetItemScrollToPosition(unsigned int itemId) const;
168
169   /**
170    * @copydoc ItemLayout::GetItemsWithinArea()
171    */
172   virtual ItemRange GetItemsWithinArea(float firstItemPosition, Vector3 layoutSize) const;
173
174   /**
175    * @copydoc ItemLayout::GetReserveItemCount()
176    */
177   virtual unsigned int GetReserveItemCount(Vector3 layoutSize) const;
178
179   /**
180    * @copydoc ItemLayout::GetItemSize()
181    */
182   virtual bool GetItemSize(unsigned int itemId, Vector3 layoutSize, Vector3& itemSize) const;
183
184   /**
185    * @copydoc ItemLayout::GetResizeAnimation()
186    */
187   virtual void GetResizeAnimation(Animation& animation,
188                                         Actor actor,
189                                         Vector3 size,
190                                         float durationSeconds) const;
191
192   /**
193    * @copydoc ItemLayout::GetPositionConstraint()
194    */
195   virtual bool GetPositionConstraint(unsigned int itemId, ItemLayout::Vector3Function& constraint) const;
196
197   /**
198    * @copydoc ItemLayout::GetRotationConstraint()
199    */
200   virtual bool GetRotationConstraint(unsigned int itemId, ItemLayout::QuaternionFunction& constraint) const;
201
202   /**
203    * @copydoc ItemLayout::GetScaleConstraint()
204    */
205   virtual bool GetScaleConstraint(unsigned int itemId, ItemLayout::Vector3Function& constraint) const;
206
207   /**
208    * @copydoc ItemLayout::GetColorConstraint()
209    */
210   virtual bool GetColorConstraint(unsigned int itemId, ItemLayout::Vector4Function& constraint) const;
211
212   /**
213    * @copydoc ItemLayout::GetVisibilityConstraint()
214    */
215   virtual bool GetVisibilityConstraint(unsigned int itemId, ItemLayout::BoolFunction& constraint) const;
216
217   /**
218    * @copydoc ItemLayout::GetScrollDirection()
219    */
220   virtual Degree GetScrollDirection() const;
221
222 protected:
223
224   /**
225    * Protected constructor; see also GridLayout::New()
226    */
227   NavigationLayout();
228
229 private:
230
231   struct Impl;
232   Impl* mImpl;
233 };
234
235 }
236 }
237 #endif //__DALI_TOOLKIT_NAVIGATION_LAYOUT_H__