[NUI] Public ChildAdded,ChildRemoved,PropertySet events & properties of TableView...
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / BaseComponents / View.cs
index d790995..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;
@@ -1242,8 +1259,6 @@ namespace Tizen.NUI.BaseComponents
         /// 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>
@@ -1257,8 +1272,6 @@ namespace Tizen.NUI.BaseComponents
         /// 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)
@@ -1315,8 +1335,6 @@ namespace Tizen.NUI.BaseComponents
         /// 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>
@@ -1330,8 +1348,6 @@ namespace Tizen.NUI.BaseComponents
         /// 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();
@@ -3435,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>
@@ -5487,6 +5524,19 @@ namespace Tizen.NUI.BaseComponents
             }
         }
 
+        internal float Weight
+        {
+            get
+            {
+                return (float)GetValue(WeightProperty);
+            }
+            set
+            {
+                SetValue(WeightProperty, value);
+                NotifyPropertyChanged();
+            }
+        }
+
     }
 
     /// <summary>