From 308e593b8a453186b4a6275f68255d622a493f46 Mon Sep 17 00:00:00 2001 From: abdullehghujeh <35222943+abdullehghujeh@users.noreply.github.com> Date: Fri, 20 Aug 2021 05:30:11 +0300 Subject: [PATCH] [NUI] Add MinLineSpacing property & Implement LineSpacing (#3375) Co-authored-by: abdullah --- .../src/internal/Interop/Interop.TextEditor.cs | 3 ++ .../public/BaseComponents/Style/TextEditorStyle.cs | 48 ++++++++++++++++++++++ .../src/public/BaseComponents/TextEditor.cs | 18 ++++++++ .../BaseComponents/TextEditorBindableProperty.cs | 18 ++++++++ 4 files changed, 87 insertions(+) diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.TextEditor.cs b/src/Tizen.NUI/src/internal/Interop/Interop.TextEditor.cs index 4c2dad8..1a0040d 100755 --- a/src/Tizen.NUI/src/internal/Interop/Interop.TextEditor.cs +++ b/src/Tizen.NUI/src/internal/Interop/Interop.TextEditor.cs @@ -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(); diff --git a/src/Tizen.NUI/src/public/BaseComponents/Style/TextEditorStyle.cs b/src/Tizen.NUI/src/public/BaseComponents/Style/TextEditorStyle.cs index a25fe05..b33d4b7 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/Style/TextEditorStyle.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/Style/TextEditorStyle.cs @@ -231,6 +231,32 @@ namespace Tizen.NUI.BaseComponents return textEditorStyle.ellipsis; }); + /// The bindable property of LineSpacingProperty. + [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; + }); + + /// The bindable property of MinLineSizeProperty. + [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); } + + /// + /// the line spacing to be used. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public float? LineSpacing + { + get => (float?)GetValue(LineSpacingProperty); + set => SetValue(LineSpacingProperty, value); + } + + /// + /// the minimum line size to be used. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public float? MinLineSize + { + get => (float?)GetValue(MinLineSizeProperty); + set => SetValue(MinLineSizeProperty, value); + } } } diff --git a/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs b/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs index 6319123..b1621c3 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs @@ -1881,6 +1881,23 @@ namespace Tizen.NUI.BaseComponents } } + /// + /// Minimum line size to be used. + /// + [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(); } diff --git a/src/Tizen.NUI/src/public/BaseComponents/TextEditorBindableProperty.cs b/src/Tizen.NUI/src/public/BaseComponents/TextEditorBindableProperty.cs index c6f6a5b..e400fe5 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/TextEditorBindableProperty.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/TextEditorBindableProperty.cs @@ -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; + })); } } -- 2.7.4