Merge "[Multimedia] Replaced '\n' with the br tag in the doc-comments."
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / PaddingType.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
21     using System;
22
23     /// <summary>
24     /// The gesture state.
25     /// </summary>
26     public class PaddingType : global::System.IDisposable
27     {
28         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
29         /// <summary>
30         /// swigCMemOwn
31         /// </summary>
32         protected bool swigCMemOwn;
33
34         internal PaddingType(global::System.IntPtr cPtr, bool cMemoryOwn)
35         {
36             swigCMemOwn = cMemoryOwn;
37             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
38         }
39
40         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PaddingType obj)
41         {
42             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
43         }
44
45         //A Flag to check who called Dispose(). (By User or DisposeQueue)
46         private bool isDisposeQueued = false;
47         /// <summary>
48         /// A Flat to check if it is already disposed.
49         /// </summary>
50         protected bool disposed = false;
51
52         /// <summary>
53         /// Dispose.
54         /// </summary>
55         /// <since_tizen> 3 </since_tizen>
56         ~PaddingType()
57         {
58             if (!isDisposeQueued)
59             {
60                 isDisposeQueued = true;
61                 DisposeQueue.Instance.Add(this);
62             }
63         }
64
65         /// <summary>
66         /// Dispose.
67         /// </summary>
68         /// <since_tizen> 3 </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         /// Dispose.
90         /// </summary>
91         /// <since_tizen> 3 </since_tizen>
92         protected virtual void Dispose(DisposeTypes type)
93         {
94             if (disposed)
95             {
96                 return;
97             }
98
99             if (type == DisposeTypes.Explicit)
100             {
101                 //Called by User
102                 //Release your own managed resources here.
103                 //You should release all of your own disposable objects here.
104
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_PaddingType(swigCPtr);
117                 }
118                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
119             }
120
121             disposed = true;
122         }
123
124         /// <summary>
125         /// Equality operator.
126         /// </summary>
127         /// <param name="a">First operand</param>
128         /// <param name="b">Second operand</param>
129         /// <returns>True if the values are identical</returns>
130         /// <since_tizen> 3 </since_tizen>
131         public static bool operator ==(PaddingType a, PaddingType b)
132         {
133             // If both are null, or both are same instance, return true.
134             if (System.Object.ReferenceEquals(a, b))
135             {
136                 return true;
137             }
138
139             // If one is null, but not both, return false.
140             if (((object)a == null) || ((object)b == null))
141             {
142                 return false;
143             }
144
145             // Return true if the fields match:
146             return (System.Math.Abs(a.Start- b.Start) < NDalic.GetRangedEpsilon(a.Start, b.Start)) &&
147                    (System.Math.Abs(a.End - b.End) < NDalic.GetRangedEpsilon(a.End, b.End)) &&
148                    (System.Math.Abs(a.Bottom - b.Bottom) < NDalic.GetRangedEpsilon(a.Bottom, b.Bottom)) &&
149                    (System.Math.Abs(a.Top - b.Top) < NDalic.GetRangedEpsilon(a.Top, b.Top));
150         }
151
152         /// <summary>
153         /// Inequality operator.
154         /// </summary>
155         /// <param name="a">First operand</param>
156         /// <param name="b">Second operand</param>
157         /// <returns>True if the values are not identical</returns>
158         /// <since_tizen> 3 </since_tizen>
159         public static bool operator !=(PaddingType a, PaddingType b)
160         {
161             return !(a == b);
162         }
163
164
165         /// <summary>
166         /// Equals
167         /// </summary>
168         /// <param name="o">The object should be compared.</param>
169         /// <returns>True if equal.</returns>
170         /// <since_tizen> 4 </since_tizen>
171         public override bool Equals(object o)
172         {
173             if(o == null)
174             {
175                 return false;
176             }
177             if(!(o is PaddingType))
178             {
179                 return false;
180             }
181             PaddingType p = (PaddingType)o;
182
183             // Return true if the fields match:
184             return (System.Math.Abs(Start- p.Start) < NDalic.GetRangedEpsilon(Start, p.Start)) &&
185                    (System.Math.Abs(End - p.End) < NDalic.GetRangedEpsilon(End, p.End)) &&
186                    (System.Math.Abs(Bottom - p.Bottom) < NDalic.GetRangedEpsilon(Bottom, p.Bottom)) &&
187                    (System.Math.Abs(Top - p.Top) < NDalic.GetRangedEpsilon(Top, p.Top));
188         }
189
190         /// <summary>
191         /// Gets the the hash code of this baseHandle.
192         /// </summary>
193         /// <returns>The Hash Code.</returns>
194         /// <since_tizen> 4 </since_tizen>
195         public override int GetHashCode()
196         {
197             return base.GetHashCode();
198         }
199
200         /// <summary>
201         /// The Left value.
202         /// </summary>
203         [Obsolete("Please do not use! this will be removed. please use Start instead")]
204         public float Left
205         {
206             set
207             {
208                 left = value;
209             }
210             get
211             {
212                 return left;
213             }
214         }
215
216         /// <summary>
217         /// The Start value.
218         /// </summary>
219         public float Start
220         {
221             set
222             {
223                 start = value;
224             }
225             get
226             {
227                 return start;
228             }
229         }
230
231         /// <summary>
232         /// The Right value.
233         /// </summary>
234         [Obsolete("Please do not use! this will be removed. please use End instead")]
235         public float Right
236         {
237             set
238             {
239                 right = value;
240             }
241             get
242             {
243                 return right;
244             }
245         }
246
247         /// <summary>
248         /// The End value.
249         /// </summary>
250         public float End
251         {
252             set
253             {
254                 end = value;
255             }
256             get
257             {
258                 return end;
259             }
260         }
261
262         /// <summary>
263         /// The Top value.
264         /// </summary>
265         /// <since_tizen> 3 </since_tizen>
266         public float Top
267         {
268             set
269             {
270                 top = value;
271             }
272             get
273             {
274                 return top;
275             }
276         }
277
278         /// <summary>
279         /// The Bottom value.
280         /// </summary>
281         /// <since_tizen> 3 </since_tizen>
282         public float Bottom
283         {
284             set
285             {
286                 bottom = value;
287             }
288             get
289             {
290                 return bottom;
291             }
292         }
293
294         /// <summary>
295         /// Creates an uninitialized PaddingType.
296         /// </summary>
297         /// <since_tizen> 3 </since_tizen>
298         public PaddingType() : this(NDalicPINVOKE.new_PaddingType__SWIG_0(), true)
299         {
300             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
301         }
302
303         /// <summary>
304         /// PaddingType Constructor.
305         /// </summary>
306         /// <param name="start">Start padding or X coordinate</param>
307         /// <param name="end">End padding or Y coordinate</param>
308         /// <param name="top">Top padding or Height</param>
309         /// <param name="bottom">Bottom padding or Width</param>
310         public PaddingType(float start, float end, float top, float bottom) : this(NDalicPINVOKE.new_PaddingType__SWIG_1(start, end, top, bottom), true)
311         {
312             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
313         }
314
315         /// <summary>
316         /// Assignment from individual values.
317         /// </summary>
318         /// <param name="newStart">Start padding or X coordinate</param>
319         /// <param name="newEnd">End padding or Y coordinate</param>
320         /// <param name="newTop">Top padding or Height</param>
321         /// <param name="newBottom">Bottom padding or Width</param>
322         public void Set(float newStart, float newEnd, float newTop, float newBottom)
323         {
324             NDalicPINVOKE.PaddingType_Set(swigCPtr, newStart, newEnd, newTop, newBottom);
325             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
326         }
327
328         private float left
329         {
330             set
331             {
332                 NDalicPINVOKE.PaddingType_left_set(swigCPtr, value);
333                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
334             }
335             get
336             {
337                 float ret = NDalicPINVOKE.PaddingType_left_get(swigCPtr);
338                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
339                 return ret;
340             }
341         }
342
343         private float start
344         {
345             set
346             {
347                 NDalicPINVOKE.PaddingType_start_set(swigCPtr, value);
348                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
349             }
350             get
351             {
352                 float ret = NDalicPINVOKE.PaddingType_start_get(swigCPtr);
353                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
354                 return ret;
355             }
356         }
357
358         private float right
359         {
360             set
361             {
362                 NDalicPINVOKE.PaddingType_right_set(swigCPtr, value);
363                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
364             }
365             get
366             {
367                 float ret = NDalicPINVOKE.PaddingType_right_get(swigCPtr);
368                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
369                 return ret;
370             }
371         }
372
373         private float end
374         {
375             set
376             {
377                 NDalicPINVOKE.PaddingType_end_set(swigCPtr, value);
378                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
379             }
380             get
381             {
382                 float ret = NDalicPINVOKE.PaddingType_end_get(swigCPtr);
383                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
384                 return ret;
385             }
386         }
387
388         private float top
389         {
390             set
391             {
392                 NDalicPINVOKE.PaddingType_top_set(swigCPtr, value);
393                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
394             }
395             get
396             {
397                 float ret = NDalicPINVOKE.PaddingType_top_get(swigCPtr);
398                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
399                 return ret;
400             }
401         }
402
403         private float bottom
404         {
405             set
406             {
407                 NDalicPINVOKE.PaddingType_bottom_set(swigCPtr, value);
408                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
409             }
410             get
411             {
412                 float ret = NDalicPINVOKE.PaddingType_bottom_get(swigCPtr);
413                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
414                 return ret;
415             }
416         }
417     }
418
419 }