Merge "Remove nui api reference warning."
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / Container.cs
1 /*
2  * Copyright(c) 2017 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 using System;
19 using Tizen.NUI.BaseComponents;
20
21 namespace Tizen.NUI
22 {
23     /// <summary>
24     ///
25     /// The Container is an abstract class to be inherited from by classes that desire to have views
26     /// added to them.
27     ///
28     /// </summary>
29     public abstract class Container : Animatable
30     {
31
32         internal Container(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
33         {
34             // No un-managed data hence no need to store a native ptr
35         }
36
37         /// <summary>
38         /// Dispose.
39         /// </summary>
40         /// <since_tizen> 3 </since_tizen>
41         protected override void Dispose(DisposeTypes type)
42         {
43             if (disposed)
44             {
45                 return;
46             }
47
48             base.Dispose(type);
49         }
50
51
52         /// <summary>
53         /// Adds a child view to this Container.
54         /// </summary>
55         /// <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>
56         /// <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>
57         /// <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>
58         /// <param name="view">The child view to add.</param>
59         /// <since_tizen> 4 </since_tizen>
60         public abstract void Add( View view );
61
62         /// <summary>
63         /// Removes a child view from this view. If the view was not a child of this view, this is a no-op.
64         /// </summary>
65         /// <pre>This View(the parent) has been initialized. The child view is not the same as the parent view.</pre>
66         /// <param name="view">The view to remove</param>
67         /// <since_tizen> 4 </since_tizen>
68         public abstract void Remove( View view );
69
70         /// <summary>
71         /// Retrieves the child view by the index.
72         /// </summary>
73         /// <pre>The view has been initialized.</pre>
74         /// <param name="index">The index of the child to retrieve.</param>
75         /// <returns>The view for the given index or empty handle if children are not initialized.</returns>
76         /// <since_tizen> 4 </since_tizen>
77         public abstract View GetChildAt( uint index );
78
79         /// <summary>
80         /// Gets the parent of this container.
81         /// </summary>
82         /// <pre>The child container has been initialized.</pre>
83         /// <returns>The parent container.</returns>
84         protected abstract Container GetParent();
85
86         /// <summary>
87         /// Gets the number of children for this container.
88         /// </summary>
89         /// <pre>The container has been initialized.</pre>
90         /// <returns>The number of children.</returns>
91         protected abstract UInt32 GetChildCount();
92
93         /// <summary>
94         /// Gets the parent container.
95         /// Read only
96         /// </summary>
97         /// <pre>The child container has been initialized.</pre>
98         /// <returns>The parent container.</returns>
99         /// <since_tizen> 4 </since_tizen>
100         public Container Parent
101         {
102             get
103             {
104                 return GetParent();
105             }
106         }
107
108         /// <summary>
109         /// Gets the number of children for this container.
110         /// Read only
111         /// </summary>
112         /// <pre>The container has been initialized.</pre>
113         /// <returns>The number of children.</returns>
114         /// <since_tizen> 4 </since_tizen>
115         public uint ChildCount
116         {
117             get
118             {
119                 return GetChildCount();
120             }
121         }
122     }
123 } // namespace Tizen.NUI