[NUI] Remove duplicate getCPtr from Disposable/View subclasses (#3544)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / Layouting / PaddingType.cs
1 /*
2  * Copyright(c) 2021 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.ComponentModel;
21
22     /// <summary>
23     /// The gesture state.
24     /// </summary>
25     /// <since_tizen> 3 </since_tizen>
26     public class PaddingType : Disposable
27     {
28
29         /// <summary>
30         /// Creates an uninitialized PaddingType.
31         /// </summary>
32         /// <since_tizen> 3 </since_tizen>
33         public PaddingType() : this(Interop.PaddingType.NewPaddingType(), true)
34         {
35             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
36         }
37
38         /// <summary>
39         /// PaddingType Constructor.
40         /// </summary>
41         /// <param name="start">Start padding or X coordinate</param>
42         /// <param name="end">End padding or Y coordinate</param>
43         /// <param name="top">Top padding or Height</param>
44         /// <param name="bottom">Bottom padding or Width</param>
45         /// <since_tizen> 3 </since_tizen>
46         public PaddingType(float start, float end, float top, float bottom) : this(Interop.PaddingType.NewPaddingType(start, end, top, bottom), true)
47         {
48             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
49         }
50
51         internal PaddingType(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
52         {
53         }
54
55         /// <summary>
56         /// The Start value.
57         /// </summary>
58         /// <since_tizen> 4 </since_tizen>
59         public float Start
60         {
61             set
62             {
63                 start = value;
64             }
65             get
66             {
67                 return start;
68             }
69         }
70
71         /// <summary>
72         /// The End value.
73         /// </summary>
74         /// <since_tizen> 4 </since_tizen>
75         public float End
76         {
77             set
78             {
79                 end = value;
80             }
81             get
82             {
83                 return end;
84             }
85         }
86
87         /// <summary>
88         /// The Top value.
89         /// </summary>
90         /// <since_tizen> 3 </since_tizen>
91         public float Top
92         {
93             set
94             {
95                 top = value;
96             }
97             get
98             {
99                 return top;
100             }
101         }
102
103         /// <summary>
104         /// The Bottom value.
105         /// </summary>
106         /// <since_tizen> 3 </since_tizen>
107         public float Bottom
108         {
109             set
110             {
111                 bottom = value;
112             }
113             get
114             {
115                 return bottom;
116             }
117         }
118
119         private float left
120         {
121             set
122             {
123                 Interop.PaddingType.LeftSet(SwigCPtr, value);
124                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
125             }
126             get
127             {
128                 float ret = Interop.PaddingType.LeftGet(SwigCPtr);
129                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
130                 return ret;
131             }
132         }
133
134         private float start
135         {
136             set
137             {
138                 Interop.PaddingType.StartSet(SwigCPtr, value);
139                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
140             }
141             get
142             {
143                 float ret = Interop.PaddingType.StartGet(SwigCPtr);
144                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
145                 return ret;
146             }
147         }
148
149         private float right
150         {
151             set
152             {
153                 Interop.PaddingType.RightSet(SwigCPtr, value);
154                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
155             }
156             get
157             {
158                 float ret = Interop.PaddingType.RightGet(SwigCPtr);
159                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
160                 return ret;
161             }
162         }
163
164         private float end
165         {
166             set
167             {
168                 Interop.PaddingType.EndSet(SwigCPtr, value);
169                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
170             }
171             get
172             {
173                 float ret = Interop.PaddingType.EndGet(SwigCPtr);
174                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
175                 return ret;
176             }
177         }
178
179         private float top
180         {
181             set
182             {
183                 Interop.PaddingType.TopSet(SwigCPtr, value);
184                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
185             }
186             get
187             {
188                 float ret = Interop.PaddingType.TopGet(SwigCPtr);
189                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
190                 return ret;
191             }
192         }
193
194         private float bottom
195         {
196             set
197             {
198                 Interop.PaddingType.BottomSet(SwigCPtr, value);
199                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
200             }
201             get
202             {
203                 float ret = Interop.PaddingType.BottomGet(SwigCPtr);
204                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
205                 return ret;
206             }
207         }
208
209         /// <summary>
210         /// Equality operator.
211         /// </summary>
212         /// <param name="a">First operand</param>
213         /// <param name="b">Second operand</param>
214         /// <returns>True if the values are identical</returns>
215         /// <since_tizen> 3 </since_tizen>
216         public static bool operator ==(PaddingType a, PaddingType b)
217         {
218             // If both are null, or both are same instance, return true.
219             if (System.Object.ReferenceEquals(a, b))
220             {
221                 return true;
222             }
223
224             // If one is null, but not both, return false.
225             if (((object)a == null) || ((object)b == null))
226             {
227                 return false;
228             }
229
230             // Return true if the fields match:
231             return (System.Math.Abs(a.Start - b.Start) < NDalic.GetRangedEpsilon(a.Start, b.Start)) &&
232                    (System.Math.Abs(a.End - b.End) < NDalic.GetRangedEpsilon(a.End, b.End)) &&
233                    (System.Math.Abs(a.Bottom - b.Bottom) < NDalic.GetRangedEpsilon(a.Bottom, b.Bottom)) &&
234                    (System.Math.Abs(a.Top - b.Top) < NDalic.GetRangedEpsilon(a.Top, b.Top));
235         }
236
237         /// <summary>
238         /// Inequality operator.
239         /// </summary>
240         /// <param name="a">First operand</param>
241         /// <param name="b">Second operand</param>
242         /// <returns>True if the values are not identical</returns>
243         /// <since_tizen> 3 </since_tizen>
244         public static bool operator !=(PaddingType a, PaddingType b)
245         {
246             return !(a == b);
247         }
248
249         /// <summary>
250         /// Equals
251         /// </summary>
252         /// <param name="o">The object should be compared.</param>
253         /// <returns>True if equal.</returns>
254         /// <since_tizen> 4 </since_tizen>
255         public override bool Equals(object o)
256         {
257             if (o == null)
258             {
259                 return false;
260             }
261             if (!(o is PaddingType))
262             {
263                 return false;
264             }
265             PaddingType p = (PaddingType)o;
266
267             // Return true if the fields match:
268             return (System.Math.Abs(Start - p.Start) < NDalic.GetRangedEpsilon(Start, p.Start)) &&
269                    (System.Math.Abs(End - p.End) < NDalic.GetRangedEpsilon(End, p.End)) &&
270                    (System.Math.Abs(Bottom - p.Bottom) < NDalic.GetRangedEpsilon(Bottom, p.Bottom)) &&
271                    (System.Math.Abs(Top - p.Top) < NDalic.GetRangedEpsilon(Top, p.Top));
272         }
273
274         /// <summary>
275         /// Gets the hash code of this baseHandle.
276         /// </summary>
277         /// <returns>The Hash Code.</returns>
278         /// <since_tizen> 4 </since_tizen>
279         public override int GetHashCode()
280         {
281             return base.GetHashCode();
282         }
283
284         /// <summary>
285         /// Assignment from individual values.
286         /// </summary>
287         /// <param name="newStart">Start padding or X coordinate</param>
288         /// <param name="newEnd">End padding or Y coordinate</param>
289         /// <param name="newTop">Top padding or Height</param>
290         /// <param name="newBottom">Bottom padding or Width</param>
291         /// <since_tizen> 3 </since_tizen>
292         public void Set(float newStart, float newEnd, float newTop, float newBottom)
293         {
294             Interop.PaddingType.Set(SwigCPtr, newStart, newEnd, newTop, newBottom);
295             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
296         }
297
298         /// This will not be public opened.
299         [EditorBrowsable(EditorBrowsableState.Never)]
300         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
301         {
302             Interop.PaddingType.DeletePaddingType(swigCPtr);
303         }
304     }
305 }