35a324d963e935caeee6aa59b3fe66aaed41584b
[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 : Disposable
28     {
29         /// <summary>
30         /// swigCMemOwn
31         /// </summary>
32         /// <since_tizen> 3 </since_tizen>
33         protected bool swigCMemOwn;
34
35         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
36
37         /// <summary>
38         /// Creates an uninitialized PaddingType.
39         /// </summary>
40         /// <since_tizen> 3 </since_tizen>
41         public PaddingType() : this(Interop.PaddingType.new_PaddingType__SWIG_0(), true)
42         {
43             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
44         }
45
46         /// <summary>
47         /// PaddingType Constructor.
48         /// </summary>
49         /// <param name="start">Start padding or X coordinate</param>
50         /// <param name="end">End padding or Y coordinate</param>
51         /// <param name="top">Top padding or Height</param>
52         /// <param name="bottom">Bottom padding or Width</param>
53         /// <since_tizen> 3 </since_tizen>
54         public PaddingType(float start, float end, float top, float bottom) : this(Interop.PaddingType.new_PaddingType__SWIG_1(start, end, top, bottom), true)
55         {
56             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
57         }
58
59         internal PaddingType(global::System.IntPtr cPtr, bool cMemoryOwn)
60         {
61             swigCMemOwn = cMemoryOwn;
62             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
63         }
64
65         /// <summary>
66         /// The Start value.
67         /// </summary>
68         /// <since_tizen> 4 </since_tizen>
69         public float Start
70         {
71             set
72             {
73                 start = value;
74             }
75             get
76             {
77                 return start;
78             }
79         }
80
81         /// <summary>
82         /// The End value.
83         /// </summary>
84         /// <since_tizen> 4 </since_tizen>
85         public float End
86         {
87             set
88             {
89                 end = value;
90             }
91             get
92             {
93                 return end;
94             }
95         }
96
97         /// <summary>
98         /// The Top value.
99         /// </summary>
100         /// <since_tizen> 3 </since_tizen>
101         public float Top
102         {
103             set
104             {
105                 top = value;
106             }
107             get
108             {
109                 return top;
110             }
111         }
112
113         /// <summary>
114         /// The Bottom value.
115         /// </summary>
116         /// <since_tizen> 3 </since_tizen>
117         public float Bottom
118         {
119             set
120             {
121                 bottom = value;
122             }
123             get
124             {
125                 return bottom;
126             }
127         }
128
129         private float left
130         {
131             set
132             {
133                 Interop.PaddingType.PaddingType_left_set(swigCPtr, value);
134                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
135             }
136             get
137             {
138                 float ret = Interop.PaddingType.PaddingType_left_get(swigCPtr);
139                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
140                 return ret;
141             }
142         }
143
144         private float start
145         {
146             set
147             {
148                 Interop.PaddingType.PaddingType_start_set(swigCPtr, value);
149                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
150             }
151             get
152             {
153                 float ret = Interop.PaddingType.PaddingType_start_get(swigCPtr);
154                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
155                 return ret;
156             }
157         }
158
159         private float right
160         {
161             set
162             {
163                 Interop.PaddingType.PaddingType_right_set(swigCPtr, value);
164                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
165             }
166             get
167             {
168                 float ret = Interop.PaddingType.PaddingType_right_get(swigCPtr);
169                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
170                 return ret;
171             }
172         }
173
174         private float end
175         {
176             set
177             {
178                 Interop.PaddingType.PaddingType_end_set(swigCPtr, value);
179                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
180             }
181             get
182             {
183                 float ret = Interop.PaddingType.PaddingType_end_get(swigCPtr);
184                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
185                 return ret;
186             }
187         }
188
189         private float top
190         {
191             set
192             {
193                 Interop.PaddingType.PaddingType_top_set(swigCPtr, value);
194                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
195             }
196             get
197             {
198                 float ret = Interop.PaddingType.PaddingType_top_get(swigCPtr);
199                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
200                 return ret;
201             }
202         }
203
204         private float bottom
205         {
206             set
207             {
208                 Interop.PaddingType.PaddingType_bottom_set(swigCPtr, value);
209                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
210             }
211             get
212             {
213                 float ret = Interop.PaddingType.PaddingType_bottom_get(swigCPtr);
214                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
215                 return ret;
216             }
217         }
218
219         /// <summary>
220         /// Equality operator.
221         /// </summary>
222         /// <param name="a">First operand</param>
223         /// <param name="b">Second operand</param>
224         /// <returns>True if the values are identical</returns>
225         /// <since_tizen> 3 </since_tizen>
226         public static bool operator ==(PaddingType a, PaddingType b)
227         {
228             // If both are null, or both are same instance, return true.
229             if (System.Object.ReferenceEquals(a, b))
230             {
231                 return true;
232             }
233
234             // If one is null, but not both, return false.
235             if (((object)a == null) || ((object)b == null))
236             {
237                 return false;
238             }
239
240             // Return true if the fields match:
241             return (System.Math.Abs(a.Start - b.Start) < NDalic.GetRangedEpsilon(a.Start, b.Start)) &&
242                    (System.Math.Abs(a.End - b.End) < NDalic.GetRangedEpsilon(a.End, b.End)) &&
243                    (System.Math.Abs(a.Bottom - b.Bottom) < NDalic.GetRangedEpsilon(a.Bottom, b.Bottom)) &&
244                    (System.Math.Abs(a.Top - b.Top) < NDalic.GetRangedEpsilon(a.Top, b.Top));
245         }
246
247         /// <summary>
248         /// Inequality operator.
249         /// </summary>
250         /// <param name="a">First operand</param>
251         /// <param name="b">Second operand</param>
252         /// <returns>True if the values are not identical</returns>
253         /// <since_tizen> 3 </since_tizen>
254         public static bool operator !=(PaddingType a, PaddingType b)
255         {
256             return !(a == b);
257         }
258
259         /// <summary>
260         /// Equals
261         /// </summary>
262         /// <param name="o">The object should be compared.</param>
263         /// <returns>True if equal.</returns>
264         /// <since_tizen> 4 </since_tizen>
265         public override bool Equals(object o)
266         {
267             if(o == null)
268             {
269                 return false;
270             }
271             if(!(o is PaddingType))
272             {
273                 return false;
274             }
275             PaddingType p = (PaddingType)o;
276
277             // Return true if the fields match:
278             return (System.Math.Abs(Start- p.Start) < NDalic.GetRangedEpsilon(Start, p.Start)) &&
279                    (System.Math.Abs(End - p.End) < NDalic.GetRangedEpsilon(End, p.End)) &&
280                    (System.Math.Abs(Bottom - p.Bottom) < NDalic.GetRangedEpsilon(Bottom, p.Bottom)) &&
281                    (System.Math.Abs(Top - p.Top) < NDalic.GetRangedEpsilon(Top, p.Top));
282         }
283
284         /// <summary>
285         /// Gets the the hash code of this baseHandle.
286         /// </summary>
287         /// <returns>The Hash Code.</returns>
288         /// <since_tizen> 4 </since_tizen>
289         public override int GetHashCode()
290         {
291             return base.GetHashCode();
292         }
293
294         /// <summary>
295         /// Assignment from individual values.
296         /// </summary>
297         /// <param name="newStart">Start padding or X coordinate</param>
298         /// <param name="newEnd">End padding or Y coordinate</param>
299         /// <param name="newTop">Top padding or Height</param>
300         /// <param name="newBottom">Bottom padding or Width</param>
301         /// <since_tizen> 3 </since_tizen>
302         public void Set(float newStart, float newEnd, float newTop, float newBottom)
303         {
304             Interop.PaddingType.PaddingType_Set(swigCPtr, newStart, newEnd, newTop, newBottom);
305             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
306         }
307
308         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PaddingType obj)
309         {
310             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
311         }
312
313         /// <summary>
314         /// Dispose.
315         /// </summary>
316         /// <since_tizen> 3 </since_tizen>
317         protected override void Dispose(DisposeTypes type)
318         {
319             if (disposed)
320             {
321                 return;
322             }
323
324             //Release your own unmanaged resources here.
325             //You should not access any managed member here except static instance.
326             //because the execution order of Finalizes is non-deterministic.
327
328             if (swigCPtr.Handle != global::System.IntPtr.Zero)
329             {
330                 if (swigCMemOwn)
331                 {
332                     swigCMemOwn = false;
333                     Interop.PaddingType.delete_PaddingType(swigCPtr);
334                 }
335                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
336             }
337
338             base.Dispose(type);
339         }
340     }
341 }