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 /// The gesture state.
23 public class PaddingType : global::System.IDisposable
25 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
29 protected bool swigCMemOwn;
31 internal PaddingType(global::System.IntPtr cPtr, bool cMemoryOwn)
33 swigCMemOwn = cMemoryOwn;
34 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
37 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PaddingType obj)
39 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
42 //A Flag to check who called Dispose(). (By User or DisposeQueue)
43 private bool isDisposeQueued = false;
45 /// A Flat to check if it is already disposed.
47 protected bool disposed = false;
52 /// <since_tizen> 3 </since_tizen>
57 isDisposeQueued = true;
58 DisposeQueue.Instance.Add(this);
65 /// <since_tizen> 3 </since_tizen>
68 //Throw excpetion if Dispose() is called in separate thread.
69 if (!Window.IsInstalled())
71 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
76 Dispose(DisposeTypes.Implicit);
80 Dispose(DisposeTypes.Explicit);
81 System.GC.SuppressFinalize(this);
88 /// <since_tizen> 3 </since_tizen>
89 protected virtual void Dispose(DisposeTypes type)
96 if (type == DisposeTypes.Explicit)
99 //Release your own managed resources here.
100 //You should release all of your own disposable objects here.
104 //Release your own unmanaged resources here.
105 //You should not access any managed member here except static instance.
106 //because the execution order of Finalizes is non-deterministic.
108 if (swigCPtr.Handle != global::System.IntPtr.Zero)
113 NDalicPINVOKE.delete_PaddingType(swigCPtr);
115 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
122 /// Equality operator
124 /// <since_tizen> 3 </since_tizen>
125 public static bool operator ==(PaddingType a, PaddingType b)
127 // If both are null, or both are same instance, return true.
128 if (System.Object.ReferenceEquals(a, b))
133 // If one is null, but not both, return false.
134 if (((object)a == null) || ((object)b == null))
139 // Return true if the fields match:
140 return (System.Math.Abs(a.Left - b.Left) < NDalic.GetRangedEpsilon(a.Left, b.Left)) &&
141 (System.Math.Abs(a.Right - b.Right) < NDalic.GetRangedEpsilon(a.Right, b.Right)) &&
142 (System.Math.Abs(a.Bottom - b.Bottom) < NDalic.GetRangedEpsilon(a.Bottom, b.Bottom)) &&
143 (System.Math.Abs(a.Top - b.Top) < NDalic.GetRangedEpsilon(a.Top, b.Top));
147 /// Inequality operator. Returns Null if either operand is Null
149 /// <since_tizen> 3 </since_tizen>
150 public static bool operator !=(PaddingType a, PaddingType b)
159 /// <param name="o">The object should be compared.</param>
160 /// <returns>True if equal.</returns>
161 /// <since_tizen> 4 </since_tizen>
162 public override bool Equals(object o)
168 if(!(o is PaddingType))
172 PaddingType p = (PaddingType)o;
174 // Return true if the fields match:
175 return (System.Math.Abs(Left - p.Left) < NDalic.GetRangedEpsilon(Left, p.Left)) &&
176 (System.Math.Abs(Right - p.Right) < NDalic.GetRangedEpsilon(Right, p.Right)) &&
177 (System.Math.Abs(Bottom - p.Bottom) < NDalic.GetRangedEpsilon(Bottom, p.Bottom)) &&
178 (System.Math.Abs(Top - p.Top) < NDalic.GetRangedEpsilon(Top, p.Top));
182 /// Gets the the hash code of this baseHandle.
184 /// <returns>The Hash Code.</returns>
185 /// <since_tizen> 4 </since_tizen>
186 public override int GetHashCode()
188 return base.GetHashCode();
194 /// <since_tizen> 3 </since_tizen>
210 /// <since_tizen> 3 </since_tizen>
224 /// The Bottom value.
226 /// <since_tizen> 3 </since_tizen>
242 /// <since_tizen> 3 </since_tizen>
256 /// Create an instance of paddingType.
258 /// <since_tizen> 3 </since_tizen>
259 public PaddingType() : this(NDalicPINVOKE.new_PaddingType__SWIG_0(), true)
261 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
265 /// Create an instance of BaseHandle.
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 PaddingType(float x, float y, float width, float height) : this(NDalicPINVOKE.new_PaddingType__SWIG_1(x, y, width, height), true)
274 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
278 /// Set the x, y, width, height of this paddingtype.
280 /// <param name="newX">The x value.</param>
281 /// <param name="newY">The y value.</param>
282 /// <param name="newWidth">The width value.</param>
283 /// <param name="newHeight">The height value.</param>
284 /// <since_tizen> 3 </since_tizen>
285 public void Set(float newX, float newY, float newWidth, float newHeight)
287 NDalicPINVOKE.PaddingType_Set(swigCPtr, newX, newY, newWidth, newHeight);
288 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
295 NDalicPINVOKE.PaddingType_x_set(swigCPtr, value);
296 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
300 float ret = NDalicPINVOKE.PaddingType_x_get(swigCPtr);
301 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
310 NDalicPINVOKE.PaddingType_left_set(swigCPtr, value);
311 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
315 float ret = NDalicPINVOKE.PaddingType_left_get(swigCPtr);
316 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
325 NDalicPINVOKE.PaddingType_y_set(swigCPtr, value);
326 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
330 float ret = NDalicPINVOKE.PaddingType_y_get(swigCPtr);
331 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
340 NDalicPINVOKE.PaddingType_right_set(swigCPtr, value);
341 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
345 float ret = NDalicPINVOKE.PaddingType_right_get(swigCPtr);
346 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
355 NDalicPINVOKE.PaddingType_width_set(swigCPtr, value);
356 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
360 float ret = NDalicPINVOKE.PaddingType_width_get(swigCPtr);
361 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
370 NDalicPINVOKE.PaddingType_bottom_set(swigCPtr, value);
371 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
375 float ret = NDalicPINVOKE.PaddingType_bottom_get(swigCPtr);
376 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
385 NDalicPINVOKE.PaddingType_height_set(swigCPtr, value);
386 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
390 float ret = NDalicPINVOKE.PaddingType_height_get(swigCPtr);
391 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
400 NDalicPINVOKE.PaddingType_top_set(swigCPtr, value);
401 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
405 float ret = NDalicPINVOKE.PaddingType_top_get(swigCPtr);
406 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();