[NUI] temporary fix! fix wrong value of screen position in object dump
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / BaseComponents / View.cs
index f312226..e91526c 100755 (executable)
  * limitations under the License.
  *
  */
+using System;
+using System.ComponentModel;
+using System.Runtime.InteropServices;
 
 namespace Tizen.NUI.BaseComponents
 {
-
-    using System;
-    using System.Runtime.InteropServices;
-
     /// <summary>
     /// View is the base class for all views.
     /// </summary>
+    /// <since_tizen> 3 </since_tizen>
     public class View : Container
     {
         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
@@ -91,6 +91,7 @@ namespace Tizen.NUI.BaseComponents
         /// Retrieves the number of children held by the view.
         /// </summary>
         /// <seealso cref="Container.GetChildCount" />
+        /// <since_tizen> 4 </since_tizen>
         public override uint GetChildCount()
         {
             return Convert.ToUInt32(Children.Count);
@@ -100,6 +101,7 @@ namespace Tizen.NUI.BaseComponents
         /// Gets the views parent.
         /// </summary>
         /// <seealso cref="Container.GetParent()" />
+        /// <since_tizen> 4 </since_tizen>
         public override Container GetParent()
         {
             IntPtr cPtr = NDalicPINVOKE.Actor_GetParent(swigCPtr);
@@ -158,12 +160,6 @@ namespace Tizen.NUI.BaseComponents
 
             base.Dispose(type);
 
-            // Dispose all Children of this View.
-            foreach (View childView in Children)
-            {
-                childView?.Dispose();
-            }
-            Children.Clear();
         }
 
         private void DisConnectFromSignals()
@@ -347,6 +343,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// Event arguments that passed via the KeyEvent signal.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public class KeyEventArgs : EventArgs
         {
             private Key _key;
@@ -377,7 +374,7 @@ namespace Tizen.NUI.BaseComponents
         /// An event for the KeyPressed signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
         /// The KeyPressed signal is emitted when the key event is received.<br />
         /// </summary>
-        /// <since_tizen> 4 </since_tizen>
+        /// <since_tizen> 3 </since_tizen>
         public event EventHandlerWithReturnType<object, KeyEventArgs, bool> KeyEvent
         {
             add
@@ -471,6 +468,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// Event arguments that passed via the touch signal.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public class TouchEventArgs : EventArgs
         {
             private Touch _touch;
@@ -501,7 +499,7 @@ namespace Tizen.NUI.BaseComponents
         /// An event for the touched signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
         /// The touched signal is emitted when the touch input is received.<br />
         /// </summary>
-        /// <since_tizen> 4 </since_tizen>
+        /// <since_tizen> 3 </since_tizen>
         public event EventHandlerWithReturnType<object, TouchEventArgs, bool> TouchEvent
         {
             add
@@ -545,6 +543,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// Event arguments that passed via the hover signal.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public class HoverEventArgs : EventArgs
         {
             private Hover _hover;
@@ -575,7 +574,7 @@ namespace Tizen.NUI.BaseComponents
         /// An event for the hovered signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
         /// The hovered signal is emitted when the hover input is received.<br />
         /// </summary>
-        /// <since_tizen> 4 </since_tizen>
+        /// <since_tizen> 3 </since_tizen>
         public event EventHandlerWithReturnType<object, HoverEventArgs, bool> HoverEvent
         {
             add
@@ -619,6 +618,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// Event arguments that passed via the wheel signal.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public class WheelEventArgs : EventArgs
         {
             private Wheel _wheel;
@@ -649,7 +649,7 @@ namespace Tizen.NUI.BaseComponents
         /// An event for the WheelMoved signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
         /// The WheelMoved signal is emitted when the wheel event is received.<br />
         /// </summary>
-        /// <since_tizen> 4 </since_tizen>
+        /// <since_tizen> 3 </since_tizen>
         public event EventHandlerWithReturnType<object, WheelEventArgs, bool> WheelEvent
         {
             add
@@ -780,6 +780,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// Event arguments of visibility changed.
         /// </summary>
+        /// <since_tizen> 3 </since_tizen>
         public class VisibilityChangedEventArgs : EventArgs
         {
             private View _view;
@@ -890,6 +891,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// Event arguments of layout direction changed.
         /// </summary>
+        /// <since_tizen> 4 </since_tizen>
         public class LayoutDirectionChangedEventArgs : EventArgs
         {
             private View _view;
@@ -995,7 +997,7 @@ namespace Tizen.NUI.BaseComponents
         /// An event for the ResourcesLoadedSignal signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
         /// This signal is emitted after all resources required by a view are loaded and ready.<br />
         /// </summary>
-        /// <since_tizen> 4 </since_tizen>
+        /// <since_tizen> 3 </since_tizen>
         public event EventHandler ResourcesLoaded
         {
             add
@@ -1090,7 +1092,6 @@ namespace Tizen.NUI.BaseComponents
             internal static readonly int SIZE_SCALE_POLICY = NDalicPINVOKE.Actor_Property_SIZE_SCALE_POLICY_get();
             internal static readonly int WIDTH_FOR_HEIGHT = NDalicPINVOKE.Actor_Property_WIDTH_FOR_HEIGHT_get();
             internal static readonly int HEIGHT_FOR_WIDTH = NDalicPINVOKE.Actor_Property_HEIGHT_FOR_WIDTH_get();
-            internal static readonly int PADDING = NDalicPINVOKE.Actor_Property_PADDING_get();
             internal static readonly int MINIMUM_SIZE = NDalicPINVOKE.Actor_Property_MINIMUM_SIZE_get();
             internal static readonly int MAXIMUM_SIZE = NDalicPINVOKE.Actor_Property_MAXIMUM_SIZE_get();
             internal static readonly int INHERIT_POSITION = NDalicPINVOKE.Actor_Property_INHERIT_POSITION_get();
@@ -1098,7 +1099,7 @@ namespace Tizen.NUI.BaseComponents
             internal static readonly int INHERIT_LAYOUT_DIRECTION = NDalicManualPINVOKE.Actor_Property_INHERIT_LAYOUT_DIRECTION_get();
             internal static readonly int LAYOUT_DIRECTION = NDalicManualPINVOKE.Actor_Property_LAYOUT_DIRECTION_get();
             internal static readonly int MARGIN = NDalicPINVOKE.View_Property_MARGIN_get();
-            internal static readonly int PADDINGEX = NDalicPINVOKE.View_Property_PADDING_get();
+            internal static readonly int PADDING = NDalicPINVOKE.View_Property_PADDING_get();
         }
 
         /// <summary>
@@ -1160,7 +1161,9 @@ namespace Tizen.NUI.BaseComponents
         /// </summary>
         /// <param name="handle">A handle to an object.</param>
         /// <returns>A handle to a view or an uninitialized handle.</returns>
-        [Obsolete("Please do not use! this will be deprecated, instead please use as keyword.")]
+        /// <since_tizen> 3 </since_tizen>
+        [Obsolete("Please do not use! This will be deprecated! Please use as keyword instead!")]
+        [EditorBrowsable(EditorBrowsableState.Never)]
         public static View DownCast(BaseHandle handle)
         {
             View ret =  Registry.GetManagedBaseHandleFromNativePtr(handle) as View;
@@ -1172,7 +1175,8 @@ namespace Tizen.NUI.BaseComponents
         /// [Obsolete("Please do not use! this will be deprecated, instead please use as keyword.")]
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        [Obsolete("Please do not use! this will be deprecated, instead please use as keyword.")]
+        [Obsolete("Please do not use! This will be deprecated! Please use as keyword instead!")]
+        [EditorBrowsable(EditorBrowsableState.Never)]
         public static T DownCast<T>(View view) where T : View
         {
             T ret = Registry.GetManagedBaseHandleFromNativePtr(view) as T;
@@ -1386,7 +1390,7 @@ namespace Tizen.NUI.BaseComponents
         /// Creates an animation to animate the background color visual. If there is no
         /// background visual, creates one with transparent black as it's mixColor.
         /// </summary>
-        /// <since_tizen> 4 </since_tizen>
+        /// <since_tizen> 3 </since_tizen>
         public Animation AnimateBackgroundColor( object destinationValue,
                                                  int startTime,
                                                  int endTime,
@@ -1408,7 +1412,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// Creates an animation to animate the mixColor of the named visual.
         /// </summary>
-        /// <since_tizen> 4 </since_tizen>
+        /// <since_tizen> 3 </since_tizen>
         public Animation AnimateColor( string targetVisual, object destinationColor, int startTime, int endTime, AlphaFunction.BuiltinFunctions? alphaFunction = null, object initialColor = null )
         {
             Animation animation = null;
@@ -2103,7 +2107,8 @@ namespace Tizen.NUI.BaseComponents
         /// [Obsolete("Please do not use! this will be deprecated. Please use Visibility instead.")]
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        [Obsolete("Please do not use! this will be deprecated. Please use Visibility instead.")]
+        [Obsolete("Please do not use! This will be deprecated! Please use Visibility instead!")]
+        [EditorBrowsable(EditorBrowsableState.Never)]
         public bool Visible
         {
             get
@@ -2160,6 +2165,10 @@ namespace Tizen.NUI.BaseComponents
             {
                 Vector2 temp = new Vector2(0.0f, 0.0f);
                 GetProperty(View.Property.SCREEN_POSITION).Get(temp);
+                // Dali's default layer is default center origin. need to change as top left.
+                // NUI's Layer is like a transparent film which covers entire window. (Layer is not an actor of Dali)
+                // otherwise, this makes ScreenPosition as wrong value.
+                temp -= (Window.Instance.GetSize() * 0.5f);
                 return temp;
             }
         }
@@ -2171,7 +2180,7 @@ namespace Tizen.NUI.BaseComponents
         /// <remarks>If false, then the top-left of the view is used for the position.
         /// Setting this to false will allow scaling or rotation around the anchor-point without affecting the view's position.
         /// </remarks>
-        /// <since_tizen> 4 </since_tizen>
+        /// <since_tizen> 3 </since_tizen>
         public bool PositionUsesPivotPoint
         {
             get
@@ -2187,10 +2196,17 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
-        /// [Obsolete("Please do not use! this will be deprecated")]
+        /// Please do not use! this will be deprecated.
         /// </summary>
+        /// Please do not use! this will be deprecated!
+        /// Instead please use PositionUsesPivotPoint.
         /// <since_tizen> 3 </since_tizen>
-        [Obsolete("Please do not use! this will be deprecated")]
+        [Obsolete("Please do not use! This will be deprecated! Please use PositionUsesPivotPoint instead! " +
+            "Like: " +
+            "View view = new View(); " +
+            "view.PivotPoint = PivotPoint.Center; " +
+            "view.PositionUsesPivotPoint = true;")]
+        [EditorBrowsable(EditorBrowsableState.Never)]
         public bool PositionUsesAnchorPoint
         {
             get
@@ -2271,7 +2287,14 @@ namespace Tizen.NUI.BaseComponents
         /// <remarks>
         /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
         /// </remarks>
-        [Obsolete("Please do not use! this will be deprecated, please use NaturalSize2D instead")]
+        /// /// Please do not use! this will be deprecated!
+        /// Instead please use NaturalSize2D.
+        /// <since_tizen> 3 </since_tizen>
+        [Obsolete("Please do not use! This will be deprecated! Please use NaturalSize2D instead! " +
+            "Like: " +
+            "TextLabel label = new TextLabel(\"Hello World!\"); " +
+            "Size2D size = label.NaturalSize2D;")]
+        [EditorBrowsable(EditorBrowsableState.Never)]
         public Vector3 NaturalSize
         {
             get
@@ -2423,7 +2446,7 @@ namespace Tizen.NUI.BaseComponents
         /// </summary>
         /// <remarks>Most resources are only loaded when the control is placed on the stage.
         /// </remarks>
-        /// <since_tizen> 4 </since_tizen>
+        /// <since_tizen> 3 </since_tizen>
         public bool IsResourceReady()
         {
             bool ret = NDalicPINVOKE.IsResourceReady(swigCPtr);
@@ -2531,7 +2554,15 @@ namespace Tizen.NUI.BaseComponents
             return ret;
         }
 
-        internal Layer GetLayer()
+        /// <summary>
+        /// Gets the parent layer of this view.If a view has no parent, this method does nothing.
+        /// </summary>
+        /// <pre>The view has been initialized. </pre>
+        /// <returns>the parent layer of view </returns>
+        /// <since_tizen> 5 </since_tizen>
+        /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public Layer GetLayer()
         {
             IntPtr cPtr = NDalicPINVOKE.Actor_GetLayer(swigCPtr);
             Layer ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Layer;
@@ -3148,7 +3179,7 @@ namespace Tizen.NUI.BaseComponents
             return ret;
         }
 
-        /// <since_tizen> 4 </since_tizen>
+        /// <since_tizen> 3 </since_tizen>
         public uint AddRenderer(Renderer renderer)
         {
             uint ret = NDalicPINVOKE.Actor_AddRenderer(swigCPtr, Renderer.getCPtr(renderer));
@@ -3165,7 +3196,7 @@ namespace Tizen.NUI.BaseComponents
             return ret;
         }
 
-        /// <since_tizen> 4 </since_tizen>
+        /// <since_tizen> 3 </since_tizen>
         public Renderer GetRendererAt(uint index)
         {
             IntPtr cPtr = NDalicPINVOKE.Actor_GetRendererAt(swigCPtr, index);
@@ -3176,7 +3207,7 @@ namespace Tizen.NUI.BaseComponents
             return ret;
         }
 
-        /// <since_tizen> 4 </since_tizen>
+        /// <since_tizen> 3 </since_tizen>
         public void RemoveRenderer(Renderer renderer)
         {
             NDalicPINVOKE.Actor_RemoveRenderer__SWIG_0(swigCPtr, Renderer.getCPtr(renderer));
@@ -3184,7 +3215,7 @@ namespace Tizen.NUI.BaseComponents
                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
 
-        /// <since_tizen> 4 </since_tizen>
+        /// <since_tizen> 3 </since_tizen>
         public void RemoveRenderer(uint index)
         {
             NDalicPINVOKE.Actor_RemoveRenderer__SWIG_1(swigCPtr, index);
@@ -4054,12 +4085,12 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// Gets or sets the padding for use in layout.
         /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        public Vector4 Padding
+        /// <since_tizen> 4 </since_tizen>
+        public Extents Padding
         {
             get
             {
-                Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
+                Extents temp = new Extents(0, 0, 0, 0);
                 GetProperty(View.Property.PADDING).Get(temp);
                 return temp;
             }
@@ -4159,7 +4190,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// Gets the number of renderers held by the view.
         /// </summary>
-        /// <since_tizen> 4 </since_tizen>
+        /// <since_tizen> 3 </since_tizen>
         public uint RendererCount
         {
             get
@@ -4174,7 +4205,10 @@ namespace Tizen.NUI.BaseComponents
         /// [Obsolete("Please do not use! this will be deprecated")]
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        [Obsolete("Please do not use! this will be deprecated")]
+        /// Please do not use! this will be deprecated!
+        /// Instead please use TouchEvent.
+        [Obsolete("Please do not use! This will be deprecated! Please use TouchEvent instead!")]
+        [EditorBrowsable(EditorBrowsableState.Never)]
         public event EventHandlerWithReturnType<object, TouchEventArgs, bool> Touched
         {
             add
@@ -4204,7 +4238,10 @@ namespace Tizen.NUI.BaseComponents
         /// [Obsolete("Please do not use! this will be deprecated")]
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        [Obsolete("Please do not use! this will be deprecated")]
+        /// Please do not use! this will be deprecated!
+        /// Instead please use HoverEvent.
+        [Obsolete("Please do not use! This will be deprecated! Please use HoverEvent instead!")]
+        [EditorBrowsable(EditorBrowsableState.Never)]
         public event EventHandlerWithReturnType<object, HoverEventArgs, bool> Hovered
         {
             add
@@ -4231,10 +4268,13 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
-        /// [Obsolete("Please do not use! this will be deprecated")]
+        /// Please do not use! this will be deprecated.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        [Obsolete("Please do not use! this will be deprecated")]
+        /// Please do not use! this will be deprecated!
+        /// Instead please use WheelEvent.
+        [Obsolete("Please do not use! This will be deprecated! Please use WheelEvent instead!")]
+        [EditorBrowsable(EditorBrowsableState.Never)]
         public event EventHandlerWithReturnType<object, WheelEventArgs, bool> WheelMoved
         {
             add
@@ -4264,7 +4304,14 @@ namespace Tizen.NUI.BaseComponents
         /// [Obsolete("Please do not use! this will be deprecated")]
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        [Obsolete("Please do not use! this will be deprecated")]
+        /// Please do not use! this will be deprecated!
+        /// Instead please use PivotPoint.
+        [Obsolete("Please do not use! This will be deprecated! Please use PivotPoint instead! " +
+            "Like: " +
+            "View view = new View(); " +
+            "view.PivotPoint = PivotPoint.Center; " +
+            "view.PositionUsesPivotPoint = true;")]
+        [EditorBrowsable(EditorBrowsableState.Never)]
         public Position AnchorPoint
         {
             get
@@ -4283,7 +4330,11 @@ namespace Tizen.NUI.BaseComponents
         /// [Obsolete("Please do not use! this will be deprecated")]
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        [Obsolete("Please do not use! this will be deprecated, please use Size2D instead")]
+        [Obsolete("Please do not use! This will be deprecated! Please use Size2D instead! " +
+            "Like: " +
+            "View view = new View(); " +
+            "view.Size2D = new Size2D(100, 100);")]
+        [EditorBrowsable(EditorBrowsableState.Never)]
         public Size Size
         {
             get
@@ -4302,7 +4353,10 @@ namespace Tizen.NUI.BaseComponents
         /// [Obsolete("Please do not use! this will be deprecated")]
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        [Obsolete("Please do not use! this will be deprecated")]
+        /// Please do not use! this will be deprecated!
+        /// Instead please use AddedToWindow.
+        [Obsolete("Please do not use! This will be deprecated! Please use AddedToWindow instead!")]
+        [EditorBrowsable(EditorBrowsableState.Never)]
         public event EventHandler OnWindowEvent
         {
             add
@@ -4331,7 +4385,10 @@ namespace Tizen.NUI.BaseComponents
         /// [Obsolete("Please do not use! this will be deprecated")]
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        [Obsolete("Please do not use! this will be deprecated")]
+        /// Please do not use! this will be deprecated!
+        /// Instead please use RemovedFromWindow.
+        [Obsolete("Please do not use! This will be deprecated! Please use RemovedFromWindow instead!")]
+        [EditorBrowsable(EditorBrowsableState.Never)]
         public event EventHandler OffWindowEvent
         {
             add
@@ -4360,7 +4417,10 @@ namespace Tizen.NUI.BaseComponents
         /// [Obsolete("Please do not use! this will be deprecated")]
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        [Obsolete("Please do not use! this will be deprecated")]
+        /// Please do not use! this will be deprecated!
+        /// Instead please use Relayout.
+        [Obsolete("Please do not use! This will be deprecated! Please use Relayout instead!")]
+        [EditorBrowsable(EditorBrowsableState.Never)]
         public event EventHandler OnRelayoutEvent
         {
             add
@@ -4390,8 +4450,11 @@ namespace Tizen.NUI.BaseComponents
         /// "Please DO NOT use! This will be deprecated! Please use 'Container GetParent() for derived class' instead!"
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
-        //"Please DO NOT use! This will be deprecated! Please use 'Container GetParent() for derived class' instead!"
-        [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
+        [Obsolete("Please do not use! This will be deprecated! Please use 'Container GetParent() for derived class' instead! " +
+            "Like: " +
+            "Container parent =  view.GetParent(); " +
+            "View view = parent as View;")]
+        [EditorBrowsable(EditorBrowsableState.Never)]
         public new View Parent
         {
             get
@@ -4458,6 +4521,7 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// Gets or sets the Margin for use in layout.
         /// </summary>
+        /// <since_tizen> 4 </since_tizen>
         public Extents Margin
         {
             get
@@ -4473,19 +4537,24 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
-        /// Gets or sets the Padding for use in layout.
+        /// [Obsolete("Please do not use! this will be deprecated")]
         /// </summary>
+        /// Please do not use! this will be deprecated!
+        /// Instead please use Padding.
+        /// <since_tizen> 4 </since_tizen>
+        [Obsolete("Please do not use! this will be deprecated, instead please use Padding.")]
+        [EditorBrowsable(EditorBrowsableState.Never)]
         public Extents PaddingEX
         {
             get
             {
                 Extents temp = new Extents(0, 0, 0, 0);
-                GetProperty(View.Property.PADDINGEX).Get(temp);
+                GetProperty(View.Property.PADDING).Get(temp);
                 return temp;
             }
             set
             {
-                SetProperty(View.Property.PADDINGEX, new Tizen.NUI.PropertyValue(value));
+                SetProperty(View.Property.PADDING, new Tizen.NUI.PropertyValue(value));
             }
         }
     }
@@ -4499,10 +4568,12 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// Left to right.
         /// </summary>
+        /// <since_tizen> 4 </since_tizen>
         LTR,
         /// <summary>
         /// Right to left.
         /// </summary>
+        /// <since_tizen> 4 </since_tizen>
         RTL
     }
 }