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.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
112 result re = E_SYSTEM;
113 if (GetRelation(item, itemEdge, null) != null)
115 re = UnsetRelation(item, itemEdge);
122 int rollBackRefCount = 0;
123 RelativeItemInfo* pTargetItemInfo = null;
124 if (pTargetNode != null)
126 pTargetItemInfo = dynamic_cast <RelativeItemInfo*>(pTargetNode->GetItemInfo());
127 if (pTargetItemInfo == null)
129 return E_INVALID_STATE;
131 rollBackRefCount = pTargetItemInfo->__refCount;
133 re = SetAlignment(*pSourceNode, itemEdge, pTargetNode, targetEdge);
139 if (pTargetItemInfo != null && IncreaseReferenceCount(*pSourceNode) != E_SUCCESS)
141 re = UnsetAlignment(*pSourceNode, itemEdge, null);
146 DecreaseReferenceCount(*pSourceNode, *pTargetNode);
147 pTargetItemInfo->__refCount = rollBackRefCount;
148 re = IncreaseReferenceCount(*pTargetNode);
154 ProxyListNode* pCurNode = pProxyList->GetFirstNode();
157 re = 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;
190 result re = E_SYSTEM;
191 ProxyListNode* pTargetNode = null;
192 LayoutItemProxy* pTargetProxy = null;
193 re = 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)
212 // Refcount of all nodes is set to 0.
213 DecreaseReferenceCount(*pItemNode, *pTargetNode);
215 // find another node to refer to pTargetNode.
216 ProxyListNode* pCurNode = pRelativeProxyList->GetFirstNode();
219 while (pCurNode != null)
221 for (int i = EDGE_LEFT; i <= EDGE_BOTTOM; i++)
223 LayoutItemProxy* pTargetProxy = GetAlignment(*pCurNode, static_cast <RelativeLayoutEdge>(i));
224 if (pTargetProxy != null && pTargetProxy != GetContainerProxy())
226 ProxyListNode* pCurTargetNode = pRelativeProxyList->GetNode(*(pTargetProxy->GetItem()));
227 if (pTargetNode == pCurTargetNode)
229 if (maxRefCount < pRelativeProxyList->GetReferenceCount(*pCurNode))
231 maxRefCount = pRelativeProxyList->GetReferenceCount(*pCurNode);
232 nodeIndex = pRelativeProxyList->GetIndex(*pCurNode);
237 pCurNode = pRelativeProxyList->GetNextNode(*pCurNode);
242 pCurNode = pRelativeProxyList->GetNode(nodeIndex);
243 IncreaseReference(*pTargetNode, *pCurNode);
246 // Nodes Recalculation
247 re = IncreaseReferenceCount(*pTargetNode);
257 RelativeLayout::GetRelation(LayoutItem& item, const RelativeLayoutEdge itemEdge, RelativeLayoutEdge* pTargetEdge)
259 ProxyList* pProxyList = GetProxyList();
260 SysAssertf(pProxyList != null, "ProxyList is invalid.");
262 ProxyListNode* pNode = pProxyList->GetNode(item);
266 LayoutItemProxy* pItemProxy = GetAlignment(*pNode, itemEdge, pTargetEdge);
269 return pItemProxy->GetItem();
277 RelativeLayout::OnLayout(int width, int height, bool updateLayouting)
279 result re = E_SUCCESS;
280 ProxyList* pProxyList = GetProxyList();
281 SysAssertf(pProxyList != null, "ProxyList is invalid.");
283 LayoutItemProxy* pContainerProxy = GetContainerProxy();
284 if (pContainerProxy == null)
286 return E_INVALID_STATE;
289 LayoutRect windowRect = {0, 0, width, height};
290 LayoutRect clientRect;
291 pContainerProxy->ConvertWindowToClientBounds(windowRect, clientRect);
293 LayoutRect layoutRect = GetLayoutRect();
294 clientRect.x = layoutRect.x;
295 clientRect.y = layoutRect.y;
297 int correctionWidth = windowRect.w - clientRect.w;
298 int correctionHeight = windowRect.h - clientRect.h;
301 LayoutMatchMode widthMatchMode = pContainerProxy->GetItemWidthMatchMode();
302 LayoutMatchMode heightMatchMode = pContainerProxy->GetItemHeightMatchMode();
304 SetLayoutRect(clientRect);
306 int childrenMaxPosX = 0;
307 int childrenMaxPosY = 0;
308 LayoutRect childRect = {0, 0, 0, 0};
310 ProxyListNode* pCurNode = pProxyList->GetFirstNode();
312 while (pCurNode != null)
314 re = CalculatePosition(*pCurNode);
315 re = CalculateCenter(*pCurNode, re == E_SUCCESS);
321 LayoutItemProxy* pItemProxy = pCurNode->GetItemProxy();
322 if (pItemProxy == null)
324 return E_INVALID_STATE;
327 pItemProxy->GetItemWindowRect(childRect);
329 if (childrenMaxPosX < childRect.x + childRect.w)
331 childrenMaxPosX = childRect.x + childRect.w;
332 if (GetAlignment(*pCurNode, EDGE_RIGHT) != null)
334 ItemMargin margin = pItemProxy->GetItemMargin();
335 childrenMaxPosX += margin.right;
339 if (childrenMaxPosY < childRect.y + childRect.h)
341 childrenMaxPosY = childRect.y + childRect.h;
342 if (GetAlignment(*pCurNode, EDGE_BOTTOM) != null)
344 ItemMargin margin = pItemProxy->GetItemMargin();
345 childrenMaxPosY += margin.bottom;
349 pCurNode = pProxyList->GetNextNode(*pCurNode);
352 if (widthMatchMode == WRAP_CONTENT)
354 clientRect.w = childrenMaxPosX + correctionWidth;
358 clientRect.w += correctionWidth;
361 if (heightMatchMode == WRAP_CONTENT)
363 clientRect.h = childrenMaxPosY + correctionHeight;
367 clientRect.h += correctionHeight;
370 SetLayoutRect(clientRect);
371 LayoutRect containerRect;
372 pContainerProxy->GetItemWindowRect(containerRect);
373 clientRect.x = containerRect.x;
374 clientRect.y = containerRect.y;
375 if (windowRect.w != clientRect.w || windowRect.h != clientRect.h)
379 pContainerProxy->SetItemWindowRect(clientRect);
382 pCurNode = pProxyList->GetFirstNode();
385 re = CalculatePosition(*pCurNode);
386 re = CalculateCenter(*pCurNode, re == E_SUCCESS);
387 pCurNode = pProxyList->GetNextNode(*pCurNode);
395 RelativeLayout::IncreaseReferenceCount(ProxyListNode& node)
397 ProxyList* pProxyList = GetProxyList();
398 SysAssertf(pProxyList != null, "ProxyList is invalid.");
400 ProxyListNode* pTargetNode = null;
401 result re = E_SUCCESS;
402 for (int i = EDGE_LEFT; i < EDGE_ALL; i++)
404 LayoutItemProxy* pProxy = GetAlignment(node, static_cast <RelativeLayoutEdge>(i));
405 if (pProxy == null || pProxy == GetContainerProxy())
409 pTargetNode = pProxyList->GetNode(*(pProxy->GetItem()));
410 if (pTargetNode != null)
412 re = IncreaseReference(*pTargetNode, node);
415 re = IncreaseReferenceCount(*pTargetNode);
427 // Order of nodes is recalculate
428 return AlignItemNodeMaxRefMove();
432 RelativeLayout::DecreaseReferenceCount(ProxyListNode& node, ProxyListNode& pTargetNode)
434 ProxyListNode* pTargetTargetNode = null;
435 for (int i = EDGE_LEFT; i <= EDGE_BOTTOM; i++)
437 pTargetTargetNode = GetTargetNode(pTargetNode, static_cast <RelativeLayoutEdge>(i));
438 if (pTargetTargetNode != null)
440 DecreaseReferenceCount(pTargetNode, *pTargetTargetNode);
443 //if (pTargetNode != null)
445 SetZeroReference(pTargetNode, node);
450 RelativeLayout::AlignItemNodeMaxRefMove()
452 result r = E_SUCCESS;
454 RelativeProxyList* pRelativeProxyList = GetRelativeProxyList();
455 SysTryReturn(NID_UI, pRelativeProxyList, E_INVALID_STATE, E_INVALID_STATE, "[E_INVALID_STATE] RelativeProxyList is invalid.");
457 ProxyListNode* pCurNode = pRelativeProxyList->GetFirstNode();
458 ProxyListNode* pNextNode = pCurNode;
461 while (pCurNode != null)
463 pNextNode = pRelativeProxyList->GetNextNode(*pCurNode);
464 maxRefCount = pRelativeProxyList->GetReferenceCount(*pCurNode);
466 if (pNextNode != null && maxRefCount < pRelativeProxyList->GetReferenceCount(*pNextNode))
468 ProxyListNode* pMoveNode = pNextNode;
469 if (pRelativeProxyList->DetachNode(*pMoveNode) != E_SUCCESS)
474 maxRefCount = pRelativeProxyList->GetReferenceCount(*pMoveNode);
476 pCurNode = pRelativeProxyList->GetFirstNode();
477 while (pRelativeProxyList->GetReferenceCount(*pCurNode) >= maxRefCount)
479 pCurNode = pRelativeProxyList->GetNextNode(*pCurNode);
481 pRelativeProxyList->InsertIntoLeft(*pCurNode, *pMoveNode);
486 pCurNode = pRelativeProxyList->GetNextNode(*pCurNode);
494 RelativeLayout::DeleteTargetInfo(ProxyListNode& targetNode, ProxyListNode& deleteNode)
496 RelativeItemInfo* pItemInfo = dynamic_cast <RelativeItemInfo*>(targetNode.GetItemInfo());
497 if (pItemInfo == null)
499 return E_INVALID_STATE;
501 for (int i = EDGE_LEFT; i < EDGE_ALL; i++)
503 if (pItemInfo->__pTarget[i] == deleteNode.GetItemProxy())
505 UnsetRelation(*(targetNode.GetItemProxy()->GetItem()), static_cast <RelativeLayoutEdge>(i));
512 RelativeLayout::CalculatePosition(ProxyListNode& curNode)
514 RelativeItemInfo* pCurItemInfo = null;
515 LayoutItemProxy* pCurProxy = null;
516 ItemMargin curItemMargin = {0, 0, 0, 0};
517 LayoutRect curItemRect = {0, 0, 0, 0};
518 LayoutPoint targetPosition = {0, 0};
519 result re = E_SYSTEM;
520 int relatedRight = 0;
521 int relatedBottom = 0;
523 pCurItemInfo = dynamic_cast <RelativeItemInfo*>(curNode.GetItemInfo());
524 pCurProxy = curNode.GetItemProxy();
526 if (pCurItemInfo == null || pCurProxy == null)
528 return E_INVALID_STATE;
531 curItemRect = pCurProxy->GetItemBaseRect();
532 GetItemMargin(*(pCurProxy->GetItem()), curItemMargin);
534 if (pCurItemInfo->__pTarget[EDGE_LEFT] != null)
536 re = GetTargetPosition(pCurItemInfo->__pTarget[EDGE_LEFT], pCurItemInfo->__targetEdge[EDGE_LEFT], targetPosition);
541 curItemRect.x = targetPosition.x + curItemMargin.left;
544 if (pCurItemInfo->__pTarget[EDGE_TOP] != null)
546 re = GetTargetPosition(pCurItemInfo->__pTarget[EDGE_TOP], pCurItemInfo->__targetEdge[EDGE_TOP], targetPosition);
551 curItemRect.y = targetPosition.y + curItemMargin.top;
554 if (pCurItemInfo->__pTarget[EDGE_RIGHT] != null)
556 re = GetTargetPosition(pCurItemInfo->__pTarget[EDGE_RIGHT], pCurItemInfo->__targetEdge[EDGE_RIGHT], targetPosition);
562 if (pCurItemInfo->__pTarget[EDGE_LEFT] != null)
564 curItemRect.w = targetPosition.x - curItemRect.x - curItemMargin.right;
566 curItemRect.x = targetPosition.x - curItemMargin.right - curItemRect.w;
567 relatedRight = curItemRect.x + curItemRect.w;
570 if (pCurItemInfo->__pTarget[EDGE_BOTTOM] != null)
572 re = GetTargetPosition(pCurItemInfo->__pTarget[EDGE_BOTTOM], pCurItemInfo->__targetEdge[EDGE_BOTTOM], targetPosition);
578 if (pCurItemInfo->__pTarget[EDGE_TOP] != null)
580 curItemRect.h = targetPosition.y - curItemRect.y - curItemMargin.bottom;
582 curItemRect.y = targetPosition.y - curItemMargin.bottom - curItemRect.h;
583 relatedBottom = curItemRect.y + curItemRect.h;
586 re = pCurProxy->Measure(curItemRect.w, curItemRect.h);
591 pCurProxy->GetMeasuredSize(curItemRect.w, curItemRect.h);
593 if (pCurItemInfo->__pTarget[EDGE_LEFT] == null && pCurItemInfo->__pTarget[EDGE_RIGHT] != null)
595 curItemRect.x = relatedRight - curItemRect.w;
598 if (pCurItemInfo->__pTarget[EDGE_TOP] == null && pCurItemInfo->__pTarget[EDGE_BOTTOM] != null)
600 curItemRect.y = relatedBottom - curItemRect.h;
603 re = pCurProxy->SetItemWindowRect(curItemRect);
613 RelativeLayout::CalculateCenter(ProxyListNode& curNode, bool calcPosition)
615 LayoutRect targetRect;
616 RelativeItemInfo* pCurItemInfo = null;
617 LayoutItemProxy* pCurProxy = null;
618 LayoutRect curItemRect = {0, 0, 0, 0};
619 result re = E_SYSTEM;
621 pCurItemInfo = dynamic_cast <RelativeItemInfo*>(curNode.GetItemInfo());
622 pCurProxy = curNode.GetItemProxy();
624 if (pCurItemInfo == null || pCurProxy == null)
626 return E_INVALID_STATE;
629 if (pCurItemInfo->__pTarget[EDGE_HCENTER] == null && pCurItemInfo->__pTarget[EDGE_VCENTER] == null)
636 pCurProxy->GetItemWindowRect(curItemRect);
640 curItemRect = pCurProxy->GetItemBaseRect();
643 re = pCurProxy->Measure(curItemRect.w, curItemRect.h);
648 pCurProxy->GetMeasuredSize(curItemRect.w, curItemRect.h);
650 if (pCurItemInfo->__pTarget[EDGE_HCENTER] == __pTargetParent)
652 //targetRect = __pTarget[EDGE_HCENTER]->GetItemWindowRect();
653 targetRect = GetLayoutRect();
654 int targetWidth = targetRect.w;
655 int margin = ((targetWidth - curItemRect.w) >> 1);
656 curItemRect.x = margin + targetRect.x;
659 if (pCurItemInfo->__pTarget[EDGE_VCENTER] == __pTargetParent)
661 //targetRect = __pTarget[EDGE_VCENTER]->GetItemWindowRect();
662 targetRect = GetLayoutRect();
663 int targetHeight = targetRect.h;
664 int margin = ((targetHeight - curItemRect.h) >> 1);
665 curItemRect.y = margin + targetRect.y;
668 re = pCurProxy->Measure(curItemRect.w, curItemRect.h);
673 pCurProxy->GetMeasuredSize(curItemRect.w, curItemRect.h);
675 re = pCurProxy->SetItemWindowRect(curItemRect);
685 RelativeLayout::CheckTargetEdge(const RelativeLayoutEdge sourceEdge, const RelativeLayoutEdge targetEdge) const
687 if (sourceEdge & 0x1)
689 if (targetEdge & 0x1)
698 else if (!(sourceEdge & 0x1))
700 if (targetEdge & 0x1)
714 RelativeLayout::SetAlignment(ProxyListNode& sourceNode, const RelativeLayoutEdge sourceEdge, ProxyListNode* pTargetNode, const RelativeLayoutEdge targetEdge)
716 //RelativeLayoutEdge realTargetEdge = const_cast<RelativeLayoutEdge>(targetEdge);
717 RelativeLayoutEdge realTargetEdge = targetEdge;
718 if (realTargetEdge == EDGE_NONE)
720 realTargetEdge = sourceEdge;
723 if (!CheckTargetEdge(sourceEdge, realTargetEdge))
725 return E_INVALID_ARG;
728 RelativeItemInfo* pSourceItemInfo = dynamic_cast <RelativeItemInfo*>(sourceNode.GetItemInfo());
730 if (pSourceItemInfo == null || pSourceItemInfo->__targetEdge[sourceEdge] != EDGE_NONE || pSourceItemInfo->__pTarget[sourceEdge] != null)
732 return E_INVALID_STATE;
735 LayoutItemProxy* pTargetProxy = null;
736 if (pTargetNode == null)
738 pTargetProxy = const_cast <LayoutItemProxy*>(__pTargetParent);
742 pTargetProxy = pTargetNode->GetItemProxy();
744 if (pTargetProxy == null)
746 return E_INVALID_ARG;
749 pSourceItemInfo->__targetEdge[sourceEdge] = realTargetEdge;
750 pSourceItemInfo->__pTarget[sourceEdge] = pTargetProxy;
756 RelativeLayout::UnsetAlignment(ProxyListNode& sourceNode, const RelativeLayoutEdge sourceEdge, LayoutItemProxy** ppTargetProxy)
758 RelativeItemInfo* pSourceItemInfo = dynamic_cast <RelativeItemInfo*>(sourceNode.GetItemInfo());
760 if (pSourceItemInfo == null)
762 return E_INVALID_STATE;
765 if (sourceEdge != EDGE_NONE)
767 pSourceItemInfo->__targetEdge[sourceEdge] = EDGE_NONE;
768 if (pSourceItemInfo->__pTarget[sourceEdge] != null)
770 if (ppTargetProxy != null)
772 if (pSourceItemInfo->__pTarget[sourceEdge] != __pTargetParent)
774 *ppTargetProxy = pSourceItemInfo->__pTarget[sourceEdge];
778 *ppTargetProxy = null;
781 pSourceItemInfo->__pTarget[sourceEdge] = null;
785 return E_INVALID_STATE;
794 RelativeLayout::GetAlignment(ProxyListNode& sourceNode, const RelativeLayoutEdge sourceEdge, RelativeLayoutEdge* pTargetEdge)
796 SysTryReturn(NID_UI, sourceEdge >= EDGE_NONE, null, E_OUT_OF_RANGE, "[E_OUT_OF_RANGE] Argument is out of range.");
797 SysTryReturn(NID_UI, sourceEdge <= EDGE_VCENTER, null, E_OUT_OF_RANGE, "[E_OUT_OF_RANGE] Argument is out of range.");
798 RelativeItemInfo* pSourceItemInfo = dynamic_cast <RelativeItemInfo*>(sourceNode.GetItemInfo());
800 SysTryReturn(NID_UI, pSourceItemInfo, null, E_INVALID_STATE, "[E_INVALID_STATE] RelativeItemInfo is invalid.");
802 if (pTargetEdge != null)
804 *pTargetEdge = pSourceItemInfo->__targetEdge[sourceEdge];
807 if (pSourceItemInfo->__pTarget[sourceEdge] != __pTargetParent)
809 return pSourceItemInfo->__pTarget[sourceEdge];
813 return GetContainerProxy();
818 RelativeLayout::IncreaseReference(ProxyListNode& targetNode, ProxyListNode& sourceNode)
820 ProxyList* pProxyList = GetProxyList();
821 SysAssertf(pProxyList != null, "ProxyList is invalid.");
823 RelativeItemInfo* pTargetItemInfo = dynamic_cast <RelativeItemInfo*>(targetNode.GetItemInfo());
824 RelativeItemInfo* pSourceItemInfo = dynamic_cast <RelativeItemInfo*>(sourceNode.GetItemInfo());
826 if (pTargetItemInfo == null || pSourceItemInfo == null)
828 return E_INVALID_STATE;
831 int refCount = pSourceItemInfo->__refCount + 1;
833 if (refCount > pProxyList->GetNodeCount() - 1)
835 return E_INVALID_STATE;
838 if (refCount > pTargetItemInfo->__refCount)
840 pTargetItemInfo->__refCount = refCount;
846 RelativeLayout::GetTargetNode(ProxyListNode& node, RelativeLayoutEdge sourceEdge)
848 ProxyList* pProxyList = GetProxyList();
849 SysAssertf(pProxyList != null, "ProxyList is invalid.");
851 LayoutItemProxy* pProxy = GetAlignment(node, sourceEdge);
852 if (pProxy == null || pProxy == GetContainerProxy())
856 return pProxyList->GetNode(*(pProxy->GetItem()));
860 RelativeLayout::SetZeroReference(ProxyListNode& node, ProxyListNode& baseNode)
862 RelativeItemInfo* pTargetItemInfo = dynamic_cast <RelativeItemInfo*>(node.GetItemInfo());
863 if (pTargetItemInfo == null)
865 return E_INVALID_STATE;
868 //int refCount = ((RelativeProxyList*)_pProxyList)->GetReferenceCount(pBaseNode) + 1;
870 //if (refCount == pTargetItemInfo->__refCount)
872 pTargetItemInfo->__refCount = 0;
878 RelativeLayout::GetTargetPosition(LayoutItemProxy* pTargetProxy, const RelativeLayoutEdge targetEdge, LayoutPoint& targetPoint) const
880 if (pTargetProxy == null)
882 return E_INVALID_ARG;
885 LayoutRect targetRect;
886 if (pTargetProxy == __pTargetParent)
888 targetRect = GetLayoutRect();
892 pTargetProxy->GetItemWindowRect(targetRect);
898 targetPoint.x = targetRect.x;
902 targetPoint.y = targetRect.y;
906 targetPoint.x = targetRect.x + targetRect.w;
910 targetPoint.y = targetRect.y + targetRect.h;
921 RelativeLayout::GetRelativeProxyList(void)
923 return dynamic_cast <RelativeProxyList*>(GetProxyList());
926 }}} // Tizen::Ui::_Layout