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-toolkit/public-api/controls/scrollable/item-view/item-layout.h>
28 class NavigationLayout;
30 typedef IntrusivePtr<NavigationLayout> NavigationLayoutPtr;
33 * An ItemView layout which arranges items in navigation mode.
35 class DALI_IMPORT_API NavigationLayout: public ItemLayout
39 typedef boost::function<Vector3 (const Vector3& layoutSize,
40 const unsigned int orientation,
41 const unsigned int numberOfColumns,
42 const float columnSpacing,
43 const float sideMargin)> ResizeFunction;
46 * Create a new navigation layout
48 static NavigationLayoutPtr New();
53 virtual ~NavigationLayout();
56 * Set the number of columns in the layout.
57 * @param[in] columns The number of columns.
59 void SetNumberOfColumns(unsigned int columns);
62 * Get the number of columns in the layout.
63 * @return The number of columns.
65 unsigned int GetNumberOfColumns() const;
68 * Set the spacing between columns.
69 * @param[in] spacing The spacing.
71 void SetColumnSpacing(float spacing);
74 * Get the spacing between columns.
75 * @return The spacing.
77 float GetColumnSpacing() const;
80 * Set the margin in the top of the layout
81 * @param[in] margin The layout top margin.
83 void SetTopMargin(float margin);
86 * Get the margin in the top of the layout
87 * @return The layout top margin.
89 float GetTopMargin() const;
92 * Set the margin in the bottom of the layout
93 * @param[in] margin The layout bottom margin.
95 void SetBottomMargin(float margin);
98 * Get the margin in the bottom of the layout
99 * @return The layout bottom margin.
101 float GetBottomMargin() const;
104 * Set the margin in the left and right of the layout
105 * @param[in] margin The layout side margin.
107 void SetSideMargin(float margin);
110 * Get the margin in the left and right of the layout
111 * @return The layout side margin.
113 float GetSideMargin() 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;
154 * @copydoc ItemLayout::GetMinimumLayoutPosition()
156 virtual float GetMinimumLayoutPosition(unsigned int numberOfItems, Vector3 layoutSize) const;
159 * @copydoc ItemLayout::GetClosestAnchorPosition()
161 virtual float GetClosestAnchorPosition(float layoutPosition) const;
164 * @copydoc ItemLayout::GetItemScrollToPosition()
166 virtual float GetItemScrollToPosition(unsigned int itemId) const;
169 * @copydoc ItemLayout::GetItemsWithinArea()
171 virtual ItemRange GetItemsWithinArea(float firstItemPosition, Vector3 layoutSize) const;
174 * @copydoc ItemLayout::GetReserveItemCount()
176 virtual unsigned int GetReserveItemCount(Vector3 layoutSize) const;
179 * @copydoc ItemLayout::GetItemSize()
181 virtual bool GetItemSize(unsigned int itemId, Vector3 layoutSize, Vector3& itemSize) const;
184 * @copydoc ItemLayout::GetResizeAnimation()
186 virtual void GetResizeAnimation(Animation& animation,
189 float durationSeconds) const;
192 * @copydoc ItemLayout::GetPositionConstraint()
194 virtual bool GetPositionConstraint(unsigned int itemId, ItemLayout::Vector3Function& constraint) const;
197 * @copydoc ItemLayout::GetRotationConstraint()
199 virtual bool GetRotationConstraint(unsigned int itemId, ItemLayout::QuaternionFunction& constraint) const;
202 * @copydoc ItemLayout::GetScaleConstraint()
204 virtual bool GetScaleConstraint(unsigned int itemId, ItemLayout::Vector3Function& constraint) const;
207 * @copydoc ItemLayout::GetColorConstraint()
209 virtual bool GetColorConstraint(unsigned int itemId, ItemLayout::Vector4Function& constraint) const;
212 * @copydoc ItemLayout::GetVisibilityConstraint()
214 virtual bool GetVisibilityConstraint(unsigned int itemId, ItemLayout::BoolFunction& constraint) const;
217 * @copydoc ItemLayout::GetScrollDirection()
219 virtual Degree GetScrollDirection() const;
224 * Protected constructor; see also GridLayout::New()
236 #endif //__DALI_TOOLKIT_NAVIGATION_LAYOUT_H__