[NUI] Add RelativeLineHeight in TextLabel, TextEditor
authorBowon Ryu <bowon.ryu@samsung.com>
Wed, 20 Apr 2022 04:50:24 +0000 (13:50 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Tue, 26 Apr 2022 04:41:13 +0000 (13:41 +0900)
RelativeLineHeight is a factor that will be multiplied by text height.

// line height will be 2.0 times the text height
label.RelativeLineHeight = 2.0f;

// if the value is less than 1.0f, the lines could to be overlapped
// line height will be 0.5 times the text height
label.RelativeLineHeight = 0.5f;

Signed-off-by: Bowon Ryu <bowon.ryu@samsung.com>
src/Tizen.NUI/src/internal/Interop/Interop.TextEditor.cs
src/Tizen.NUI/src/internal/Interop/Interop.TextLabel.cs
src/Tizen.NUI/src/public/BaseComponents/Style/TextEditorStyle.cs
src/Tizen.NUI/src/public/BaseComponents/Style/TextLabelStyle.cs
src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs
src/Tizen.NUI/src/public/BaseComponents/TextEditorBindableProperty.cs
src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs
src/Tizen.NUI/src/public/BaseComponents/TextLabelBindableProperty.cs

index 174cdae..21f7934 100755 (executable)
@@ -117,6 +117,9 @@ namespace Tizen.NUI
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextEditor_Property_INPUT_LINE_SPACING_get")]
             public static extern int InputLineSpacingGet();
 
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextEditor_Property_RELATIVE_LINE_SIZE_get")]
+            public static extern int RelativeLineHeightGet();
+
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextEditor_Property_UNDERLINE_get")]
             public static extern int UnderlineGet();
 
index 27d4da8..787ff65 100755 (executable)
@@ -63,6 +63,9 @@ namespace Tizen.NUI
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextLabel_Property_LINE_SPACING_get")]
             public static extern int LineSpacingGet();
 
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextLabel_Property_RELATIVE_LINE_SIZE_get")]
+            public static extern int RelativeLineHeightGet();
+
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextLabel_Property_UNDERLINE_get")]
             public static extern int UnderlineGet();
 
index f7601fe..ab46af3 100755 (executable)
@@ -263,6 +263,19 @@ namespace Tizen.NUI.BaseComponents
             return textEditorStyle.minLineSize;
         });
 
+        /// <summary> The bindable property of RelativeLineHeightProperty. </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public static readonly BindableProperty RelativeLineHeightProperty = BindableProperty.Create(nameof(RelativeLineHeight), typeof(float?), typeof(TextEditorStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
+        {
+            var textEditorStyle = (TextEditorStyle)bindable;
+            textEditorStyle.relativeLineHeight = (float?)newValue;
+        },
+        defaultValueCreator: (bindable) =>
+        {
+            var textEditorStyle = (TextEditorStyle)bindable;
+            return textEditorStyle.relativeLineHeight;
+        });
+
         private HorizontalAlignment? horizontalAlignment;
         private VerticalAlignment? verticalAlignment;
         private Vector4 secondaryCursorColor;
@@ -299,6 +312,7 @@ namespace Tizen.NUI.BaseComponents
         private bool? ellipsis;
         private float? lineSpacing;
         private float? minLineSize;
+        private float? relativeLineHeight;
 
         static TextEditorStyle() { }
 
@@ -674,5 +688,15 @@ namespace Tizen.NUI.BaseComponents
             get => (float?)GetValue(MinLineSizeProperty);
             set => SetValue(MinLineSizeProperty, value);
         }
+
+        /// <summary>
+        /// the relative line height to be used.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public float? RelativeLineHeight
+        {
+            get => (float?)GetValue(RelativeLineHeightProperty);
+            set => SetValue(RelativeLineHeightProperty, value);
+        }
     }
 }
index 912adca..e24271a 100755 (executable)
@@ -185,6 +185,18 @@ namespace Tizen.NUI.BaseComponents
             var textLabelStyle = (TextLabelStyle)bindable;
             return textLabelStyle.lineSpacing;
         });
+        /// <summary> The bindable property of RelativeLineHeightProperty. </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public static readonly BindableProperty RelativeLineHeightProperty = BindableProperty.Create(nameof(RelativeLineHeight), typeof(float?), typeof(TextLabelStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
+        {
+            var textLabelStyle = (TextLabelStyle)bindable;
+            textLabelStyle.relativeLineHeight = (float?)newValue;
+        },
+        defaultValueCreator: (bindable) =>
+        {
+            var textLabelStyle = (TextLabelStyle)bindable;
+            return textLabelStyle.relativeLineHeight;
+        });
         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
         [EditorBrowsable(EditorBrowsableState.Never)]
         public static readonly BindableProperty EmbossProperty = BindableProperty.Create(nameof(Emboss), typeof(string), typeof(TextLabelStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
@@ -335,6 +347,7 @@ namespace Tizen.NUI.BaseComponents
         private int? autoScrollLoopCount;
         private float? autoScrollGap;
         private float? lineSpacing;
+        private float? relativeLineHeight;
         private string emboss;
         private Selector<float?> pixelSizeSelector;
         private bool? ellipsis;
@@ -459,6 +472,16 @@ namespace Tizen.NUI.BaseComponents
             set => SetValue(LineSpacingProperty, value);
         }
 
+        /// <summary>
+        /// the relative line height to be used.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public float? RelativeLineHeight
+        {
+            get => (float?)GetValue(RelativeLineHeightProperty);
+            set => SetValue(RelativeLineHeightProperty, value);
+        }
+
         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
         [EditorBrowsable(EditorBrowsableState.Never)]
         public string Emboss
index c04bbd9..0e32c3f 100755 (executable)
@@ -1057,6 +1057,24 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
+        /// The relative height of the line (a factor that will be multiplied by text height). <br />
+        /// If the value is less than 1, the lines could to be overlapped.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public float RelativeLineHeight
+        {
+            get
+            {
+                return (float)GetValue(RelativeLineHeightProperty);
+            }
+            set
+            {
+                SetValue(RelativeLineHeightProperty, value);
+                NotifyPropertyChanged();
+            }
+        }
+
+        /// <summary>
         /// The Underline property.<br />
         /// The default underline parameters.<br />
         /// The underline map contains the following keys :<br />
@@ -2570,6 +2588,7 @@ namespace Tizen.NUI.BaseComponents
             internal static readonly int InputPointSize = Interop.TextEditor.InputPointSizeGet();
             internal static readonly int LineSpacing = Interop.TextEditor.LineSpacingGet();
             internal static readonly int InputLineSpacing = Interop.TextEditor.InputLineSpacingGet();
+            internal static readonly int RelativeLineHeight = Interop.TextEditor.RelativeLineHeightGet();
             internal static readonly int UNDERLINE = Interop.TextEditor.UnderlineGet();
             internal static readonly int InputUnderline = Interop.TextEditor.InputUnderlineGet();
             internal static readonly int SHADOW = Interop.TextEditor.ShadowGet();
index ffa0f92..3102b43 100755 (executable)
@@ -577,6 +577,22 @@ namespace Tizen.NUI.BaseComponents
             Tizen.NUI.Object.GetProperty((System.Runtime.InteropServices.HandleRef)textEditor.SwigCPtr, TextEditor.Property.InputLineSpacing).Get(out temp);
             return temp;
         }));
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public static readonly BindableProperty RelativeLineHeightProperty = BindableProperty.Create(nameof(RelativeLineHeight), 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.RelativeLineHeight, 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.RelativeLineHeight).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 UnderlineProperty = BindableProperty.Create(nameof(Underline), typeof(PropertyMap), typeof(TextEditor), null, propertyChanged: (BindableProperty.BindingPropertyChangedDelegate)((bindable, oldValue, newValue) =>
index f9cf574..20c4231 100755 (executable)
@@ -783,6 +783,24 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
+        /// The relative height of the line (a factor that will be multiplied by text height). <br />
+        /// If the value is less than 1, the lines could to be overlapped.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public float RelativeLineHeight
+        {
+            get
+            {
+                return (float)GetValue(RelativeLineHeightProperty);
+            }
+            set
+            {
+                SetValue(RelativeLineHeightProperty, value);
+                NotifyPropertyChanged();
+            }
+        }
+
+        /// <summary>
         /// The Underline property.<br />
         /// The default underline parameters.<br />
         /// The underline map contains the following keys :<br />
@@ -1588,6 +1606,7 @@ namespace Tizen.NUI.BaseComponents
             internal static readonly int AutoScrollLoopCount = Interop.TextLabel.AutoScrollLoopCountGet();
             internal static readonly int AutoScrollGap = Interop.TextLabel.AutoScrollGapGet();
             internal static readonly int LineSpacing = Interop.TextLabel.LineSpacingGet();
+            internal static readonly int RelativeLineHeight = Interop.TextLabel.RelativeLineHeightGet();
             internal static readonly int UNDERLINE = Interop.TextLabel.UnderlineGet();
             internal static readonly int SHADOW = Interop.TextLabel.ShadowGet();
             internal static readonly int EMBOSS = Interop.TextLabel.EmbossGet();
index 7dd7d1a..f0970ff 100755 (executable)
@@ -328,6 +328,22 @@ namespace Tizen.NUI.BaseComponents
             Tizen.NUI.Object.GetProperty((System.Runtime.InteropServices.HandleRef)textLabel.SwigCPtr, TextLabel.Property.LineSpacing).Get(out temp);
             return temp;
         }));
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public static readonly BindableProperty RelativeLineHeightProperty = BindableProperty.Create(nameof(RelativeLineHeight), typeof(float), typeof(TextLabel), default(float), propertyChanged: (BindableProperty.BindingPropertyChangedDelegate)((bindable, oldValue, newValue) =>
+        {
+            var textLabel = (TextLabel)bindable;
+            if (newValue != null)
+            {
+                Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)textLabel.SwigCPtr, TextLabel.Property.RelativeLineHeight, new Tizen.NUI.PropertyValue((float)newValue));
+            }
+        }),
+        defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) =>
+        {
+            var textLabel = (TextLabel)bindable;
+            float temp = 0.0f;
+            Tizen.NUI.Object.GetProperty((System.Runtime.InteropServices.HandleRef)textLabel.SwigCPtr, TextLabel.Property.RelativeLineHeight).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 UnderlineProperty = BindableProperty.Create(nameof(Underline), typeof(PropertyMap), typeof(TextLabel), null, propertyChanged: (BindableProperty.BindingPropertyChangedDelegate)((bindable, oldValue, newValue) =>