Revert "[NUI] Fix ConvertIdToView (#877)" (#889)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / Container.cs
index 9a96336..8a61ac8 100755 (executable)
-/** 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
+/*
+ * Copyright(c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+using System;
+using System.Collections.Generic;
+using Tizen.NUI.BaseComponents;
+
+namespace Tizen.NUI
+{
+    /// <summary>
+    /// The Container is an abstract class to be inherited from by classes that desire to have views
+    /// added to them.
+    /// </summary>
+    /// <since_tizen> 4 </since_tizen>
+    public abstract class Container : Animatable
+    {
+        internal BaseHandle InternalParent;
+        private List<View> _childViews = new List<View>();
+
+        internal Container(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
+        {
+            // No un-managed data hence no need to store a native ptr
+        }
+
+        /// <summary>
+        /// List of children of Container.
+        /// </summary>
+        /// <since_tizen> 4 </since_tizen>
+        public List<View> Children
+        {
+            get
+            {
+                return _childViews;
+            }
+        }
+
+        /// <summary>
+        /// Gets the parent container.
+        /// Read only
+        /// </summary>
+        /// <pre>The child container has been initialized.</pre>
+        /// <returns>The parent container.</returns>
+        /// <since_tizen> 4 </since_tizen>
+        public Container Parent
+        {
+            get
+            {
+                return GetParent();
+            }
+        }
+
+        /// <summary>
+        /// Gets the number of children for this container.
+        /// Read only
+        /// </summary>
+        /// <pre>The container has been initialized.</pre>
+        /// <returns>The number of children.</returns>
+        /// <since_tizen> 4 </since_tizen>
+        public uint ChildCount
+        {
+            get
+            {
+                return GetChildCount();
+            }
+        }
+
+        /// <summary>
+        /// Adds a child view to this Container.
+        /// </summary>
+        /// <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>
+        /// <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 the 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="view">The child view to add.</param>
+        /// <since_tizen> 4 </since_tizen>
+        public abstract void Add(View view);
+
+        /// <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="view">The view to remove</param>
+        /// <since_tizen> 4 </since_tizen>
+        public abstract void Remove(View view);
+
+        /// <summary>
+        /// Retrieves the child view by the 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 are not initialized.</returns>
+        /// <since_tizen> 4 </since_tizen>
+        public abstract View GetChildAt(uint index);
+
+        /// <summary>
+        /// Gets the parent of this container.
+        /// </summary>
+        /// <pre>The child container has been initialized.</pre>
+        /// <returns>The parent container.</returns>
+        /// <since_tizen> 4 </since_tizen>
+        public abstract Container GetParent();
+
+        /// <summary>
+        /// Gets the number of children for this container.
+        /// </summary>
+        /// <pre>The container has been initialized.</pre>
+        /// <returns>The number of children.</returns>
+        /// <since_tizen> 4 </since_tizen>
+        public abstract UInt32 GetChildCount();
+
+        /// <summary>
+        /// Dispose.
+        /// </summary>
+        /// <since_tizen> 4 </since_tizen>
+        protected override void Dispose(DisposeTypes type)
+        {
+            if (disposed)
+            {
+                return;
+            }
+
+            base.Dispose(type);
+        }
+
+    }
+} // namespace Tizen.NUI