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