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 public class PaddingType : global::System.IDisposable
28 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
32 protected bool swigCMemOwn;
34 internal PaddingType(global::System.IntPtr cPtr, bool cMemoryOwn)
36 swigCMemOwn = cMemoryOwn;
37 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
40 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PaddingType obj)
42 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
45 //A Flag to check who called Dispose(). (By User or DisposeQueue)
46 private bool isDisposeQueued = false;
48 /// A Flat to check if it is already disposed.
50 protected bool disposed = false;
55 /// <since_tizen> 3 </since_tizen>
60 isDisposeQueued = true;
61 DisposeQueue.Instance.Add(this);
68 /// <since_tizen> 3 </since_tizen>
71 //Throw excpetion if Dispose() is called in separate thread.
72 if (!Window.IsInstalled())
74 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
79 Dispose(DisposeTypes.Implicit);
83 Dispose(DisposeTypes.Explicit);
84 System.GC.SuppressFinalize(this);
91 /// <since_tizen> 3 </since_tizen>
92 protected virtual void Dispose(DisposeTypes type)
99 if (type == DisposeTypes.Explicit)
102 //Release your own managed resources here.
103 //You should release all of your own disposable objects here.
107 //Release your own unmanaged resources here.
108 //You should not access any managed member here except static instance.
109 //because the execution order of Finalizes is non-deterministic.
111 if (swigCPtr.Handle != global::System.IntPtr.Zero)
116 NDalicPINVOKE.delete_PaddingType(swigCPtr);
118 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
125 /// Equality operator.
127 /// <param name="a">First operand</param>
128 /// <param name="b">Second operand</param>
129 /// <returns>True if the values are identical</returns>
130 /// <since_tizen> 3 </since_tizen>
131 public static bool operator ==(PaddingType a, PaddingType b)
133 // If both are null, or both are same instance, return true.
134 if (System.Object.ReferenceEquals(a, b))
139 // If one is null, but not both, return false.
140 if (((object)a == null) || ((object)b == null))
145 // Return true if the fields match:
146 return (System.Math.Abs(a.Start- b.Start) < NDalic.GetRangedEpsilon(a.Start, b.Start)) &&
147 (System.Math.Abs(a.End - b.End) < NDalic.GetRangedEpsilon(a.End, b.End)) &&
148 (System.Math.Abs(a.Bottom - b.Bottom) < NDalic.GetRangedEpsilon(a.Bottom, b.Bottom)) &&
149 (System.Math.Abs(a.Top - b.Top) < NDalic.GetRangedEpsilon(a.Top, b.Top));
153 /// Inequality operator.
155 /// <param name="a">First operand</param>
156 /// <param name="b">Second operand</param>
157 /// <returns>True if the values are not identical</returns>
158 /// <since_tizen> 3 </since_tizen>
159 public static bool operator !=(PaddingType a, PaddingType b)
168 /// <param name="o">The object should be compared.</param>
169 /// <returns>True if equal.</returns>
170 /// <since_tizen> 4 </since_tizen>
171 public override bool Equals(object o)
177 if(!(o is PaddingType))
181 PaddingType p = (PaddingType)o;
183 // Return true if the fields match:
184 return (System.Math.Abs(Start- p.Start) < NDalic.GetRangedEpsilon(Start, p.Start)) &&
185 (System.Math.Abs(End - p.End) < NDalic.GetRangedEpsilon(End, p.End)) &&
186 (System.Math.Abs(Bottom - p.Bottom) < NDalic.GetRangedEpsilon(Bottom, p.Bottom)) &&
187 (System.Math.Abs(Top - p.Top) < NDalic.GetRangedEpsilon(Top, p.Top));
191 /// Gets the the hash code of this baseHandle.
193 /// <returns>The Hash Code.</returns>
194 /// <since_tizen> 4 </since_tizen>
195 public override int GetHashCode()
197 return base.GetHashCode();
203 /// Please DO NOT use! This will be deprecated!
204 /// instead please use Start property.
205 [Obsolete("Please DO NOT use! This will be Deprecated!. Please USE Tizen.NUI.PaddingType.Start instead!")]
206 [EditorBrowsable(EditorBrowsableState.Never)]
237 /// Please DO NOT use! This will be deprecated!
238 /// instead please use Start property.
239 [Obsolete("Please DO NOT use! This will be Deprecated!. Please USE Tizen.NUI.PaddingType.End instead!")]
240 [EditorBrowsable(EditorBrowsableState.Never)]
271 /// <since_tizen> 3 </since_tizen>
285 /// The Bottom value.
287 /// <since_tizen> 3 </since_tizen>
301 /// Creates an uninitialized PaddingType.
303 /// <since_tizen> 3 </since_tizen>
304 public PaddingType() : this(NDalicPINVOKE.new_PaddingType__SWIG_0(), true)
306 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
310 /// PaddingType Constructor.
312 /// <param name="start">Start padding or X coordinate</param>
313 /// <param name="end">End padding or Y coordinate</param>
314 /// <param name="top">Top padding or Height</param>
315 /// <param name="bottom">Bottom padding or Width</param>
316 public PaddingType(float start, float end, float top, float bottom) : this(NDalicPINVOKE.new_PaddingType__SWIG_1(start, end, top, bottom), true)
318 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
322 /// Assignment from individual values.
324 /// <param name="newStart">Start padding or X coordinate</param>
325 /// <param name="newEnd">End padding or Y coordinate</param>
326 /// <param name="newTop">Top padding or Height</param>
327 /// <param name="newBottom">Bottom padding or Width</param>
328 public void Set(float newStart, float newEnd, float newTop, float newBottom)
330 NDalicPINVOKE.PaddingType_Set(swigCPtr, newStart, newEnd, newTop, newBottom);
331 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
338 NDalicPINVOKE.PaddingType_left_set(swigCPtr, value);
339 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
343 float ret = NDalicPINVOKE.PaddingType_left_get(swigCPtr);
344 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
353 NDalicPINVOKE.PaddingType_start_set(swigCPtr, value);
354 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
358 float ret = NDalicPINVOKE.PaddingType_start_get(swigCPtr);
359 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
368 NDalicPINVOKE.PaddingType_right_set(swigCPtr, value);
369 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
373 float ret = NDalicPINVOKE.PaddingType_right_get(swigCPtr);
374 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
383 NDalicPINVOKE.PaddingType_end_set(swigCPtr, value);
384 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
388 float ret = NDalicPINVOKE.PaddingType_end_get(swigCPtr);
389 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
398 NDalicPINVOKE.PaddingType_top_set(swigCPtr, value);
399 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
403 float ret = NDalicPINVOKE.PaddingType_top_get(swigCPtr);
404 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
413 NDalicPINVOKE.PaddingType_bottom_set(swigCPtr, value);
414 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
418 float ret = NDalicPINVOKE.PaddingType_bottom_get(swigCPtr);
419 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();