[NUI] Add SelectText to TextField, TextEditor
authorBowon Ryu <bowon.ryu@samsung.com>
Thu, 29 Jul 2021 11:06:11 +0000 (20:06 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Tue, 10 Aug 2021 09:08:13 +0000 (18:08 +0900)
Select text from start to end index.
This API works in the same way as SelectWholeText().
When this is called, a SelectText event is added to the event queue.
So this can guarantee the behavior even if called before the text is rendered.

// example
textField.SelectText(2, 10);

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.TextField.cs
src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs
src/Tizen.NUI/src/public/BaseComponents/TextField.cs

index bbf8954..4ea2379 100755 (executable)
@@ -235,6 +235,9 @@ namespace Tizen.NUI
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextEditor_SelectWholeText")]
             public static extern void SelectWholeText(global::System.Runtime.InteropServices.HandleRef jarg1);
 
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextEditor_SelectText")]
+            public static extern void SelectText(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2, uint jarg3);
+
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextEditor_Property_SELECTED_TEXT_get")]
             public static extern int SelectedTextGet();
 
index a68a46f..4c31d16 100755 (executable)
@@ -250,6 +250,9 @@ namespace Tizen.NUI
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextField_SelectWholeText")]
             public static extern void SelectWholeText(global::System.Runtime.InteropServices.HandleRef jarg1);
 
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextField_SelectText")]
+            public static extern void SelectText(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2, uint jarg3);
+
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_TextField_Property_ENABLE_GRAB_HANDLE_get")]
             public static extern int EnableGrabHandleGet();
 
index 8373f91..3085284 100755 (executable)
@@ -1642,6 +1642,18 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
+        /// Select text from start to end index.
+        /// </summary>
+        /// <param name="start">The start index for selection.</param>
+        /// <param name="end">The end index for selection.</param>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public void SelectText(uint start, uint end)
+        {
+            Interop.TextEditor.SelectText(SwigCPtr, start, end);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
+
+        /// <summary>
         /// Clear selection of the text.
         /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
index 3140224..ee5d19e 100755 (executable)
@@ -1693,6 +1693,18 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
+        /// Select text from start to end index.
+        /// </summary>
+        /// <param name="start">The start index for selection.</param>
+        /// <param name="end">The end index for selection.</param>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public void SelectText(uint start, uint end)
+        {
+            Interop.TextField.SelectText(SwigCPtr, start, end);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
+
+        /// <summary>
         /// Clear selection of the text.
         /// </summary>
         /// <since_tizen> 8 </since_tizen>