[NUI] Sync dalihub/TizenFX and Samsung/TizenFX (#549)
authorhuiyueun <35286162+huiyueun@users.noreply.github.com>
Tue, 13 Nov 2018 09:50:47 +0000 (18:50 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Tue, 13 Nov 2018 09:50:47 +0000 (18:50 +0900)
* [NUI] Set LayoutItem Width/Height specification

Change-Id: Idec264329f6dc20db4692fba84ac8ee1f95067aa
Signed-off-by: huiyu.eun <huiyu.eun@samsung.com>
* [NUI] Fix build error

Change-Id: Ib1ff4dcb142ce09539dbef3b567f649e40459527
Signed-off-by: huiyu.eun <huiyu.eun@samsung.com>
* LayoutGroup to layout children

Change-Id: Idff81189013e4cb0e85a8bbf13e268170b8aad31

* [NUI] Public some apis for TCT and fix an issue

Here are some changes:
1. public ScrollViewPagePathEffect class
2. public TypeRegistry class
3. public PinchGesture constructor
4. public SetScrollPropertySource api
5. Fix ScrollInterval event issue

Change-Id: I649f0fc464a5af0453475b7ef0dcf4df614eb34e

* fix codacy

Signed-off-by: huiyu.eun <huiyu.eun@samsung.com>
src/Tizen.NUI/src/internal/Layouting/LayoutGroup.cs
src/Tizen.NUI/src/internal/Layouting/LayoutItem.cs
src/Tizen.NUI/src/public/BaseComponents/View.cs
src/Tizen.NUI/src/public/Layer.cs
src/Tizen.NUI/src/public/PinchGesture.cs
src/Tizen.NUI/src/public/ScrollViewPagePathEffect.cs [moved from src/Tizen.NUI/src/internal/ScrollViewPagePathEffect.cs with 61% similarity]
src/Tizen.NUI/src/public/TypeRegistry.cs [moved from src/Tizen.NUI/src/internal/TypeRegistry.cs with 65% similarity]
src/Tizen.NUI/src/public/UIComponents/ScrollBar.cs

index bfe9cfe..5efe006 100755 (executable)
@@ -84,6 +84,7 @@ namespace Tizen.NUI
         /// <param name="heightMeasureSpec">vertical space requirements as imposed by the parent.</param>
         protected override void OnMeasure(LayoutMeasureSpec widthMeasureSpec, LayoutMeasureSpec heightMeasureSpec)
         {
+            Log.Info("NUI", "OnMeasure\n");
             LayoutLength childWidth  = new LayoutLength( 0 );
             LayoutLength childHeight =  new LayoutLength( 0 );
 
@@ -125,9 +126,35 @@ namespace Tizen.NUI
         /// <param name="top"> Top position, relative to parent.</param>
         /// <param name="right">Right position, relative to parent.</param>
         /// <param name="bottom">Bottom position, relative to parent.</param>
-        protected virtual void OnLayout(bool changed, LayoutLength left, LayoutLength top, LayoutLength right, LayoutLength bottom)
+        protected override void OnLayout(bool changed, LayoutLength left, LayoutLength top, LayoutLength right, LayoutLength bottom)
         {
+            Log.Info("NUI", "OnLayout\n");
 
+            for( uint i = 0; i < ChildCount; ++i )
+            {
+                var childLayout = GetChildAt( i );
+                if( childLayout )
+                {
+                    View childOwner = childLayout.GetOwner();
+
+                    // Use position if explicitly set to child otherwise will be top left.
+                    var childLeft = new LayoutLength( childOwner.Position2D.X );
+                    var childTop = new LayoutLength( childOwner.Position2D.Y );
+
+                    View owner = GetOwner();
+
+                    if ( owner )
+                    {
+                        // Margin and Padding only supported when child anchor point is TOP_LEFT.
+                        if ( owner.PivotPoint == PivotPoint.TopLeft || ( owner.PositionUsesPivotPoint == false ) )
+                        {
+                          childLeft = childLeft + owner.Padding.Start + childOwner.Margin.Start;
+                          childTop = childTop + owner.Padding.Top + childOwner.Margin.Top;
+                        }
+                    }
+                    childLayout.Layout( childLeft, childTop, childLeft + childLayout.MeasuredWidth, childTop + childLayout.MeasuredHeight );
+                }
+            }
         }
 
         /// <summary>
index b8b1fbd..730781d 100755 (executable)
@@ -86,6 +86,7 @@ namespace Tizen.NUI
         /// <param name="bottom">Bottom position, relative to parent.</param>
         public void Layout(LayoutLength left, LayoutLength top, LayoutLength right, LayoutLength bottom)
         {
+            Log.Info("NUI", "LayoutItem Layout\n");
             layoutItemWrapperImpl.Layout(left, top, right, bottom);
         }
 
index 48b439f..69f25c6 100755 (executable)
@@ -1282,14 +1282,14 @@ namespace Tizen.NUI.BaseComponents
         /// <since_tizen> 4 </since_tizen>
         public override void Add(View child)
         {
-            Log.Info("NUI", "Add child:" + child.Name + " to " + Name + "\n");
-
             if (null == child)
             {
                 Tizen.Log.Fatal("NUI", "Child is null");
                 return;
             }
 
+            Log.Info("NUI", "Adding Child:" + child.Name + " to " + Name + "\n");
+
             Container oldParent = child.GetParent();
             if (oldParent != this)
             {
@@ -1304,19 +1304,19 @@ namespace Tizen.NUI.BaseComponents
                 // layoutSet flag is true when the View became a layout using the SetLayout API
                 if (true == layoutSet && null == child.Layout)
                 {
-                    Log.Info("NUI", "Add child Parent[" + Name + "] Layout set\n");
+                    Log.Info("NUI", "Parent[" + Name + "] Layout set[" + layoutSet.ToString() + "] Pure View[" + (!layoutSet).ToString() + "]\n");
                     // If child is a View or explicitly set to require layouting then set child as a LayoutGroup.
                     // If the child is derived from a View then it may be a legacy or existing container hence will do layouting itself.
                     if( child.GetType() == typeof(View) ||  true == child.LayoutingRequired )
                     {
-                        Log.Info("NUI", "Add child Creating LayoutGroup\n");
+                        Log.Info("NUI", "Creating LayoutGroup for " + child.Name + " LayoutingRequired[" + child.LayoutingRequired.ToString() + "]\n");
                         child.Layout = new LayoutGroup();
                     }
                     else
                     {
-                        // Adding child as a leaf, layouting will not propogate past this child.
+                        // Adding child as a leaf, layouting will not propagate past this child.
                         // Legacy containers will be a LayoutItems too and layout their children how they wish.
-                        Log.Info("NUI", "Add child Creating LayoutItem for " + child.Name + "\n");
+                        Log.Info("NUI", "Creating LayoutItem for " + child.Name + "\n");
                         child.Layout = new LayoutItem();
                     }
                 }
@@ -5315,6 +5315,10 @@ namespace Tizen.NUI.BaseComponents
             set
             {
                 SetValue(SizeProperty, 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();
             }
         }
index 24e94eb..62c0152 100755 (executable)
@@ -74,7 +74,7 @@ namespace Tizen.NUI
                 // If adding a View then set layout required flag
                 if( child.GetType() == typeof(View) )
                 {
-                    Log.Info("NUI", "Add child LayoutingRequired for:" + child.Name + "\n");
+                    Log.Info("NUI", "Add child[" + child.Name + "] LayoutingRequired set as pure view\n");
                     child.LayoutingRequired = true;
                 }
 
index 7ca17f7..f1b122a 100755 (executable)
@@ -14,6 +14,7 @@
  * limitations under the License.
  *
  */
+using System.ComponentModel;
 
 namespace Tizen.NUI
 {
@@ -136,7 +137,9 @@ namespace Tizen.NUI
         /// The default constructor.
         /// </summary>
         /// <param name="state">The state of the gesture.</param>
-        internal PinchGesture(Gesture.StateType state) : this(NDalicPINVOKE.new_PinchGesture__SWIG_0((int)state), true)
+        /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public PinchGesture(Gesture.StateType state) : this(NDalicPINVOKE.new_PinchGesture__SWIG_0((int)state), true)
         {
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
  * limitations under the License.
  *
  */
+using System.ComponentModel;
+using Tizen.NUI.BaseComponents;
 
 namespace Tizen.NUI
 {
-    using Tizen.NUI.BaseComponents;
-    internal class ScrollViewPagePathEffect : ScrollViewEffect
+    /// <summary>
+    /// ScrollView Page Path Effect.
+    /// This effect causes Views to follow a given path. The opacity of the view will be 0.0 at
+    /// the beginning of the path and will go to 1.0 as it is approximating to half of the path to return
+    /// to 0.0 at the end of the path.
+    /// </summary>
+    /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
+    [EditorBrowsable(EditorBrowsableState.Never)]
+    public class ScrollViewPagePathEffect : ScrollViewEffect
     {
         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
 
@@ -32,6 +41,9 @@ namespace Tizen.NUI
             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
         }
 
+        /// <summary>
+        /// Dispose.
+        /// </summary>
         protected override void Dispose(DisposeTypes type)
         {
             if (disposed)
@@ -64,18 +76,36 @@ namespace Tizen.NUI
             base.Dispose(type);
         }
 
+        /// <summary>
+        /// Creates an initialized ScrollViewPagePathEffect.
+        /// </summary>
+        /// <param name="path">The path that will be used by the scroll effect.</param>
+        /// <param name="forward">Vector in page object space which will be aligned with the tangent of the path.</param>
+        /// <param name="inputPropertyIndex">Index of a property of the scroll-view which will be used as the input for the path.</param>
+        /// <param name="pageSize">Size of a page in the scrollview.</param>
+        /// <param name="pageCount">Total number of pages in the scrollview.</param>
+        /// <returns>A handle to a newly allocated Dali resource.</returns>
+        /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
         public ScrollViewPagePathEffect(Path path, Vector3 forward, int inputPropertyIndex, Vector3 pageSize, uint pageCount) : this(NDalicPINVOKE.ScrollViewPagePathEffect_New(Path.getCPtr(path), Vector3.getCPtr(forward), inputPropertyIndex, Vector3.getCPtr(pageSize), pageCount), true)
         {
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-
         }
-        public static ScrollViewPagePathEffect DownCast(BaseHandle handle)
+
+        internal static ScrollViewPagePathEffect DownCast(BaseHandle handle)
         {
             ScrollViewPagePathEffect ret =  Registry.GetManagedBaseHandleFromNativePtr(handle) as ScrollViewPagePathEffect;
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             return ret;
         }
 
+        /// <summary>
+        /// Manually apply effect to a page in the scroll-view.
+        /// </summary>
+        /// <param name="page">The page to be affected by this effect.</param>
+        /// <param name="pageOrder">The order of the page in the scroll view.</param>
+        /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
         public void ApplyToPage(View page, uint pageOrder)
         {
             NDalicPINVOKE.ScrollViewPagePathEffect_ApplyToPage(swigCPtr, View.getCPtr(page), pageOrder);
similarity index 65%
rename from src/Tizen.NUI/src/internal/TypeRegistry.cs
rename to src/Tizen.NUI/src/public/TypeRegistry.cs
index 078e355..64f9f9a 100755 (executable)
  * limitations under the License.
  *
  */
+using System.ComponentModel;
 
 namespace Tizen.NUI
 {
-
-    internal class TypeRegistry : BaseHandle
+    /// <summary>
+    /// The TypeRegistry allows registration of type instance creation functions.
+    /// These can then be created later by name and down cast to the appropriate type.
+    /// </summary>
+    /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
+    [EditorBrowsable(EditorBrowsableState.Never)]
+    public class TypeRegistry : BaseHandle
     {
         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
 
@@ -32,6 +38,9 @@ namespace Tizen.NUI
             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
         }
 
+        /// <summary>
+        /// Dispose.
+        /// </summary>
         protected override void Dispose(DisposeTypes type)
         {
             if (disposed)
@@ -64,6 +73,12 @@ namespace Tizen.NUI
             base.Dispose(type);
         }
 
+        /// <summary>
+        /// Gets Type Registry handle.
+        /// </summary>
+        /// <returns>TypeRegistry handle.</returns>
+        /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
         public static TypeRegistry Get()
         {
             TypeRegistry ret = new TypeRegistry(NDalicPINVOKE.TypeRegistry_Get(), true);
@@ -71,23 +86,35 @@ namespace Tizen.NUI
             return ret;
         }
 
+        /// <summary>
+        /// Allows the creation of an empty typeRegistry handle.
+        /// </summary>
+        /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
         public TypeRegistry() : this(NDalicPINVOKE.new_TypeRegistry__SWIG_0(), true)
         {
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
 
-        public TypeRegistry(TypeRegistry handle) : this(NDalicPINVOKE.new_TypeRegistry__SWIG_1(TypeRegistry.getCPtr(handle)), true)
+        internal TypeRegistry(TypeRegistry handle) : this(NDalicPINVOKE.new_TypeRegistry__SWIG_1(TypeRegistry.getCPtr(handle)), true)
         {
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
 
-        public TypeRegistry Assign(TypeRegistry rhs)
+        internal TypeRegistry Assign(TypeRegistry rhs)
         {
             TypeRegistry ret = new TypeRegistry(NDalicPINVOKE.TypeRegistry_Assign(swigCPtr, TypeRegistry.getCPtr(rhs)), false);
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             return ret;
         }
 
+        /// <summary>
+        /// Gets TypeInfo for a registered type.
+        /// </summary>
+        /// <param name="uniqueTypeName">A unique type name.</param>
+        /// <returns>TypeInfo if the type exists, otherwise an empty handle.</returns>
+        /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
         public Tizen.NUI.TypeInfo GetTypeInfo(string uniqueTypeName)
         {
             Tizen.NUI.TypeInfo ret = new Tizen.NUI.TypeInfo(NDalicPINVOKE.TypeRegistry_GetTypeInfo__SWIG_0(swigCPtr, uniqueTypeName), true);
@@ -102,6 +129,12 @@ namespace Tizen.NUI
             return ret;
         }
 
+        /// <summary>
+        /// Gets type name count.
+        /// </summary>
+        /// <returns>The counte.</returns>
+        /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
         public uint GetTypeNameCount()
         {
             uint ret = NDalicPINVOKE.TypeRegistry_GetTypeNameCount(swigCPtr);
@@ -109,6 +142,13 @@ namespace Tizen.NUI
             return ret;
         }
 
+        /// <summary>
+        /// Gets type names by index.
+        /// </summary>
+        /// <param name="index">The index to get the type name.</param>
+        /// <returns>The type name or an empty string when index is not valid.</returns>
+        /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
         public string GetTypeName(uint index)
         {
             string ret = NDalicPINVOKE.TypeRegistry_GetTypeName(swigCPtr, index);
index 9db3bd2..3a15ed3 100755 (executable)
@@ -313,13 +313,14 @@ namespace Tizen.NUI.UIComponents
         private PanFinishedEventCallbackDelegate _scrollBarPanFinishedEventCallbackDelegate;
 
         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
-        private delegate void ScrollPositionIntervalReachedEventCallbackDelegate();
+        private delegate void ScrollPositionIntervalReachedEventCallbackDelegate(float position);
         private EventHandler<ScrollIntervalEventArgs> _scrollBarScrollPositionIntervalReachedEventHandler;
         private ScrollPositionIntervalReachedEventCallbackDelegate _scrollBarScrollPositionIntervalReachedEventCallbackDelegate;
 
         /// <summary>
         /// The event emitted when panning is finished on the scroll indicator.
         /// </summary>
+        /// <remarks>Event only emitted when the source of the scroll position properties are set.</remarks>
         /// <since_tizen> 3 </since_tizen>
         public event EventHandler<PanFinishedEventArgs> PanFinished
         {
@@ -356,8 +357,9 @@ namespace Tizen.NUI.UIComponents
 
 
         /// <summary>
-        /// This is the event emitted when the current scroll position of the scrollable content.
+        /// This is the event emitted when the current scroll position of the scrollable content goes above or below the values specified by ScrollPositionIntervals property.
         /// </summary>
+        /// <remarks>Event only emitted when the source of the scroll position properties are set.</remarks>
         /// <since_tizen> 3 </since_tizen>
         public event EventHandler<ScrollIntervalEventArgs> ScrollInterval
         {
@@ -381,9 +383,10 @@ namespace Tizen.NUI.UIComponents
         }
 
         // Callback for ScrollBar ScrollPositionIntervalReachedSignal
-        private void OnScrollBarScrollPositionIntervalReached()
+        private void OnScrollBarScrollPositionIntervalReached(float position)
         {
             ScrollIntervalEventArgs e = new ScrollIntervalEventArgs();
+            e.CurrentScrollPosition = position;
 
             if (_scrollBarScrollPositionIntervalReachedEventHandler != null)
             {
@@ -430,7 +433,18 @@ namespace Tizen.NUI.UIComponents
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
 
-        internal void SetScrollPropertySource(Animatable handle, int propertyScrollPosition, int propertyMinScrollPosition, int propertyMaxScrollPosition, int propertyScrollContentSize)
+        /// <summary>
+        /// Sets the source of the scroll position properties.
+        /// </summary>
+        /// <param name="handle">The handle of the object owing the scroll properties.</param>
+        /// <param name="propertyScrollPosition">The index of the scroll position property(The scroll position, type float).</param>
+        /// <param name="propertyMinScrollPosition">The index of the minimum scroll position property(The minimum scroll position, type float).</param>
+        /// <param name="propertyMaxScrollPosition">The index of the maximum scroll position property(The maximum scroll position, type float).</param>
+        /// <param name="propertyScrollContentSize">The index of the scroll content size property(The size of the scrollable content in actor coordinates, type float).</param>
+        /// <remarks>The handle to the object owing the scroll properties has been initialised and the property index must be valid.</remarks>
+        /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public void SetScrollPropertySource(Animatable handle, int propertyScrollPosition, int propertyMinScrollPosition, int propertyMaxScrollPosition, int propertyScrollContentSize)
         {
             NDalicPINVOKE.ScrollBar_SetScrollPropertySource(swigCPtr, Animatable.getCPtr(handle), propertyScrollPosition, propertyMinScrollPosition, propertyMaxScrollPosition, propertyScrollContentSize);
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();