diff --git a/src/Tizen.NUI/src/public/BaseComponents/TextUtils.cs b/src/Tizen.NUI/src/public/BaseComponents/TextUtils.cs
index e7deb1ed7c7..8da86abffb4 100755
--- a/src/Tizen.NUI/src/public/BaseComponents/TextUtils.cs
+++ b/src/Tizen.NUI/src/public/BaseComponents/TextUtils.cs
@@ -758,7 +758,10 @@ public Size Size
{
set
{
- Interop.EmbeddedItemInfo.SizeSet(SwigCPtr, Size.getCPtr(value));
+ var handle = Size.GetHandleRef(value);
+ Interop.EmbeddedItemInfo.SizeSet(SwigCPtr, handle);
+ Size.ReleaseHandleRef(handle);
+
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
get
@@ -778,7 +781,10 @@ public Size RotatedSize
{
set
{
- Interop.EmbeddedItemInfo.RotatedSizeSet(SwigCPtr, Size.getCPtr(value));
+ var handleRef = Size.GetHandleRef(value);
+ Interop.EmbeddedItemInfo.RotatedSizeSet(SwigCPtr, handleRef);
+ Size.ReleaseHandleRef (handleRef);
+
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
get
diff --git a/src/Tizen.NUI/src/public/BaseComponents/View.cs b/src/Tizen.NUI/src/public/BaseComponents/View.cs
index 18604ba69f0..d130d58cc89 100755
--- a/src/Tizen.NUI/src/public/BaseComponents/View.cs
+++ b/src/Tizen.NUI/src/public/BaseComponents/View.cs
@@ -5386,7 +5386,13 @@ private Size GetInternalSize()
{
internalSize = new Size(OnSizeChanged, 0, 0, 0);
}
- Object.InternalRetrievingPropertyVector3(SwigCPtr, Property.SIZE, internalSize.SwigCPtr);
+
+ var w = Interop.Actor.InternalGetPropertyFloat(SwigCPtr, Property.SizeWidth);
+ var h = Interop.Actor.InternalGetPropertyFloat(SwigCPtr, Property.SizeHeight);
+ var d = Interop.Actor.InternalGetPropertyFloat(SwigCPtr, Property.SizeDepth);
+
+ internalSize.ResetValue(w, h, d);
+
return internalSize;
}
diff --git a/src/Tizen.NUI/src/public/Common/PropertyValue.cs b/src/Tizen.NUI/src/public/Common/PropertyValue.cs
index ae5cf5c5b8c..a9d02a2220e 100755
--- a/src/Tizen.NUI/src/public/Common/PropertyValue.cs
+++ b/src/Tizen.NUI/src/public/Common/PropertyValue.cs
@@ -220,9 +220,8 @@ public PropertyValue(PropertyValue value) : this(Interop.PropertyValue.NewProper
/// Creates a Size property value.
///
/// Size values.
- internal PropertyValue(Size vectorValue) : this(Interop.PropertyValue.NewPropertyValueVector3(Size.getCPtr(vectorValue)), true)
+ internal PropertyValue(Size vectorValue) : this(vectorValue.Width, vectorValue.Height, vectorValue.Depth)
{
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
internal PropertyValue(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
{
@@ -548,7 +547,8 @@ static public PropertyValue CreateFromObject(System.Object obj)
}
else if (type.Equals(typeof(Size)))
{
- value = Interop.PropertyValue.NewPropertyValueVector3(Size.getCPtr((Size)obj));
+ var size = obj as Size;
+ value = Interop.PropertyValue.NewPropertyValueVector3Componentwise(size.Width, size.Height, size.Depth);
}
else if (type.Equals(typeof(Size2D)))
{
@@ -655,8 +655,14 @@ public bool Get(Position2D vectorValue)
[EditorBrowsable(EditorBrowsableState.Never)]
public bool Get(Size vectorValue)
{
- bool ret = Interop.PropertyValue.GetVector3(SwigCPtr, Size.getCPtr(vectorValue));
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ if (null == vectorValue)
+ {
+ throw new ArgumentNullException(nameof(vectorValue));
+ }
+
+ var ret = GetVector3Component(out var w, out var h, out var d);
+ vectorValue.ResetValue(w, h, d);
+
return ret;
}
diff --git a/src/Tizen.NUI/src/public/Common/Size.cs b/src/Tizen.NUI/src/public/Common/Size.cs
index 6ba1226f3c8..a7ee9d89871 100755
--- a/src/Tizen.NUI/src/public/Common/Size.cs
+++ b/src/Tizen.NUI/src/public/Common/Size.cs
@@ -28,7 +28,11 @@ namespace Tizen.NUI
[Tizen.NUI.Binding.TypeConverter(typeof(SizeTypeConverter))]
public class Size : Disposable, ICloneable
{
- private static readonly Vector3 zero = new Vector3(0.0f, 0.0f, 0.0f);
+ private static readonly Size zero = new Size(0.0f, 0.0f, 0.0f);
+
+ private float width;
+ private float height;
+ private float depth;
///
/// The constructor.
@@ -42,9 +46,8 @@ public class Size : Disposable, ICloneable
/// Size Tmp = view.MaximumSize; //here Tmp.Depth will be 0.0f.
///
/// 5
- public Size() : this(Interop.Vector3.NewVector3(), true)
+ public Size()
{
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
@@ -62,9 +65,11 @@ public Size() : this(Interop.Vector3.NewVector3(), true)
/// Size Tmp = view.MaximumSize; //here Tmp.Depth will be 0.0f.
///
/// 5
- public Size(float width, float height, float depth = 0.0f) : this(Interop.Vector3.NewVector3(width, height, depth), true)
+ public Size(float width, float height, float depth = 0.0f)
{
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ this.width = width;
+ this.height = height;
+ this.depth = depth;
}
///
@@ -72,9 +77,13 @@ public Size(float width, float height, float depth = 0.0f) : this(Interop.Vector
///
/// Size2D with width and height.
/// 5
- public Size(Size2D size2d) : this(Interop.Vector3.NewVector3WithVector2(Size2D.getCPtr(size2d)), true)
+ public Size(Size2D size2d)
{
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ if (null != size2d)
+ {
+ width = size2d.Width;
+ height = size2d.Height;
+ }
}
///
@@ -103,16 +112,12 @@ public float Width
[Obsolete("Do not use this setter, that is deprecated in API8 and will be removed in API10. Use new Size(...) constructor")]
set
{
- Interop.Vector3.WidthSet(SwigCPtr, value);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-
- callback?.Invoke(value, Height, Depth);
+ width = value;
+ callback?.Invoke(width, Height, Depth);
}
get
{
- float ret = Interop.Vector3.WidthGet(SwigCPtr);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
- return ret;
+ return width;
}
}
@@ -136,16 +141,12 @@ public float Height
[Obsolete("Do not use this setter, that is deprecated in API8 and will be removed in API10. Use new Size(...) constructor")]
set
{
- Interop.Vector3.HeightSet(SwigCPtr, value);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-
- callback?.Invoke(Width, value, Depth);
+ height = value;
+ callback?.Invoke(width, Height, Depth);
}
get
{
- float ret = Interop.Vector3.HeightGet(SwigCPtr);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
- return ret;
+ return height;
}
}
@@ -169,16 +170,12 @@ public float Depth
[Obsolete("Do not use this setter, that is deprecated in API8 and will be removed in API10. Use new Size(...) constructor")]
set
{
- Interop.Vector3.DepthSet(SwigCPtr, value);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-
- callback?.Invoke(Width, Height, value);
+ depth = value;
+ callback?.Invoke(width, Height, Depth);
}
get
{
- float ret = Interop.Vector3.DepthGet(SwigCPtr);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
- return ret;
+ return depth;
}
}
@@ -302,7 +299,7 @@ public override bool Equals(System.Object obj)
/// 6
public override int GetHashCode()
{
- return SwigCPtr.Handle.GetHashCode();
+ return base.GetHashCode();
}
///
@@ -314,9 +311,19 @@ public override int GetHashCode()
/// 5
public bool EqualTo(Size rhs)
{
- bool ret = Interop.Vector3.EqualTo(SwigCPtr, Size.getCPtr(rhs));
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
+ if (rhs == null)
+ {
+ throw new ArgumentNullException(nameof(rhs), "rhs is null.");
+ }
+
+ if (NDalic.Equals(width, rhs.width) && NDalic.Equals(height, rhs.height) && NDalic.Equals(depth, rhs.depth))
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
}
///
@@ -328,9 +335,19 @@ public bool EqualTo(Size rhs)
/// 5
public bool NotEqualTo(Size rhs)
{
- bool ret = Interop.Vector3.NotEqualTo(SwigCPtr, Size.getCPtr(rhs));
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
+ if (rhs == null)
+ {
+ throw new ArgumentNullException(nameof(rhs), "rhs is null.");
+ }
+
+ if (NDalic.Equals(width, rhs.width) && NDalic.Equals(height, rhs.height) && NDalic.Equals(depth, rhs.depth))
+ {
+ return false;
+ }
+ else
+ {
+ return true;
+ }
}
///
@@ -381,18 +398,6 @@ public static implicit operator Size(Size2D size2d)
return new Size(size2d.Width, size2d.Height);
}
-
- internal static Size GetSizeFromPtr(global::System.IntPtr cPtr)
- {
- Size ret = new Size(cPtr, false);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
-
- internal Size(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
- {
- }
-
/// This will not be public opened.
[EditorBrowsable(EditorBrowsableState.Never)]
protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
@@ -400,72 +405,146 @@ protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef
Interop.Vector3.DeleteVector3(swigCPtr);
}
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected override void Dispose(bool disposing)
+ {
+ }
+
private Size Add(Size rhs)
{
- Size ret = new Size(Interop.Vector3.Add(SwigCPtr, Size.getCPtr(rhs)), true);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
+ if (null == rhs)
+ {
+ throw new ArgumentNullException(nameof(rhs));
+ }
+
+ return new Size(width + rhs.width, height + rhs.height, depth + rhs.depth);
}
private Size Subtract(Size rhs)
{
- Size ret = new Size(Interop.Vector3.Subtract(SwigCPtr, Size.getCPtr(rhs)), true);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
+ if (null == rhs)
+ {
+ throw new ArgumentNullException(nameof(rhs));
+ }
+
+ return new Size(width - rhs.width, height - rhs.height, depth - rhs.depth);
}
private Size Multiply(Size rhs)
{
- Size ret = new Size(Interop.Vector3.Multiply(SwigCPtr, Size.getCPtr(rhs)), true);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
+ if (null == rhs)
+ {
+ throw new ArgumentNullException(nameof(rhs));
+ }
+
+ return new Size(width * rhs.width, height * rhs.height, depth * rhs.depth);
}
private Size Multiply(float rhs)
{
- Size ret = new Size(Interop.Vector3.Multiply(SwigCPtr, rhs), true);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
+ return new Size(width * rhs, height * rhs, depth * rhs);
}
private Size Divide(Size rhs)
{
- Size ret = new Size(Interop.Vector3.Divide(SwigCPtr, Size.getCPtr(rhs)), true);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
+ if (null == rhs)
+ {
+ throw new ArgumentNullException(nameof(rhs));
+ }
+
+ return new Size(width / rhs.width, height / rhs.height, depth / rhs.depth);
}
private Size Divide(float rhs)
{
- Size ret = new Size(Interop.Vector3.Divide(SwigCPtr, rhs), true);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
+ return new Size(width / rhs, height / rhs, depth / rhs);
}
private Size Subtract()
{
- Size ret = new Size(Interop.Vector3.Subtract(SwigCPtr), true);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
+ return new Size(-width, -height, -depth);
}
private float ValueOfIndex(uint index)
{
- float ret = Interop.Vector3.ValueOfIndex(SwigCPtr, index);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ var ret = 0.0f;
+
+ switch (index)
+ {
+ case 0:
+ ret = width;
+ break;
+
+ case 1:
+ ret = height;
+ break;
+
+ case 2:
+ ret = depth;
+ break;
+ }
+
return ret;
}
+ internal static global::System.Runtime.InteropServices.HandleRef GetHandleRef(Size obj)
+ {
+ if (null == obj)
+ {
+ return new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ }
+ else
+ {
+ return new global::System.Runtime.InteropServices.HandleRef(obj, Interop.Vector3.NewVector3(obj.width, obj.height, obj.depth));
+ }
+ }
+
+ internal static void ReleaseHandleRef(global::System.Runtime.InteropServices.HandleRef swigCPtr)
+ {
+ if (swigCPtr.Handle != global::System.IntPtr.Zero)
+ {
+ Interop.Vector3.DeleteVector3(swigCPtr);
+ }
+ }
+
internal delegate void SizeChangedCallback(float width, float height, float depth);
- internal Size(SizeChangedCallback cb, float w, float h, float d) : this(Interop.Vector3.NewVector3(w, h, d), true)
+ internal Size(IntPtr ptr, bool cMemoryOwn)
+ {
+ var swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, ptr);
+ width = Interop.Vector3.WidthGet(swigCPtr);
+ height = Interop.Vector3.HeightGet(swigCPtr);
+ depth = Interop.Vector3.DepthGet(swigCPtr);
+
+ if (cMemoryOwn)
+ {
+ Interop.Vector3.DeleteVector3(swigCPtr);
+ }
+
+ if (NDalicPINVOKE.SWIGPendingException.Pending)
+ {
+ throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+ }
+
+ internal Size(SizeChangedCallback cb, float w, float h, float d)
{
callback = cb;
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+
+ width = w;
+ height = h;
+ depth = d;
+ }
+
+ internal Size(SizeChangedCallback cb, Size other) : this(cb, other.width, other.height, other.depth)
+ {
}
- internal Size(SizeChangedCallback cb, Size other) : this(cb, other.Width, other.Height, other.Depth)
+ internal void ResetValue(float w, float h, float d)
{
+ width = w;
+ height = h;
+ depth = d;
}
private SizeChangedCallback callback = null;