1 #ifndef __DALI_TOOLKIT_DEPTH_LAYOUT_H__
2 #define __DALI_TOOLKIT_DEPTH_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.
22 #include <dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h>
35 typedef IntrusivePtr<DepthLayout> DepthLayoutPtr;
38 * This layout arranges items in a grid, which scrolls along the Z-Axis.
40 class DepthLayout : public ItemLayout
45 * Create a new spiral layout
47 static DepthLayoutPtr New();
52 virtual ~DepthLayout();
55 * Set the number of columns in the layout.
56 * @param[in] columns The number of columns.
58 void SetNumberOfColumns(unsigned int columns);
61 * Get the number of columns in the layout.
62 * @return The number of columns.
64 unsigned int GetNumberOfColumns() const;
67 * Set the number of rows in the layout.
68 * The default is 20, with 10 behind the viewable area.
69 * @param[in] rows The number-of-rows.
71 void SetNumberOfRows(unsigned int rows);
74 * Get the number of rows in the layout.
75 * @return The number of rows.
77 unsigned int GetNumberOfRows() const;
80 * Set the spacing between rows.
81 * @param[in] spacing The row spacing.
83 void SetRowSpacing(float spacing);
86 * Get the spacing between rows.
87 * @return The row spacing.
89 float GetRowSpacing() const;
92 * Set the tilt angle of the layout; this is clamped between -45 & 45 degrees.
93 * @param[in] angle The tilt angle in degrees.
95 void SetTiltAngle(Degree angle);
98 * Get the tilt angle of the layout.
99 * @return The tilt angle in degrees.
101 Degree GetTiltAngle() const;
104 * Set the tilt angle of the individual items in the layout.
105 * @param[in] angle The item tilt angle in degrees.
107 void SetItemTiltAngle(Degree angle);
110 * Get the tilt angle of the individual items in the layout.
111 * @return The item tilt angle in degrees.
113 Degree GetItemTiltAngle() const;
116 * Set the factor used to customise the scroll speed while dragging and swiping the layout.
117 * @param[in] scrollSpeed The scroll speed factor.
119 void SetScrollSpeedFactor(float scrollSpeed);
122 * Set the maximum swipe speed in pixels per second.
123 * @param[in] speed The maximum swipe speed.
125 void SetMaximumSwipeSpeed(float speed);
128 * Set the duration of the flick animation in second. This is the time taken to animate each
129 * item to its next layout position (e.g. from 1.0 to 2.0) when a flick animation is triggered
130 * by a swipe gesture.
131 * @pre durationSeconds must be greater than zero.
132 * @param[in] durationSeconds The duration of flick animation in seconds.
134 void SetItemFlickAnimationDuration(float durationSeconds);
137 * @copydoc ItemLayout::GetScrollSpeedFactor()
139 virtual float GetScrollSpeedFactor() const;
142 * @copydoc ItemLayout::GetMaximumSwipeSpeed()
144 virtual float GetMaximumSwipeSpeed() const;
147 * @copydoc ItemLayout::GetItemFlickAnimationDuration()
149 virtual float GetItemFlickAnimationDuration() const;
152 * @copydoc ItemLayout::GetClosestOnScreenLayoutPosition()
154 virtual float GetClosestOnScreenLayoutPosition(int itemID, float currentLayoutPosition, const Vector3& layoutSize);
157 * @copydoc ItemLayout::GetNextFocusItemID()
159 virtual int GetNextFocusItemID(int itemID, int maxItems, Dali::Toolkit::Control::KeyboardFocus::Direction direction, bool loopEnabled);
164 * @copydoc ItemLayout::GetMinimumLayoutPosition()
166 virtual float GetMinimumLayoutPosition(unsigned int numberOfItems, Vector3 layoutSize) const;
169 * @copydoc ItemLayout::GetClosestAnchorPosition()
171 virtual float GetClosestAnchorPosition(float layoutPosition) const;
174 * @copydoc ItemLayout::GetItemScrollToPosition()
176 virtual float GetItemScrollToPosition(unsigned int itemId) const;
179 * @copydoc ItemLayout::GetItemsWithinArea()
181 virtual ItemRange GetItemsWithinArea(float firstItemPosition, Vector3 layoutSize) const;
184 * @copydoc ItemLayout::GetReserveItemCount()
186 virtual unsigned int GetReserveItemCount(Vector3 layoutSize) const;
189 * @copydoc ItemLayout::GetDefaultItemSize()
191 virtual void GetDefaultItemSize( unsigned int itemId, const Vector3& layoutSize, Vector3& itemSize ) const;
194 * @copydoc ItemLayout::GetScrollDirection()
196 virtual Degree GetScrollDirection() const;
199 * @copydoc ItemLayout::ApplyConstraints()
201 virtual void ApplyConstraints( Actor& actor, const int itemId, const Vector3& layoutSize, const Actor& itemViewActor );
204 * @copydoc ItemLayout::GetItemPosition()
206 virtual Vector3 GetItemPosition( int itemID, float currentLayoutPosition, const Vector3& layoutSize ) const;
211 * Protected constructor; see also DepthLayout::New()
218 DepthLayout( const DepthLayout& depthLayout );
221 DepthLayout& operator=( const DepthLayout& depthLayout );
229 } // namespace Internal
231 } // namespace Toolkit
235 #endif // __DALI_TOOLKIT_DEPTH_LAYOUT_H__