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