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>
37 typedef IntrusivePtr<SpiralLayout> SpiralLayoutPtr;
40 * An ItemView layout which arranges items in a spiral.
42 class SpiralLayout : public ItemLayout
47 * Create a new spiral layout
49 static SpiralLayoutPtr New();
54 virtual ~SpiralLayout();
57 * Apply spiral layout Properties.
58 * @param[in] properties The properties of the layout.
60 void SetSpiralLayoutProperties(const Property::Map& properties);
63 * Set spacing angle between items.
64 * @param[in] itemSpacing The angle in radians.
66 void SetItemSpacing(Radian itemSpacing);
69 * Get spacing angle between items.
70 * @return The angle in radians.
72 Radian GetItemSpacing() const;
75 * Set the vertical distance for one revolution of the spiral.
76 * @param[in] distance The revolution distance.
78 void SetRevolutionDistance(float distance);
81 * Get the vertical distance for one revolution of the spiral.
82 * @return The revolution distance.
84 float GetRevolutionDistance() const;
87 * Set the alignment of the top-item, when at the beginning of the spiral (with a first-item layout-position of zero).
88 * 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
89 * that the top-item is centred at the top or bottom of the layout respectively.
90 * @param[in] alignment The top-item alignment.
92 void SetTopItemAlignment(float alignment);
95 * Get the alignment of the top-item, when at the beginning of the spiral
96 * @return The top-item alignment.
98 float GetTopItemAlignment() const;
101 * Set the factor used to customise the scroll speed while dragging and swiping the layout.
102 * @param[in] scrollSpeed The scroll speed factor.
104 void SetScrollSpeedFactor(float scrollSpeed);
107 * Set the maximum swipe speed in pixels per second.
108 * @param[in] speed The maximum swipe speed.
110 void SetMaximumSwipeSpeed(float speed);
113 * Set the duration of the flick animation in second. This is the time taken to animate each
114 * item to its next layout position (e.g. from 1.0 to 2.0) when a flick animation is triggered
115 * by a swipe gesture.
116 * @pre durationSeconds must be greater than zero.
117 * @param[in] durationSeconds The duration of flick animation in seconds.
119 void SetItemFlickAnimationDuration(float durationSeconds);
122 * @copydoc ItemLayout::GetScrollSpeedFactor()
124 virtual float GetScrollSpeedFactor() const;
127 * @copydoc ItemLayout::GetMaximumSwipeSpeed()
129 virtual float GetMaximumSwipeSpeed() const;
132 * @copydoc ItemLayout::GetItemFlickAnimationDuration()
134 virtual float GetItemFlickAnimationDuration() const;
137 * @copydoc ItemLayout::GetClosestOnScreenLayoutPosition()
139 virtual float GetClosestOnScreenLayoutPosition(int itemID, float currentLayoutPosition, const Vector3& layoutSize);
144 * @copydoc ItemLayout::GetMinimumLayoutPosition()
146 virtual float GetMinimumLayoutPosition(unsigned int numberOfItems, Vector3 layoutSize) const;
149 * @copydoc ItemLayout::GetClosestAnchorPosition()
151 virtual float GetClosestAnchorPosition(float layoutPosition) const;
154 * @copydoc ItemLayout::GetItemScrollToPosition()
156 virtual float GetItemScrollToPosition(unsigned int itemId) const;
159 * @copydoc ItemLayout::GetItemsWithinArea()
161 virtual ItemRange GetItemsWithinArea(float firstItemPosition, Vector3 layoutSize) const;
164 * @copydoc ItemLayout::GetReserveItemCount()
166 virtual unsigned int GetReserveItemCount(Vector3 layoutSize) const;
169 * @copydoc ItemLayout::GetDefaultItemSize()
171 virtual void GetDefaultItemSize( unsigned int itemId, const Vector3& layoutSize, Vector3& itemSize ) const;
174 * @copydoc ItemLayout::GetScrollDirection()
176 virtual Degree GetScrollDirection() const;
179 * @copydoc ItemLayout::ApplyConstraints()
181 virtual void ApplyConstraints( Actor& actor, const int itemId, const Vector3& layoutSize, const Actor& itemViewActor );
184 * @copydoc ItemLayout::GetItemPosition()
186 virtual Vector3 GetItemPosition( int itemID, float currentLayoutPosition, const Vector3& layoutSize ) const;
191 * Protected constructor; see also SpiralLayout::New()
198 SpiralLayout( const SpiralLayout& spiralLayout );
201 SpiralLayout& operator=( const SpiralLayout& spiralLayout );
209 } // namespace Internal
211 } // namespace Toolkit
215 #endif // __DALI_TOOLKIT_SPIRAL_LAYOUT_H__