[NUI] Change all CallingConvention to `Cdecl`
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / BaseComponents / TextEditorEvent.cs
index 44c8959..8a37327 100755 (executable)
@@ -45,36 +45,44 @@ namespace Tizen.NUI.BaseComponents
         private EventHandler textEditorSelectionClearedEventHandler;
         private SelectionClearedCallbackDelegate textEditorSelectionClearedCallbackDelegate;
 
+        private EventHandler textEditorSelectionStartedEventHandler;
+        private SelectionStartedCallbackDelegate textEditorSelectionStartedCallbackDelegate;
+
         private EventHandler textEditorSelectionChangedEventHandler;
         private SelectionChangedCallbackDelegate textEditorSelectionChangedCallbackDelegate;
 
         private EventHandler<InputFilteredEventArgs> textEditorInputFilteredEventHandler;
         private InputFilteredCallbackDelegate textEditorInputFilteredCallbackDelegate;
 
-        [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
         private delegate void TextChangedCallbackDelegate(IntPtr textEditor);
 
-        [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
         private delegate void ScrollStateChangedCallbackDelegate(IntPtr textEditor, ScrollState state);
 
-        [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
         private delegate void CursorPositionChangedCallbackDelegate(IntPtr textEditor, uint oldPosition);
 
-        [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
         private delegate void MaxLengthReachedCallbackDelegate(IntPtr textEditor);
 
-        [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
         private delegate void SelectionClearedCallbackDelegate(IntPtr textEditor);
 
-        [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+        private delegate void SelectionStartedCallbackDelegate(IntPtr textEditor);
+
+        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
         private delegate void AnchorClickedCallbackDelegate(IntPtr textEditor, IntPtr href, uint hrefLength);
 
-        [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
         private delegate void SelectionChangedCallbackDelegate(IntPtr textEditor, uint oldStart, uint oldEnd);
 
-        [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
         private delegate void InputFilteredCallbackDelegate(IntPtr textEditor, InputFilterType type);
 
+        private bool invokeTextChanged = true;
+
         /// <summary>
         /// An event for the TextChanged signal which can be used to subscribe or unsubscribe the event handler
         /// provided by the user. The TextChanged signal is emitted when the text changes.<br />
@@ -204,10 +212,34 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
+        /// The SelectionStarted event is emitted when the selection has been started.
+        /// </summary>
+        /// <since_tizen> 10 </since_tizen>
+        public event EventHandler SelectionStarted
+        {
+            add
+            {
+                if (textEditorSelectionStartedEventHandler == null)
+                {
+                    textEditorSelectionStartedCallbackDelegate = (OnSelectionStarted);
+                    SelectionStartedSignal().Connect(textEditorSelectionStartedCallbackDelegate);
+                }
+                textEditorSelectionStartedEventHandler += value;
+            }
+            remove
+            {
+                if (textEditorSelectionStartedEventHandler == null && SelectionStartedSignal().Empty() == false)
+                {
+                    this.SelectionStartedSignal().Disconnect(textEditorSelectionStartedCallbackDelegate);
+                }
+                textEditorSelectionStartedEventHandler -= value;
+            }
+        }
+
+        /// <summary>
         /// The SelectionCleared signal is emitted when selection is cleared.
         /// </summary>
-        /// This will be public opened after ACR done. Before ACR, need to be hidden as inhouse API.
-        [EditorBrowsable(EditorBrowsableState.Never)]
+        /// <since_tizen> 9 </since_tizen>
         public event EventHandler SelectionCleared
         {
             add
@@ -230,7 +262,7 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
-        /// The SelectionChanged signal is emitted whenever the selected text changed.
+        /// The SelectionChanged event is emitted whenever the selected text is changed.
         /// </summary>
         /// <since_tizen> 9 </since_tizen>
         public event EventHandler SelectionChanged
@@ -276,7 +308,7 @@ namespace Tizen.NUI.BaseComponents
         /// };
         /// </code>
         /// </example>
-        [EditorBrowsable(EditorBrowsableState.Never)]
+        /// <since_tizen> 9 </since_tizen>
         public event EventHandler<InputFilteredEventArgs> InputFiltered
         {
             add
@@ -298,6 +330,13 @@ namespace Tizen.NUI.BaseComponents
             }
         }
 
+        internal TextEditorSignal SelectionStartedSignal()
+        {
+            TextEditorSignal ret = new TextEditorSignal(Interop.TextEditor.SelectionStartedSignal(SwigCPtr), false);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret;
+        }
+
         internal TextEditorSignal SelectionClearedSignal()
         {
             TextEditorSignal ret = new TextEditorSignal(Interop.TextEditor.SelectionClearedSignal(SwigCPtr), false);
@@ -356,7 +395,7 @@ namespace Tizen.NUI.BaseComponents
 
         private void OnTextChanged(IntPtr textEditor)
         {
-            if (textEditorTextChangedEventHandler != null)
+            if (textEditorTextChangedEventHandler != null && invokeTextChanged)
             {
                 TextChangedEventArgs e = new TextChangedEventArgs();
 
@@ -367,6 +406,12 @@ namespace Tizen.NUI.BaseComponents
             }
         }
 
+        private void OnSelectionStarted(IntPtr textEditor)
+        {
+            //no data to be sent to the user
+            textEditorSelectionStartedEventHandler?.Invoke(this, EventArgs.Empty);
+        }
+
         private void OnSelectionCleared(IntPtr textEditor)
         {
             //no data to be sent to the user