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