805cacc6ecfcc0eb91365c3b8d143d2a064c307c
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / RelayoutContainer.cs
1 /*
2  * Copyright(c) 2019 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
19 namespace Tizen.NUI
20 {
21     using Tizen.NUI.BaseComponents;
22     /// <summary>
23     /// An interface to encapsulate the information required for relayout.
24     /// </summary>
25     /// <since_tizen> 3 </since_tizen>
26     public class RelayoutContainer : Disposable
27     {
28         /// <summary>
29         /// swigCMemOwn
30         /// </summary>
31         /// <since_tizen> 3 </since_tizen>
32         protected bool swigCMemOwn;
33
34         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
35
36         /// <summary>
37         /// Adds relayout information to the container if it doesn't already exist.
38         /// </summary>
39         /// <param name="view">The view to relayout.</param>
40         /// <param name="size">The size to relayout.</param>
41         /// <since_tizen> 3 </since_tizen>
42         public virtual void Add(View view, Size2D size)
43         {
44             Interop.NDalic.RelayoutContainer_Add(swigCPtr, View.getCPtr(view), Size2D.getCPtr(size));
45             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
46         }
47
48         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(RelayoutContainer obj)
49         {
50             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
51         }
52
53         internal RelayoutContainer(global::System.IntPtr cPtr, bool cMemoryOwn)
54         {
55             swigCMemOwn = cMemoryOwn;
56             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
57         }
58
59         /// <summary>
60         /// Dispose.
61         /// </summary>
62         /// <since_tizen> 3 </since_tizen>
63         protected override void Dispose(DisposeTypes type)
64         {
65             if (disposed)
66             {
67                 return;
68             }
69
70             //Release your own unmanaged resources here.
71             //You should not access any managed member here except static instance.
72             //because the execution order of Finalizes is non-deterministic.
73
74             if (swigCPtr.Handle != global::System.IntPtr.Zero)
75             {
76                 if (swigCMemOwn)
77                 {
78                     swigCMemOwn = false;
79                     Interop.NDalic.delete_RelayoutContainer(swigCPtr);
80                 }
81                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
82             }
83             base.Dispose(type);
84         }
85     }
86 }