1 #ifndef __DALI_TOOLKIT_NAVIGATION_LAYOUT_H__
2 #define __DALI_TOOLKIT_NAVIGATION_LAYOUT_H__
5 * Copyright (c) 2014 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/dali.h>
23 #include <dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h>
25 namespace Dali DALI_IMPORT_API
29 class NavigationLayout;
31 typedef IntrusivePtr<NavigationLayout> NavigationLayoutPtr;
34 * An ItemView layout which arranges items in navigation mode.
36 class NavigationLayout: public ItemLayout
40 typedef boost::function<Vector3 (const Vector3& layoutSize,
41 const unsigned int orientation,
42 const unsigned int numberOfColumns,
43 const float columnSpacing,
44 const float sideMargin)> ResizeFunction;
47 * Create a new navigation layout
49 static NavigationLayoutPtr New();
54 virtual ~NavigationLayout();
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 spacing between columns.
70 * @param[in] spacing The spacing.
72 void SetColumnSpacing(float spacing);
75 * Get the spacing between columns.
76 * @return The spacing.
78 float GetColumnSpacing() const;
81 * Set the margin in the top of the layout
82 * @param[in] margin The layout top margin.
84 void SetTopMargin(float margin);
87 * Get the margin in the top of the layout
88 * @return The layout top margin.
90 float GetTopMargin() const;
93 * Set the margin in the bottom of the layout
94 * @param[in] margin The layout bottom margin.
96 void SetBottomMargin(float margin);
99 * Get the margin in the bottom of the layout
100 * @return The layout bottom margin.
102 float GetBottomMargin() const;
105 * Set the margin in the left and right of the layout
106 * @param[in] margin The layout side margin.
108 void SetSideMargin(float margin);
111 * Get the margin in the left and right of the layout
112 * @return The layout side margin.
114 float GetSideMargin() const;
117 * Set the factor used to customise the scroll speed while dragging and swiping the layout.
118 * @param[in] scrollSpeed The scroll speed factor.
120 void SetScrollSpeedFactor(float scrollSpeed);
123 * Set the maximum swipe speed in pixels per second.
124 * @param[in] speed The maximum swipe speed.
126 void SetMaximumSwipeSpeed(float speed);
129 * Set the duration of the flick animation in second. This is the time taken to animate each
130 * item to its next layout position (e.g. from 1.0 to 2.0) when a flick animation is triggered
131 * by a swipe gesture.
132 * @pre durationSeconds must be greater than zero.
133 * @param[in] durationSeconds The duration of flick animation in seconds.
135 void SetItemFlickAnimationDuration(float durationSeconds);
138 * @copydoc ItemLayout::GetScrollSpeedFactor()
140 virtual float GetScrollSpeedFactor() const;
143 * @copydoc ItemLayout::GetMaximumSwipeSpeed()
145 virtual float GetMaximumSwipeSpeed() const;
148 * @copydoc ItemLayout::GetItemFlickAnimationDuration()
150 virtual float GetItemFlickAnimationDuration() const;
155 * @copydoc ItemLayout::GetMinimumLayoutPosition()
157 virtual float GetMinimumLayoutPosition(unsigned int numberOfItems, Vector3 layoutSize) const;
160 * @copydoc ItemLayout::GetClosestAnchorPosition()
162 virtual float GetClosestAnchorPosition(float layoutPosition) const;
165 * @copydoc ItemLayout::GetItemScrollToPosition()
167 virtual float GetItemScrollToPosition(unsigned int itemId) const;
170 * @copydoc ItemLayout::GetItemsWithinArea()
172 virtual ItemRange GetItemsWithinArea(float firstItemPosition, Vector3 layoutSize) const;
175 * @copydoc ItemLayout::GetReserveItemCount()
177 virtual unsigned int GetReserveItemCount(Vector3 layoutSize) const;
180 * @copydoc ItemLayout::GetItemSize()
182 virtual bool GetItemSize(unsigned int itemId, Vector3 layoutSize, Vector3& itemSize) const;
185 * @copydoc ItemLayout::GetResizeAnimation()
187 virtual void GetResizeAnimation(Animation& animation,
190 float durationSeconds) const;
193 * @copydoc ItemLayout::GetPositionConstraint()
195 virtual bool GetPositionConstraint(unsigned int itemId, ItemLayout::Vector3Function& constraint) const;
198 * @copydoc ItemLayout::GetRotationConstraint()
200 virtual bool GetRotationConstraint(unsigned int itemId, ItemLayout::QuaternionFunction& constraint) const;
203 * @copydoc ItemLayout::GetScaleConstraint()
205 virtual bool GetScaleConstraint(unsigned int itemId, ItemLayout::Vector3Function& constraint) const;
208 * @copydoc ItemLayout::GetColorConstraint()
210 virtual bool GetColorConstraint(unsigned int itemId, ItemLayout::Vector4Function& constraint) const;
213 * @copydoc ItemLayout::GetVisibilityConstraint()
215 virtual bool GetVisibilityConstraint(unsigned int itemId, ItemLayout::BoolFunction& constraint) const;
218 * @copydoc ItemLayout::GetScrollDirection()
220 virtual Degree GetScrollDirection() const;
225 * Protected constructor; see also GridLayout::New()
237 #endif //__DALI_TOOLKIT_NAVIGATION_LAYOUT_H__