[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextEditor_SelectionClearedSignal")]
public static extern global::System.IntPtr SelectionClearedSignal(global::System.Runtime.InteropServices.HandleRef pTextEditor);
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextEditor_SelectionStartedSignal")]
+ public static extern global::System.IntPtr SelectionStartedSignal(global::System.Runtime.InteropServices.HandleRef pTextEditor);
+
[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextEditor_AnchorClickedSignal")]
public static extern global::System.IntPtr AnchorClickedSignal(global::System.Runtime.InteropServices.HandleRef jarg1);
[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextField_SelectionClearedSignal")]
public static extern global::System.IntPtr SelectionClearedSignal(global::System.Runtime.InteropServices.HandleRef pTextField);
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextField_SelectionStartedSignal")]
+ public static extern global::System.IntPtr SelectionStartedSignal(global::System.Runtime.InteropServices.HandleRef pTextField);
+
[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_TextField_AnchorClickedSignal")]
public static extern global::System.IntPtr AnchorClickedSignal(global::System.Runtime.InteropServices.HandleRef jarg1);
this.MaxLengthReachedSignal().Disconnect(textEditorMaxLengthReachedCallbackDelegate);
}
+ if (textEditorSelectionStartedCallbackDelegate != null)
+ {
+ this.SelectionStartedSignal().Disconnect(textEditorSelectionStartedCallbackDelegate);
+ }
+
if (textEditorSelectionClearedCallbackDelegate != null)
{
this.SelectionClearedSignal().Disconnect(textEditorSelectionClearedCallbackDelegate);
private EventHandler textEditorSelectionClearedEventHandler;
private SelectionClearedCallbackDelegate textEditorSelectionClearedCallbackDelegate;
+ private EventHandler textEditorSelectionStartedEventHandler;
+ private SelectionStartedCallbackDelegate textEditorSelectionStartedCallbackDelegate;
+
private EventHandler textEditorSelectionChangedEventHandler;
private SelectionChangedCallbackDelegate textEditorSelectionChangedCallbackDelegate;
private delegate void SelectionClearedCallbackDelegate(IntPtr textEditor);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void SelectionStartedCallbackDelegate(IntPtr textEditor);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void AnchorClickedCallbackDelegate(IntPtr textEditor, IntPtr href, uint hrefLength);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
}
/// <summary>
+ /// The SelectionStarted event is emitted when the selection start.
+ /// </summary>
+ /// This will be public opened in after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ 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>
/// <since_tizen> 9 </since_tizen>
}
}
+ 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);
}
}
+ 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
this.MaxLengthReachedSignal().Disconnect(textFieldMaxLengthReachedCallbackDelegate);
}
+ if (textFieldSelectionStartedCallbackDelegate != null)
+ {
+ this.SelectionStartedSignal().Disconnect(textFieldSelectionStartedCallbackDelegate);
+ }
+
if (textFieldSelectionClearedCallbackDelegate != null)
{
this.SelectionClearedSignal().Disconnect(textFieldSelectionClearedCallbackDelegate);
private EventHandler textFieldSelectionClearedEventHandler;
private SelectionClearedCallbackDelegate textFieldSelectionClearedCallbackDelegate;
+ private EventHandler textFieldSelectionStartedEventHandler;
+ private SelectionStartedCallbackDelegate textFieldSelectionStartedCallbackDelegate;
+
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void TextChangedCallbackDelegate(IntPtr textField);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void SelectionClearedCallbackDelegate(IntPtr textField);
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void SelectionStartedCallbackDelegate(IntPtr textField);
+
private bool invokeTextChanged = true;
/// <summary>
}
/// <summary>
+ /// The SelectionStarted event is emitted when the selection start.
+ /// </summary>
+ /// This will be public opened in after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler SelectionStarted
+ {
+ add
+ {
+ if (textFieldSelectionStartedEventHandler == null)
+ {
+ textFieldSelectionStartedCallbackDelegate = (OnSelectionStarted);
+ SelectionStartedSignal().Connect(textFieldSelectionStartedCallbackDelegate);
+ }
+ textFieldSelectionStartedEventHandler += value;
+ }
+ remove
+ {
+ if (textFieldSelectionStartedEventHandler == null && SelectionStartedSignal().Empty() == false)
+ {
+ this.SelectionStartedSignal().Disconnect(textFieldSelectionStartedCallbackDelegate);
+ }
+ textFieldSelectionStartedEventHandler -= value;
+ }
+ }
+
+ /// <summary>
/// The SelectionCleared signal is emitted when selection is cleared.
/// </summary>
/// <since_tizen> 9 </since_tizen>
}
}
+ internal TextFieldSignal SelectionStartedSignal()
+ {
+ TextFieldSignal ret = new TextFieldSignal(Interop.TextField.SelectionStartedSignal(SwigCPtr), false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
internal TextFieldSignal SelectionClearedSignal()
{
TextFieldSignal ret = new TextFieldSignal(Interop.TextField.SelectionClearedSignal(SwigCPtr), false);
return ret;
}
+ private void OnSelectionStarted(IntPtr textField)
+ {
+ //no data to be sent to the user
+ textFieldSelectionStartedEventHandler?.Invoke(this, EventArgs.Empty);
+ }
+
private void OnSelectionCleared(IntPtr textField)
{
//no data to be sent to the user
using Tizen.NUI.Components;
using Tizen.NUI.BaseComponents;
using System.Collections.Generic;
+using System.Threading.Tasks;
namespace Tizen.NUI.Devel.Tests
{
public class PublicTextEditorEventTest
{
private const string tag = "NUITEST";
+ private bool selectionStartedFlag = false;
[SetUp]
public void Init()
testingTarget.AnchorClicked += OnAnchorClicked;
testingTarget.AnchorClicked -= OnAnchorClicked;
+ testingTarget.SelectionStarted += OnSelectionStarted;
+ testingTarget.SelectionStarted -= OnSelectionStarted;
+
testingTarget.Dispose();
tlog.Debug(tag, $"TextEditorEventEvents END (OK)");
}
+ [Test]
+ [Category("P1")]
+ [Description("TextEditorEvent SelectionStarted.")]
+ [Property("SPEC", "Tizen.NUI.TextEditor.SelectionStarted A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "a.ghujeh@samsung.com")]
+ async public Task TextEditorSelectionStarted()
+ {
+ tlog.Debug(tag, $"SelectionStarted START");
+
+ var testingTarget = new TextEditor()
+ {
+ Text = "texteditor",
+ };
+
+ Window.Instance.GetDefaultLayer().Add(testingTarget);
+
+ Assert.IsNotNull(testingTarget, "Can't create success object TextEditor");
+ Assert.IsInstanceOf<TextEditor>(testingTarget, "Should be an instance of TextEditor type.");
+
+ try
+ {
+ testingTarget.SelectionStarted += OnSelectionStarted;
+
+ testingTarget.SelectWholeText();
+ await Task.Delay(500);
+
+ testingTarget.SelectionStarted -= OnSelectionStarted;
+ }
+ catch (Exception e)
+ {
+ tlog.Info(tag, e.Message.ToString());
+ Assert.Fail("Caught Exception : Failed!");
+ }
+
+ testingTarget.Dispose();
+
+ if(selectionStartedFlag == true)
+ tlog.Debug(tag, $"SelectionStarted END (OK)");
+ else
+ Assert.Fail("SelectionStarted : Failed!");
+ }
+
private void OnAnchorClicked(object sender, AnchorClickedEventArgs e)
{
}
private void OnTextChanged(object sender, TextEditor.TextChangedEventArgs e)
{
}
+
+ private void OnSelectionStarted(object sender, EventArgs e)
+ {
+ selectionStartedFlag = true;
+ }
}
}
private const string tag = "NUITEST";
private bool textChangedFlag = false;
private bool maxLengthFlag = false;
+ private bool selectionStartedFlag = false;
private void OnTextChanged(object sender, TextField.TextChangedEventArgs e) { }
private void OnMaxLengthReached(object sender, TextField.MaxLengthReachedEventArgs e) { }
private void OnSelectionCleared(object sender, EventArgs e) { }
private void OnInputFiltered(object sender, InputFilteredEventArgs e) { }
+ private void OnSelectionStarted(object sender, EventArgs e)
+ {
+ selectionStartedFlag = true;
+ }
+
[SetUp]
public void Init()
{
testingTarget.Dispose();
tlog.Debug(tag, $"TextFieldMaxLengthReached END (OK)");
}
+
+ [Test]
+ [Category("P1")]
+ [Description("TextFieldEvent SelectionStarted.")]
+ [Property("SPEC", "Tizen.NUI.TextField.SelectionStarted A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ [Property("AUTHOR", "a.ghujeh@samsung.com")]
+ async public Task TextFieldSelectionStarted()
+ {
+ tlog.Debug(tag, $"SelectionStarted START");
+
+ var testingTarget = new TextField()
+ {
+ Text = "textfield",
+ };
+
+ Window.Instance.GetDefaultLayer().Add(testingTarget);
+
+ Assert.IsNotNull(testingTarget, "Can't create success object TextField");
+ Assert.IsInstanceOf<TextField>(testingTarget, "Should be an instance of TextField type.");
+
+ try
+ {
+ testingTarget.SelectionStarted += OnSelectionStarted;
+
+ testingTarget.SelectWholeText();
+ await Task.Delay(500);
+
+ testingTarget.SelectionStarted -= OnSelectionStarted;
+ }
+ catch (Exception e)
+ {
+ tlog.Info(tag, e.Message.ToString());
+ Assert.Fail("Caught Exception : Failed!");
+ }
+
+ testingTarget.Dispose();
+
+ if(selectionStartedFlag == true)
+ tlog.Debug(tag, $"SelectionStarted END (OK)");
+ else
+ Assert.Fail("SelectionStarted : Failed!");
+ }
}
}