[NUI] Copy, Paste & Cut Public APIs (#3450)
authorSaraMohSamara <43113185+SaraMohSamara@users.noreply.github.com>
Tue, 24 Aug 2021 10:43:39 +0000 (13:43 +0300)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Fri, 27 Aug 2021 05:29:50 +0000 (14:29 +0900)
[NUI] Adding the Copy, Cut and paste public APIs to NUI.

Added:
string CopyText() //Copy and return the selected text.
- This function will copy the previously selected string into the clipboard and will return it.
string CutText() //Cut and return the selected text.
- This function will cut the previously selected string into the clipboard and will return it.
void PasteText() //Paste the most recently copied/cut text.
- This function will paste the most recent string in the clipboard stack into the text control.

src/Tizen.NUI/src/internal/Interop/Interop.TextEditor.cs
src/Tizen.NUI/src/internal/Interop/Interop.TextField.cs
src/Tizen.NUI/src/public/BaseComponents/TextUtils.cs

index 53fb762..9e0f572 100755 (executable)
@@ -325,6 +325,15 @@ namespace Tizen.NUI
 
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextEditor_InputFilteredSignal")]
             public static extern global::System.IntPtr InputFilteredSignal(global::System.Runtime.InteropServices.HandleRef textEditorRef);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextEditor_CopyText")]
+            public static extern string CopyText(global::System.Runtime.InteropServices.HandleRef textEditorRef);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextEditor_CutText")]
+            public static extern string CutText(global::System.Runtime.InteropServices.HandleRef textEditorRef);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextEditor_PasteText")]
+            public static extern void PasteText(global::System.Runtime.InteropServices.HandleRef textEditorRef);
         }
     }
 }
index 86b32da..4333c8c 100755 (executable)
@@ -294,6 +294,15 @@ namespace Tizen.NUI
 
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextField_InputFilteredSignal")]
             public static extern global::System.IntPtr InputFilteredSignal(global::System.Runtime.InteropServices.HandleRef textFieldRef);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextField_CopyText")]
+            public static extern string CopyText(global::System.Runtime.InteropServices.HandleRef textFieldRef);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextField_CutText")]
+            public static extern string CutText(global::System.Runtime.InteropServices.HandleRef textFieldRef);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextField_PasteText")]
+            public static extern void PasteText(global::System.Runtime.InteropServices.HandleRef textFieldRef);
         }
     }
 }
index dae3f06..2305db6 100755 (executable)
@@ -1590,5 +1590,85 @@ namespace Tizen.NUI.BaseComponents
 
             return textFit;
         }
+
+        /// <summary>
+        /// Copy the previously selected text into the clipboard and return the copied value.
+        /// </summary>
+        /// <param name="textEditor">The textEditor control from which the text is copied.</param>
+        /// <returns>The copied text.</returns>
+        // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public static string CopyToClipboard(TextEditor textEditor)
+        {
+            string copiedText = Interop.TextEditor.CopyText(textEditor.SwigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return copiedText;
+        }
+
+        /// <summary>
+        /// Copy the previously selected text into the clipboard and return the copied value.
+        /// </summary>
+        /// <param name="textField">The textField control from which the text is copied.</param>
+        /// <returns>The copied text.</returns>
+        // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public static string CopyToClipboard(TextField textField)
+        {
+            string copiedText = Interop.TextField.CopyText(textField.SwigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return copiedText;
+        }
+
+        /// <summary>
+        /// Cut the previously selected text from the text control and into the clipboard and return the cut value.
+        /// </summary>
+        /// <param name="textEditor">The textEditor control from which the text is cut.</param>
+        /// <returns>The cut text.</returns>
+        // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public static string CutToClipboard(TextEditor textEditor)
+        {
+            string cutText = Interop.TextEditor.CutText(textEditor.SwigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return cutText;
+        }
+
+        /// <summary>
+        /// Cut the previously selected text from the text control and into the clipboard and return the cut value.
+        /// </summary>
+        /// <param name="textField">The textField control from which the text is cut.</param>
+        /// <returns>The cut text.</returns>
+        // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public static string CutToClipboard(TextField textField)
+        {
+            string cutText = Interop.TextField.CutText(textField.SwigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return cutText;
+        }
+
+        /// <summary>
+        /// Paste the most recently copied/cut text from the clipboard and into the text control.
+        /// </summary>
+        /// <param name="textEditor">The textEditor control into which the text is pasted.</param>
+        // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public static void PasteTo(TextEditor textEditor)
+        {
+            Interop.TextEditor.PasteText(textEditor.SwigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
+
+        /// <summary>
+        /// Paste the most recently copied/cut text from the clipboard and into the text control.
+        /// </summary>
+        /// <param name="textField">The textField control into which the text is pasted.</param>
+        // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public static void PasteTo(TextField textField)
+        {
+            Interop.TextField.PasteText(textField.SwigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
     }
 }