[NUI] Remove [Obsolete()] attribute
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / Rectangle.cs
index 372f623..1036e9c 100755 (executable)
@@ -14,6 +14,7 @@
  * limitations under the License.
  *
  */
+using System;
 using System.ComponentModel;
 using Tizen.NUI.Binding;
 
@@ -24,7 +25,7 @@ namespace Tizen.NUI
     /// </summary>
     /// <since_tizen> 3 </since_tizen>
     [Binding.TypeConverter(typeof(RectangleTypeConverter))]
-    public class Rectangle : Disposable
+    public class Rectangle : Disposable, ICloneable
     {
         /// <summary>
         /// The constructor.
@@ -64,6 +65,7 @@ namespace Tizen.NUI
 
         internal Rectangle(RectangleChangedCallback cb) : this()
         {
+            callback = cb;
         }
 
         internal Rectangle(RectangleChangedCallback cb, Rectangle other) : this(cb, other.x, other.y, other.width, other.height)
@@ -87,11 +89,24 @@ namespace Tizen.NUI
         /// <summary>
         /// The x position of the rectangle.
         /// </summary>
+        /// <remarks>
+        /// The setter is deprecated in API8 and will be removed in API10. Please use new Rectangle(...) constructor.
+        /// </remarks>
+        /// <code>
+        /// // DO NOT use like the followings!
+        /// Rectangle rectangle = new Rectangle();
+        /// rectangle.X = 1; 
+        /// // Please USE like this
+        /// int x = 1, y = 2, width = 3, height = 4;
+        /// Rectangle rectangle = new Rectangle(x, y, width, height);
+        /// </code>
         /// <since_tizen> 3 </since_tizen>
         public int X
         {
             set
             {
+                Tizen.Log.Fatal("NUI", "Please do not use this setter, Deprecated in API8, will be removed in API10. please use new Rectangle(...) constructor");
+
                 x = (value);
 
                 callback?.Invoke(X, Y, Width, Height);
@@ -105,11 +120,24 @@ namespace Tizen.NUI
         /// <summary>
         /// The Y position of the rectangle.
         /// </summary>
+        /// <remarks>
+        /// The setter is deprecated in API8 and will be removed in API10. Please use new Rectangle(...) constructor.
+        /// </remarks>
+        /// <code>
+        /// // DO NOT use like the followings!
+        /// Rectangle rectangle = new Rectangle();
+        /// rectangle.Y = 2; 
+        /// // Please USE like this
+        /// int x = 1, y = 2, width = 3, height = 4;
+        /// Rectangle rectangle = new Rectangle(x, y, width, height);
+        /// </code>
         /// <since_tizen> 3 </since_tizen>
         public int Y
         {
             set
             {
+                Tizen.Log.Fatal("NUI", "Please do not use this setter, Deprecated in API8, will be removed in API10. please use new Rectangle(...) constructor");
+
                 y = (value);
 
                 callback?.Invoke(X, Y, Width, Height);
@@ -123,11 +151,24 @@ namespace Tizen.NUI
         /// <summary>
         /// The width of the rectangle.
         /// </summary>
+        /// <remarks>
+        /// The setter is deprecated in API8 and will be removed in API10. Please use new Rectangle(...) constructor.
+        /// </remarks>
+        /// <code>
+        /// // DO NOT use like the followings!
+        /// Rectangle rectangle = new Rectangle();
+        /// rectangle.Width = 3; 
+        /// // Please USE like this
+        /// int x = 1, y = 2, width = 3, height = 4;
+        /// Rectangle rectangle = new Rectangle(x, y, width, height);
+        /// </code>
         /// <since_tizen> 3 </since_tizen>
         public int Width
         {
             set
             {
+                Tizen.Log.Fatal("NUI", "Please do not use this setter, Deprecated in API8, will be removed in API10. please use new Rectangle(...) constructor");
+
                 width = (value);
 
                 callback?.Invoke(X, Y, Width, Height);
@@ -141,11 +182,24 @@ namespace Tizen.NUI
         /// <summary>
         /// The height of the rectangle.
         /// </summary>
+        /// <remarks>
+        /// The setter is deprecated in API8 and will be removed in API10. Please use new Rectangle(...) constructor.
+        /// </remarks>
+        /// <code>
+        /// // DO NOT use like the followings!
+        /// Rectangle rectangle = new Rectangle();
+        /// rectangle.Height = 4; 
+        /// // Please USE like this
+        /// int x = 1, y = 2, width = 3, height = 4;
+        /// Rectangle rectangle = new Rectangle(x, y, width, height);
+        /// </code>
         /// <since_tizen> 3 </since_tizen>
         public int Height
         {
             set
             {
+                Tizen.Log.Fatal("NUI", "Please do not use this setter, Deprecated in API8, will be removed in API10. please use new Rectangle(...) constructor");
+
                 height = (value);
 
                 callback?.Invoke(X, Y, Width, Height);
@@ -321,11 +375,11 @@ namespace Tizen.NUI
         /// <since_tizen> 4 </since_tizen>
         public override bool Equals(object o)
         {
-            if(o == null)
+            if (o == null)
             {
                 return false;
             }
-            if(!(o is Rectangle))
+            if (!(o is Rectangle))
             {
                 return false;
             }
@@ -457,6 +511,10 @@ namespace Tizen.NUI
             return ret;
         }
 
+        /// <inheritdoc/>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public object Clone() => new Rectangle(this);
+
         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Rectangle obj)
         {
             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;