From 7ae59ed561139034532505643f19b58ae92d98c5 Mon Sep 17 00:00:00 2001 From: "jaewon7.cho" Date: Sat, 30 Mar 2013 16:10:21 +0900 Subject: [PATCH] Change ownership policy of SearchBar::SetContent() and SplitPanel::SetPane() function Change-Id: Ib180de6d4dfef52a2a87c0ffc48b9ebff838c00a Signed-off-by: jaewon7.cho --- src/ui/FUi_ContainerImpl.cpp | 9 +++++++++ src/ui/FUi_ControlImpl.cpp | 7 +++++++ src/ui/controls/FUiCtrl_SearchBarImpl.cpp | 28 ---------------------------- src/ui/controls/FUiCtrl_SplitPanel.cpp | 16 ---------------- src/ui/inc/FUi_Control.h | 6 +++--- src/ui/inc/FUi_ControlImpl.h | 1 + 6 files changed, 20 insertions(+), 47 deletions(-) mode change 100644 => 100755 src/ui/controls/FUiCtrl_SearchBarImpl.cpp mode change 100644 => 100755 src/ui/controls/FUiCtrl_SplitPanel.cpp diff --git a/src/ui/FUi_ContainerImpl.cpp b/src/ui/FUi_ContainerImpl.cpp index 85069b9..84a3113 100755 --- a/src/ui/FUi_ContainerImpl.cpp +++ b/src/ui/FUi_ContainerImpl.cpp @@ -186,6 +186,15 @@ _ContainerImpl::Destroy(void) { r = pParent->RemoveChild(this, false); } + else + { + _Control* pParent = GetCore().GetParent(); + if (pParent) + { + ControlList& children = pParent->GetChildList(); + r = children.Remove(&GetCore()); + } + } RemoveAllChildren(true); Container* pContainer = &GetPublic(); delete pContainer; diff --git a/src/ui/FUi_ControlImpl.cpp b/src/ui/FUi_ControlImpl.cpp index 2a9abea..baf2c41 100755 --- a/src/ui/FUi_ControlImpl.cpp +++ b/src/ui/FUi_ControlImpl.cpp @@ -336,6 +336,13 @@ _ControlImpl::Destroy(void) } else { + _Control* pParent = GetCore().GetParent(); + if (pParent) + { + ControlList& children = pParent->GetChildList(); + r = children.Remove(&GetCore()); + } + Control* pControl= &GetPublic(); delete pControl; pControl = null; diff --git a/src/ui/controls/FUiCtrl_SearchBarImpl.cpp b/src/ui/controls/FUiCtrl_SearchBarImpl.cpp old mode 100644 new mode 100755 index 5227180..c6ea90b --- a/src/ui/controls/FUiCtrl_SearchBarImpl.cpp +++ b/src/ui/controls/FUiCtrl_SearchBarImpl.cpp @@ -321,34 +321,6 @@ _SearchBarImpl::SetContent(const Control* pContent) "[E_INVALID_ARG] Invalid argument(s) is used. The content cannot be set."); } - if (__pContentControl != null) - { - _Control& contentControl = _ControlImpl::GetInstance(*__pContentControl)->GetCore(); - - if (pContent != null) - { - const _Control& content = _ControlImpl::GetInstance(*pContent)->GetCore(); - - if (contentControl.GetHandle() == content.GetHandle()) - { - return r; - } - } - - _Control* pContainer = __pSearchBar->GetSearchBarContainer(); - - if (pContainer) - { - pContainer->DetachChild(contentControl); - - if (_AppInfo::GetApiVersion() == _API_VERSION_2_0 && _AppInfo::IsOspCompat()) - { - delete __pContentControl; - } - __pContentControl = null; - } - } - if (pContent != null && __pContentControl == null) { __pContentControl = const_cast (pContent); diff --git a/src/ui/controls/FUiCtrl_SplitPanel.cpp b/src/ui/controls/FUiCtrl_SplitPanel.cpp old mode 100644 new mode 100755 index 573b1e1..c964217 --- a/src/ui/controls/FUiCtrl_SplitPanel.cpp +++ b/src/ui/controls/FUiCtrl_SplitPanel.cpp @@ -256,22 +256,6 @@ _SplitPanel::~_SplitPanel(void) __pDividerVisualElement = null; } - if (__pFirstPaneParent) - { - DetachChild(*__pFirstPaneParent); - - delete __pFirstPaneParent; - __pFirstPaneParent = null; - } - - if (__pSecondPaneParent) - { - DetachChild(*__pSecondPaneParent); - - delete __pSecondPaneParent; - __pSecondPaneParent = null; - } - ClearLastResult(); } diff --git a/src/ui/inc/FUi_Control.h b/src/ui/inc/FUi_Control.h index 03b29bf..20ed139 100755 --- a/src/ui/inc/FUi_Control.h +++ b/src/ui/inc/FUi_Control.h @@ -281,6 +281,9 @@ public: _Control* GetChild(int index) const; int GetChildCount(void) const; + const ControlList& GetChildList(void) const; + ControlList& GetChildList(void); + result AttachChild(_Control& child); result InsertChildToBottom(_Control& child); result InsertChildAfter(const _Control& targetChild, _Control& child); @@ -556,9 +559,6 @@ private: result SetBoundsFinal(const Tizen::Graphics::FloatRectangle& newBounds, bool changeLayoutBaseRect, bool callBoundsChangeCallbacks); result UpdateBoundsOfVisualElement(const Tizen::Graphics::FloatRectangle& controlBounds); result AdjustAbsoluteBounds(void); - - const ControlList& GetChildList(void) const; - ControlList& GetChildList(void); result StartAttaching(_Control& child, _ControlArea area); result EndAttaching(_Control& child); void SetParent(_Control* pParent); diff --git a/src/ui/inc/FUi_ControlImpl.h b/src/ui/inc/FUi_ControlImpl.h index fe91294..c929dbd 100755 --- a/src/ui/inc/FUi_ControlImpl.h +++ b/src/ui/inc/FUi_ControlImpl.h @@ -373,6 +373,7 @@ protected: static result CheckConstruction(_Control* pCore, _ControlImpl* pImpl); // Use this in the Factory methods. typedef Tizen::Base::Collection::LinkedListT PublicEventListenerList; + typedef Tizen::Base::Collection::ArrayListT<_Control*> ControlList; PublicEventListenerList* CreatePublicEventListenerListN(void) const; void SetMovable(bool movable); -- 2.7.4