From a4cd4a1588f7daaad61b4b25d724b0c0a006e2be Mon Sep 17 00:00:00 2001 From: Shrouq Sabah Date: Wed, 30 Jun 2021 03:10:55 +0300 Subject: [PATCH] [NUI] Support Ellipsis location, END, START and MIDDLE in TextLabel, TextField and TextEditor --- .../src/internal/Interop/Interop.TextEditor.cs | 6 +++ .../src/internal/Interop/Interop.TextField.cs | 3 ++ .../src/internal/Interop/Interop.TextLabel.cs | 3 ++ .../public/BaseComponents/Style/TextEditorStyle.cs | 24 +++++++++++- .../public/BaseComponents/Style/TextLabelStyle.cs | 21 +++++++++++ .../src/public/BaseComponents/TextEditor.cs | 43 ++++++++++++++++++++++ .../BaseComponents/TextEditorBindableProperty.cs | 34 +++++++++++++++++ .../BaseComponents/TextFieldBindableProperty.cs | 17 +++++++++ .../src/public/BaseComponents/TextLabel.cs | 22 +++++++++++ .../BaseComponents/TextLabelBindableProperty.cs | 17 +++++++++ src/Tizen.NUI/src/public/Common/NUIConstants.cs | 25 +++++++++++++ 11 files changed, 214 insertions(+), 1 deletion(-) diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.TextEditor.cs b/src/Tizen.NUI/src/internal/Interop/Interop.TextEditor.cs index 4e7f556..e545ff9 100755 --- a/src/Tizen.NUI/src/internal/Interop/Interop.TextEditor.cs +++ b/src/Tizen.NUI/src/internal/Interop/Interop.TextEditor.cs @@ -301,6 +301,12 @@ 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_ELLIPSIS_get")] + public static extern int EllipsisGet(); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_TextEditor_Property_ELLIPSIS_LOCATION_get")] + public static extern int EllipsisLocationGet(); } } } diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.TextField.cs b/src/Tizen.NUI/src/internal/Interop/Interop.TextField.cs index 3fe1152..e0edf58 100755 --- a/src/Tizen.NUI/src/internal/Interop/Interop.TextField.cs +++ b/src/Tizen.NUI/src/internal/Interop/Interop.TextField.cs @@ -244,6 +244,9 @@ namespace Tizen.NUI [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_TextField_Property_ELLIPSIS_get")] public static extern int EllipsisGet(); + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_TextField_Property_ELLIPSIS_LOCATION_get")] + public static extern int EllipsisLocationGet(); + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextField_SelectWholeText")] public static extern void SelectWholeText(global::System.Runtime.InteropServices.HandleRef jarg1); diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.TextLabel.cs b/src/Tizen.NUI/src/internal/Interop/Interop.TextLabel.cs index 893ed95..099b289 100755 --- a/src/Tizen.NUI/src/internal/Interop/Interop.TextLabel.cs +++ b/src/Tizen.NUI/src/internal/Interop/Interop.TextLabel.cs @@ -108,6 +108,9 @@ namespace Tizen.NUI [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_TextLabel_Property_ELLIPSIS_get")] public static extern int EllipsisGet(); + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_TextLabel_Property_ELLIPSIS_LOCATION_get")] + public static extern int EllipsisLocationGet(); + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_TextLabel_Property_LINE_COUNT_get")] public static extern int LineCountGet(); diff --git a/src/Tizen.NUI/src/public/BaseComponents/Style/TextEditorStyle.cs b/src/Tizen.NUI/src/public/BaseComponents/Style/TextEditorStyle.cs index d2fefa1..a25fe05 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/Style/TextEditorStyle.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/Style/TextEditorStyle.cs @@ -38,7 +38,7 @@ namespace Tizen.NUI.BaseComponents internal static readonly BindableProperty PointSizeProperty = BindableProperty.Create(nameof(PointSize), typeof(float?), typeof(TextEditorStyle), null, propertyChanged: (bindable, oldValue, newValue) => ((TextEditorStyle)bindable).pointSize = (float?)newValue, defaultValueCreator: (bindable) => ((TextEditorStyle)bindable).pointSize); - + /// The bindable property of PixelSize. [EditorBrowsable(EditorBrowsableState.Never)] internal static readonly BindableProperty PixelSizeProperty = BindableProperty.Create(nameof(PixelSize), typeof(float?), typeof(TextEditorStyle), null, @@ -218,6 +218,19 @@ namespace Tizen.NUI.BaseComponents propertyChanged: (bindable, oldValue, newValue) => ((TextEditorStyle)bindable).fontStyle = (PropertyMap)newValue, defaultValueCreator: (bindable) => ((TextEditorStyle)bindable).fontStyle); + /// 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 EllipsisProperty = BindableProperty.Create(nameof(Ellipsis), typeof(bool?), typeof(TextEditorStyle), null, propertyChanged: (bindable, oldValue, newValue) => + { + var textEditorStyle = (TextEditorStyle)bindable; + textEditorStyle.ellipsis = (bool?)newValue; + }, + defaultValueCreator: (bindable) => + { + var textEditorStyle = (TextEditorStyle)bindable; + return textEditorStyle.ellipsis; + }); + private HorizontalAlignment? horizontalAlignment; private Vector4 secondaryCursorColor; private bool? enableCursorBlink; @@ -250,6 +263,7 @@ namespace Tizen.NUI.BaseComponents private Color placeholderTextColor; private Vector4 primaryCursorColor; private PropertyMap fontStyle; + private bool? ellipsis; static TextEditorStyle() { } @@ -587,5 +601,13 @@ namespace Tizen.NUI.BaseComponents get => (PropertyMap)GetValue(FontStyleProperty); set => SetValue(FontStyleProperty, value); } + + /// This will be public opened in tizen_6.5 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public bool? Ellipsis + { + get => (bool?)GetValue(EllipsisProperty); + set => SetValue(EllipsisProperty, value); + } } } diff --git a/src/Tizen.NUI/src/public/BaseComponents/Style/TextLabelStyle.cs b/src/Tizen.NUI/src/public/BaseComponents/Style/TextLabelStyle.cs index 3bd0ccb..00759ca 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/Style/TextLabelStyle.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/Style/TextLabelStyle.cs @@ -267,6 +267,18 @@ namespace Tizen.NUI.BaseComponents var textLabelStyle = (TextLabelStyle)bindable; return textLabelStyle.verticalLineAlignment; }); + /// This will be public opened in tizen_6.5 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static readonly BindableProperty EllipsisLocationProperty = BindableProperty.Create(nameof(EllipsisLocation), typeof(EllipsisLocation?), typeof(TextLabelStyle), null, propertyChanged: (bindable, oldValue, newValue) => + { + var textLabelStyle = (TextLabelStyle)bindable; + textLabelStyle.ellipsisLocation = (EllipsisLocation?)newValue; + }, + defaultValueCreator: (bindable) => + { + var textLabelStyle = (TextLabelStyle)bindable; + return textLabelStyle.ellipsisLocation; + }); /// 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 MatchSystemLanguageDirectionProperty = BindableProperty.Create(nameof(MatchSystemLanguageDirection), typeof(bool?), typeof(TextLabelStyle), null, propertyChanged: (bindable, oldValue, newValue) => @@ -318,6 +330,7 @@ namespace Tizen.NUI.BaseComponents private AutoScrollStopMode? autoScrollStopMode; private LineWrapMode? lineWrapMode; private VerticalLineAlignment? verticalLineAlignment; + private EllipsisLocation? ellipsisLocation; private bool? matchSystemLanguageDirection; private Selector translatableTextSelector; private Selector fontFamilySelector; @@ -489,6 +502,14 @@ namespace Tizen.NUI.BaseComponents set => SetValue(VerticalLineAlignmentProperty, value); } + /// This will be public opened in tizen_6.5 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public EllipsisLocation? EllipsisLocation + { + get => (EllipsisLocation?)GetValue(EllipsisLocationProperty); + set => SetValue(EllipsisLocationProperty, 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 bool? MatchSystemLanguageDirection diff --git a/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs b/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs index 77ddb52..638b082 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs @@ -1339,6 +1339,47 @@ namespace Tizen.NUI.BaseComponents } /// + /// The Ellipsis property.
+ /// Enable or disable the ellipsis.
+ ///
+ /// 6.5 + /// This will be released at Tizen.NET API Level 6.5, so currently this would be used as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public bool Ellipsis + { + get + { + return (bool)GetValue(EllipsisProperty); + } + set + { + SetValue(EllipsisProperty, value); + NotifyPropertyChanged(); + } + } + + /// + /// The ellipsis location of the text. + /// The ellipsis location type when the text size over the layout size.
+ /// The ellipsis location: End, Start or Middle.
+ ///
+ /// 6.5 + /// This will be released at Tizen.NET API Level 6.5, so currently this would be used as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public EllipsisLocation EllipsisLocation + { + get + { + return (EllipsisLocation)GetValue(EllipsisLocationProperty); + } + set + { + SetValue(EllipsisLocationProperty, value); + NotifyPropertyChanged(); + } + } + + /// /// The LineWrapMode property.
/// The line wrap mode when the text lines over the layout width.
///
@@ -1790,6 +1831,8 @@ namespace Tizen.NUI.BaseComponents internal static readonly int EnableGrabHandle = Interop.TextEditor.EnableGrabHandleGet(); internal static readonly int EnableGrabHandlePopup = Interop.TextEditor.EnableGrabHandlePopupGet(); internal static readonly int InputMethodSettings = Interop.TextEditor.InputMethodSettingsGet(); + internal static readonly int ELLIPSIS = Interop.TextEditor.EllipsisGet(); + internal static readonly int EllipsisLocation = Interop.TextEditor.EllipsisLocationGet(); } internal class InputStyle diff --git a/src/Tizen.NUI/src/public/BaseComponents/TextEditorBindableProperty.cs b/src/Tizen.NUI/src/public/BaseComponents/TextEditorBindableProperty.cs index 718e79e..b780f72 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/TextEditorBindableProperty.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/TextEditorBindableProperty.cs @@ -1024,5 +1024,39 @@ namespace Tizen.NUI.BaseComponents Tizen.NUI.Object.GetProperty((System.Runtime.InteropServices.HandleRef)textEditor.SwigCPtr, TextEditor.Property.InputMethodSettings).Get(temp); return temp; })); + /// This will be public opened in tizen_6.5 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static readonly BindableProperty EllipsisProperty = BindableProperty.Create(nameof(TextEditor.Ellipsis), typeof(bool), typeof(TextEditor), false, 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.ELLIPSIS, new Tizen.NUI.PropertyValue((bool)newValue)); + } + }), + defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) => + { + var textEditor = (TextEditor)bindable; + bool temp = false; + Tizen.NUI.Object.GetProperty((System.Runtime.InteropServices.HandleRef)textEditor.SwigCPtr, TextEditor.Property.ELLIPSIS).Get(out temp); + return temp; + })); + /// This will be public opened in tizen_6.5 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static readonly BindableProperty EllipsisLocationProperty = BindableProperty.Create(nameof(EllipsisLocation), typeof(EllipsisLocation), typeof(TextEditor), EllipsisLocation.End, 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.EllipsisLocation, new Tizen.NUI.PropertyValue((int)newValue)); + } + }), + defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) => + { + var textEditor = (TextEditor)bindable; + int temp = 0; + Tizen.NUI.Object.GetProperty((System.Runtime.InteropServices.HandleRef)textEditor.SwigCPtr, TextEditor.Property.EllipsisLocation).Get(out temp); + return (EllipsisLocation)temp; + })); } } diff --git a/src/Tizen.NUI/src/public/BaseComponents/TextFieldBindableProperty.cs b/src/Tizen.NUI/src/public/BaseComponents/TextFieldBindableProperty.cs index b332ed7..5d96c17 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/TextFieldBindableProperty.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/TextFieldBindableProperty.cs @@ -952,6 +952,23 @@ namespace Tizen.NUI.BaseComponents Tizen.NUI.Object.GetProperty((System.Runtime.InteropServices.HandleRef)textField.SwigCPtr, TextField.Property.ELLIPSIS).Get(out temp); return temp; })); + /// This will be public opened in tizen_6.5 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static readonly BindableProperty EllipsisLocationProperty = BindableProperty.Create(nameof(EllipsisLocation), typeof(EllipsisLocation), typeof(TextField), EllipsisLocation.End, propertyChanged: (BindableProperty.BindingPropertyChangedDelegate)((bindable, oldValue, newValue) => + { + var textField = (TextField)bindable; + if (newValue != null) + { + Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)textField.SwigCPtr, TextField.Property.EllipsisLocation, new Tizen.NUI.PropertyValue((int)newValue)); + } + }), + defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) => + { + var textField = (TextField)bindable; + int temp = 0; + Tizen.NUI.Object.GetProperty((System.Runtime.InteropServices.HandleRef)textField.SwigCPtr, TextField.Property.EllipsisLocation).Get(out temp); + return (EllipsisLocation)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 EnableShiftSelectionProperty = BindableProperty.Create(nameof(TextField.EnableShiftSelection), typeof(bool), typeof(TextField), false, 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 d3a36b9..2e73c7a 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs @@ -782,6 +782,27 @@ namespace Tizen.NUI.BaseComponents } /// + /// The ellipsis location of the text. + /// The ellipsis location type when the text size over the layout size.
+ /// The ellipsis location: End, Start or Middle.
+ ///
+ /// 6.5 + /// This will be released at Tizen.NET API Level 6.5, so currently this would be used as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public EllipsisLocation EllipsisLocation + { + get + { + return (EllipsisLocation)GetValue(EllipsisLocationProperty); + } + set + { + SetValue(EllipsisLocationProperty, value); + NotifyPropertyChanged(); + } + } + + /// /// The AutoScrollLoopDelay property.
/// Do something.
///
@@ -1156,6 +1177,7 @@ namespace Tizen.NUI.BaseComponents internal static readonly int TextFit = Interop.TextLabel.TextFitGet(); internal static readonly int MinLineSize = Interop.TextLabel.MinLineSizeGet(); internal static readonly int FontSizeScale = Interop.TextLabel.FontSizeScaleGet(); + internal static readonly int EllipsisLocation = Interop.TextLabel.EllipsisLocationGet(); } private void OnShadowColorChanged(float x, float y, float z, float w) diff --git a/src/Tizen.NUI/src/public/BaseComponents/TextLabelBindableProperty.cs b/src/Tizen.NUI/src/public/BaseComponents/TextLabelBindableProperty.cs index a77a2d4..a2e06f1 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/TextLabelBindableProperty.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/TextLabelBindableProperty.cs @@ -459,6 +459,23 @@ namespace Tizen.NUI.BaseComponents Tizen.NUI.Object.GetProperty((System.Runtime.InteropServices.HandleRef)textLabel.SwigCPtr, TextLabel.Property.ELLIPSIS).Get(out temp); return temp; })); + /// This will be public opened in tizen_6.5 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public static readonly BindableProperty EllipsisLocationProperty = BindableProperty.Create(nameof(EllipsisLocation), typeof(EllipsisLocation), typeof(TextLabel), EllipsisLocation.End, 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.EllipsisLocation, new Tizen.NUI.PropertyValue((int)newValue)); + } + }), + defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) => + { + var textLabel = (TextLabel)bindable; + int temp = 0; + Tizen.NUI.Object.GetProperty((System.Runtime.InteropServices.HandleRef)textLabel.SwigCPtr, TextLabel.Property.EllipsisLocation).Get(out temp); + return (EllipsisLocation)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 AutoScrollLoopDelayProperty = BindableProperty.Create(nameof(AutoScrollLoopDelay), typeof(float), typeof(TextLabel), default(float), propertyChanged: (BindableProperty.BindingPropertyChangedDelegate)((bindable, oldValue, newValue) => diff --git a/src/Tizen.NUI/src/public/Common/NUIConstants.cs b/src/Tizen.NUI/src/public/Common/NUIConstants.cs index 606ea7c..d4874b2 100755 --- a/src/Tizen.NUI/src/public/Common/NUIConstants.cs +++ b/src/Tizen.NUI/src/public/Common/NUIConstants.cs @@ -884,6 +884,31 @@ namespace Tizen.NUI } /// + /// An enum of ellipsis location. + /// + /// 6 + public enum EllipsisLocation + { + /// + /// ellipsis location at end. + /// + /// 6 + End, + + /// + /// ellipsis location at start. + /// + /// 6 + Start, + + /// + /// ellipsis location in middle. + /// + /// 6 + Middle + } + + /// /// Enumeration type for the font's slant. /// /// 5 -- 2.7.4