[Tizen] nui 0.2.52 version change
[platform/core/csapi/nui.git] / Tizen.NUI / src / public / Container.cs
1 /** Copyright (c) 2017 Samsung Electronics Co., Ltd.\r
2 *\r
3 * Licensed under the Apache License, Version 2.0 (the "License");\r
4 * you may not use this file except in compliance with the License.\r
5 * You may obtain a copy of the License at\r
6 *\r
7 * http://www.apache.org/licenses/LICENSE-2.0\r
8 *\r
9 * Unless required by applicable law or agreed to in writing, software\r
10 * distributed under the License is distributed on an "AS IS" BASIS,\r
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
12 * See the License for the specific language governing permissions and\r
13 * limitations under the License.\r
14 *\r
15 */\r
16 \r
17 using System;\r
18 using Tizen.NUI.BaseComponents;\r
19 \r
20 namespace Tizen.NUI\r
21 {\r
22     /// <summary>\r
23     ///\r
24     /// Container is an abstract class to be inherited from by classes that desire to have Views\r
25     /// added to them.\r
26     ///\r
27     /// </summary>\r
28 \r
29     public abstract class Container : Animatable\r
30     {\r
31 \r
32         internal Container(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)\r
33         {\r
34             // No un-managed data hence no need to store a native ptr\r
35         }\r
36 \r
37         protected override void Dispose(DisposeTypes type)\r
38         {\r
39             if (disposed)\r
40             {\r
41                 return;\r
42             }\r
43 \r
44             base.Dispose(type);\r
45         }\r
46 \r
47 \r
48         /// <summary>\r
49         /// Adds a child view to this Container.\r
50         /// </summary>\r
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>\r
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>\r
53         /// <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
54         /// <param name="view">The child view to add</param>\r
55         public abstract void Add( View view );\r
56 \r
57         /// <summary>\r
58         /// Removes a child View from this View. If the view was not a child of this view, this is a no-op.\r
59         /// </summary>\r
60         /// <pre>This View(the parent) has been initialized. The child view is not the same as the parent view.</pre>\r
61         /// <param name="child">The child</param>\r
62         public abstract void Remove( View view );\r
63 \r
64         /// <summary>\r
65         /// Retrieves child view by index.\r
66         /// </summary>\r
67         /// <pre>The View has been initialized.</pre>\r
68         /// <param name="index">The index of the child to retrieve</param>\r
69         /// <returns>The view for the given index or empty handle if children not initialized</returns>\r
70         public abstract View GetChildAt( uint index );\r
71 \r
72         /// <summary>\r
73         /// Get the parent of this container\r
74         /// </summary>\r
75         /// <pre>The child container has been initialized.</pre>\r
76         /// <returns>The parent container</returns>\r
77         protected abstract Container GetParent();\r
78 \r
79         /// <summary>\r
80         /// Get the number of children for this container\r
81         /// </summary>\r
82         /// <pre>The container has been initialized.</pre>\r
83         /// <returns>number of children</returns>\r
84         protected abstract UInt32 GetChildCount();\r
85 \r
86         /// <summary>\r
87         /// Get the parent Container\r
88         /// Read only\r
89         /// </summary>\r
90         /// <pre>The child container has been initialized.</pre>\r
91         /// <returns>The parent container</returns>\r
92         public Container Parent\r
93         {\r
94             get\r
95             {\r
96                 return GetParent();\r
97             }\r
98         }\r
99 \r
100         /// <summary>\r
101         /// Get the number of children for this container\r
102         /// Read only\r
103         /// </summary>\r
104         /// <pre>The container has been initialized.</pre>\r
105         /// <returns>number of children</returns>\r
106         public uint ChildCount\r
107         {\r
108             get\r
109             {\r
110                 return GetChildCount();\r
111             }\r
112         }\r
113     }\r
114 } // namespace Tizen.NUI