2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0/
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.cpp
19 * @brief This is the implementation file for RelativeLayout class.
21 * This file contains the implementation of RelativeLayout class.
26 #include <FBaseResult.h>
27 #include "FUi_LayoutRelativeLayout.h"
28 #include "FUi_LayoutLayoutItemProxy.h"
29 #include "FUi_LayoutProxyList.h"
30 #include "FUi_LayoutLayoutItemInfo.h"
32 namespace Tizen { namespace Ui { namespace _Layout
36 RelativeLayout::RelativeLayout()
37 : __pTargetParent(reinterpret_cast <LayoutItemProxy*>(0xffff))
39 RelativeProxyList* pRelativeProxyList = new (std::nothrow) RelativeProxyList();
40 SysTryReturnVoidResult(NID_UI, pRelativeProxyList, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
41 SetItemList(pRelativeProxyList);
43 pRelativeProxyList->SetRelativeLayout(this);
46 RelativeLayout::~RelativeLayout()
51 RelativeLayout::CreateRelativeLayoutN()
53 RelativeLayout* pLayout = new (std::nothrow) RelativeLayout();
54 SysTryReturn(NID_UI, pLayout != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Relative layout core allocation failure.");
55 if (GetLastResult() != E_SUCCESS)
65 RelativeLayout::SetRelation(LayoutItem& item, const RelativeLayoutEdge itemEdge, LayoutItem* pTarget,
66 const RelativeLayoutEdge targetEdge)
68 ProxyList* pProxyList = GetProxyList();
69 SysAssertf(pProxyList != null, "ProxyList is invalid.");
71 ProxyListNode* pSourceNode = pProxyList->GetNode(item);
72 ProxyListNode* pTargetNode = pProxyList->GetNode(*pTarget);
73 LayoutItemProxy* pContainerProxy = GetContainerProxy();
75 if (pContainerProxy == null)
77 return E_INVALID_STATE;
80 if (pSourceNode == null ||
81 (pTarget != null && pTarget != pContainerProxy->GetItem() && pTargetNode == null))
86 if (itemEdge == EDGE_ALL)
91 if (itemEdge == EDGE_NONE)
93 for (int i = EDGE_LEFT; i < EDGE_ALL; i++)
95 UnsetRelation(item, static_cast <RelativeLayoutEdge>(i));
99 SetPartialUpdateFlag(true);
103 if (itemEdge == EDGE_HCENTER || itemEdge == EDGE_VCENTER)
105 if (pTarget != null || targetEdge != EDGE_NONE)
107 return E_INVALID_ARG;
111 // release to relation if exist relation
113 if (GetRelation(item, itemEdge, null) != null)
115 r = UnsetRelation(item, itemEdge);
122 int rollBackRefCount = 0;
123 RelativeItemInfo* pTargetItemInfo = null;
124 if (pTargetNode != null)
126 pTargetItemInfo = static_cast <RelativeItemInfo*>(pTargetNode->GetItemInfo());
127 if (pTargetItemInfo == null)
129 return E_INVALID_STATE;
131 rollBackRefCount = pTargetItemInfo->__refCount;
133 r = SetAlignment(*pSourceNode, itemEdge, pTargetNode, targetEdge);
139 if (pTargetItemInfo != null && IncreaseReferenceCount(*pSourceNode) != E_SUCCESS)
141 r = UnsetAlignment(*pSourceNode, itemEdge, null);
146 DecreaseReferenceCount(*pSourceNode, *pTargetNode);
147 pTargetItemInfo->__refCount = rollBackRefCount;
148 r = IncreaseReferenceCount(*pTargetNode);
154 ProxyListNode* pCurNode = pProxyList->GetFirstNode();
157 r = IncreaseReferenceCount(*pCurNode);
162 pCurNode = pProxyList->GetNextNode(*pCurNode);
168 SetUpdateState(true);
169 SetPartialUpdateFlag(true);
174 RelativeLayout::UnsetRelation(LayoutItem& item, const RelativeLayoutEdge itemEdge)
176 RelativeProxyList* pRelativeProxyList = GetRelativeProxyList();
177 SysTryReturn(NID_UI, pRelativeProxyList, E_INVALID_STATE, E_INVALID_STATE, "[E_INVALID_STATE] RelativeProxyList is invalid.");
179 ProxyListNode* pItemNode = pRelativeProxyList->GetNode(item);
180 if (pItemNode == null)
182 return E_INVALID_ARG;
185 if (itemEdge == EDGE_NONE || itemEdge == EDGE_ALL)
187 return E_INVALID_ARG;
191 ProxyListNode* pTargetNode = null;
192 LayoutItemProxy* pTargetProxy = null;
193 r = UnsetAlignment(*pItemNode, itemEdge, &pTargetProxy);
198 if (pTargetProxy != null)
200 pTargetNode = pRelativeProxyList->GetNode(*(pTargetProxy->GetItem()));
201 if (pTargetNode == null)
203 return E_INVALID_STATE;
207 if (pTargetNode == null)
209 SetUpdateState(true);
210 SetPartialUpdateFlag(true);
215 // Refcount of all nodes is set to 0.
216 DecreaseReferenceCount(*pItemNode, *pTargetNode);
218 // find another node to refer to pTargetNode.
219 ProxyListNode* pCurNode = pRelativeProxyList->GetFirstNode();
222 while (pCurNode != null)
224 for (int i = EDGE_LEFT; i <= EDGE_BOTTOM; i++)
226 LayoutItemProxy* pTargetProxy = GetAlignment(*pCurNode, static_cast <RelativeLayoutEdge>(i));
227 if (pTargetProxy != null && pTargetProxy != GetContainerProxy())
229 ProxyListNode* pCurTargetNode = pRelativeProxyList->GetNode(*(pTargetProxy->GetItem()));
230 if (pTargetNode == pCurTargetNode)
232 if (maxRefCount < pRelativeProxyList->GetReferenceCount(*pCurNode))
234 maxRefCount = pRelativeProxyList->GetReferenceCount(*pCurNode);
235 nodeIndex = pRelativeProxyList->GetIndex(*pCurNode);
240 pCurNode = pRelativeProxyList->GetNextNode(*pCurNode);
245 pCurNode = pRelativeProxyList->GetNode(nodeIndex);
246 IncreaseReference(*pTargetNode, *pCurNode);
249 // Nodes Recalculation
250 r = IncreaseReferenceCount(*pTargetNode);
256 SetUpdateState(true);
257 SetPartialUpdateFlag(true);
262 RelativeLayout::GetRelation(LayoutItem& item, const RelativeLayoutEdge itemEdge, RelativeLayoutEdge* pTargetEdge)
264 ProxyList* pProxyList = GetProxyList();
265 SysAssertf(pProxyList != null, "ProxyList is invalid.");
267 ProxyListNode* pNode = pProxyList->GetNode(item);
271 LayoutItemProxy* pItemProxy = GetAlignment(*pNode, itemEdge, pTargetEdge);
274 return pItemProxy->GetItem();
282 RelativeLayout::OnLayout(float width, float height, bool updateLayouting)
284 result r = E_SUCCESS;
285 ProxyList* pProxyList = GetProxyList();
286 SysAssertf(pProxyList != null, "ProxyList is invalid.");
288 LayoutItemProxy* pContainerProxy = GetContainerProxy();
289 if (pContainerProxy == null)
291 return E_INVALID_STATE;
294 LayoutRect windowRect = {0.0f, 0.0f, width, height};
295 LayoutRect clientRect;
296 pContainerProxy->ConvertWindowToClientBounds(windowRect, clientRect);
298 LayoutRect layoutRect = GetLayoutRect();
299 clientRect.x = layoutRect.x;
300 clientRect.y = layoutRect.y;
302 float correctionWidth = windowRect.w - clientRect.w;
303 float correctionHeight = windowRect.h - clientRect.h;
305 if (correctionWidth < 0.0f)
307 correctionWidth = 0.0f;
309 if (correctionHeight < 0.0f)
311 correctionHeight = 0.0f;
314 LayoutMatchMode widthMatchMode = pContainerProxy->GetItemWidthMatchMode();
315 LayoutMatchMode heightMatchMode = pContainerProxy->GetItemHeightMatchMode();
317 SetLayoutRect(clientRect);
319 float childrenMaxPosX = 0.0f;
320 float childrenMaxPosY = 0.0f;
321 LayoutRect childRect = {0.0f, 0.0f, 0.0f, 0.0f};
323 ProxyListNode* pCurNode = pProxyList->GetFirstNode();
325 while (pCurNode != null)
327 r = CalculatePosition(*pCurNode);
328 r = CalculateCenter(*pCurNode, r == E_SUCCESS);
334 LayoutItemProxy* pItemProxy = pCurNode->GetItemProxy();
335 if (pItemProxy == null)
337 return E_INVALID_STATE;
340 pItemProxy->GetItemWindowRect(childRect);
342 if (childrenMaxPosX < childRect.x + childRect.w)
344 childrenMaxPosX = childRect.x + childRect.w;
345 if (GetAlignment(*pCurNode, EDGE_RIGHT) != null)
347 ItemMargin margin = pItemProxy->GetItemMargin();
348 childrenMaxPosX += margin.right;
352 if (childrenMaxPosY < childRect.y + childRect.h)
354 childrenMaxPosY = childRect.y + childRect.h;
355 if (GetAlignment(*pCurNode, EDGE_BOTTOM) != null)
357 ItemMargin margin = pItemProxy->GetItemMargin();
358 childrenMaxPosY += margin.bottom;
362 pCurNode = pProxyList->GetNextNode(*pCurNode);
365 if (widthMatchMode == WRAP_CONTENT)
367 clientRect.w = childrenMaxPosX + correctionWidth;
371 clientRect.w += correctionWidth;
374 if (heightMatchMode == WRAP_CONTENT)
376 clientRect.h = childrenMaxPosY + correctionHeight;
380 clientRect.h += correctionHeight;
383 SetLayoutRect(clientRect);
384 LayoutRect containerRect;
385 pContainerProxy->GetItemWindowRect(containerRect);
386 clientRect.x = containerRect.x;
387 clientRect.y = containerRect.y;
388 if (windowRect.w != clientRect.w || windowRect.h != clientRect.h)
392 pContainerProxy->SetItemWindowRect(clientRect);
395 pCurNode = pProxyList->GetFirstNode();
398 r = CalculatePosition(*pCurNode);
399 r = CalculateCenter(*pCurNode, r == E_SUCCESS);
400 pCurNode = pProxyList->GetNextNode(*pCurNode);
408 RelativeLayout::IncreaseReferenceCount(ProxyListNode& node)
410 ProxyList* pProxyList = GetProxyList();
411 SysAssertf(pProxyList != null, "ProxyList is invalid.");
413 ProxyListNode* pTargetNode = null;
414 result r = E_SUCCESS;
415 for (int i = EDGE_LEFT; i < EDGE_ALL; i++)
417 LayoutItemProxy* pProxy = GetAlignment(node, static_cast <RelativeLayoutEdge>(i));
418 if (pProxy == null || pProxy == GetContainerProxy())
422 pTargetNode = pProxyList->GetNode(*(pProxy->GetItem()));
423 if (pTargetNode != null)
425 r = IncreaseReference(*pTargetNode, node);
428 r = IncreaseReferenceCount(*pTargetNode);
440 // Order of nodes is recalculate
441 return AlignItemNodeMaxRefMove();
445 RelativeLayout::DecreaseReferenceCount(ProxyListNode& node, ProxyListNode& pTargetNode)
447 ProxyListNode* pTargetTargetNode = null;
448 for (int i = EDGE_LEFT; i <= EDGE_BOTTOM; i++)
450 pTargetTargetNode = GetTargetNode(pTargetNode, static_cast <RelativeLayoutEdge>(i));
451 if (pTargetTargetNode != null)
453 DecreaseReferenceCount(pTargetNode, *pTargetTargetNode);
456 //if (pTargetNode != null)
458 SetZeroReference(pTargetNode, node);
463 RelativeLayout::AlignItemNodeMaxRefMove()
465 result r = E_SUCCESS;
467 RelativeProxyList* pRelativeProxyList = GetRelativeProxyList();
468 SysTryReturn(NID_UI, pRelativeProxyList, E_INVALID_STATE, E_INVALID_STATE, "[E_INVALID_STATE] RelativeProxyList is invalid.");
470 ProxyListNode* pCurNode = pRelativeProxyList->GetFirstNode();
471 ProxyListNode* pNextNode = pCurNode;
474 while (pCurNode != null)
476 pNextNode = pRelativeProxyList->GetNextNode(*pCurNode);
477 maxRefCount = pRelativeProxyList->GetReferenceCount(*pCurNode);
479 if (pNextNode != null && maxRefCount < pRelativeProxyList->GetReferenceCount(*pNextNode))
481 ProxyListNode* pMoveNode = pNextNode;
482 if (pRelativeProxyList->DetachNode(*pMoveNode) != E_SUCCESS)
487 maxRefCount = pRelativeProxyList->GetReferenceCount(*pMoveNode);
489 pCurNode = pRelativeProxyList->GetFirstNode();
490 while (pRelativeProxyList->GetReferenceCount(*pCurNode) >= maxRefCount)
492 pCurNode = pRelativeProxyList->GetNextNode(*pCurNode);
494 pRelativeProxyList->InsertIntoLeft(*pCurNode, *pMoveNode);
499 pCurNode = pRelativeProxyList->GetNextNode(*pCurNode);
507 RelativeLayout::DeleteTargetInfo(ProxyListNode& targetNode, ProxyListNode& deleteNode)
509 RelativeItemInfo* pItemInfo = static_cast <RelativeItemInfo*>(targetNode.GetItemInfo());
510 if (pItemInfo == null)
512 return E_INVALID_STATE;
514 for (int i = EDGE_LEFT; i < EDGE_ALL; i++)
516 if (pItemInfo->__pTarget[i] == deleteNode.GetItemProxy())
518 UnsetRelation(*(targetNode.GetItemProxy()->GetItem()), static_cast <RelativeLayoutEdge>(i));
525 RelativeLayout::CalculatePosition(ProxyListNode& curNode)
527 RelativeItemInfo* pCurItemInfo = null;
528 LayoutItemProxy* pCurProxy = null;
529 ItemMargin curItemMargin = {0.0f, 0.0f, 0.0f, 0.0f};
530 LayoutRect curItemRect = {0.0f, 0.0f, 0.0f, 0.0f};
531 LayoutPoint targetPosition = {0.0f, 0.0f};
534 pCurItemInfo = static_cast <RelativeItemInfo*>(curNode.GetItemInfo());
535 pCurProxy = curNode.GetItemProxy();
537 if (pCurItemInfo == null || pCurProxy == null)
539 return E_INVALID_STATE;
542 curItemRect = pCurProxy->GetItemBaseRect();
543 GetItemMargin(*(pCurProxy->GetItem()), curItemMargin);
545 r = pCurProxy->Measure(curItemRect.w, curItemRect.h);
550 pCurProxy->GetMeasuredSize(curItemRect.w, curItemRect.h);
552 if (pCurItemInfo->__pTarget[EDGE_LEFT] != null)
554 r = GetTargetPosition(pCurItemInfo->__pTarget[EDGE_LEFT], pCurItemInfo->__targetEdge[EDGE_LEFT], targetPosition);
559 AlignToDevice(curItemRect, curItemRect);
560 curItemRect.x = targetPosition.x + curItemMargin.left;
563 if (pCurItemInfo->__pTarget[EDGE_TOP] != null)
565 r = GetTargetPosition(pCurItemInfo->__pTarget[EDGE_TOP], pCurItemInfo->__targetEdge[EDGE_TOP], targetPosition);
570 AlignToDevice(curItemRect, curItemRect);
571 curItemRect.y = targetPosition.y + curItemMargin.top;
574 if (pCurItemInfo->__pTarget[EDGE_RIGHT] != null)
576 r = GetTargetPosition(pCurItemInfo->__pTarget[EDGE_RIGHT], pCurItemInfo->__targetEdge[EDGE_RIGHT], targetPosition);
582 AlignToDevice(curItemRect, curItemRect);
583 if (pCurItemInfo->__pTarget[EDGE_LEFT] != null)
585 curItemRect.w = targetPosition.x - curItemRect.x - curItemMargin.right;
587 curItemRect.x = targetPosition.x - curItemMargin.right - curItemRect.w;
590 if (pCurItemInfo->__pTarget[EDGE_BOTTOM] != null)
592 r = GetTargetPosition(pCurItemInfo->__pTarget[EDGE_BOTTOM], pCurItemInfo->__targetEdge[EDGE_BOTTOM], targetPosition);
598 AlignToDevice(curItemRect, curItemRect);
599 if (pCurItemInfo->__pTarget[EDGE_TOP] != null)
601 curItemRect.h = targetPosition.y - curItemRect.y - curItemMargin.bottom;
603 curItemRect.y = targetPosition.y - curItemMargin.bottom - curItemRect.h;
606 r = pCurProxy->Measure(curItemRect.w, curItemRect.h);
611 pCurProxy->GetMeasuredSize(curItemRect.w, curItemRect.h);
613 r = pCurProxy->SetItemWindowRect(curItemRect);
623 RelativeLayout::CalculateCenter(ProxyListNode& curNode, bool calcPosition)
625 LayoutRect targetRect;
626 RelativeItemInfo* pCurItemInfo = null;
627 LayoutItemProxy* pCurProxy = null;
628 LayoutRect curItemRect = {0.0f, 0.0f, 0.0f, 0.0f};
631 pCurItemInfo = static_cast <RelativeItemInfo*>(curNode.GetItemInfo());
632 pCurProxy = curNode.GetItemProxy();
634 if (pCurItemInfo == null || pCurProxy == null)
636 return E_INVALID_STATE;
639 if (pCurItemInfo->__pTarget[EDGE_HCENTER] == null && pCurItemInfo->__pTarget[EDGE_VCENTER] == null)
646 pCurProxy->GetItemWindowRect(curItemRect);
650 curItemRect = pCurProxy->GetItemBaseRect();
653 r = pCurProxy->Measure(curItemRect.w, curItemRect.h);
658 pCurProxy->GetMeasuredSize(curItemRect.w, curItemRect.h);
660 if (pCurItemInfo->__pTarget[EDGE_HCENTER] == __pTargetParent)
662 targetRect = GetLayoutRect();
663 float targetWidth = targetRect.w;
664 float margin = ((targetWidth - curItemRect.w) / 2);
665 curItemRect.x = margin + targetRect.x;
668 if (pCurItemInfo->__pTarget[EDGE_VCENTER] == __pTargetParent)
670 targetRect = GetLayoutRect();
671 float targetHeight = targetRect.h;
672 float margin = ((targetHeight - curItemRect.h) / 2);
673 curItemRect.y = margin + targetRect.y;
676 r = pCurProxy->Measure(curItemRect.w, curItemRect.h);
681 pCurProxy->GetMeasuredSize(curItemRect.w, curItemRect.h);
683 r = pCurProxy->SetItemWindowRect(curItemRect);
693 RelativeLayout::CheckTargetEdge(const RelativeLayoutEdge sourceEdge, const RelativeLayoutEdge targetEdge) const
695 if (sourceEdge & 0x1)
697 if (targetEdge & 0x1)
706 else if (!(sourceEdge & 0x1))
708 if (targetEdge & 0x1)
722 RelativeLayout::SetAlignment(ProxyListNode& sourceNode, const RelativeLayoutEdge sourceEdge, ProxyListNode* pTargetNode, const RelativeLayoutEdge targetEdge)
724 RelativeLayoutEdge realTargetEdge = targetEdge;
725 if (realTargetEdge == EDGE_NONE)
727 realTargetEdge = sourceEdge;
730 if (!CheckTargetEdge(sourceEdge, realTargetEdge))
732 return E_INVALID_ARG;
735 RelativeItemInfo* pSourceItemInfo = static_cast <RelativeItemInfo*>(sourceNode.GetItemInfo());
737 if (pSourceItemInfo == null || pSourceItemInfo->__targetEdge[sourceEdge] != EDGE_NONE || pSourceItemInfo->__pTarget[sourceEdge] != null)
739 return E_INVALID_STATE;
742 LayoutItemProxy* pTargetProxy = null;
743 if (pTargetNode == null)
745 pTargetProxy = const_cast <LayoutItemProxy*>(__pTargetParent);
749 pTargetProxy = pTargetNode->GetItemProxy();
751 if (pTargetProxy == null)
753 return E_INVALID_ARG;
756 pSourceItemInfo->__targetEdge[sourceEdge] = realTargetEdge;
757 pSourceItemInfo->__pTarget[sourceEdge] = pTargetProxy;
763 RelativeLayout::UnsetAlignment(ProxyListNode& sourceNode, const RelativeLayoutEdge sourceEdge, LayoutItemProxy** ppTargetProxy)
765 RelativeItemInfo* pSourceItemInfo = static_cast <RelativeItemInfo*>(sourceNode.GetItemInfo());
767 if (pSourceItemInfo == null)
769 return E_INVALID_STATE;
772 if (sourceEdge != EDGE_NONE)
774 pSourceItemInfo->__targetEdge[sourceEdge] = EDGE_NONE;
775 if (pSourceItemInfo->__pTarget[sourceEdge] != null)
777 if (ppTargetProxy != null)
779 if (pSourceItemInfo->__pTarget[sourceEdge] != __pTargetParent)
781 *ppTargetProxy = pSourceItemInfo->__pTarget[sourceEdge];
785 *ppTargetProxy = null;
788 pSourceItemInfo->__pTarget[sourceEdge] = null;
792 return E_INVALID_STATE;
801 RelativeLayout::GetAlignment(ProxyListNode& sourceNode, const RelativeLayoutEdge sourceEdge, RelativeLayoutEdge* pTargetEdge)
803 SysTryReturn(NID_UI, sourceEdge >= EDGE_NONE, null, E_OUT_OF_RANGE, "[E_OUT_OF_RANGE] Argument is out of range.");
804 SysTryReturn(NID_UI, sourceEdge <= EDGE_VCENTER, null, E_OUT_OF_RANGE, "[E_OUT_OF_RANGE] Argument is out of range.");
805 RelativeItemInfo* pSourceItemInfo = static_cast <RelativeItemInfo*>(sourceNode.GetItemInfo());
807 SysTryReturn(NID_UI, pSourceItemInfo, null, E_INVALID_STATE, "[E_INVALID_STATE] RelativeItemInfo is invalid.");
809 if (pTargetEdge != null)
811 *pTargetEdge = pSourceItemInfo->__targetEdge[sourceEdge];
814 if (pSourceItemInfo->__pTarget[sourceEdge] != __pTargetParent)
816 return pSourceItemInfo->__pTarget[sourceEdge];
820 return GetContainerProxy();
825 RelativeLayout::IncreaseReference(ProxyListNode& targetNode, ProxyListNode& sourceNode)
827 ProxyList* pProxyList = GetProxyList();
828 SysAssertf(pProxyList != null, "ProxyList is invalid.");
830 RelativeItemInfo* pTargetItemInfo = static_cast <RelativeItemInfo*>(targetNode.GetItemInfo());
831 RelativeItemInfo* pSourceItemInfo = static_cast <RelativeItemInfo*>(sourceNode.GetItemInfo());
833 if (pTargetItemInfo == null || pSourceItemInfo == null)
835 return E_INVALID_STATE;
838 int refCount = pSourceItemInfo->__refCount + 1;
840 if (refCount > pProxyList->GetNodeCount() - 1)
842 return E_INVALID_STATE;
845 if (refCount > pTargetItemInfo->__refCount)
847 pTargetItemInfo->__refCount = refCount;
853 RelativeLayout::GetTargetNode(ProxyListNode& node, RelativeLayoutEdge sourceEdge)
855 ProxyList* pProxyList = GetProxyList();
856 SysAssertf(pProxyList != null, "ProxyList is invalid.");
858 LayoutItemProxy* pProxy = GetAlignment(node, sourceEdge);
859 if (pProxy == null || pProxy == GetContainerProxy())
863 return pProxyList->GetNode(*(pProxy->GetItem()));
867 RelativeLayout::SetZeroReference(ProxyListNode& node, ProxyListNode& baseNode)
869 RelativeItemInfo* pTargetItemInfo = static_cast <RelativeItemInfo*>(node.GetItemInfo());
870 if (pTargetItemInfo == null)
872 return E_INVALID_STATE;
875 pTargetItemInfo->__refCount = 0;
881 RelativeLayout::GetTargetPosition(LayoutItemProxy* pTargetProxy, const RelativeLayoutEdge targetEdge, LayoutPoint& targetPoint) const
883 if (pTargetProxy == null)
885 return E_INVALID_ARG;
888 LayoutRect targetRect;
889 if (pTargetProxy == __pTargetParent)
891 targetRect = GetLayoutRect();
895 pTargetProxy->GetItemWindowRect(targetRect);
901 targetPoint.x = targetRect.x;
905 targetPoint.y = targetRect.y;
909 targetPoint.x = targetRect.x + targetRect.w;
913 targetPoint.y = targetRect.y + targetRect.h;
924 RelativeLayout::GetRelativeProxyList(void)
926 return static_cast <RelativeProxyList*>(GetProxyList());
929 }}} // Tizen::Ui::_Layout