[NUI] Public ChildAdded,ChildRemoved,PropertySet events & properties of TableView...
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / BaseComponents / View.cs
index a7aabe0..0ee01e9 100755 (executable)
@@ -394,6 +394,23 @@ namespace Tizen.NUI.BaseComponents
         });
         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
         [EditorBrowsable(EditorBrowsableState.Never)]
+        public static readonly BindableProperty WeightProperty = BindableProperty.Create("Weight", typeof(float), typeof(View), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+        {
+            var view = (View)bindable;
+            if (newValue != null)
+            {
+                Tizen.NUI.Object.SetProperty(view.swigCPtr, LinearLayout.ChildProperty.WEIGHT, new Tizen.NUI.PropertyValue((float)newValue));
+            }
+        },
+        defaultValueCreator:(bindable) =>
+        {
+            var view = (View)bindable;
+            float temp = 0.0f;
+            Tizen.NUI.Object.GetProperty(view.swigCPtr, LinearLayout.ChildProperty.WEIGHT).Get(out temp);
+            return temp;
+        });
+        /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
         public static readonly BindableProperty LeftFocusableViewProperty = BindableProperty.Create("LeftFocusableView", typeof(View), typeof(View), default(View), propertyChanged: (bindable, oldValue, newValue) =>
         {
             var view = (View)bindable;
@@ -1239,26 +1256,22 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
-        /// Event argument passed through ChildAdded event
+        /// Event argument passed through the ChildAdded event.
         /// </summary>
         /// <since_tizen> 5 </since_tizen>
-        /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
-        [EditorBrowsable(EditorBrowsableState.Never)]
         public class ChildAddedEventArgs : EventArgs
         {
             /// <summary>
-            /// Added child View at moment
+            /// Added child view at moment.
             /// </summary>
             /// <since_tizen> 5 </since_tizen>
             public View Added { get; set; }
         }
 
         /// <summary>
-        /// Event when a child is added
+        /// Event when a child is added.
         /// </summary>
         /// <since_tizen> 5 </since_tizen>
-        /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
-        [EditorBrowsable(EditorBrowsableState.Never)]
         public new event EventHandler<ChildAddedEventArgs> ChildAdded;
 
         // From Container Base class
@@ -1286,8 +1299,15 @@ namespace Tizen.NUI.BaseComponents
 
                 if (layoutSet == true && child.Layout == null) // Only give children a layout if parent an explicit container
                 {
-                    LayoutItem layoutItem = new LayoutItem();
-                    child.Layout = layoutItem;
+                    if( child.GetType() == typeof(View) ||  true == child.LayoutingRequired )
+                    {
+                        child.Layout = new LayoutGroup();
+
+                    }
+                    else
+                    {
+                        child.Layout = new LayoutItem();
+                    }
                 }
 
                 if (Layout)
@@ -1312,26 +1332,22 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
-        /// Event argument passed through ChildRemoved event
+        /// Event argument passed through the ChildRemoved event.
         /// </summary>
         /// <since_tizen> 5 </since_tizen>
-        /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
-        [EditorBrowsable(EditorBrowsableState.Never)]
         public class ChildRemovedEventArgs : EventArgs
         {
             /// <summary>
-            /// Removed child View at moment
+            /// Removed child view at moment.
             /// </summary>
             /// <since_tizen> 5 </since_tizen>
             public View Removed { get; set; }
         }
 
         /// <summary>
-        /// Event when a child is removed
+        /// Event when a child is removed.
         /// </summary>
         /// <since_tizen> 5 </since_tizen>
-        /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
-        [EditorBrowsable(EditorBrowsableState.Never)]
         public new event EventHandler<ChildRemovedEventArgs> ChildRemoved;
 
 
@@ -3170,6 +3186,8 @@ namespace Tizen.NUI.BaseComponents
             set
             {
                 SetValue(Size2DProperty, value);
+                // Set Specification so when layouts measure this View it matches the value set here.
+                // All Views are currently Layouts.
                 SetProperty(LayoutItemWrapper.ChildProperty.WIDTH_SPECIFICATION, new Tizen.NUI.PropertyValue(value.Width));
                 SetProperty(LayoutItemWrapper.ChildProperty.HEIGHT_SPECIFICATION, new Tizen.NUI.PropertyValue(value.Height));
                 NotifyPropertyChanged();
@@ -3371,14 +3389,7 @@ namespace Tizen.NUI.BaseComponents
         /// <remarks>
         /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
         /// </remarks>
-        /// /// 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)]
+        /// <since_tizen> 5 </since_tizen>
         public Vector3 NaturalSize
         {
             get
@@ -3442,6 +3453,25 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
+        /// Set that layouting is required on this View. It will automatically receive a Layout.
+        /// </summary>
+        /// <remarks>
+        /// </remarks>
+        internal bool LayoutingRequired
+        {
+            get
+            {
+                bool result = Tizen.NUI.NDalicManualPINVOKE.View_IsLayoutingRequired(View.getCPtr(this));
+                if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+                return result;
+            }
+            set
+            {
+                Tizen.NUI.NDalicManualPINVOKE.View_SetLayoutingRequired(View.getCPtr(this), value);
+            }
+        }
+
+        /// <summary>
         /// Shows the view.
         /// </summary>
         /// <remarks>
@@ -3687,10 +3717,10 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
-        /// Gets the parent layer of this view.If a view has no parent, this method does nothing.
+        /// Gets the parent layer of this view.If a view has no parent, this method does not do anything.
         /// </summary>
         /// <pre>The view has been initialized. </pre>
-        /// <returns>the parent layer of view </returns>
+        /// <returns>The parent layer of view </returns>
         /// <since_tizen> 5 </since_tizen>
         public Layer GetLayer()
         {
@@ -5246,14 +5276,18 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
-        /// [Obsolete("Please do not use! this will be deprecated")]
+        /// Sets the size of a view for the width, the height and the depth.<br />
+        /// Geometry can be scaled to fit within this area.<br />
+        /// This does not interfere with the view's scale factor.<br />
+        /// The views default depth is the minimum of width and height.<br />
         /// </summary>
-        /// <since_tizen> 3 </since_tizen>
-        [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)]
+        /// <remarks>
+        /// Please note that multi-cascade setting is not possible for this NUI object. <br />
+        /// It is recommended that NUI object typed properties are configured by their constructor with parameters. <br />
+        /// For example, this code is working fine : view.Size = new Size( 1.0f, 1.0f, 0.0f); <br />
+        /// but this will not work! : view.Size.Width = 2.0f; view.Size.Height = 2.0f; <br />
+        /// </remarks>
+        /// <since_tizen> 5 </since_tizen>
         public Size Size
         {
             get
@@ -5341,6 +5375,10 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// Gets or sets the Margin for use in layout.
         /// </summary>
+        /// <remarks>
+        /// Margin property is supported by Layout algorithms and containers.
+        /// Please Set Layout if you want to use Margin property.
+        /// </remarks>
         /// <since_tizen> 4 </since_tizen>
         public Extents Margin
         {
@@ -5392,10 +5430,10 @@ namespace Tizen.NUI.BaseComponents
 
         /// <summary>
         /// Perform an action on a visual registered to this view. <br />
-        /// Visuals will have actions, this API is used to perform one of these actions with the given attributes.
+        /// Visuals will have actions. This API is used to perform one of these actions with the given attributes.
         /// </summary>
         /// <param name="propertyIndexOfVisual">The Property index of the visual.</param>
-        /// <param name="propertyIndexOfActionId">The action to perform.  See Visual to find supported actions.</param>
+        /// <param name="propertyIndexOfActionId">The action to perform. See Visual to find the supported actions.</param>
         /// <param name="attributes">Optional attributes for the action.</param>
         /// <since_tizen> 5 </since_tizen>
         public void DoAction(int propertyIndexOfVisual, int propertyIndexOfActionId, PropertyValue attributes)
@@ -5486,6 +5524,19 @@ namespace Tizen.NUI.BaseComponents
             }
         }
 
+        internal float Weight
+        {
+            get
+            {
+                return (float)GetValue(WeightProperty);
+            }
+            set
+            {
+                SetValue(WeightProperty, value);
+                NotifyPropertyChanged();
+            }
+        }
+
     }
 
     /// <summary>