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 * @deprecated This should not have been added to an ItemLayout
49 typedef SignalV2< void (int) > NavigationSignalV2;
52 * Create a new navigation layout
54 static NavigationLayoutPtr New();
59 virtual ~NavigationLayout();
64 NavigationSignalV2& PanSignal();
67 * Set the number of columns in the layout.
68 * @param[in] columns The number of columns.
70 void SetNumberOfColumns(unsigned int columns);
73 * Get the number of columns in the layout.
74 * @return The number of columns.
76 unsigned int GetNumberOfColumns() const;
79 * Set the spacing between columns.
80 * @param[in] spacing The spacing.
82 void SetColumnSpacing(float spacing);
85 * Get the spacing between columns.
86 * @return The spacing.
88 float GetColumnSpacing() const;
91 * Set the margin in the top of the layout
92 * @param[in] margin The layout top margin.
94 void SetTopMargin(float margin);
97 * Get the margin in the top of the layout
98 * @return The layout top margin.
100 float GetTopMargin() const;
103 * Set the margin in the bottom of the layout
104 * @param[in] margin The layout bottom margin.
106 void SetBottomMargin(float margin);
109 * Get the margin in the bottom of the layout
110 * @return The layout bottom margin.
112 float GetBottomMargin() const;
115 * Set the margin in the left and right of the layout
116 * @param[in] margin The layout side margin.
118 void SetSideMargin(float margin);
121 * Get the margin in the left and right of the layout
122 * @return The layout side margin.
124 float GetSideMargin() const;
127 * Set the factor used to customise the scroll speed while dragging and swiping the layout.
128 * @param[in] scrollSpeed The scroll speed factor.
130 void SetScrollSpeedFactor(float scrollSpeed);
133 * Set the maximum swipe speed in pixels per second.
134 * @param[in] speed The maximum swipe speed.
136 void SetMaximumSwipeSpeed(float speed);
139 * Set the duration of the flick animation in second. This is the time taken to animate each
140 * item to its next layout position (e.g. from 1.0 to 2.0) when a flick animation is triggered
141 * by a swipe gesture.
142 * @pre durationSeconds must be greater than zero.
143 * @param[in] durationSeconds The duration of flick animation in seconds.
145 void SetItemFlickAnimationDuration(float durationSeconds);
148 * @copydoc ItemLayout::GetScrollSpeedFactor()
150 virtual float GetScrollSpeedFactor() const;
153 * @copydoc ItemLayout::GetMaximumSwipeSpeed()
155 virtual float GetMaximumSwipeSpeed() const;
158 * @copydoc ItemLayout::GetItemFlickAnimationDuration()
160 virtual float GetItemFlickAnimationDuration() const;
165 * @copydoc ItemLayout::GetMinimumLayoutPosition()
167 virtual float GetMinimumLayoutPosition(unsigned int numberOfItems, Vector3 layoutSize) const;
170 * @copydoc ItemLayout::GetClosestAnchorPosition()
172 virtual float GetClosestAnchorPosition(float layoutPosition) const;
175 * @copydoc ItemLayout::GetItemScrollToPosition()
177 virtual float GetItemScrollToPosition(unsigned int itemId) const;
180 * @copydoc ItemLayout::GetItemsWithinArea()
182 virtual ItemRange GetItemsWithinArea(float firstItemPosition, Vector3 layoutSize) const;
185 * @copydoc ItemLayout::GetReserveItemCount()
187 virtual unsigned int GetReserveItemCount(Vector3 layoutSize) const;
190 * @copydoc ItemLayout::GetItemSize()
192 virtual bool GetItemSize(unsigned int itemId, Vector3 layoutSize, Vector3& itemSize) const;
195 * @copydoc ItemLayout::GetResizeAnimation()
197 virtual void GetResizeAnimation(Animation& animation,
200 float durationSeconds) const;
203 * @copydoc ItemLayout::GetPositionConstraint()
205 virtual bool GetPositionConstraint(unsigned int itemId, ItemLayout::Vector3Function& constraint) const;
208 * @copydoc ItemLayout::GetRotationConstraint()
210 virtual bool GetRotationConstraint(unsigned int itemId, ItemLayout::QuaternionFunction& constraint) const;
213 * @copydoc ItemLayout::GetScaleConstraint()
215 virtual bool GetScaleConstraint(unsigned int itemId, ItemLayout::Vector3Function& constraint) const;
218 * @copydoc ItemLayout::GetColorConstraint()
220 virtual bool GetColorConstraint(unsigned int itemId, ItemLayout::Vector4Function& constraint) const;
223 * @copydoc ItemLayout::GetVisibilityConstraint()
225 virtual bool GetVisibilityConstraint(unsigned int itemId, ItemLayout::BoolFunction& constraint) const;
228 * @copydoc ItemLayout::GetScrollDirection()
230 virtual Degree GetScrollDirection() const;
235 * Protected constructor; see also GridLayout::New()
247 #endif //__DALI_TOOLKIT_NAVIGATION_LAYOUT_H__