1 /** Copyright (c) 2017 Samsung Electronics Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
20 /// The gesture state.
22 public class PaddingType : global::System.IDisposable
24 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
25 protected bool swigCMemOwn;
27 internal PaddingType(global::System.IntPtr cPtr, bool cMemoryOwn)
29 swigCMemOwn = cMemoryOwn;
30 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
33 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PaddingType obj)
35 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
38 //A Flag to check who called Dispose(). (By User or DisposeQueue)
39 private bool isDisposeQueued = false;
40 //A Flat to check if it is already disposed.
41 protected bool disposed = false;
48 isDisposeQueued = true;
49 DisposeQueue.Instance.Add(this);
56 /// <since_tizen> 3 </since_tizen>
59 //Throw excpetion if Dispose() is called in separate thread.
60 if (!Window.IsInstalled())
62 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
67 Dispose(DisposeTypes.Implicit);
71 Dispose(DisposeTypes.Explicit);
72 System.GC.SuppressFinalize(this);
76 protected virtual void Dispose(DisposeTypes type)
83 if (type == DisposeTypes.Explicit)
86 //Release your own managed resources here.
87 //You should release all of your own disposable objects here.
91 //Release your own unmanaged resources here.
92 //You should not access any managed member here except static instance.
93 //because the execution order of Finalizes is non-deterministic.
95 if (swigCPtr.Handle != global::System.IntPtr.Zero)
100 NDalicPINVOKE.delete_PaddingType(swigCPtr);
102 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
109 /// Equality operator
111 /// <since_tizen> 3 </since_tizen>
112 public static bool operator ==(PaddingType a, PaddingType b)
114 // If both are null, or both are same instance, return true.
115 if (System.Object.ReferenceEquals(a, b))
120 // If one is null, but not both, return false.
121 if (((object)a == null) || ((object)b == null))
126 // Return true if the fields match:
127 return (System.Math.Abs(a.Left - b.Left) < NDalic.GetRangedEpsilon(a.Left, b.Left)) &&
128 (System.Math.Abs(a.Right - b.Right) < NDalic.GetRangedEpsilon(a.Right, b.Right)) &&
129 (System.Math.Abs(a.Bottom - b.Bottom) < NDalic.GetRangedEpsilon(a.Bottom, b.Bottom)) &&
130 (System.Math.Abs(a.Top - b.Top) < NDalic.GetRangedEpsilon(a.Top, b.Top));
134 /// Inequality operator. Returns Null if either operand is Null
136 /// <since_tizen> 3 </since_tizen>
137 public static bool operator !=(PaddingType a, PaddingType b)
146 /// <param name="o">The object should be compared.</param>
147 /// <returns>True if equal.</returns>
148 /// <since_tizen> 4 </since_tizen>
149 public override bool Equals(object o)
155 if(!(o is PaddingType))
159 PaddingType p = (PaddingType)o;
161 // Return true if the fields match:
162 return (System.Math.Abs(Left - p.Left) < NDalic.GetRangedEpsilon(Left, p.Left)) &&
163 (System.Math.Abs(Right - p.Right) < NDalic.GetRangedEpsilon(Right, p.Right)) &&
164 (System.Math.Abs(Bottom - p.Bottom) < NDalic.GetRangedEpsilon(Bottom, p.Bottom)) &&
165 (System.Math.Abs(Top - p.Top) < NDalic.GetRangedEpsilon(Top, p.Top));
169 /// Gets the the hash code of this baseHandle.
171 /// <returns>The Hash Code.</returns>
172 /// <since_tizen> 4 </since_tizen>
173 public override int GetHashCode()
175 return base.GetHashCode();
181 /// <since_tizen> 3 </since_tizen>
197 /// <since_tizen> 3 </since_tizen>
211 /// The Bottom value.
213 /// <since_tizen> 3 </since_tizen>
229 /// <since_tizen> 3 </since_tizen>
243 /// Create an instance of paddingType.
245 /// <since_tizen> 3 </since_tizen>
246 public PaddingType() : this(NDalicPINVOKE.new_PaddingType__SWIG_0(), true)
248 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
252 /// Create an instance of BaseHandle.
254 /// <param name="x">The x value.</param>
255 /// <param name="y">The y value.</param>
256 /// <param name="width">The width value.</param>
257 /// <param name="height">The height value.</param>
258 /// <since_tizen> 3 </since_tizen>
259 public PaddingType(float x, float y, float width, float height) : this(NDalicPINVOKE.new_PaddingType__SWIG_1(x, y, width, height), true)
261 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
265 /// Set the x, y, width, height of this paddingtype.
267 /// <param name="x">The x value.</param>
268 /// <param name="y">The y value.</param>
269 /// <param name="width">The width value.</param>
270 /// <param name="height">The height value.</param>
271 /// <since_tizen> 3 </since_tizen>
272 public void Set(float newX, float newY, float newWidth, float newHeight)
274 NDalicPINVOKE.PaddingType_Set(swigCPtr, newX, newY, newWidth, newHeight);
275 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
282 NDalicPINVOKE.PaddingType_x_set(swigCPtr, value);
283 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
287 float ret = NDalicPINVOKE.PaddingType_x_get(swigCPtr);
288 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
297 NDalicPINVOKE.PaddingType_left_set(swigCPtr, value);
298 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
302 float ret = NDalicPINVOKE.PaddingType_left_get(swigCPtr);
303 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
312 NDalicPINVOKE.PaddingType_y_set(swigCPtr, value);
313 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
317 float ret = NDalicPINVOKE.PaddingType_y_get(swigCPtr);
318 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
327 NDalicPINVOKE.PaddingType_right_set(swigCPtr, value);
328 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
332 float ret = NDalicPINVOKE.PaddingType_right_get(swigCPtr);
333 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
342 NDalicPINVOKE.PaddingType_width_set(swigCPtr, value);
343 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
347 float ret = NDalicPINVOKE.PaddingType_width_get(swigCPtr);
348 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
357 NDalicPINVOKE.PaddingType_bottom_set(swigCPtr, value);
358 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
362 float ret = NDalicPINVOKE.PaddingType_bottom_get(swigCPtr);
363 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
372 NDalicPINVOKE.PaddingType_height_set(swigCPtr, value);
373 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
377 float ret = NDalicPINVOKE.PaddingType_height_get(swigCPtr);
378 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
387 NDalicPINVOKE.PaddingType_top_set(swigCPtr, value);
388 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
392 float ret = NDalicPINVOKE.PaddingType_top_get(swigCPtr);
393 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();