1 #ifndef __DALI_TOOLKIT_ROLL_LAYOUT_H__
2 #define __DALI_TOOLKIT_ROLL_LAYOUT_H__
5 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
23 #include <dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h>
33 typedef IntrusivePtr<RollLayout> RollLayoutPtr;
36 * An ItemView layout which arranges items in a roll.
38 class DALI_IMPORT_API RollLayout : public ItemLayout
42 typedef boost::function<Vector3 (float layoutWidth, float layoutHeight, float rowSpacing)> ItemSizeFunction;
45 * Create a new roll layout
47 static RollLayoutPtr New();
52 virtual ~RollLayout();
55 * Set the spacing between rows.
56 * @param[in] spacing The row spacing.
58 void SetRowSpacing(float spacing);
61 * Get the spacing between rows.
62 * @return The row spacing.
64 float GetRowSpacing() const;
67 * Set the function used to calculate the item-size, for a given layout-size.
68 * @param[in] function The item-size function.
70 void SetItemSizeFunction(ItemSizeFunction function);
73 * Get the function used to calculate the item-size.
74 * @return The item-size function.
76 ItemSizeFunction GetItemSizeFunction() const;
79 * Set the factor used to customise the scroll speed while dragging and swiping the layout.
80 * @param[in] scrollSpeed The scroll speed factor.
82 void SetScrollSpeedFactor(float scrollSpeed);
85 * Set the maximum swipe speed in pixels per second.
86 * @param[in] speed The maximum swipe speed.
88 void SetMaximumSwipeSpeed(float speed);
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
94 * @pre durationSeconds must be greater than zero.
95 * @param[in] durationSeconds The duration of flick animation in seconds.
97 void SetItemFlickAnimationDuration(float durationSeconds);
100 * @copydoc ItemLayout::GetScrollSpeedFactor()
102 virtual float GetScrollSpeedFactor() const;
105 * @copydoc ItemLayout::GetMaximumSwipeSpeed()
107 virtual float GetMaximumSwipeSpeed() const;
110 * @copydoc ItemLayout::GetItemFlickAnimationDuration()
112 virtual float GetItemFlickAnimationDuration() const;
117 * @copydoc ItemLayout::GetMinimumLayoutPosition()
119 virtual float GetMinimumLayoutPosition(unsigned int numberOfItems, Vector3 layoutSize) const;
122 * @copydoc ItemLayout::GetClosestAnchorPosition()
124 virtual float GetClosestAnchorPosition(float layoutPosition) const;
127 * @copydoc ItemLayout::GetItemScrollToPosition()
129 virtual float GetItemScrollToPosition(unsigned int itemId) const;
132 * @copydoc ItemLayout::GetItemsWithinArea()
134 virtual ItemRange GetItemsWithinArea(float firstItemPosition, Vector3 layoutSize) const;
137 * @copydoc ItemLayout::GetReserveItemCount()
139 virtual unsigned int GetReserveItemCount(Vector3 layoutSize) const;
142 * @copydoc ItemLayout::GetItemSize()
144 virtual bool GetItemSize(unsigned int itemId, Vector3 layoutSize, Vector3& itemSize) const;
147 * @copydoc ItemLayout::GetResizeAnimation()
149 virtual void GetResizeAnimation(Animation& animation, Actor actor, Vector3 size, float durationSeconds) const;
152 * @copydoc ItemLayout::GetPositionConstraint()
154 virtual bool GetPositionConstraint(unsigned int itemId, ItemLayout::Vector3Function& constraint) const;
157 * @copydoc ItemLayout::GetRotationConstraint()
159 virtual bool GetRotationConstraint(unsigned int itemId, ItemLayout::QuaternionFunction& constraint) const;
162 * @copydoc ItemLayout::GetScaleConstraint()
164 virtual bool GetScaleConstraint(unsigned int itemId, ItemLayout::Vector3Function& constraint) const;
167 * @copydoc ItemLayout::GetColorConstraint()
169 virtual bool GetColorConstraint(unsigned int itemId, ItemLayout::Vector4Function& constraint) const;
172 * @copydoc ItemLayout::GetVisibilityConstraint()
174 virtual bool GetVisibilityConstraint(unsigned int itemId, ItemLayout::BoolFunction& constraint) const;
177 * @copydoc ItemLayout::GetScrollDirection()
179 virtual Degree GetScrollDirection() const;
184 * Protected constructor; see also RollLayout::New()
194 } // namespace Toolkit
198 #endif // __DALI_TOOLKIT_ROLL_LAYOUT_H__