1 #ifndef __DALI_TOOLKIT_SPIRAL_LAYOUT_H__
2 #define __DALI_TOOLKIT_SPIRAL_LAYOUT_H__
5 * Copyright (c) 2015 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>
36 typedef IntrusivePtr<SpiralLayout> SpiralLayoutPtr;
39 * An ItemView layout which arranges items in a spiral.
41 class SpiralLayout : public ItemLayout
46 * Create a new spiral layout
48 static SpiralLayoutPtr New();
53 virtual ~SpiralLayout();
56 * Set spacing angle between items.
57 * @param[in] itemSpacing The angle in radians.
59 void SetItemSpacing(Radian itemSpacing);
62 * Get spacing angle between items.
63 * @return The angle in radians.
65 Radian GetItemSpacing() const;
68 * Set the vertical distance for one revolution of the spiral.
69 * @param[in] distance The revolution distance.
71 void SetRevolutionDistance(float distance);
74 * Get the vertical distance for one revolution of the spiral.
75 * @return The revolution distance.
77 float GetRevolutionDistance() const;
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.
85 void SetTopItemAlignment(float alignment);
88 * Get the alignment of the top-item, when at the beginning of the spiral
89 * @return The top-item alignment.
91 float GetTopItemAlignment() const;
94 * Set the factor used to customise the scroll speed while dragging and swiping the layout.
95 * @param[in] scrollSpeed The scroll speed factor.
97 void SetScrollSpeedFactor(float scrollSpeed);
100 * Set the maximum swipe speed in pixels per second.
101 * @param[in] speed The maximum swipe speed.
103 void SetMaximumSwipeSpeed(float speed);
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.
112 void SetItemFlickAnimationDuration(float durationSeconds);
115 * @copydoc ItemLayout::GetScrollSpeedFactor()
117 virtual float GetScrollSpeedFactor() const;
120 * @copydoc ItemLayout::GetMaximumSwipeSpeed()
122 virtual float GetMaximumSwipeSpeed() const;
125 * @copydoc ItemLayout::GetItemFlickAnimationDuration()
127 virtual float GetItemFlickAnimationDuration() const;
130 * @copydoc ItemLayout::GetClosestOnScreenLayoutPosition()
132 virtual float GetClosestOnScreenLayoutPosition(int itemID, float currentLayoutPosition, const Vector3& layoutSize);
137 * @copydoc ItemLayout::GetMinimumLayoutPosition()
139 virtual float GetMinimumLayoutPosition(unsigned int numberOfItems, Vector3 layoutSize) const;
142 * @copydoc ItemLayout::GetClosestAnchorPosition()
144 virtual float GetClosestAnchorPosition(float layoutPosition) const;
147 * @copydoc ItemLayout::GetItemScrollToPosition()
149 virtual float GetItemScrollToPosition(unsigned int itemId) const;
152 * @copydoc ItemLayout::GetItemsWithinArea()
154 virtual ItemRange GetItemsWithinArea(float firstItemPosition, Vector3 layoutSize) const;
157 * @copydoc ItemLayout::GetReserveItemCount()
159 virtual unsigned int GetReserveItemCount(Vector3 layoutSize) const;
162 * @copydoc ItemLayout::GetDefaultItemSize()
164 virtual void GetDefaultItemSize( unsigned int itemId, const Vector3& layoutSize, Vector3& itemSize ) const;
167 * @copydoc ItemLayout::GetScrollDirection()
169 virtual Degree GetScrollDirection() const;
172 * @copydoc ItemLayout::ApplyConstraints()
174 virtual void ApplyConstraints( Actor& actor, const int itemId, const Vector3& layoutSize, const Actor& itemViewActor );
177 * @copydoc ItemLayout::GetItemPosition()
179 virtual Vector3 GetItemPosition( int itemID, float currentLayoutPosition, const Vector3& layoutSize ) const;
184 * Protected constructor; see also SpiralLayout::New()
191 SpiralLayout( const SpiralLayout& spiralLayout );
194 SpiralLayout& operator=( const SpiralLayout& spiralLayout );
202 } // namespace Internal
204 } // namespace Toolkit
208 #endif // __DALI_TOOLKIT_SPIRAL_LAYOUT_H__