From 1daac2032f1ee6eb1df5530625f4eec075dc9cc3 Mon Sep 17 00:00:00 2001 From: Bowon Ryu Date: Wed, 20 Apr 2022 13:50:24 +0900 Subject: [PATCH] [NUI] Add RelativeLineHeight in TextLabel, TextEditor 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 --- .../src/internal/Interop/Interop.TextEditor.cs | 3 +++ .../src/internal/Interop/Interop.TextLabel.cs | 3 +++ .../public/BaseComponents/Style/TextEditorStyle.cs | 24 ++++++++++++++++++++++ .../public/BaseComponents/Style/TextLabelStyle.cs | 23 +++++++++++++++++++++ .../src/public/BaseComponents/TextEditor.cs | 19 +++++++++++++++++ .../BaseComponents/TextEditorBindableProperty.cs | 16 +++++++++++++++ .../src/public/BaseComponents/TextLabel.cs | 19 +++++++++++++++++ .../BaseComponents/TextLabelBindableProperty.cs | 16 +++++++++++++++ 8 files changed, 123 insertions(+) diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.TextEditor.cs b/src/Tizen.NUI/src/internal/Interop/Interop.TextEditor.cs index 174cdae..21f7934 100755 --- a/src/Tizen.NUI/src/internal/Interop/Interop.TextEditor.cs +++ b/src/Tizen.NUI/src/internal/Interop/Interop.TextEditor.cs @@ -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(); diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.TextLabel.cs b/src/Tizen.NUI/src/internal/Interop/Interop.TextLabel.cs index 27d4da8..787ff65 100755 --- a/src/Tizen.NUI/src/internal/Interop/Interop.TextLabel.cs +++ b/src/Tizen.NUI/src/internal/Interop/Interop.TextLabel.cs @@ -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(); diff --git a/src/Tizen.NUI/src/public/BaseComponents/Style/TextEditorStyle.cs b/src/Tizen.NUI/src/public/BaseComponents/Style/TextEditorStyle.cs index f7601fe..ab46af3 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/Style/TextEditorStyle.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/Style/TextEditorStyle.cs @@ -263,6 +263,19 @@ namespace Tizen.NUI.BaseComponents return textEditorStyle.minLineSize; }); + /// The bindable property of RelativeLineHeightProperty. + [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); } + + /// + /// the relative line height to be used. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public float? RelativeLineHeight + { + get => (float?)GetValue(RelativeLineHeightProperty); + set => SetValue(RelativeLineHeightProperty, value); + } } } diff --git a/src/Tizen.NUI/src/public/BaseComponents/Style/TextLabelStyle.cs b/src/Tizen.NUI/src/public/BaseComponents/Style/TextLabelStyle.cs index 912adca..e24271a 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/Style/TextLabelStyle.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/Style/TextLabelStyle.cs @@ -185,6 +185,18 @@ namespace Tizen.NUI.BaseComponents var textLabelStyle = (TextLabelStyle)bindable; return textLabelStyle.lineSpacing; }); + /// The bindable property of RelativeLineHeightProperty. + [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 pixelSizeSelector; private bool? ellipsis; @@ -459,6 +472,16 @@ namespace Tizen.NUI.BaseComponents set => SetValue(LineSpacingProperty, value); } + /// + /// the relative line height to be used. + /// + [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 diff --git a/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs b/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs index c04bbd9..0e32c3f 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs @@ -1057,6 +1057,24 @@ namespace Tizen.NUI.BaseComponents } /// + /// The relative height of the line (a factor that will be multiplied by text height).
+ /// If the value is less than 1, the lines could to be overlapped. + ///
+ [EditorBrowsable(EditorBrowsableState.Never)] + public float RelativeLineHeight + { + get + { + return (float)GetValue(RelativeLineHeightProperty); + } + set + { + SetValue(RelativeLineHeightProperty, value); + NotifyPropertyChanged(); + } + } + + /// /// The Underline property.
/// The default underline parameters.
/// The underline map contains the following keys :
@@ -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(); diff --git a/src/Tizen.NUI/src/public/BaseComponents/TextEditorBindableProperty.cs b/src/Tizen.NUI/src/public/BaseComponents/TextEditorBindableProperty.cs index ffa0f92..3102b43 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/TextEditorBindableProperty.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/TextEditorBindableProperty.cs @@ -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) => diff --git a/src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs b/src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs index f9cf574..20c4231 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs @@ -783,6 +783,24 @@ namespace Tizen.NUI.BaseComponents } /// + /// The relative height of the line (a factor that will be multiplied by text height).
+ /// If the value is less than 1, the lines could to be overlapped. + ///
+ [EditorBrowsable(EditorBrowsableState.Never)] + public float RelativeLineHeight + { + get + { + return (float)GetValue(RelativeLineHeightProperty); + } + set + { + SetValue(RelativeLineHeightProperty, value); + NotifyPropertyChanged(); + } + } + + /// /// The Underline property.
/// The default underline parameters.
/// The underline map contains the following keys :
@@ -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(); diff --git a/src/Tizen.NUI/src/public/BaseComponents/TextLabelBindableProperty.cs b/src/Tizen.NUI/src/public/BaseComponents/TextLabelBindableProperty.cs index 7dd7d1a..f0970ff 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/TextLabelBindableProperty.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/TextLabelBindableProperty.cs @@ -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) => -- 2.7.4