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
29 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
33 /// <since_tizen> 3 </since_tizen>
34 protected bool swigCMemOwn;
36 internal PaddingType(global::System.IntPtr cPtr, bool cMemoryOwn)
38 swigCMemOwn = cMemoryOwn;
39 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
42 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PaddingType obj)
44 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
47 //A Flag to check who called Dispose(). (By User or DisposeQueue)
48 private bool isDisposeQueued = false;
50 /// A Flat to check if it is already disposed.
52 /// <since_tizen> 3 </since_tizen>
53 protected bool disposed = false;
58 /// <since_tizen> 3 </since_tizen>
63 isDisposeQueued = true;
64 DisposeQueue.Instance.Add(this);
71 /// <since_tizen> 3 </since_tizen>
74 //Throw excpetion if Dispose() is called in separate thread.
75 if (!Window.IsInstalled())
77 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
82 Dispose(DisposeTypes.Implicit);
86 Dispose(DisposeTypes.Explicit);
87 System.GC.SuppressFinalize(this);
94 /// <since_tizen> 3 </since_tizen>
95 protected virtual void Dispose(DisposeTypes type)
102 if (type == DisposeTypes.Explicit)
105 //Release your own managed resources here.
106 //You should release all of your own disposable objects here.
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.
114 if (swigCPtr.Handle != global::System.IntPtr.Zero)
119 NDalicPINVOKE.delete_PaddingType(swigCPtr);
121 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
128 /// Equality operator.
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)
136 // If both are null, or both are same instance, return true.
137 if (System.Object.ReferenceEquals(a, b))
142 // If one is null, but not both, return false.
143 if (((object)a == null) || ((object)b == null))
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));
156 /// Inequality operator.
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)
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)
180 if(!(o is PaddingType))
184 PaddingType p = (PaddingType)o;
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));
194 /// Gets the the hash code of this baseHandle.
196 /// <returns>The Hash Code.</returns>
197 /// <since_tizen> 4 </since_tizen>
198 public override int GetHashCode()
200 return base.GetHashCode();
206 /// <since_tizen> 4 </since_tizen>
222 /// <since_tizen> 4 </since_tizen>
238 /// <since_tizen> 3 </since_tizen>
252 /// The Bottom value.
254 /// <since_tizen> 3 </since_tizen>
268 /// Creates an uninitialized PaddingType.
270 /// <since_tizen> 3 </since_tizen>
271 public PaddingType() : this(NDalicPINVOKE.new_PaddingType__SWIG_0(), true)
273 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
277 /// PaddingType Constructor.
279 /// <param name="start">Start padding or X coordinate</param>
280 /// <param name="end">End padding or Y coordinate</param>
281 /// <param name="top">Top padding or Height</param>
282 /// <param name="bottom">Bottom padding or Width</param>
283 /// <since_tizen> 3 </since_tizen>
284 public PaddingType(float start, float end, float top, float bottom) : this(NDalicPINVOKE.new_PaddingType__SWIG_1(start, end, top, bottom), true)
286 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
290 /// Assignment from individual values.
292 /// <param name="newStart">Start padding or X coordinate</param>
293 /// <param name="newEnd">End padding or Y coordinate</param>
294 /// <param name="newTop">Top padding or Height</param>
295 /// <param name="newBottom">Bottom padding or Width</param>
296 /// <since_tizen> 3 </since_tizen>
297 public void Set(float newStart, float newEnd, float newTop, float newBottom)
299 NDalicPINVOKE.PaddingType_Set(swigCPtr, newStart, newEnd, newTop, newBottom);
300 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
307 NDalicPINVOKE.PaddingType_left_set(swigCPtr, value);
308 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
312 float ret = NDalicPINVOKE.PaddingType_left_get(swigCPtr);
313 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
322 NDalicPINVOKE.PaddingType_start_set(swigCPtr, value);
323 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
327 float ret = NDalicPINVOKE.PaddingType_start_get(swigCPtr);
328 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
337 NDalicPINVOKE.PaddingType_right_set(swigCPtr, value);
338 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
342 float ret = NDalicPINVOKE.PaddingType_right_get(swigCPtr);
343 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
352 NDalicPINVOKE.PaddingType_end_set(swigCPtr, value);
353 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
357 float ret = NDalicPINVOKE.PaddingType_end_get(swigCPtr);
358 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
367 NDalicPINVOKE.PaddingType_top_set(swigCPtr, value);
368 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
372 float ret = NDalicPINVOKE.PaddingType_top_get(swigCPtr);
373 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
382 NDalicPINVOKE.PaddingType_bottom_set(swigCPtr, value);
383 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
387 float ret = NDalicPINVOKE.PaddingType_bottom_get(swigCPtr);
388 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();