2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://floralicense.org/license/
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
18 * @file FUi_LayoutRelativeLayout.h
19 * @brief This is the header file for RelativeLayout class.
21 * This header file contains the declaration of RelativeLayout class.
26 #ifndef _FUI_INTERNAL_LAYOUT_RELATIVE_LAYOUT_H_
27 #define _FUI_INTERNAL_LAYOUT_RELATIVE_LAYOUT_H_
29 #include "FUi_LayoutLayout.h"
31 namespace Tizen { namespace Ui { namespace _Layout
33 class RelativeProxyList;
35 class _OSP_EXPORT_ RelativeLayout
40 * This is the default constructor for this class.
47 * This is the destructor for this class.
51 virtual ~RelativeLayout(void);
54 * Creates the instance of RelativeLayout.
57 * @return The instance of RelativeLayout.
58 * @exception E_SUCCESS The method was successful.
59 * @exception E_OUT_OF_MEMORY Insufficient memory.
61 static RelativeLayout* CreateRelativeLayoutN(void);
64 * Sets the relation of the specified layout item for the edge with other layout item.
67 * @return An error code
68 * @param[in] pItem The layout item for which the relation is set
69 * @param[in] itemEdge The edge of pItem.
70 * @param[in] pTarget The target layout item.
71 * @param[in] targetEdge The edge of targetEdge.
72 * @exception E_SUCCESS The method was successful.
73 * @exception E_INVALID_STATE This instance is in an invalid state.
74 * @exception E_INVALID_ARG The specified input parameter is invalid.
75 * @exception E_SYSTEM A system error occurred.
77 result SetRelation(LayoutItem& item, const RelativeLayoutEdge itemEdge, LayoutItem* pTarget = null, const RelativeLayoutEdge targetEdge = EDGE_NONE);
80 * Unsets the relation of the specified layout item for the edge.
83 * @return An error code
84 * @param[in] pItem The layout item for which the relation is unset
85 * @param[in] itemEdge The edge of pItem.
86 * @exception E_SUCCESS The method was successful.
87 * @exception E_INVALID_STATE This instance is in an invalid state.
88 * @exception E_INVALID_ARG The specified input parameter is invalid.
89 * @exception E_SYSTEM A system error occurred.
91 result UnsetRelation(LayoutItem& item, const RelativeLayoutEdge itemEdge);
94 * Gets the layout itme of the specified layout item for the edge.
97 * @return The layout item of specified edge.
98 * @param[in] pItem The layout item for which the relation is set
99 * @param[in] itemEdge The edge of pItem.
100 * @param[out] targetEdge The edge of target layout item.
102 LayoutItem* GetRelation(LayoutItem& item, const RelativeLayoutEdge itemEdge, RelativeLayoutEdge* pTargetEdge = null);
106 * Calculates the position and bounds of all chindren, and applies to the control.
108 * @return An error code
111 * @param[in] layoutUpdating
112 * @exception E_SUCCESS The method was successful.
113 * @exception E_INVALID_STATE This instance is in an invalid state.
116 virtual result OnLayout(int width, int height, bool updateLayouting);
120 * This is the copy constructor for this class.
124 RelativeLayout(const RelativeLayout&);
127 * This is the substitution operator for this class.
131 RelativeLayout& operator =(const RelativeLayout&);
134 * Increases the reference count.
136 * @return An error code
138 * @exception E_SUCCESS The method was successful.
139 * @exception E_INVALID_STATE This instance is in an invalid state.
142 result IncreaseReferenceCount(ProxyListNode& node);
145 * Decreases the reference count.
149 * @param[in] pTargetNode
152 void DecreaseReferenceCount(ProxyListNode& node, ProxyListNode& targetNode);
155 * Reorders the node list
157 * @return An error code
158 * @exception E_SUCCESS The method was successful.
159 * @exception E_INVALID_STATE This instance is in an invalid state.
162 result AlignItemNodeMaxRefMove(void);
165 * Unsets the all relation of the specified node.
167 * @return An error code
168 * @param[in] pTargetNode
169 * @param[in] pDeleteNode
170 * @exception E_SUCCESS The method was successful.
171 * @exception E_INVALID_STATE This instance is in an invalid state.
174 result DeleteTargetInfo(ProxyListNode& targetNode, ProxyListNode& deleteNode);
177 * Calculates the position of the specified node.
179 * @return An error code
180 * @param[in] pCurNode
181 * @exception E_SUCCESS The method was successful.
182 * @exception E_INVALID_STATE This instance is in an invalid state.
183 * @exception E_INVALID_ARG The specified input parameter is invalid.
184 * @exception E_SYSTEM A system error occurred.
187 result CalculatePosition(ProxyListNode& curNode);
190 * Calculates the center position of the specified node.
192 * @return An error code
193 * @param[in] pCurNode
194 * @param[out] calcPosition
195 * @exception E_SUCCESS The method was successful.
196 * @exception E_INVALID_STATE This instance is in an invalid state.
197 * @exception E_INVALID_ARG The specified input parameter is invalid.
198 * @exception E_SYSTEM A system error occurred.
201 result CalculateCenter(ProxyListNode& curNode, bool calcPosition);
204 * Checks whether the sourceEdge and targetEdge is right.
206 * @return @c true, if the sourceEdge and targetEdge is right @n
208 * @param[in] sourceEdge
209 * @param[in] targetEdge
212 bool CheckTargetEdge(const RelativeLayoutEdge sourceEdge, const RelativeLayoutEdge targetEdge) const;
215 * Gets the position of specified item.
217 * @return An error code
218 * @param[in] pTargetProxy
219 * @param[in] targetEdge
220 * @param[out] targetPoint
221 * @exception E_SUCCESS The method was successful.
222 * @exception E_INVALID_STATE This instance is in an invalid state.
223 * @exception E_INVALID_ARG The specified input parameter is invalid.
224 * @exception E_SYSTEM A system error occurred.
227 result GetTargetPosition(LayoutItemProxy* pTargetProxy, const RelativeLayoutEdge targetEdge, LayoutPoint& targetPoint) const;
230 * Sets the relation of the specified node for the edge with pTargetNode.
232 * @return An error code
233 * @param[in] pSourceNode
234 * @param[in] sourceEdge
235 * @param[in] pTargetNode
236 * @param[in] targetEdge
237 * @exception E_SUCCESS The method was successful.
238 * @exception E_INVALID_STATE This instance is in an invalid state.
239 * @exception E_INVALID_ARG The specified input parameter is invalid.
242 result SetAlignment(ProxyListNode& sourceNode, const RelativeLayoutEdge sourceEdge, ProxyListNode* pTargetNode, const RelativeLayoutEdge targetEdge);
245 * Unsets the relation of the specified node for the edge.
247 * @return An error code
248 * @param[in] pSourceNode
249 * @param[in] sourceEdge
250 * @param[out] ppTargetProxy
251 * @exception E_SUCCESS The method was successful.
252 * @exception E_INVALID_STATE This instance is in an invalid state.
253 * @exception E_SYSTEM A system error occurred.
256 result UnsetAlignment(ProxyListNode& sourceNode, const RelativeLayoutEdge sourceEdge, LayoutItemProxy** ppTargetProxy);
259 * Gets the layout itme proxy of the specified node for the edge.
261 * @return LayoutItemProxy of pSourceNode for sourceEdge
262 * @param[in] pSourceNode
263 * @param[in] sourceEdge
264 * @param[out] targetEdge
265 * @exception E_OUT_OF_RANGE An edge value is invalid.
268 LayoutItemProxy* GetAlignment(ProxyListNode& sourceNode, const RelativeLayoutEdge sourceEdge, RelativeLayoutEdge* targetEdge = null);
271 * The internal methode of IncreaseRefCount.
273 * @return An error code
274 * @param[in] pTargetNode
275 * @param[in] pBaseNode
276 * @exception E_SUCCESS The method was successful.
277 * @exception E_INVALID_STATE This instance is in an invalid state.
278 * @exception E_SYSTEM A system error occurred.
281 result IncreaseReference(ProxyListNode& targetNode, ProxyListNode& pBaseNode);
284 * Gets the node of specified node for edge.
286 * @return ProxyListNode of pNode for the edge
289 * @exception E_SUCCESS The method was successful.
290 * @exception E_INVALID_STATE This instance is in an invalid state.
291 * @exception E_SYSTEM A system error occurred.
294 ProxyListNode* GetTargetNode(ProxyListNode& node, const RelativeLayoutEdge edge);
297 * Sets the reference count to zero.
299 * @return An error code
301 * @param[in] pBaseNode
302 * @exception E_SUCCESS The method was successful.
303 * @exception E_INVALID_STATE This instance is in an invalid state.
306 result SetZeroReference(ProxyListNode& node, ProxyListNode& pBaseNode);
308 RelativeProxyList* GetRelativeProxyList(void);
312 const LayoutItemProxy* __pTargetParent;
314 friend class RelativeProxyList;
317 }}} //Tizen::Ui::_Layout
319 #endif // _FUI_INTERNAL_LAYOUT_RELATIVE_LAYOUT_H_