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.
22 #include <dali/dali.h>
24 #include <dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h>
26 namespace Dali DALI_IMPORT_API
34 typedef IntrusivePtr<RollLayout> RollLayoutPtr;
37 * An ItemView layout which arranges items in a roll.
39 class RollLayout : public ItemLayout
43 typedef boost::function<Vector3 (float layoutWidth, float layoutHeight, float rowSpacing)> ItemSizeFunction;
46 * Create a new roll layout
48 static RollLayoutPtr New();
53 virtual ~RollLayout();
56 * Set the spacing between rows.
57 * @param[in] spacing The row spacing.
59 void SetRowSpacing(float spacing);
62 * Get the spacing between rows.
63 * @return The row spacing.
65 float GetRowSpacing() const;
68 * Set the function used to calculate the item-size, for a given layout-size.
69 * @param[in] function The item-size function.
71 void SetItemSizeFunction(ItemSizeFunction function);
74 * Get the function used to calculate the item-size.
75 * @return The item-size function.
77 ItemSizeFunction GetItemSizeFunction() const;
80 * Set the factor used to customise the scroll speed while dragging and swiping the layout.
81 * @param[in] scrollSpeed The scroll speed factor.
83 void SetScrollSpeedFactor(float scrollSpeed);
86 * Set the maximum swipe speed in pixels per second.
87 * @param[in] speed The maximum swipe speed.
89 void SetMaximumSwipeSpeed(float speed);
92 * Set the duration of the flick animation in second. This is the time taken to animate each
93 * item to its next layout position (e.g. from 1.0 to 2.0) when a flick animation is triggered
95 * @pre durationSeconds must be greater than zero.
96 * @param[in] durationSeconds The duration of flick animation in seconds.
98 void SetItemFlickAnimationDuration(float durationSeconds);
101 * @copydoc ItemLayout::GetScrollSpeedFactor()
103 virtual float GetScrollSpeedFactor() const;
106 * @copydoc ItemLayout::GetMaximumSwipeSpeed()
108 virtual float GetMaximumSwipeSpeed() const;
111 * @copydoc ItemLayout::GetItemFlickAnimationDuration()
113 virtual float GetItemFlickAnimationDuration() const;
118 * @copydoc ItemLayout::GetMinimumLayoutPosition()
120 virtual float GetMinimumLayoutPosition(unsigned int numberOfItems, Vector3 layoutSize) const;
123 * @copydoc ItemLayout::GetClosestAnchorPosition()
125 virtual float GetClosestAnchorPosition(float layoutPosition) const;
128 * @copydoc ItemLayout::GetItemScrollToPosition()
130 virtual float GetItemScrollToPosition(unsigned int itemId) const;
133 * @copydoc ItemLayout::GetItemsWithinArea()
135 virtual ItemRange GetItemsWithinArea(float firstItemPosition, Vector3 layoutSize) const;
138 * @copydoc ItemLayout::GetReserveItemCount()
140 virtual unsigned int GetReserveItemCount(Vector3 layoutSize) const;
143 * @copydoc ItemLayout::GetItemSize()
145 virtual bool GetItemSize(unsigned int itemId, Vector3 layoutSize, Vector3& itemSize) const;
148 * @copydoc ItemLayout::GetResizeAnimation()
150 virtual void GetResizeAnimation(Animation& animation, Actor actor, Vector3 size, float durationSeconds) const;
153 * @copydoc ItemLayout::GetPositionConstraint()
155 virtual bool GetPositionConstraint(unsigned int itemId, ItemLayout::Vector3Function& constraint) const;
158 * @copydoc ItemLayout::GetRotationConstraint()
160 virtual bool GetRotationConstraint(unsigned int itemId, ItemLayout::QuaternionFunction& constraint) const;
163 * @copydoc ItemLayout::GetScaleConstraint()
165 virtual bool GetScaleConstraint(unsigned int itemId, ItemLayout::Vector3Function& constraint) const;
168 * @copydoc ItemLayout::GetColorConstraint()
170 virtual bool GetColorConstraint(unsigned int itemId, ItemLayout::Vector4Function& constraint) const;
173 * @copydoc ItemLayout::GetVisibilityConstraint()
175 virtual bool GetVisibilityConstraint(unsigned int itemId, ItemLayout::BoolFunction& constraint) const;
178 * @copydoc ItemLayout::GetScrollDirection()
180 virtual Degree GetScrollDirection() const;
185 * Protected constructor; see also RollLayout::New()
195 } // namespace Toolkit
199 #endif // __DALI_TOOLKIT_ROLL_LAYOUT_H__