From bc7c9ef4f147ff40bd6f7b5bc34cc35d4c94b6ad Mon Sep 17 00:00:00 2001 From: ali198724 Date: Tue, 8 Dec 2020 10:46:51 +0200 Subject: [PATCH] [NUI] text: Add property for primary cursor (caret) position in TextField/TextEditor --- .../src/internal/Interop/Interop.TextEditor.cs | 3 +++ .../src/internal/Interop/Interop.TextField.cs | 3 +++ .../src/public/BaseComponents/TextEditor.cs | 26 +++++++++++++++++++++ .../src/public/BaseComponents/TextField.cs | 27 ++++++++++++++++++++++ 4 files changed, 59 insertions(+) diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.TextEditor.cs b/src/Tizen.NUI/src/internal/Interop/Interop.TextEditor.cs index 26acebd..9c5fd13 100755 --- a/src/Tizen.NUI/src/internal/Interop/Interop.TextEditor.cs +++ b/src/Tizen.NUI/src/internal/Interop/Interop.TextEditor.cs @@ -264,6 +264,9 @@ namespace Tizen.NUI [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextEditor_Property_VERTICAL_SCROLL_POSITION_get")] public static extern int VerticalScrollPositionGet(); + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextEditor_Property_PRIMARY_CURSOR_POSITION_get")] + public static extern int PrimaryCursorPositionGet(); + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextEditor_ScrollBy")] public static extern void ScrollBy(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.TextField.cs b/src/Tizen.NUI/src/internal/Interop/Interop.TextField.cs index d6b9220..dc794eb 100755 --- a/src/Tizen.NUI/src/internal/Interop/Interop.TextField.cs +++ b/src/Tizen.NUI/src/internal/Interop/Interop.TextField.cs @@ -248,6 +248,9 @@ namespace Tizen.NUI [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextField_Property_ENABLE_EDITING_get")] public static extern int EnableEditingGet(); + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextField_Property_PRIMARY_CURSOR_POSITION_get")] + public static extern int PrimaryCursorPositionGet(); + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextField_SelectNone")] public static extern int SelectNone(global::System.Runtime.InteropServices.HandleRef jarg1); } diff --git a/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs b/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs index e59b309..d50fea5 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs @@ -1111,6 +1111,31 @@ namespace Tizen.NUI.BaseComponents } /// + /// Specify primary cursor (caret) position in text control. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public int PrimaryCursorPosition + { + get + { + int temp; + using (PropertyValue propertyValue = GetProperty(TextEditor.Property.PrimaryCursorPosition)) + { + propertyValue.Get(out temp); + } + return temp; + } + set + { + using (PropertyValue propertyValue = new PropertyValue(value)) + { + SetProperty(TextEditor.Property.PrimaryCursorPosition, propertyValue); + NotifyPropertyChanged(); + } + } + } + + /// /// The Placeholder property. /// Gets or sets the placeholder: text, color, font family, font style, point size, and pixel size. /// @@ -1440,6 +1465,7 @@ namespace Tizen.NUI.BaseComponents internal static readonly int SelectedText = Interop.TextEditor.SelectedTextGet(); internal static readonly int HorizontalScrollPosition = Interop.TextEditor.HorizontalScrollPositionGet(); internal static readonly int VerticalScrollPosition = Interop.TextEditor.VerticalScrollPositionGet(); + internal static readonly int PrimaryCursorPosition = Interop.TextEditor.PrimaryCursorPositionGet(); } internal class InputStyle diff --git a/src/Tizen.NUI/src/public/BaseComponents/TextField.cs b/src/Tizen.NUI/src/public/BaseComponents/TextField.cs index d42d27e..d638ded 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/TextField.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/TextField.cs @@ -1164,6 +1164,7 @@ namespace Tizen.NUI.BaseComponents } } + /// /// Enable editing in text control. /// /// 8 @@ -1185,6 +1186,31 @@ namespace Tizen.NUI.BaseComponents } /// + /// Specify primary cursor (caret) position in text control. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public int PrimaryCursorPosition + { + get + { + int temp; + using (PropertyValue propertyValue = GetProperty(TextField.Property.PrimaryCursorPosition)) + { + propertyValue.Get(out temp); + } + return temp; + } + set + { + using (PropertyValue propertyValue = new PropertyValue(value)) + { + SetProperty(TextField.Property.PrimaryCursorPosition, propertyValue); + NotifyPropertyChanged(); + } + } + } + + /// /// The Placeholder property. /// Gets or sets the placeholder: text, color, font family, font style, point size, and pixel size. /// @@ -1507,6 +1533,7 @@ namespace Tizen.NUI.BaseComponents internal static readonly int SelectedTextStart = Interop.TextField.SelectedTextStartGet(); internal static readonly int SelectedTextEnd = Interop.TextField.SelectedTextEndGet(); internal static readonly int EnableEditing = Interop.TextField.EnableEditingGet(); + internal static readonly int PrimaryCursorPosition = Interop.TextField.PrimaryCursorPositionGet(); } internal class InputStyle -- 2.7.4