2 * Copyright(c) 2017 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
21 using System.ComponentModel;
24 /// The gesture state.
26 /// <since_tizen> 3 </since_tizen>
27 public class PaddingType : global::System.IDisposable
32 /// <since_tizen> 3 </since_tizen>
33 protected bool swigCMemOwn;
36 /// A Flat to check if it is already disposed.
38 /// <since_tizen> 3 </since_tizen>
39 protected bool disposed = false;
41 //A Flag to check who called Dispose(). (By User or DisposeQueue)
42 private bool isDisposeQueued = false;
43 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
46 /// Creates an uninitialized PaddingType.
48 /// <since_tizen> 3 </since_tizen>
49 public PaddingType() : this(Interop.PaddingType.new_PaddingType__SWIG_0(), true)
51 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
55 /// PaddingType Constructor.
57 /// <param name="start">Start padding or X coordinate</param>
58 /// <param name="end">End padding or Y coordinate</param>
59 /// <param name="top">Top padding or Height</param>
60 /// <param name="bottom">Bottom padding or Width</param>
61 /// <since_tizen> 3 </since_tizen>
62 public PaddingType(float start, float end, float top, float bottom) : this(Interop.PaddingType.new_PaddingType__SWIG_1(start, end, top, bottom), true)
64 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
67 internal PaddingType(global::System.IntPtr cPtr, bool cMemoryOwn)
69 swigCMemOwn = cMemoryOwn;
70 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
76 /// <since_tizen> 3 </since_tizen>
81 isDisposeQueued = true;
82 DisposeQueue.Instance.Add(this);
89 /// <since_tizen> 4 </since_tizen>
105 /// <since_tizen> 4 </since_tizen>
121 /// <since_tizen> 3 </since_tizen>
135 /// The Bottom value.
137 /// <since_tizen> 3 </since_tizen>
154 Interop.PaddingType.PaddingType_left_set(swigCPtr, value);
155 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
159 float ret = Interop.PaddingType.PaddingType_left_get(swigCPtr);
160 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
169 Interop.PaddingType.PaddingType_start_set(swigCPtr, value);
170 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
174 float ret = Interop.PaddingType.PaddingType_start_get(swigCPtr);
175 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
184 Interop.PaddingType.PaddingType_right_set(swigCPtr, value);
185 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
189 float ret = Interop.PaddingType.PaddingType_right_get(swigCPtr);
190 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
199 Interop.PaddingType.PaddingType_end_set(swigCPtr, value);
200 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
204 float ret = Interop.PaddingType.PaddingType_end_get(swigCPtr);
205 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
214 Interop.PaddingType.PaddingType_top_set(swigCPtr, value);
215 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
219 float ret = Interop.PaddingType.PaddingType_top_get(swigCPtr);
220 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
229 Interop.PaddingType.PaddingType_bottom_set(swigCPtr, value);
230 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
234 float ret = Interop.PaddingType.PaddingType_bottom_get(swigCPtr);
235 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
241 /// Equality operator.
243 /// <param name="a">First operand</param>
244 /// <param name="b">Second operand</param>
245 /// <returns>True if the values are identical</returns>
246 /// <since_tizen> 3 </since_tizen>
247 public static bool operator ==(PaddingType a, PaddingType b)
249 // If both are null, or both are same instance, return true.
250 if (System.Object.ReferenceEquals(a, b))
255 // If one is null, but not both, return false.
256 if (((object)a == null) || ((object)b == null))
261 // Return true if the fields match:
262 return (System.Math.Abs(a.Start - b.Start) < NDalic.GetRangedEpsilon(a.Start, b.Start)) &&
263 (System.Math.Abs(a.End - b.End) < NDalic.GetRangedEpsilon(a.End, b.End)) &&
264 (System.Math.Abs(a.Bottom - b.Bottom) < NDalic.GetRangedEpsilon(a.Bottom, b.Bottom)) &&
265 (System.Math.Abs(a.Top - b.Top) < NDalic.GetRangedEpsilon(a.Top, b.Top));
269 /// Inequality operator.
271 /// <param name="a">First operand</param>
272 /// <param name="b">Second operand</param>
273 /// <returns>True if the values are not identical</returns>
274 /// <since_tizen> 3 </since_tizen>
275 public static bool operator !=(PaddingType a, PaddingType b)
283 /// <since_tizen> 3 </since_tizen>
284 public void Dispose()
286 //Throw excpetion if Dispose() is called in separate thread.
287 if (!Window.IsInstalled())
289 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
294 Dispose(DisposeTypes.Implicit);
298 Dispose(DisposeTypes.Explicit);
299 System.GC.SuppressFinalize(this);
307 /// <param name="o">The object should be compared.</param>
308 /// <returns>True if equal.</returns>
309 /// <since_tizen> 4 </since_tizen>
310 public override bool Equals(object o)
316 if(!(o is PaddingType))
320 PaddingType p = (PaddingType)o;
322 // Return true if the fields match:
323 return (System.Math.Abs(Start- p.Start) < NDalic.GetRangedEpsilon(Start, p.Start)) &&
324 (System.Math.Abs(End - p.End) < NDalic.GetRangedEpsilon(End, p.End)) &&
325 (System.Math.Abs(Bottom - p.Bottom) < NDalic.GetRangedEpsilon(Bottom, p.Bottom)) &&
326 (System.Math.Abs(Top - p.Top) < NDalic.GetRangedEpsilon(Top, p.Top));
330 /// Gets the the hash code of this baseHandle.
332 /// <returns>The Hash Code.</returns>
333 /// <since_tizen> 4 </since_tizen>
334 public override int GetHashCode()
336 return base.GetHashCode();
340 /// Assignment from individual values.
342 /// <param name="newStart">Start padding or X coordinate</param>
343 /// <param name="newEnd">End padding or Y coordinate</param>
344 /// <param name="newTop">Top padding or Height</param>
345 /// <param name="newBottom">Bottom padding or Width</param>
346 /// <since_tizen> 3 </since_tizen>
347 public void Set(float newStart, float newEnd, float newTop, float newBottom)
349 Interop.PaddingType.PaddingType_Set(swigCPtr, newStart, newEnd, newTop, newBottom);
350 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
353 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PaddingType obj)
355 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
361 /// <since_tizen> 3 </since_tizen>
362 protected virtual void Dispose(DisposeTypes type)
369 if (type == DisposeTypes.Explicit)
372 //Release your own managed resources here.
373 //You should release all of your own disposable objects here.
377 //Release your own unmanaged resources here.
378 //You should not access any managed member here except static instance.
379 //because the execution order of Finalizes is non-deterministic.
381 if (swigCPtr.Handle != global::System.IntPtr.Zero)
386 Interop.PaddingType.delete_PaddingType(swigCPtr);
388 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);