1 /** Copyright (c) 2017 Samsung Electronics Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
18 using Tizen.NUI.BaseComponents;
24 /// The Container is an abstract class to be inherited from by classes that desire to have views
29 public abstract class Container : Animatable
32 internal Container(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
34 // No un-managed data hence no need to store a native ptr
37 protected override void Dispose(DisposeTypes type)
49 /// Adds a child view to this Container.
51 /// <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>
52 /// <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>
53 /// <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>
54 /// <param name="view">The child view to add.</param>
55 public abstract void Add( View view );
58 /// Removes a child view from this view. If the view was not a child of this view, this is a no-op.
60 /// <pre>This view (the parent) has been initialized. The child view is not the same as the parent view.</pre>
61 /// <param name="child">The child.</param>
62 public abstract void Remove( View view );
65 /// Retrieves the child view by the index.
67 /// <pre>The view has been initialized.</pre>
68 /// <param name="index">The index of the child to retrieve.</param>
69 /// <returns>The view for the given index or empty handle if children are not initialized.</returns>
70 public abstract View GetChildAt( uint index );
73 /// Gets the parent of this container.
75 /// <pre>The child container has been initialized.</pre>
76 /// <returns>The parent container.</returns>
77 protected abstract Container GetParent();
80 /// Gets the number of children for this container.
82 /// <pre>The container has been initialized.</pre>
83 /// <returns>The number of children.</returns>
84 protected abstract UInt32 GetChildCount();
87 /// Gets the parent container.
90 /// <pre>The child container has been initialized.</pre>
91 /// <returns>The parent container.</returns>
92 public Container Parent
101 /// Gets the number of children for this container.
104 /// <pre>The container has been initialized.</pre>
105 /// <returns>The number of children.</returns>
106 public uint ChildCount
110 return GetChildCount();
114 } // namespace Tizen.NUI