[NUI] Sync with dalihub & API5 branch (#631)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / Layouting / LayoutGroupWrapper.cs
1 /*
2  * Copyright (c) 2018 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 System.ComponentModel;
20 using Tizen.NUI.BaseComponents;
21
22 namespace Tizen.NUI
23 {
24     internal class LayoutGroupWrapper : LayoutItem
25     {
26         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
27         internal LayoutGroupWrapperImpl layoutGroupWrapperImpl;
28
29         internal LayoutGroupWrapper(global::System.IntPtr cPtr, bool cMemoryOwn) : base(LayoutPINVOKE.LayoutGroupWrapper_SWIGUpcast(cPtr), cMemoryOwn)
30         {
31             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
32         }
33
34         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(LayoutGroupWrapper obj)
35         {
36             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
37         }
38
39         protected override void Dispose(DisposeTypes type)
40         {
41             if (disposed)
42             {
43                 return;
44             }
45
46             if (type == DisposeTypes.Explicit)
47             {
48                 //Called by User
49                 //Release your own managed resources here.
50                 //You should release all of your own disposable objects here.
51
52             }
53
54             //Release your own unmanaged resources here.
55             //You should not access any managed member here except static instance.
56             //because the execution order of Finalizes is non-deterministic.
57
58             if (swigCPtr.Handle != global::System.IntPtr.Zero)
59             {
60                 if (swigCMemOwn)
61                 {
62                     swigCMemOwn = false;
63                     LayoutPINVOKE.delete_LayoutGroupWrapper(swigCPtr);
64                 }
65                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
66             }
67
68             base.Dispose(type);
69         }
70
71         public new class ChildProperty
72         {
73             public static readonly int MARGIN_SPECIFICATION = LayoutPINVOKE.LayoutGroupWrapper_ChildProperty_MARGIN_SPECIFICATION_get();
74         }
75
76         public LayoutGroupWrapper() : this(LayoutPINVOKE.new_LayoutGroupWrapper__SWIG_0(), true)
77         {
78             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
79         }
80
81         public LayoutGroupWrapper(LayoutGroupWrapper copy) : this(LayoutPINVOKE.new_LayoutGroupWrapper__SWIG_1(LayoutGroupWrapper.getCPtr(copy)), true)
82         {
83             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
84         }
85
86         public uint Add(LayoutItemWrapper childLayout)
87         {
88             uint ret = LayoutPINVOKE.LayoutGroupWrapper_Add(swigCPtr, LayoutItemWrapper.getCPtr(childLayout));
89             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
90             LayoutChildren.Add(childLayout);
91             return ret;
92         }
93
94         public void Remove(uint childId)
95         {
96             LayoutPINVOKE.LayoutGroupWrapper_Remove__SWIG_0(swigCPtr, childId);
97             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
98         }
99
100         public void Remove(LayoutItemWrapper childLayout)
101         {
102             LayoutPINVOKE.LayoutGroupWrapper_Remove__SWIG_1(swigCPtr, LayoutItemWrapper.getCPtr(childLayout));
103             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
104             LayoutChildren.Remove(childLayout);
105         }
106
107         public LayoutItem GetChildAt(uint index)
108         {
109             if(index >= 0 && index < LayoutChildren.Count)
110             {
111                 LayoutItem layoutItem = LayoutChildren[Convert.ToInt32(index)] as LayoutItem;
112                 return layoutItem;
113             }
114             return null;
115         }
116
117         private uint GetChildCount()
118         {
119             return Convert.ToUInt32(LayoutChildren.Count);
120         }
121
122         public uint ChildCount
123         {
124             get
125             {
126                 return GetChildCount();
127             }
128         }
129
130         public LayoutItemWrapper GetChild(uint childId)
131         {
132             LayoutItemWrapper ret = new LayoutItemWrapper(LayoutPINVOKE.LayoutGroupWrapper_GetChild(swigCPtr, childId), true);
133             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
134             return ret;
135         }
136
137         internal LayoutGroupWrapper(LayoutGroupWrapperImpl implementation) : this(LayoutPINVOKE.new_LayoutGroupWrapper__SWIG_2(LayoutGroupWrapperImpl.getCPtr(implementation)), true)
138         {
139             layoutGroupWrapperImpl = implementation;
140             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
141         }
142
143         public static readonly uint UNKNOWN_ID = LayoutPINVOKE.LayoutGroupWrapper_UNKNOWN_ID_get();
144     }
145 }