From: Taehyub Kim Date: Wed, 11 May 2022 01:36:06 +0000 (+0900) Subject: [NUI][TCSACR-487] DragAndDrop: Add drag and drop APIs X-Git-Tag: accepted/tizen/unified/20231205.024657~713 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=799382830b486e09279dfe4187a957bc0990e151;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [NUI][TCSACR-487] DragAndDrop: Add drag and drop APIs --- diff --git a/src/Tizen.NUI/src/public/DragAndDrop/DragAndDrop.cs b/src/Tizen.NUI/src/public/DragAndDrop/DragAndDrop.cs index 60e567c..b9d5724 100755 --- a/src/Tizen.NUI/src/public/DragAndDrop/DragAndDrop.cs +++ b/src/Tizen.NUI/src/public/DragAndDrop/DragAndDrop.cs @@ -24,14 +24,13 @@ using Tizen.NUI.BaseComponents; namespace Tizen.NUI { /// - /// DragAndDrop controls the drag objet and data. + /// DragAndDrop controls the drag object and data. /// + /// 10 [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000: Dispose objects before losing scope", Justification = "It does not have ownership.")] - [EditorBrowsable(EditorBrowsableState.Never)] public class DragAndDrop : BaseHandle { - [EditorBrowsable(EditorBrowsableState.Never)] - public delegate void SourceEventHandler(SourceEventType sourceEventType); + public delegate void SourceEventHandler(DragSourceEventType sourceEventType); private delegate void InternalSourceEventHandler(int sourceEventType); public delegate void DragAndDropEventHandler(View targetView, DragEvent dragEvent); private delegate void InternalDragAndDropEventHandler(global::System.IntPtr dragEvent); @@ -42,7 +41,6 @@ namespace Tizen.NUI private int shadowWidth = 100; private int shadowHeight = 100; - [EditorBrowsable(EditorBrowsableState.Never)] private DragAndDrop() : this(Interop.DragAndDrop.New(), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); @@ -56,7 +54,7 @@ namespace Tizen.NUI /// /// Gets the singleton instance of DragAndDrop. /// - [EditorBrowsable(EditorBrowsableState.Never)] + /// 10 public static DragAndDrop Instance { get; } = new DragAndDrop(); /// @@ -66,8 +64,7 @@ namespace Tizen.NUI /// The shadow view for drag object /// The data to send /// The source event callback - /// The multi-window feature is not supported. - [EditorBrowsable(EditorBrowsableState.Never)] + /// 10 public void StartDragAndDrop(View sourceView, View shadowView, DragData dragData, SourceEventHandler callback) { if (Window.IsSupportedMultiWindow() == false) @@ -128,7 +125,7 @@ namespace Tizen.NUI sourceEventCb = (sourceEventType) => { - if ((SourceEventType)sourceEventType == SourceEventType.Finish) + if ((DragSourceEventType)sourceEventType == DragSourceEventType.Finish) { if (mShadowView) { @@ -142,7 +139,7 @@ namespace Tizen.NUI mDragWindow.RenderOnce(); } - callback((SourceEventType)sourceEventType); + callback((DragSourceEventType)sourceEventType); }; if (!Interop.DragAndDrop.StartDragAndDrop(SwigCPtr, View.getCPtr(sourceView), Window.getCPtr(mDragWindow), dragData.MimeType, dragData.Data, @@ -158,8 +155,8 @@ namespace Tizen.NUI /// Adds listener for drop targets /// /// The target view - /// The callback function to get drag event - [EditorBrowsable(EditorBrowsableState.Never)] + /// The callback function to get drag event when the drag source enters, moves, leaves and drops on the drop target + /// 10 public void AddListener(View targetView, DragAndDropEventHandler callback) { InternalDragAndDropEventHandler cb = (dragEvent) => @@ -207,7 +204,7 @@ namespace Tizen.NUI /// /// The target view /// The callback function to remove - [EditorBrowsable(EditorBrowsableState.Never)] + /// 10 public void RemoveListener(View targetView, DragAndDropEventHandler callback) { if (!targetEventDictionary.ContainsKey(targetView)) diff --git a/src/Tizen.NUI/src/public/DragAndDrop/DragEvent.cs b/src/Tizen.NUI/src/public/DragAndDrop/DragEvent.cs index ee7a8cd..6c705b9 100755 --- a/src/Tizen.NUI/src/public/DragAndDrop/DragEvent.cs +++ b/src/Tizen.NUI/src/public/DragAndDrop/DragEvent.cs @@ -21,10 +21,10 @@ using Tizen.NUI.Binding; namespace Tizen.NUI { /// - /// Source event type. + /// Drag source event type. /// - [EditorBrowsable(EditorBrowsableState.Never)] - public enum SourceEventType + /// 10 + public enum DragSourceEventType { /// /// Drag and drop is started. @@ -47,9 +47,9 @@ namespace Tizen.NUI /// /// This specifies drag data. /// - /// Suppress warning : This struct will be used data of callback, so override equals and operator does not necessary. + /// 10 + // Suppress warning : This struct will be used data of callback, so override equals and operator does not necessary. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1815: Override equals and operator equals on value types")] - [EditorBrowsable(EditorBrowsableState.Never)] public struct DragData { /// @@ -65,7 +65,7 @@ namespace Tizen.NUI /// /// Drag event type. /// - [EditorBrowsable(EditorBrowsableState.Never)] + /// 10 public enum DragType { /// @@ -89,9 +89,9 @@ namespace Tizen.NUI /// /// This specifies drag event. /// - /// Suppress warning : This struct will be used data of callback, so override equals and operator does not necessary. + /// 10 + // Suppress warning : This struct will be used data of callback, so override equals and operator does not necessary. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1815: Override equals and operator equals on value types")] - [EditorBrowsable(EditorBrowsableState.Never)] public struct DragEvent { /// diff --git a/test/NUIDnDSource/NUIDnDSource.cs b/test/NUIDnDSource/NUIDnDSource.cs index 8725d34..4fd294c 100644 --- a/test/NUIDnDSource/NUIDnDSource.cs +++ b/test/NUIDnDSource/NUIDnDSource.cs @@ -131,23 +131,23 @@ namespace NUIDnDSource } } - public void OnSourceEventFunc(SourceEventType type) + public void OnSourceEventFunc(DragSourceEventType type) { - if (type == SourceEventType.Start) + if (type == DragSourceEventType.Start) { - Tizen.Log.Debug("NUIDnDSource", "Source App SourceEvnetType: " + "Start"); + Tizen.Log.Debug("NUIDnDSource", "Source App DragSourceEventType: " + "Start"); } - else if (type == SourceEventType.Cancel) + else if (type == DragSourceEventType.Cancel) { - Tizen.Log.Debug("NUIDnDSource", "Source App SourceEvnetType: " + "Cancel"); + Tizen.Log.Debug("NUIDnDSource", "Source App DragSourceEventType: " + "Cancel"); } - else if (type == SourceEventType.Accept) + else if (type == DragSourceEventType.Accept) { - Tizen.Log.Debug("NUIDnDSource", "Source App SourceEvnetType: " + "Accept"); + Tizen.Log.Debug("NUIDnDSource", "Source App DragSourceEventType: " + "Accept"); } - else if (type == SourceEventType.Finish) + else if (type == DragSourceEventType.Finish) { - Tizen.Log.Debug("NUIDnDSource", "Source App SourceEvnetType: " + "Finish"); + Tizen.Log.Debug("NUIDnDSource", "Source App DragSourceEventType: " + "Finish"); } }