Change ownership policy of SearchBar::SetContent() and SplitPanel::SetPane() function
authorjaewon7.cho <jaewon7.cho@samsung.com>
Sat, 30 Mar 2013 07:10:21 +0000 (16:10 +0900)
committerjaewon7.cho <jaewon7.cho@samsung.com>
Sat, 30 Mar 2013 07:10:21 +0000 (16:10 +0900)
Change-Id: Ib180de6d4dfef52a2a87c0ffc48b9ebff838c00a
Signed-off-by: jaewon7.cho <jaewon7.cho@samsung.com>
src/ui/FUi_ContainerImpl.cpp
src/ui/FUi_ControlImpl.cpp
src/ui/controls/FUiCtrl_SearchBarImpl.cpp [changed mode: 0644->0755]
src/ui/controls/FUiCtrl_SplitPanel.cpp [changed mode: 0644->0755]
src/ui/inc/FUi_Control.h
src/ui/inc/FUi_ControlImpl.h

index 85069b9..84a3113 100755 (executable)
@@ -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;
index 2a9abea..baf2c41 100755 (executable)
@@ -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;
old mode 100644 (file)
new mode 100755 (executable)
index 5227180..c6ea90b
@@ -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 <Control*>(pContent);
old mode 100644 (file)
new mode 100755 (executable)
index 573b1e1..c964217
@@ -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();
 }
 
index 03b29bf..20ed139 100755 (executable)
@@ -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);
index fe91294..c929dbd 100755 (executable)
@@ -373,6 +373,7 @@ protected:
        static result CheckConstruction(_Control* pCore, _ControlImpl* pImpl); // Use this in the Factory methods.
 
        typedef Tizen::Base::Collection::LinkedListT <Tizen::Base::Runtime::IEventListener*> PublicEventListenerList;
+       typedef Tizen::Base::Collection::ArrayListT<_Control*> ControlList;
        PublicEventListenerList* CreatePublicEventListenerListN(void) const;
 
        void SetMovable(bool movable);