remove (dead) ImageView UI control
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / controls / scrollable / item-view / roll-layout.h
1 #ifndef __DALI_TOOLKIT_ROLL_LAYOUT_H__
2 #define __DALI_TOOLKIT_ROLL_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
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 class RollLayout;
32
33 typedef IntrusivePtr<RollLayout> RollLayoutPtr;
34
35 /**
36  * An ItemView layout which arranges items in a roll.
37  */
38 class DALI_IMPORT_API RollLayout : public ItemLayout
39 {
40 public:
41
42   typedef boost::function<Vector3 (float layoutWidth, float layoutHeight, float rowSpacing)> ItemSizeFunction;
43
44   /**
45    * Create a new roll layout
46    */
47   static RollLayoutPtr New();
48
49   /**
50    * Virtual destructor.
51    */
52   virtual ~RollLayout();
53
54   /**
55    * Set the spacing between rows.
56    * @param[in] spacing The row spacing.
57    */
58   void SetRowSpacing(float spacing);
59
60   /**
61    * Get the spacing between rows.
62    * @return The row spacing.
63    */
64   float GetRowSpacing() const;
65
66   /**
67    * Set the function used to calculate the item-size, for a given layout-size.
68    * @param[in] function The item-size function.
69    */
70   void SetItemSizeFunction(ItemSizeFunction function);
71
72   /**
73    * Get the function used to calculate the item-size.
74    * @return The item-size function.
75    */
76   ItemSizeFunction GetItemSizeFunction() const;
77
78   /**
79    * Set the factor used to customise the scroll speed while dragging and swiping the layout.
80    * @param[in] scrollSpeed The scroll speed factor.
81    */
82   void SetScrollSpeedFactor(float scrollSpeed);
83
84   /**
85    * Set the maximum swipe speed in pixels per second.
86    * @param[in] speed The maximum swipe speed.
87    */
88   void SetMaximumSwipeSpeed(float speed);
89
90   /**
91    * Set the duration of the flick animation in second. This is the time taken to animate each
92    * item to its next layout position (e.g. from 1.0 to 2.0) when a flick animation is triggered
93    * by a swipe gesture.
94    * @pre durationSeconds must be greater than zero.
95    * @param[in] durationSeconds The duration of flick animation in seconds.
96    */
97   void SetItemFlickAnimationDuration(float durationSeconds);
98
99   /**
100    * @copydoc ItemLayout::GetScrollSpeedFactor()
101    */
102   virtual float GetScrollSpeedFactor() const;
103
104   /**
105    * @copydoc ItemLayout::GetMaximumSwipeSpeed()
106    */
107   virtual float GetMaximumSwipeSpeed() const;
108
109   /**
110    * @copydoc ItemLayout::GetItemFlickAnimationDuration()
111    */
112   virtual float GetItemFlickAnimationDuration() const;
113
114 private:
115
116   /**
117    * @copydoc ItemLayout::GetMinimumLayoutPosition()
118    */
119   virtual float GetMinimumLayoutPosition(unsigned int numberOfItems, Vector3 layoutSize) const;
120
121   /**
122    * @copydoc ItemLayout::GetClosestAnchorPosition()
123    */
124   virtual float GetClosestAnchorPosition(float layoutPosition) const;
125
126   /**
127    * @copydoc ItemLayout::GetItemScrollToPosition()
128    */
129   virtual float GetItemScrollToPosition(unsigned int itemId) const;
130
131   /**
132    * @copydoc ItemLayout::GetItemsWithinArea()
133    */
134   virtual ItemRange GetItemsWithinArea(float firstItemPosition, Vector3 layoutSize) const;
135
136   /**
137    * @copydoc ItemLayout::GetReserveItemCount()
138    */
139   virtual unsigned int GetReserveItemCount(Vector3 layoutSize) const;
140
141   /**
142    * @copydoc ItemLayout::GetItemSize()
143    */
144   virtual bool GetItemSize(unsigned int itemId, Vector3 layoutSize, Vector3& itemSize) const;
145
146   /**
147    * @copydoc ItemLayout::GetResizeAnimation()
148    */
149   virtual void GetResizeAnimation(Animation& animation, Actor actor, Vector3 size, float durationSeconds) const;
150
151   /**
152    * @copydoc ItemLayout::GetPositionConstraint()
153    */
154   virtual bool GetPositionConstraint(unsigned int itemId, ItemLayout::Vector3Function& constraint) const;
155
156   /**
157    * @copydoc ItemLayout::GetRotationConstraint()
158    */
159   virtual bool GetRotationConstraint(unsigned int itemId, ItemLayout::QuaternionFunction& constraint) const;
160
161   /**
162    * @copydoc ItemLayout::GetScaleConstraint()
163    */
164   virtual bool GetScaleConstraint(unsigned int itemId, ItemLayout::Vector3Function& constraint) const;
165
166   /**
167    * @copydoc ItemLayout::GetColorConstraint()
168    */
169   virtual bool GetColorConstraint(unsigned int itemId, ItemLayout::Vector4Function& constraint) const;
170
171   /**
172    * @copydoc ItemLayout::GetVisibilityConstraint()
173    */
174   virtual bool GetVisibilityConstraint(unsigned int itemId, ItemLayout::BoolFunction& constraint) const;
175
176   /**
177    * @copydoc ItemLayout::GetScrollDirection()
178    */
179   virtual Degree GetScrollDirection() const;
180
181 protected:
182
183   /**
184    * Protected constructor; see also RollLayout::New()
185    */
186   RollLayout();
187
188 private:
189
190   struct Impl;
191   Impl* mImpl;
192 };
193
194 } // namespace Toolkit
195
196 } // namespace Dali
197
198 #endif // __DALI_TOOLKIT_ROLL_LAYOUT_H__