[NUI] Add more selection functinality into TextEditor (#2152)
authorAli-Alzyoud <ali198724@gmail.com>
Wed, 18 Nov 2020 01:33:39 +0000 (03:33 +0200)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Thu, 19 Nov 2020 09:36:46 +0000 (18:36 +0900)
1- Add SelectWholeText method
2- Add SelectNone method
3- add SELECTED_TEXT property

Co-authored-by: Seoyeon2Kim <34738918+Seoyeon2Kim@users.noreply.github.com>
src/Tizen.NUI/src/internal/Interop/Interop.TextEditor.cs
src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs

index c29f652..e45dfce 100755 (executable)
@@ -215,6 +215,15 @@ namespace Tizen.NUI
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_TextEditor_Property_PLACEHOLDER_get")]
             public static extern int TextEditor_Property_PLACEHOLDER_get();
 
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextEditor_SelectWholeText")]
+            public static extern void TextEditor_SelectWholeText(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextEditor_Property_SELECTED_TEXT_get")]
+            public static extern int TextEditor_Property_SELECTED_TEXT_get();
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextEditor_SelectNone")]
+            public static extern int TextEditor_SelectNone(global::System.Runtime.InteropServices.HandleRef jarg1);
+
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_TextEditor_Property_LINE_WRAP_MODE_get")]
             public static extern int TextEditor_Property_LINE_WRAP_MODE_get();
 
index 674ec53..f38919c 100755 (executable)
@@ -946,6 +946,20 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
+        /// The Selected Text property (read-only).
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public string SelectedText
+        {
+            get
+            {
+                string temp;
+                GetProperty(TextEditor.Property.SELECTED_TEXT).Get(out temp);
+                return temp;
+            }
+        }
+
+        /// <summary>
         /// The Placeholder text color.
         /// </summary>
         /// <remarks>
@@ -1193,6 +1207,26 @@ namespace Tizen.NUI.BaseComponents
             return inputMethodContext;
         }
 
+        /// <summary>
+        /// Select the whole text.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public void SelectWholeText()
+        {
+            Interop.TextEditor.TextEditor_SelectWholeText(swigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
+
+        /// <summary>
+        /// Clear selection of the text.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public void SelectNone()
+        {
+            Interop.TextEditor.TextEditor_SelectNone(swigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
+
         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;
@@ -1336,6 +1370,7 @@ namespace Tizen.NUI.BaseComponents
             internal static readonly int SELECTED_TEXT_START = Interop.TextEditor.TextEditor_Property_SELECTED_TEXT_START_get();
             internal static readonly int SELECTED_TEXT_END = Interop.TextEditor.TextEditor_Property_SELECTED_TEXT_END_get();
             internal static readonly int ENABLE_EDITING = Interop.TextEditor.TextEditor_Property_ENABLE_EDITING_get();
+            internal static readonly int SELECTED_TEXT = Interop.TextEditor.TextEditor_Property_SELECTED_TEXT_get();
         }
 
         internal class InputStyle