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 Flora License, Version 1.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://floralicense.org/license/
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.
21 #include <dali/dali.h>
22 #include <dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h>
24 namespace Dali DALI_IMPORT_API
28 class NavigationLayout;
30 typedef IntrusivePtr<NavigationLayout> NavigationLayoutPtr;
33 * An ItemView layout which arranges items in navigation mode.
35 class 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 * @deprecated This should not have been added to an ItemLayout
48 typedef SignalV2< void (int) > NavigationSignalV2;
51 * Create a new navigation layout
53 static NavigationLayoutPtr New();
58 virtual ~NavigationLayout();
63 NavigationSignalV2& PanSignal();
66 * Set the number of columns in the layout.
67 * @param[in] columns The number of columns.
69 void SetNumberOfColumns(unsigned int columns);
72 * Get the number of columns in the layout.
73 * @return The number of columns.
75 unsigned int GetNumberOfColumns() const;
78 * Set the spacing between columns.
79 * @param[in] spacing The spacing.
81 void SetColumnSpacing(float spacing);
84 * Get the spacing between columns.
85 * @return The spacing.
87 float GetColumnSpacing() const;
90 * Set the margin in the top of the layout
91 * @param[in] margin The layout top margin.
93 void SetTopMargin(float margin);
96 * Get the margin in the top of the layout
97 * @return The layout top margin.
99 float GetTopMargin() const;
102 * Set the margin in the bottom of the layout
103 * @param[in] margin The layout bottom margin.
105 void SetBottomMargin(float margin);
108 * Get the margin in the bottom of the layout
109 * @return The layout bottom margin.
111 float GetBottomMargin() const;
114 * Set the margin in the left and right of the layout
115 * @param[in] margin The layout side margin.
117 void SetSideMargin(float margin);
120 * Get the margin in the left and right of the layout
121 * @return The layout side margin.
123 float GetSideMargin() const;
126 * Set the factor used to customise the scroll speed while dragging and swiping the layout.
127 * @param[in] scrollSpeed The scroll speed factor.
129 void SetScrollSpeedFactor(float scrollSpeed);
132 * Set the maximum swipe speed in pixels per second.
133 * @param[in] speed The maximum swipe speed.
135 void SetMaximumSwipeSpeed(float speed);
138 * Set the duration of the flick animation in second. This is the time taken to animate each
139 * item to its next layout position (e.g. from 1.0 to 2.0) when a flick animation is triggered
140 * by a swipe gesture.
141 * @pre durationSeconds must be greater than zero.
142 * @param[in] durationSeconds The duration of flick animation in seconds.
144 void SetItemFlickAnimationDuration(float durationSeconds);
147 * @copydoc ItemLayout::GetScrollSpeedFactor()
149 virtual float GetScrollSpeedFactor() const;
152 * @copydoc ItemLayout::GetMaximumSwipeSpeed()
154 virtual float GetMaximumSwipeSpeed() const;
157 * @copydoc ItemLayout::GetItemFlickAnimationDuration()
159 virtual float GetItemFlickAnimationDuration() const;
164 * @copydoc ItemLayout::GetMinimumLayoutPosition()
166 virtual float GetMinimumLayoutPosition(unsigned int numberOfItems, Vector3 layoutSize) const;
169 * @copydoc ItemLayout::GetClosestAnchorPosition()
171 virtual float GetClosestAnchorPosition(float layoutPosition) const;
174 * @copydoc ItemLayout::GetItemScrollToPosition()
176 virtual float GetItemScrollToPosition(unsigned int itemId) const;
179 * @copydoc ItemLayout::GetItemsWithinArea()
181 virtual ItemRange GetItemsWithinArea(float firstItemPosition, Vector3 layoutSize) const;
184 * @copydoc ItemLayout::GetReserveItemCount()
186 virtual unsigned int GetReserveItemCount(Vector3 layoutSize) const;
189 * @copydoc ItemLayout::GetItemSize()
191 virtual bool GetItemSize(unsigned int itemId, Vector3 layoutSize, Vector3& itemSize) const;
194 * @copydoc ItemLayout::GetResizeAnimation()
196 virtual void GetResizeAnimation(Animation& animation,
199 float durationSeconds) const;
202 * @copydoc ItemLayout::GetPositionConstraint()
204 virtual bool GetPositionConstraint(unsigned int itemId, ItemLayout::Vector3Function& constraint) const;
207 * @copydoc ItemLayout::GetRotationConstraint()
209 virtual bool GetRotationConstraint(unsigned int itemId, ItemLayout::QuaternionFunction& constraint) const;
212 * @copydoc ItemLayout::GetScaleConstraint()
214 virtual bool GetScaleConstraint(unsigned int itemId, ItemLayout::Vector3Function& constraint) const;
217 * @copydoc ItemLayout::GetColorConstraint()
219 virtual bool GetColorConstraint(unsigned int itemId, ItemLayout::Vector4Function& constraint) const;
222 * @copydoc ItemLayout::GetVisibilityConstraint()
224 virtual bool GetVisibilityConstraint(unsigned int itemId, ItemLayout::BoolFunction& constraint) const;
227 * @copydoc ItemLayout::GetScrollDirection()
229 virtual Degree GetScrollDirection() const;
234 * Protected constructor; see also GridLayout::New()
246 #endif //__DALI_TOOLKIT_NAVIGATION_LAYOUT_H__