[Tizen] Revert "Adding Container base for Layer and View"
authorminho.sun <minho.sun@samsung.com>
Thu, 17 Aug 2017 10:12:50 +0000 (19:12 +0900)
committerminho.sun <minho.sun@samsung.com>
Thu, 17 Aug 2017 10:12:50 +0000 (19:12 +0900)
This reverts commit 77c3d84e4878a3f2267b7f0c244d7ac74ff736c2.

Signed-off-by: minho.sun <minho.sun@samsung.com>
Conflicts:
Tizen.NUI/src/public/BaseComponents/View.cs
Tizen.NUI/src/public/Layer.cs

Change-Id: I2e0c644f265e3ce4e1a085937c42c691290a4c5d

src/Tizen.NUI/src/public/BaseComponents/View.cs
src/Tizen.NUI/src/public/Container.cs [deleted file]
src/Tizen.NUI/src/public/Layer.cs

index 38fc529..6e35d4c 100755 (executable)
@@ -20,10 +20,12 @@ namespace Tizen.NUI.BaseComponents
     using System;
     using System.Runtime.InteropServices;
 
+
+
     /// <summary>
     /// View is the base class for all views.
     /// </summary>
-    public class View : Container
+    public class View : Animatable //CustomActor => Animatable
     {
         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
 
@@ -38,89 +40,6 @@ namespace Tizen.NUI.BaseComponents
             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
         }
 
-        // From Container Base class
-
-        /// <summary>
-        /// Adds a child view to this View.
-        /// </summary>
-        /// <seealso cref="Container::Add()">
-        /// </seealso>
-        public override void Add(View child)
-        {
-            NDalicPINVOKE.Actor_Add(swigCPtr, View.getCPtr(child));
-            if (NDalicPINVOKE.SWIGPendingException.Pending)
-                throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-        }
-
-        /// <summary>
-        /// Removes a child View from this View. If the view was not a child of this view, this is a no-op.
-        /// </summary>
-        /// <seealso cref="Container::Remove()">
-        /// </seealso>
-        public override void Remove(View child)
-        {
-            NDalicPINVOKE.Actor_Remove(swigCPtr, View.getCPtr(child));
-            if (NDalicPINVOKE.SWIGPendingException.Pending)
-                throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-        }
-
-        /// <summary>
-        /// Retrieves child view by index.
-        /// </summary>
-        /// <seealso cref="Container::GetChildAt()">
-        /// </seealso>
-        public override View GetChildAt(uint index)
-        {
-            IntPtr cPtr = NDalicPINVOKE.Actor_GetChildAt(swigCPtr, index);
-
-            View ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as View;
-
-            if (NDalicPINVOKE.SWIGPendingException.Pending)
-                throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-            return ret ?? null;
-        }
-
-        /// <summary>
-        /// Retrieves the number of children held by the view.
-        /// </summary>
-        /// <seealso cref="Container::GetChildCount()">
-        /// </seealso>
-        protected override uint GetChildCount()
-        {
-            uint ret = NDalicPINVOKE.Actor_GetChildCount(swigCPtr);
-            if (NDalicPINVOKE.SWIGPendingException.Pending)
-                throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-            return ret;
-        }
-
-        /// <summary>
-        /// Get the Views parent
-        /// </summary>
-        /// <seealso cref="Container::GetParent()">
-
-        protected override Container GetParent()
-        {
-            Container ret;
-            IntPtr cPtr = NDalicPINVOKE.Actor_GetParent(swigCPtr);
-
-            BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(cPtr);
-
-            if(basehandle is Layer)
-            {
-                ret = basehandle as Layer;
-            }
-            else
-            {
-                ret = basehandle as View;
-            }
-
-            if (NDalicPINVOKE.SWIGPendingException.Pending)
-                throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-            return ret;
-        }
-
-        ///
-
         // you can override it to clean-up your own resources.
         protected override void Dispose(DisposeTypes type)
         {
@@ -1011,10 +930,9 @@ namespace Tizen.NUI.BaseComponents
         {
             View view = null;
 
-            if (Parent is View)
+            if (Parent)
             {
-                View parentView = Parent as View;
-                view = parentView.FindChildById(id);
+                view = Parent.FindChildById(id);
             }
 
             if (!view)
@@ -1868,7 +1786,7 @@ namespace Tizen.NUI.BaseComponents
         {
             get
             {
-                return GetParent() as View;
+                return GetParent();
             }
         }
 
@@ -2217,6 +2135,32 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
+        /// Adds a child view to this View.
+        /// </summary>
+        /// <pre>This View(the parent) has been initialized. The child view has been initialized. The child view is not the same as the parent view.</pre>
+        /// <post>The child will be referenced by its parent. This means that the child will be kept alive, even if the handle passed into this method is reset or destroyed.</post>
+        /// <remarks>If the child already has a parent, it will be removed from old parent and reparented to this view. This may change child's position, color, scale etc as it now inherits them from this view.</remarks>
+        /// <param name="child">The child</param>
+        public void Add(View child)
+        {
+            NDalicPINVOKE.Actor_Add(swigCPtr, View.getCPtr(child));
+            if (NDalicPINVOKE.SWIGPendingException.Pending)
+                throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
+
+        /// <summary>
+        /// Removes a child View from this View. If the view was not a child of this view, this is a no-op.
+        /// </summary>
+        /// <pre>This View(the parent) has been initialized. The child view is not the same as the parent view.</pre>
+        /// <param name="child">The child</param>
+        public void Remove(View child)
+        {
+            NDalicPINVOKE.Actor_Remove(swigCPtr, View.getCPtr(child));
+            if (NDalicPINVOKE.SWIGPendingException.Pending)
+                throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
+
+        /// <summary>
         /// Removes a View from its Parent View / Layer. If the View has no parent, this method does nothing.
         /// </summary>
         /// <pre>The (child) View has been initialized. </pre>
@@ -2228,6 +2172,36 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
+        /// Retrieves the number of children held by the view.
+        /// </summary>
+        /// <pre>The View has been initialized.</pre>
+        /// <returns>The number of children</returns>
+        internal uint GetChildCount()
+        {
+            uint ret = NDalicPINVOKE.Actor_GetChildCount(swigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending)
+                throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret;
+        }
+
+        /// <summary>
+        /// Retrieves child view by index.
+        /// </summary>
+        /// <pre>The View has been initialized.</pre>
+        /// <param name="index">The index of the child to retrieve</param>
+        /// <returns>The view for the given index or empty handle if children not initialized</returns>
+        public View GetChildAt(uint index)
+        {
+            IntPtr cPtr = NDalicPINVOKE.Actor_GetChildAt(swigCPtr, index);
+
+            View ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as View;
+
+            if (NDalicPINVOKE.SWIGPendingException.Pending)
+                throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret ?? null;
+        }
+
+        /// <summary>
         /// Search through this view's hierarchy for an view with the given name.
         /// The view itself is also considered in the search.
         /// </summary>
@@ -2256,7 +2230,7 @@ namespace Tizen.NUI.BaseComponents
             return ret;
         }
 
-        /*internal View GetParent()
+        internal View GetParent()
         {
             View ret;
             IntPtr cPtr = NDalicPINVOKE.Actor_GetParent(swigCPtr);
@@ -2275,7 +2249,7 @@ namespace Tizen.NUI.BaseComponents
             if (NDalicPINVOKE.SWIGPendingException.Pending)
                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             return ret;
-        }*/
+        }
 
         internal void SetParentOrigin(Vector3 origin)
         {
@@ -3370,6 +3344,17 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
+        /// Get the number of children held by the view.
+        /// </summary>
+        public uint ChildCount
+        {
+            get
+            {
+                return GetChildCount();
+            }
+        }
+
+        /// <summary>
         /// Gets the View's ID.
         /// Readonly
         /// </summary>
diff --git a/src/Tizen.NUI/src/public/Container.cs b/src/Tizen.NUI/src/public/Container.cs
deleted file mode 100755 (executable)
index 9a96336..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-/** Copyright (c) 2017 Samsung Electronics Co., Ltd.\r
-*\r
-* Licensed under the Apache License, Version 2.0 (the "License");\r
-* you may not use this file except in compliance with the License.\r
-* You may obtain a copy of the License at\r
-*\r
-* http://www.apache.org/licenses/LICENSE-2.0\r
-*\r
-* Unless required by applicable law or agreed to in writing, software\r
-* distributed under the License is distributed on an "AS IS" BASIS,\r
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-* See the License for the specific language governing permissions and\r
-* limitations under the License.\r
-*\r
-*/\r
-\r
-using System;\r
-using Tizen.NUI.BaseComponents;\r
-\r
-namespace Tizen.NUI\r
-{\r
-    /// <summary>\r
-    ///\r
-    /// Container is an abstract class to be inherited from by classes that desire to have Views\r
-    /// added to them.\r
-    ///\r
-    /// </summary>\r
-\r
-    public abstract class Container : Animatable\r
-    {\r
-\r
-        internal Container(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)\r
-        {\r
-            // No un-managed data hence no need to store a native ptr\r
-        }\r
-\r
-        protected override void Dispose(DisposeTypes type)\r
-        {\r
-            if (disposed)\r
-            {\r
-                return;\r
-            }\r
-\r
-            base.Dispose(type);\r
-        }\r
-\r
-\r
-        /// <summary>\r
-        /// Adds a child view to this Container.\r
-        /// </summary>\r
-        /// <pre>This Container(the parent) has been initialized. The child view has been initialized. The child view is not the same as the parent view.</pre>\r
-        /// <post>The child will be referenced by its parent. This means that the child will be kept alive, even if the handle passed into this method is reset or destroyed.</post>\r
-        /// <remarks>If the child already has a parent, it will be removed from old parent and reparented to this view. This may change child's position, color, scale etc as it now inherits them from this view.</remarks>\r
-        /// <param name="view">The child view to add</param>\r
-        public abstract void Add( View view );\r
-\r
-        /// <summary>\r
-        /// Removes a child View from this View. If the view was not a child of this view, this is a no-op.\r
-        /// </summary>\r
-        /// <pre>This View(the parent) has been initialized. The child view is not the same as the parent view.</pre>\r
-        /// <param name="child">The child</param>\r
-        public abstract void Remove( View view );\r
-\r
-        /// <summary>\r
-        /// Retrieves child view by index.\r
-        /// </summary>\r
-        /// <pre>The View has been initialized.</pre>\r
-        /// <param name="index">The index of the child to retrieve</param>\r
-        /// <returns>The view for the given index or empty handle if children not initialized</returns>\r
-        public abstract View GetChildAt( uint index );\r
-\r
-        /// <summary>\r
-        /// Get the parent of this container\r
-        /// </summary>\r
-        /// <pre>The child container has been initialized.</pre>\r
-        /// <returns>The parent container</returns>\r
-        protected abstract Container GetParent();\r
-\r
-        /// <summary>\r
-        /// Get the number of children for this container\r
-        /// </summary>\r
-        /// <pre>The container has been initialized.</pre>\r
-        /// <returns>number of children</returns>\r
-        protected abstract UInt32 GetChildCount();\r
-\r
-        /// <summary>\r
-        /// Get the parent Container\r
-        /// Read only\r
-        /// </summary>\r
-        /// <pre>The child container has been initialized.</pre>\r
-        /// <returns>The parent container</returns>\r
-        public Container Parent\r
-        {\r
-            get\r
-            {\r
-                return GetParent();\r
-            }\r
-        }\r
-\r
-        /// <summary>\r
-        /// Get the number of children for this container\r
-        /// Read only\r
-        /// </summary>\r
-        /// <pre>The container has been initialized.</pre>\r
-        /// <returns>number of children</returns>\r
-        public uint ChildCount\r
-        {\r
-            get\r
-            {\r
-                return GetChildCount();\r
-            }\r
-        }\r
-    }\r
-} // namespace Tizen.NUI
\ No newline at end of file
index b7ced1b..17179f8 100755 (executable)
@@ -22,7 +22,7 @@ namespace Tizen.NUI
     /// <summary>
     /// Layers provide a mechanism for overlaying groups of actors on top of each other.
     /// </summary>
-    public class Layer : Container
+    public class Layer : Animatable
     {
         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
 
@@ -36,66 +36,6 @@ namespace Tizen.NUI
             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
         }
 
-        /// from Container base class
-
-        /// <summary>
-        /// Adds a child view to this layer.
-        /// </summary>
-        /// <seealso cref="Container::Add()">
-        /// </seealso>
-        public override void Add(View child)
-        {
-            NDalicPINVOKE.Actor_Add(swigCPtr, View.getCPtr(child));
-            if (NDalicPINVOKE.SWIGPendingException.Pending)
-                throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-        }
-
-        /// <summary>
-        /// Removes a child View from this layer. If the view was not a child of this layer, this is a no-op.
-        /// </summary>
-        /// <seealso cref="Container::Add()">
-        /// </seealso>
-        public override void Remove(View child)
-        {
-            NDalicPINVOKE.Actor_Remove(swigCPtr, View.getCPtr(child));
-            if (NDalicPINVOKE.SWIGPendingException.Pending)
-                throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-        }
-
-        /// <summary>
-        /// Retrieves child view by index.
-        /// </summary>
-        /// <pre>The View has been initialized.</pre>
-        /// <param name="index">The index of the child to retrieve</param>
-        /// <returns>The view for the given index or empty handle if children not initialized</returns>
-        public override View GetChildAt(uint index)
-        {
-            System.IntPtr cPtr = NDalicPINVOKE.Actor_GetChildAt(swigCPtr, index);
-
-            View ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as View;
-
-            if (NDalicPINVOKE.SWIGPendingException.Pending)
-                throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-
-            return ret ?? null;
-        }
-
-
-        protected override Container GetParent()
-        {
-            return null;
-        }
-
-        protected override uint GetChildCount()
-        {
-            uint ret = NDalicPINVOKE.Actor_GetChildCount(swigCPtr);
-            if (NDalicPINVOKE.SWIGPendingException.Pending)
-                throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-            return ret;
-        }
-
-        ///
-
         protected override void Dispose(DisposeTypes type)
         {
             if(disposed)
@@ -186,6 +126,32 @@ namespace Tizen.NUI
         }
 
         /// <summary>
+        /// Adds a child view to this layer.
+        /// </summary>
+        /// <pre>This layer(the parent) has been initialized. The child view has been initialized. The child view is not the same as the parent layer.</pre>
+        /// <post>The child will be referenced by its parent. This means that the child will be kept alive, even if the handle passed into this method is reset or destroyed.</post>
+        /// <remarks>If the child already has a parent, it will be removed from old parent and reparented to this layer. This may change child's position, color, scale etc as it now inherits them from this layer.</remarks>
+        /// <param name="child">The child</param>
+        public void Add(View child)
+        {
+            NDalicPINVOKE.Actor_Add(swigCPtr, View.getCPtr(child));
+            if (NDalicPINVOKE.SWIGPendingException.Pending)
+                throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
+
+        /// <summary>
+        /// Removes a child View from this layer. If the view was not a child of this layer, this is a no-op.
+        /// </summary>
+        /// <pre>This layer(the parent) has been initialized. The child view is not the same as the parent view.</pre>
+        /// <param name="child">The child</param>
+        public void Remove(View child)
+        {
+            NDalicPINVOKE.Actor_Remove(swigCPtr, View.getCPtr(child));
+            if (NDalicPINVOKE.SWIGPendingException.Pending)
+                throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
+
+        /// <summary>
         /// Queries the depth of the layer.<br>
         /// 0 is the bottom most layer, higher number is on top.<br>
         /// </summary>
@@ -320,6 +286,24 @@ namespace Tizen.NUI
         }
 
         /// <summary>
+        /// Retrieves child view by index.
+        /// </summary>
+        /// <pre>The View has been initialized.</pre>
+        /// <param name="index">The index of the child to retrieve</param>
+        /// <returns>The view for the given index or empty handle if children not initialized</returns>
+        public View GetChildAt(uint index)
+        {
+            System.IntPtr cPtr = NDalicPINVOKE.Actor_GetChildAt(swigCPtr, index);
+
+            View ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as View;
+
+            if (NDalicPINVOKE.SWIGPendingException.Pending)
+                throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+
+            return ret ?? null;
+        }
+
+        /// <summary>
         /// Enumeration for the behavior of the layer.
         /// </summary>
         public enum LayerBehavior