[NUI] Add LinearLayout Alignment and Weight (#469)
authorSeoyeon2Kim <34738918+Seoyeon2Kim@users.noreply.github.com>
Mon, 17 Sep 2018 04:26:52 +0000 (13:26 +0900)
committerhuiyueun <35286162+huiyueun@users.noreply.github.com>
Mon, 17 Sep 2018 04:26:52 +0000 (13:26 +0900)
* [NUI] Add LinearLayout Alignment and Weight

Change-Id: I0ed3010fd27f8f4cb26126efc5547a301c69cf38
Signed-off-by: Seoyeon Kim <seoyeon2.kim@samsung.com>
* Update LinearLayout.cs

According to Codacy-bot review, changed to 'static' class.

src/Tizen.NUI/src/internal/Layouting/LayoutPINVOKE.cs
src/Tizen.NUI/src/internal/Layouting/LinearLayout.cs
src/Tizen.NUI/src/public/BaseComponents/View.cs

index aa135f3f7d4a0ecc0cd1712e29b7de6fba9475ac..3e21246d752fe46ae70dcaddaf8e6a89dc8326cc 100755 (executable)
@@ -4538,6 +4538,96 @@ namespace Tizen.NUI
             }
         }
 
+        [global::System.Runtime.InteropServices.DllImport(Graphics.GlesCSharpBinder, EntryPoint = "CSharp_Dali_LinearLayout_SetAlignment")]
+        public static extern void LinearLayout_SetAlignment_gl(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2);
+
+        [global::System.Runtime.InteropServices.DllImport(Graphics.VulkanCSharpBinder, EntryPoint = "CSharp_Dali_LinearLayout_SetAlignment")]
+        public static extern void LinearLayout_SetAlignment_vulkan(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2);
+
+        public static void LinearLayout_SetAlignment(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2)
+        {
+            if (Tizen.NUI.Graphics.Backend == Tizen.NUI.Graphics.BackendType.Vulkan)
+            {
+                LinearLayout_SetAlignment_vulkan(jarg1, jarg2);
+            }
+            else
+            {
+                LinearLayout_SetAlignment_gl(jarg1, jarg2);
+            }
+        }
+
+        [global::System.Runtime.InteropServices.DllImport(Graphics.GlesCSharpBinder, EntryPoint = "CSharp_Dali_LinearLayout_GetAlignment")]
+        public static extern uint LinearLayout_GetAlignment_gl(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+        [global::System.Runtime.InteropServices.DllImport(Graphics.VulkanCSharpBinder, EntryPoint = "CSharp_Dali_LinearLayout_GetAlignment")]
+        public static extern uint LinearLayout_GetAlignment_vulkan(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+        public static uint LinearLayout_GetAlignment(global::System.Runtime.InteropServices.HandleRef jarg1)
+        {
+            if (Tizen.NUI.Graphics.Backend == Tizen.NUI.Graphics.BackendType.Vulkan)
+            {
+                return LinearLayout_GetAlignment_vulkan(jarg1);
+            }
+            else
+            {
+                return LinearLayout_GetAlignment_gl(jarg1);
+            }
+        }
+
+        [global::System.Runtime.InteropServices.DllImport(Graphics.GlesCSharpBinder, EntryPoint = "CSharp_Dali_LinearLayout_ChildProperty_WEIGHT_get")]
+        public static extern int LinearLayout_ChildProperty_WEIGHT_get_gl();
+
+        [global::System.Runtime.InteropServices.DllImport(Graphics.VulkanCSharpBinder, EntryPoint = "CSharp_Dali_LinearLayout_ChildProperty_WEIGHT_get")]
+        public static extern int LinearLayout_ChildProperty_WEIGHT_get_vulkan();
+
+        public static int LinearLayout_ChildProperty_WEIGHT_get()
+        {
+            if (Tizen.NUI.Graphics.Backend == Tizen.NUI.Graphics.BackendType.Vulkan)
+            {
+                return LinearLayout_ChildProperty_WEIGHT_get_vulkan();
+            }
+            else
+            {
+                return LinearLayout_ChildProperty_WEIGHT_get_gl();
+            }
+        }
+
+        [global::System.Runtime.InteropServices.DllImport(Graphics.GlesCSharpBinder, EntryPoint = "CSharp_Dali_new_LinearLayout_ChildProperty")]
+        public static extern global::System.IntPtr new_LinearLayout_ChildProperty_gl();
+
+        [global::System.Runtime.InteropServices.DllImport(Graphics.VulkanCSharpBinder, EntryPoint = "CSharp_Dali_new_LinearLayout_ChildProperty")]
+        public static extern global::System.IntPtr new_LinearLayout_ChildProperty_vulkan();
+
+        public static global::System.IntPtr new_LinearLayout_ChildProperty()
+        {
+            if (Tizen.NUI.Graphics.Backend == Tizen.NUI.Graphics.BackendType.Vulkan)
+            {
+                return new_LinearLayout_ChildProperty_vulkan();
+            }
+            else
+            {
+                return new_LinearLayout_ChildProperty_gl();
+            }
+        }
+
+        [global::System.Runtime.InteropServices.DllImport(Graphics.GlesCSharpBinder, EntryPoint = "CSharp_Dali_delete_LinearLayout_ChildProperty")]
+        public static extern void delete_LinearLayout_ChildProperty_gl(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+        [global::System.Runtime.InteropServices.DllImport(Graphics.VulkanCSharpBinder, EntryPoint = "CSharp_Dali_delete_LinearLayout_ChildProperty")]
+        public static extern void delete_LinearLayout_ChildProperty_vulkan(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+        public static void delete_LinearLayout_ChildProperty(global::System.Runtime.InteropServices.HandleRef jarg1)
+        {
+            if (Tizen.NUI.Graphics.Backend == Tizen.NUI.Graphics.BackendType.Vulkan)
+            {
+                delete_LinearLayout_ChildProperty_vulkan(jarg1);
+            }
+            else
+            {
+                delete_LinearLayout_ChildProperty_gl(jarg1);
+            }
+        }
+
         // Grid Layout
 
         // GridLayout_SWIGUpcast
index 603bf141d73e78305fc881fb3454c6cf6c2536fc..3930f1a9361b3ee7cedd9e4ecc1ed10d62e21171 100755 (executable)
@@ -64,6 +64,10 @@ namespace Tizen.NUI
             base.Dispose(type);
         }
 
+        internal static class ChildProperty
+        {
+            internal static readonly int WEIGHT = LayoutPINVOKE.LinearLayout_ChildProperty_WEIGHT_get();
+        }
         public LinearLayout() : this(LayoutPINVOKE.LinearLayout_New(), true)
         {
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
@@ -115,6 +119,19 @@ namespace Tizen.NUI
             return ret;
         }
 
+        internal void SetAlignment(LinearLayout.Alignment alignment)
+        {
+            LayoutPINVOKE.LinearLayout_SetAlignment(swigCPtr, (uint)alignment);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
+
+        internal LinearLayout.Alignment GetAlignment()
+        {
+            LinearLayout.Alignment ret = (LinearLayout.Alignment)LayoutPINVOKE.LinearLayout_GetAlignment(swigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret;
+        }
+
         internal enum PropertyRange
         {
             CHILD_PROPERTY_START_INDEX = PropertyRanges.CHILD_PROPERTY_REGISTRATION_START_INDEX,
@@ -152,7 +169,22 @@ namespace Tizen.NUI
         }
 
         /// <summary>
-        /// [Draft] Enumeration for the direction in which the content is laid out   */
+        /// [Draft] Get/Set the alignment in the layout
+        /// </summary>
+        public LinearLayout.Alignment LinearAlignment
+        {
+            get
+            {
+                return GetAlignment();
+            }
+            set
+            {
+                SetAlignment(value);
+            }
+        }
+
+        /// <summary>
+        /// [Draft] Enumeration for the direction in which the content is laid out
         /// </summary>
         public enum Orientation
         {
@@ -166,6 +198,37 @@ namespace Tizen.NUI
             Vertical
         }
 
+        /// <summary>
+        /// [Draft] Enumeration for the alignment of the linear layout items
+        /// </summary>
+        public enum Alignment
+        {
+            /// <summary>
+            /// At the left/right edge of the container (maps to LTR/RTL direction for horizontal orientation)
+            /// </summary>
+            Begin              = 0x1,
+            /// <summary>
+            /// At the right/left edge of the container (maps to LTR/RTL direction for horizontal orientation)
+            /// </summary>
+            End                = 0x2,
+            /// <summary>
+            /// At the horizontal center of the container
+            /// </summary>
+            CenterHorizontal   = 0x4,
+            /// <summary>
+            /// At the top edge of the container
+            /// </summary>
+            Top                = 0x8,
+            /// <summary>
+            /// At the bottom edge of the container
+            /// </summary>
+            Bottom             = 0x10,
+            /// <summary>
+            /// At the vertical center of the container
+            /// </summary>
+            CenterVertical     = 0x20
+        }
+
     }
 
 }
index fb3c3fc5e926904caad104f3e5605dedeeeb9b26..04f4b51a460232ecb5a3e7a00f6acca4d005b5cf 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;
@@ -5515,6 +5532,19 @@ namespace Tizen.NUI.BaseComponents
             }
         }
 
+        internal float Weight
+        {
+            get
+            {
+                return (float)GetValue(WeightProperty);
+            }
+            set
+            {
+                SetValue(WeightProperty, value);
+                NotifyPropertyChanged();
+            }
+        }
+
     }
 
     /// <summary>