2 * Copyright(c) 2017 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 using System.Collections.Generic;
20 using Tizen.NUI.BaseComponents;
25 /// The Container is an abstract class to be inherited from by classes that desire to have views
28 /// <since_tizen> 4 </since_tizen>
29 public abstract class Container : Animatable
32 private List<View> _childViews = new List<View>();
35 /// List of children of Container.
37 /// <since_tizen> 4 </since_tizen>
38 public List<View> Children
46 internal Container(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
48 // No un-managed data hence no need to store a native ptr
54 /// <since_tizen> 4 </since_tizen>
55 protected override void Dispose(DisposeTypes type)
66 /// Adds a child view to this Container.
68 /// <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>
69 /// <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>
70 /// <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>
71 /// <param name="view">The child view to add.</param>
72 /// <since_tizen> 4 </since_tizen>
73 public abstract void Add( View view );
76 /// Removes a child view from this view. If the view was not a child of this view, this is a no-op.
78 /// <pre>This View(the parent) has been initialized. The child view is not the same as the parent view.</pre>
79 /// <param name="view">The view to remove</param>
80 /// <since_tizen> 4 </since_tizen>
81 public abstract void Remove( View view );
84 /// Retrieves the child view by the index.
86 /// <pre>The view has been initialized.</pre>
87 /// <param name="index">The index of the child to retrieve.</param>
88 /// <returns>The view for the given index or empty handle if children are not initialized.</returns>
89 /// <since_tizen> 4 </since_tizen>
90 public abstract View GetChildAt( uint index );
93 /// Gets the parent of this container.
95 /// <pre>The child container has been initialized.</pre>
96 /// <returns>The parent container.</returns>
97 /// <since_tizen> 4 </since_tizen>
98 public abstract Container GetParent();
101 /// Gets the number of children for this container.
103 /// <pre>The container has been initialized.</pre>
104 /// <returns>The number of children.</returns>
105 /// <since_tizen> 4 </since_tizen>
106 public abstract UInt32 GetChildCount();
109 /// Gets the parent container.
112 /// <pre>The child container has been initialized.</pre>
113 /// <returns>The parent container.</returns>
114 /// <since_tizen> 4 </since_tizen>
115 public new Container Parent
124 /// Gets the number of children for this container.
127 /// <pre>The container has been initialized.</pre>
128 /// <returns>The number of children.</returns>
129 /// <since_tizen> 4 </since_tizen>
130 public uint ChildCount
134 return GetChildCount();
138 } // namespace Tizen.NUI