/*
- * Copyright(c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright(c) 2019 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
*/
using System;
+using System.ComponentModel;
+using Tizen.NUI.Binding;
namespace Tizen.NUI
{
/// A three-dimensional vector.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- public class Vector3 : global::System.IDisposable
+ [Binding.TypeConverter(typeof(Vector3TypeConverter))]
+ public class Vector3 : Disposable, ICloneable
{
/// <summary>
- /// swigCMemOwn.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- protected bool swigCMemOwn;
- /// <summary>
- /// A Flat to check if it is already disposed.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- protected bool disposed = false;
- private global::System.Runtime.InteropServices.HandleRef swigCPtr;
- //A Flag to check who called Dispose(). (By User or DisposeQueue)
- private bool isDisposeQueued = false;
-
- /// <summary>
/// The constructor.
/// </summary>
/// <since_tizen> 3 </since_tizen>
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
- internal Vector3(global::System.IntPtr cPtr, bool cMemoryOwn)
+ internal Vector3(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
{
- swigCMemOwn = cMemoryOwn;
- swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
}
- /// <summary>
- /// Destructor.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- ~Vector3()
+ internal Vector3(Vector3ChangedCallback cb, float x, float y, float z) : this(Interop.Vector3.new_Vector3__SWIG_1(x, y, z), true)
{
- if(!isDisposeQueued)
- {
- isDisposeQueued = true;
- DisposeQueue.Instance.Add(this);
- }
+ callback = cb;
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
+ internal delegate void Vector3ChangedCallback(float x, float y, float z);
+ private Vector3ChangedCallback callback = null;
/// <summary>
/// (1.0f,1.0f,1.0f).
{
Interop.Vector3.Vector3_X_set(swigCPtr, value);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+
+ callback?.Invoke(X, Y, Z);
}
get
{
{
Interop.Vector3.Vector3_Width_set(swigCPtr, value);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+
+ callback?.Invoke(X, Y, Z);
}
get
{
{
Interop.Vector3.Vector3_r_set(swigCPtr, value);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+
+ callback?.Invoke(X, Y, Z);
}
get
{
{
Interop.Vector3.Vector3_Y_set(swigCPtr, value);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+
+ callback?.Invoke(X, Y, Z);
}
get
{
{
Interop.Vector3.Vector3_Height_set(swigCPtr, value);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+
+ callback?.Invoke(X, Y, Z);
}
get
{
{
Interop.Vector3.Vector3_g_set(swigCPtr, value);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+
+ callback?.Invoke(X, Y, Z);
}
get
{
{
Interop.Vector3.Vector3_Z_set(swigCPtr, value);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+
+ callback?.Invoke(X, Y, Z);
}
get
{
{
Interop.Vector3.Vector3_Depth_set(swigCPtr, value);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+
+ callback?.Invoke(X, Y, Z);
}
get
{
{
Interop.Vector3.Vector3_b_set(swigCPtr, value);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+
+ callback?.Invoke(X, Y, Z);
}
get
{
return ret;
}
- /// <summary>
- /// Dispose.
- /// </summary>
- /// <since_tizen> 3 </since_tizen>
- public void Dispose()
- {
- //Throw excpetion if Dispose() is called in separate thread.
- if (!Window.IsInstalled())
- {
- throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
- }
-
- if (isDisposeQueued)
- {
- Dispose(DisposeTypes.Implicit);
- }
- else
- {
- Dispose(DisposeTypes.Explicit);
- System.GC.SuppressFinalize(this);
- }
- }
+ /// <inheritdoc/>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public object Clone() => new Vector3(X, Y, Z);
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Vector3 obj)
{
return ret;
}
- /// <summary>
- /// Dispose.
- /// </summary>
- /// <param name="type">The dispose type</param>
- /// <since_tizen> 3 </since_tizen>
- protected virtual void Dispose(DisposeTypes type)
+ /// This will not be public opened.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
{
- if (disposed)
- {
- return;
- }
-
- if (type == DisposeTypes.Explicit)
- {
- //Called by User
- //Release your own managed resources here.
- //You should release all of your own disposable objects here.
- }
-
- //Release your own unmanaged resources here.
- //You should not access any managed member here except static instance.
- //because the execution order of Finalizes is non-deterministic.
-
- if (swigCPtr.Handle != global::System.IntPtr.Zero)
- {
- if (swigCMemOwn)
- {
- swigCMemOwn = false;
- Interop.Vector3.delete_Vector3(swigCPtr);
- }
- swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
- }
- disposed = true;
+ Interop.Vector3.delete_Vector3(swigCPtr);
}
private Vector3 Add(Vector3 rhs)