1 #ifndef DALI_TOOLKIT_DEPTH_LAYOUT_H
2 #define DALI_TOOLKIT_DEPTH_LAYOUT_H
5 * Copyright (c) 2019 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>
37 typedef IntrusivePtr<DepthLayout> DepthLayoutPtr;
40 * This layout arranges items in a grid, which scrolls along the Z-Axis.
42 class DepthLayout : public ItemLayout
47 * Create a new spiral layout
49 static DepthLayoutPtr New();
54 virtual ~DepthLayout();
57 * Apply depth layout Properties.
58 * @param[in] properties The properties of the layout.
60 void SetDepthLayoutProperties(const Property::Map& properties);
63 * Set the number of columns in the layout.
64 * @param[in] columns The number of columns.
66 void SetNumberOfColumns(unsigned int columns);
69 * Get the number of columns in the layout.
70 * @return The number of columns.
72 unsigned int GetNumberOfColumns() const;
75 * Set the number of rows in the layout.
76 * The default is 20, with 10 behind the viewable area.
77 * @param[in] rows The number-of-rows.
79 void SetNumberOfRows(unsigned int rows);
82 * Get the number of rows in the layout.
83 * @return The number of rows.
85 unsigned int GetNumberOfRows() const;
88 * Set the spacing between rows.
89 * @param[in] spacing The row spacing.
91 void SetRowSpacing(float spacing);
94 * Get the spacing between rows.
95 * @return The row spacing.
97 float GetRowSpacing() const;
100 * Set the tilt angle of the layout; this is clamped between -45 & 45 degrees.
101 * @param[in] angle The tilt angle in degrees.
103 void SetTiltAngle(Degree angle);
106 * Get the tilt angle of the layout.
107 * @return The tilt angle in degrees.
109 Degree GetTiltAngle() const;
112 * Set the tilt angle of the individual items in the layout.
113 * @param[in] angle The item tilt angle in degrees.
115 void SetItemTiltAngle(Degree angle);
118 * Get the tilt angle of the individual items in the layout.
119 * @return The item tilt angle in degrees.
121 Degree GetItemTiltAngle() const;
124 * Set the factor used to customise the scroll speed while dragging and swiping the layout.
125 * @param[in] scrollSpeed The scroll speed factor.
127 void SetScrollSpeedFactor(float scrollSpeed);
130 * Set the maximum swipe speed in pixels per second.
131 * @param[in] speed The maximum swipe speed.
133 void SetMaximumSwipeSpeed(float speed);
136 * Set the duration of the flick animation in second. This is the time taken to animate each
137 * item to its next layout position (e.g. from 1.0 to 2.0) when a flick animation is triggered
138 * by a swipe gesture.
139 * @pre durationSeconds must be greater than zero.
140 * @param[in] durationSeconds The duration of flick animation in seconds.
142 void SetItemFlickAnimationDuration(float durationSeconds);
145 * @copydoc ItemLayout::GetScrollSpeedFactor()
147 virtual float GetScrollSpeedFactor() const;
150 * @copydoc ItemLayout::GetMaximumSwipeSpeed()
152 virtual float GetMaximumSwipeSpeed() const;
155 * @copydoc ItemLayout::GetItemFlickAnimationDuration()
157 virtual float GetItemFlickAnimationDuration() const;
160 * @copydoc ItemLayout::GetClosestOnScreenLayoutPosition()
162 virtual float GetClosestOnScreenLayoutPosition(int itemID, float currentLayoutPosition, const Vector3& layoutSize);
165 * @copydoc ItemLayout::GetNextFocusItemID()
167 virtual int GetNextFocusItemID(int itemID, int maxItems, Dali::Toolkit::Control::KeyboardFocus::Direction direction, bool loopEnabled);
172 * @copydoc ItemLayout::GetMinimumLayoutPosition()
174 virtual float GetMinimumLayoutPosition(unsigned int numberOfItems, Vector3 layoutSize) const;
177 * @copydoc ItemLayout::GetClosestAnchorPosition()
179 virtual float GetClosestAnchorPosition(float layoutPosition) const;
182 * @copydoc ItemLayout::GetItemScrollToPosition()
184 virtual float GetItemScrollToPosition(unsigned int itemId) const;
187 * @copydoc ItemLayout::GetItemsWithinArea()
189 virtual ItemRange GetItemsWithinArea(float firstItemPosition, Vector3 layoutSize) const;
192 * @copydoc ItemLayout::GetReserveItemCount()
194 virtual unsigned int GetReserveItemCount(Vector3 layoutSize) const;
197 * @copydoc ItemLayout::GetDefaultItemSize()
199 virtual void GetDefaultItemSize( unsigned int itemId, const Vector3& layoutSize, Vector3& itemSize ) const;
202 * @copydoc ItemLayout::GetScrollDirection()
204 virtual Degree GetScrollDirection() const;
207 * @copydoc ItemLayout::ApplyConstraints()
209 virtual void ApplyConstraints( Actor& actor, const int itemId, const Vector3& layoutSize, const Actor& itemViewActor );
212 * @copydoc ItemLayout::GetItemPosition()
214 virtual Vector3 GetItemPosition( int itemID, float currentLayoutPosition, const Vector3& layoutSize ) const;
219 * Protected constructor; see also DepthLayout::New()
226 DepthLayout( const DepthLayout& depthLayout );
229 DepthLayout& operator=( const DepthLayout& depthLayout );
237 } // namespace Internal
239 } // namespace Toolkit
243 #endif // DALI_TOOLKIT_DEPTH_LAYOUT_H