[NUI] Add MinLineSpacing property & Implement LineSpacing (#3375)
authorabdullehghujeh <35222943+abdullehghujeh@users.noreply.github.com>
Fri, 20 Aug 2021 02:30:11 +0000 (05:30 +0300)
committerJunsuChoi <junduru019@gmail.com>
Tue, 24 Aug 2021 05:09:56 +0000 (14:09 +0900)
Co-authored-by: abdullah <abdullahhasan10@gmail.com>
src/Tizen.NUI/src/internal/Interop/Interop.TextEditor.cs
src/Tizen.NUI/src/public/BaseComponents/Style/TextEditorStyle.cs
src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs
src/Tizen.NUI/src/public/BaseComponents/TextEditorBindableProperty.cs

index 4c2dad8..1a0040d 100755 (executable)
@@ -305,6 +305,9 @@ namespace Tizen.NUI
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextEditor_Property_INPUT_METHOD_SETTINGS_get")]
             public static extern int InputMethodSettingsGet();
 
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_TextEditor_Property_MIN_LINE_SIZE_get")]
+            public static extern int MinLineSizeGet();
+
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_TextEditor_Property_ELLIPSIS_get")]
             public static extern int EllipsisGet();
 
index a25fe05..b33d4b7 100755 (executable)
@@ -231,6 +231,32 @@ namespace Tizen.NUI.BaseComponents
             return textEditorStyle.ellipsis;
         });
 
+        /// <summary> The bindable property of LineSpacingProperty. </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public static readonly BindableProperty LineSpacingProperty = BindableProperty.Create(nameof(LineSpacing), typeof(float?), typeof(TextEditorStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
+        {
+            var textEditorStyle = (TextEditorStyle)bindable;
+            textEditorStyle.lineSpacing = (float?)newValue;
+        },
+        defaultValueCreator: (bindable) =>
+        {
+            var textEditorStyle = (TextEditorStyle)bindable;
+            return textEditorStyle.lineSpacing;
+        });
+
+        /// <summary> The bindable property of MinLineSizeProperty. </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public static readonly BindableProperty MinLineSizeProperty = BindableProperty.Create(nameof(MinLineSize), typeof(float?), typeof(TextEditorStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
+        {
+            var textEditorStyle = (TextEditorStyle)bindable;
+            textEditorStyle.minLineSize = (float?)newValue;
+        },
+        defaultValueCreator: (bindable) =>
+        {
+            var textEditorStyle = (TextEditorStyle)bindable;
+            return textEditorStyle.minLineSize;
+        });
+
         private HorizontalAlignment? horizontalAlignment;
         private Vector4 secondaryCursorColor;
         private bool? enableCursorBlink;
@@ -264,6 +290,8 @@ namespace Tizen.NUI.BaseComponents
         private Vector4 primaryCursorColor;
         private PropertyMap fontStyle;
         private bool? ellipsis;
+        private float? lineSpacing;
+        private float? minLineSize;
 
         static TextEditorStyle() { }
 
@@ -609,5 +637,25 @@ namespace Tizen.NUI.BaseComponents
             get => (bool?)GetValue(EllipsisProperty);
             set => SetValue(EllipsisProperty, value);
         }
+
+        /// <summary>
+        /// the line spacing to be used.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public float? LineSpacing
+        {
+            get => (float?)GetValue(LineSpacingProperty);
+            set => SetValue(LineSpacingProperty, value);
+        }
+
+        /// <summary>
+        /// the minimum line size to be used.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public float? MinLineSize
+        {
+            get => (float?)GetValue(MinLineSizeProperty);
+            set => SetValue(MinLineSizeProperty, value);
+        }
     }
 }
index 6319123..b1621c3 100755 (executable)
@@ -1881,6 +1881,23 @@ namespace Tizen.NUI.BaseComponents
             }
         }
 
+        /// <summary>
+        /// Minimum line size to be used.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public float MinLineSize
+        {
+            get
+            {
+                return (float)GetValue(MinLineSizeProperty);
+            }
+            set
+            {
+                SetValue(MinLineSizeProperty, value);
+                NotifyPropertyChanged();
+            }
+        }
+
         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TextEditor obj)
         {
             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
@@ -2083,6 +2100,7 @@ namespace Tizen.NUI.BaseComponents
             internal static readonly int InputMethodSettings = Interop.TextEditor.InputMethodSettingsGet();
             internal static readonly int ELLIPSIS = Interop.TextEditor.EllipsisGet();
             internal static readonly int EllipsisPosition = Interop.TextEditor.EllipsisPositionGet();
+            internal static readonly int MinLineSize = Interop.TextEditor.MinLineSizeGet();
             internal static readonly int InputFilter = Interop.TextEditor.InputFilterGet();
         }
 
index c6f6a5b..e400fe5 100755 (executable)
@@ -1058,5 +1058,23 @@ namespace Tizen.NUI.BaseComponents
             Tizen.NUI.Object.GetProperty((System.Runtime.InteropServices.HandleRef)textEditor.SwigCPtr, TextEditor.Property.EllipsisPosition).Get(out temp);
             return (EllipsisPosition)temp;
         }));
+
+        /// currently need to be hidden as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public static readonly BindableProperty MinLineSizeProperty = BindableProperty.Create(nameof(MinLineSize), typeof(float), typeof(TextEditor), default(float), propertyChanged: (BindableProperty.BindingPropertyChangedDelegate)((bindable, oldValue, newValue) =>
+        {
+            var textEditor = (TextEditor)bindable;
+            if (newValue != null)
+            {
+                Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)textEditor.SwigCPtr, TextEditor.Property.MinLineSize, new Tizen.NUI.PropertyValue((float)newValue));
+            }
+        }),
+        defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) =>
+        {
+            var textEditor = (TextEditor)bindable;
+            float temp = 0.0f;
+            Tizen.NUI.Object.GetProperty((System.Runtime.InteropServices.HandleRef)textEditor.SwigCPtr, TextEditor.Property.MinLineSize).Get(out temp);
+            return temp;
+        }));
     }
 }