Merge "[Multimedia] Added InternalsVisibleTo attribute for Radio."
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / Extents.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 namespace Tizen.NUI
19 {
20     /// <summary>
21     /// Extents class describing the a collection of uint16_t.
22     /// </summary>
23     public class Extents : global::System.IDisposable
24     {
25         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
26         protected bool swigCMemOwn;
27
28         internal Extents(global::System.IntPtr cPtr, bool cMemoryOwn)
29         {
30             swigCMemOwn = cMemoryOwn;
31             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
32         }
33
34         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Extents obj)
35         {
36             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
37         }
38
39         //A Flag to check who called Dispose(). (By User or DisposeQueue)
40         private bool isDisposeQueued = false;
41         //A Flat to check if it is already disposed.
42         protected bool disposed = false;
43
44         /// <summary>
45         /// Destructor.
46         /// </summary>
47         /// <since_tizen> 4 </since_tizen>
48         ~Extents()
49         {
50             if (!isDisposeQueued)
51             {
52                 isDisposeQueued = true;
53                 DisposeQueue.Instance.Add(this);
54             }
55         }
56
57         /// <summary>
58         /// To make a Extents instance be disposed.
59         /// </summary>
60         /// <since_tizen> 4 </since_tizen>
61         public void Dispose()
62         {
63             //Throw excpetion if Dispose() is called in separate thread.
64             if (!Window.IsInstalled())
65             {
66                 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
67             }
68
69             if (isDisposeQueued)
70             {
71                 Dispose(DisposeTypes.Implicit);
72             }
73             else
74             {
75                 Dispose(DisposeTypes.Explicit);
76                 System.GC.SuppressFinalize(this);
77             }
78         }
79
80         protected virtual void Dispose(DisposeTypes type)
81         {
82             if (disposed)
83             {
84                 return;
85             }
86
87             if (type == DisposeTypes.Explicit)
88             {
89                 //Called by User
90                 //Release your own managed resources here.
91                 //You should release all of your own disposable objects here.
92             }
93
94             //Release your own unmanaged resources here.
95             //You should not access any managed member here except static instance.
96             //because the execution order of Finalizes is non-deterministic.
97
98             if (swigCPtr.Handle != global::System.IntPtr.Zero)
99             {
100                 if (swigCMemOwn)
101                 {
102                     swigCMemOwn = false;
103                     NDalicPINVOKE.delete_Extents(swigCPtr);
104                 }
105                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
106             }
107             disposed = true;
108         }
109
110         /// <summary>
111         /// Constructor.
112         /// </summary>
113         /// <since_tizen> 4 </since_tizen>
114         public Extents() : this(NDalicPINVOKE.new_Extents__SWIG_0(), true)
115         {
116             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
117         }
118
119         /// <summary>
120         /// Constructor.
121         /// </summary>
122         /// <param name="copy">A reference to the copied Extents.</param>
123         /// <since_tizen> 4 </since_tizen>
124         public Extents(Extents copy) : this(NDalicPINVOKE.new_Extents__SWIG_1(Extents.getCPtr(copy)), true)
125         {
126             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
127         }
128
129         /// <summary>
130         /// Constructor.
131         /// <param name="start">Start extent.</param>
132         /// <param name="end">End extent.</param>
133         /// <param name="top">Top extent.</param>
134         /// <param name="bottom">Bottom extent.</param>
135         /// </summary>
136         /// <since_tizen> 4 </since_tizen>
137         public Extents(ushort start, ushort end, ushort top, ushort bottom) : this(NDalicPINVOKE.new_Extents__SWIG_2(start, end, top, bottom), true)
138         {
139             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
140         }
141
142         internal Extents Assign(SWIGTYPE_p_uint16_t array)
143         {
144             Extents ret = new Extents(NDalicPINVOKE.Extents_Assign__SWIG_1(swigCPtr, SWIGTYPE_p_uint16_t.getCPtr(array)), false);
145             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
146             return ret;
147         }
148
149         internal Extents Assign(Extents copy)
150         {
151             Extents ret = new Extents(NDalicPINVOKE.Extents_Assign__SWIG_0(swigCPtr, Extents.getCPtr(copy)), false);
152             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
153             return ret;
154         }
155
156         /// <summary>
157         /// Equality operator.
158         /// </summary>
159         /// <param name="rhs">The Extents to test against.</param>
160         /// <returns>True if the extents are not equal.</returns>
161         /// <since_tizen> 4 </since_tizen>
162         public bool EqualTo(Extents rhs)
163         {
164             bool ret = NDalicPINVOKE.Extents_EqualTo(swigCPtr, Extents.getCPtr(rhs));
165             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
166             return ret;
167         }
168
169         /// <summary>
170         /// Inequality operator.
171         /// </summary>
172         /// <param name="rhs">The Extents to test against.</param>
173         /// <returns>True if the extents are not equal.</returns>
174         /// <since_tizen> 4 </since_tizen>
175         public bool NotEqualTo(Extents rhs)
176         {
177             bool ret = NDalicPINVOKE.Extents_NotEqualTo(swigCPtr, Extents.getCPtr(rhs));
178             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
179             return ret;
180         }
181
182         /// <summary>
183         /// The Start extent.
184         /// </summary>
185         /// <since_tizen> 4 </since_tizen>
186         public ushort Start
187         {
188             set
189             {
190                 NDalicPINVOKE.Extents_start_set(swigCPtr, value);
191                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
192             }
193             get
194             {
195                 ushort ret = NDalicPINVOKE.Extents_start_get(swigCPtr);
196                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
197                 return ret;
198             }
199         }
200
201         /// <summary>
202         /// The End extend.
203         /// </summary>
204         /// <since_tizen> 4 </since_tizen>
205         public ushort End
206         {
207             set
208             {
209                 NDalicPINVOKE.Extents_end_set(swigCPtr, value);
210                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
211             }
212             get
213             {
214                 ushort ret = NDalicPINVOKE.Extents_end_get(swigCPtr);
215                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
216                 return ret;
217             }
218         }
219
220         /// <summary>
221         /// The Top extend.
222         /// </summary>
223         /// <since_tizen> 4 </since_tizen>
224         public ushort Top
225         {
226             set
227             {
228                 NDalicPINVOKE.Extents_top_set(swigCPtr, value);
229                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
230             }
231             get
232             {
233                 ushort ret = NDalicPINVOKE.Extents_top_get(swigCPtr);
234                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
235                 return ret;
236             }
237         }
238
239         /// <summary>
240         /// The Bottom Extend.
241         /// </summary>
242         /// <since_tizen> 4 </since_tizen>
243         public ushort Bottom
244         {
245             set
246             {
247                 NDalicPINVOKE.Extents_bottom_set(swigCPtr, value);
248                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
249             }
250             get
251             {
252                 ushort ret = NDalicPINVOKE.Extents_bottom_get(swigCPtr);
253                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
254                 return ret;
255             }
256         }
257
258     }
259
260 }