1 #ifndef DALI_TOOLKIT_DEPTH_LAYOUT_H
2 #define DALI_TOOLKIT_DEPTH_LAYOUT_H
5 * Copyright (c) 2021 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>
32 typedef IntrusivePtr<DepthLayout> DepthLayoutPtr;
35 * This layout arranges items in a grid, which scrolls along the Z-Axis.
37 class DepthLayout : public ItemLayout
41 * Create a new spiral layout
43 static DepthLayoutPtr New();
48 virtual ~DepthLayout();
51 * Apply depth layout Properties.
52 * @param[in] properties The properties of the layout.
54 void SetDepthLayoutProperties(const Property::Map& properties);
57 * Set the number of columns in the layout.
58 * @param[in] columns The number of columns.
60 void SetNumberOfColumns(unsigned int columns);
63 * Get the number of columns in the layout.
64 * @return The number of columns.
66 unsigned int GetNumberOfColumns() const;
69 * Set the number of rows in the layout.
70 * The default is 20, with 10 behind the viewable area.
71 * @param[in] rows The number-of-rows.
73 void SetNumberOfRows(unsigned int rows);
76 * Get the number of rows in the layout.
77 * @return The number of rows.
79 unsigned int GetNumberOfRows() const;
82 * Set the spacing between rows.
83 * @param[in] spacing The row spacing.
85 void SetRowSpacing(float spacing);
88 * Get the spacing between rows.
89 * @return The row spacing.
91 float GetRowSpacing() const;
94 * Set the tilt angle of the layout; this is clamped between -45 & 45 degrees.
95 * @param[in] angle The tilt angle in degrees.
97 void SetTiltAngle(Degree angle);
100 * Get the tilt angle of the layout.
101 * @return The tilt angle in degrees.
103 Degree GetTiltAngle() const;
106 * Set the tilt angle of the individual items in the layout.
107 * @param[in] angle The item tilt angle in degrees.
109 void SetItemTiltAngle(Degree angle);
112 * Get the tilt angle of the individual items in the layout.
113 * @return The item tilt angle in degrees.
115 Degree GetItemTiltAngle() const;
118 * Set the factor used to customise the scroll speed while dragging and swiping the layout.
119 * @param[in] scrollSpeed The scroll speed factor.
121 void SetScrollSpeedFactor(float scrollSpeed);
124 * Set the maximum swipe speed in pixels per second.
125 * @param[in] speed The maximum swipe speed.
127 void SetMaximumSwipeSpeed(float speed);
130 * Set the duration of the flick animation in second. This is the time taken to animate each
131 * item to its next layout position (e.g. from 1.0 to 2.0) when a flick animation is triggered
132 * by a swipe gesture.
133 * @pre durationSeconds must be greater than zero.
134 * @param[in] durationSeconds The duration of flick animation in seconds.
136 void SetItemFlickAnimationDuration(float durationSeconds);
139 * @copydoc ItemLayout::GetScrollSpeedFactor()
141 float GetScrollSpeedFactor() const override;
144 * @copydoc ItemLayout::GetMaximumSwipeSpeed()
146 float GetMaximumSwipeSpeed() const override;
149 * @copydoc ItemLayout::GetItemFlickAnimationDuration()
151 float GetItemFlickAnimationDuration() const override;
154 * @copydoc ItemLayout::GetClosestOnScreenLayoutPosition()
156 float GetClosestOnScreenLayoutPosition(int itemID, float currentLayoutPosition, const Vector3& layoutSize) override;
159 * @copydoc ItemLayout::GetNextFocusItemID()
161 int GetNextFocusItemID(int itemID, int maxItems, Dali::Toolkit::Control::KeyboardFocus::Direction direction, bool loopEnabled) override;
165 * @copydoc ItemLayout::GetMinimumLayoutPosition()
167 float GetMinimumLayoutPosition(unsigned int numberOfItems, Vector3 layoutSize) const override;
170 * @copydoc ItemLayout::GetClosestAnchorPosition()
172 float GetClosestAnchorPosition(float layoutPosition) const override;
175 * @copydoc ItemLayout::GetItemScrollToPosition()
177 float GetItemScrollToPosition(unsigned int itemId) const override;
180 * @copydoc ItemLayout::GetItemsWithinArea()
182 ItemRange GetItemsWithinArea(float firstItemPosition, Vector3 layoutSize) const override;
185 * @copydoc ItemLayout::GetReserveItemCount()
187 unsigned int GetReserveItemCount(Vector3 layoutSize) const override;
190 * @copydoc ItemLayout::GetDefaultItemSize()
192 void GetDefaultItemSize(unsigned int itemId, const Vector3& layoutSize, Vector3& itemSize) const override;
195 * @copydoc ItemLayout::GetScrollDirection()
197 Degree GetScrollDirection() const override;
200 * @copydoc ItemLayout::ApplyConstraints()
202 void ApplyConstraints(Actor& actor, const int itemId, const Vector3& layoutSize, const Actor& itemViewActor) override;
205 * @copydoc ItemLayout::GetItemPosition()
207 Vector3 GetItemPosition(int itemID, float currentLayoutPosition, const Vector3& layoutSize) const override;
211 * Protected constructor; see also DepthLayout::New()
217 DepthLayout(const DepthLayout& depthLayout);
220 DepthLayout& operator=(const DepthLayout& depthLayout);
227 } // namespace Internal
229 } // namespace Toolkit
233 #endif // DALI_TOOLKIT_DEPTH_LAYOUT_H