1
0
Эх сурвалжийг харах

renamed IDragData to IDataObject

boombuler 7 жил өмнө
parent
commit
0adc6e62de

+ 4 - 4
src/Avalonia.Controls/DragDrop/DefaultDragDispatcher.cs

@@ -23,7 +23,7 @@ namespace Avalonia.Controls.DragDrop
             return null;
         }
         
-        private DragDropEffects RaiseDragEvent(Interactive target, RoutedEvent<DragEventArgs> routedEvent, DragDropEffects operation, IDragData data)
+        private DragDropEffects RaiseDragEvent(Interactive target, RoutedEvent<DragEventArgs> routedEvent, DragDropEffects operation, IDataObject data)
         {
             if (target == null)
                 return DragDropEffects.None;
@@ -36,13 +36,13 @@ namespace Avalonia.Controls.DragDrop
             return args.DragEffects;
         }
         
-        public DragDropEffects DragEnter(IInputElement inputRoot, Point point, IDragData data, DragDropEffects effects)
+        public DragDropEffects DragEnter(IInputElement inputRoot, Point point, IDataObject data, DragDropEffects effects)
         {
             _lastTarget = GetTarget(inputRoot, point);
             return RaiseDragEvent(_lastTarget, DragDrop.DragEnterEvent, effects, data);
         }
 
-        public DragDropEffects DragOver(IInputElement inputRoot, Point point, IDragData data, DragDropEffects effects)
+        public DragDropEffects DragOver(IInputElement inputRoot, Point point, IDataObject data, DragDropEffects effects)
         {
             var target = GetTarget(inputRoot, point);
 
@@ -75,7 +75,7 @@ namespace Avalonia.Controls.DragDrop
             }
         }
 
-        public DragDropEffects Drop(IInputElement inputRoot, Point point, IDragData data, DragDropEffects effects)
+        public DragDropEffects Drop(IInputElement inputRoot, Point point, IDataObject data, DragDropEffects effects)
         {
             try
             {

+ 2 - 2
src/Avalonia.Controls/DragDrop/DragEventArgs.cs

@@ -6,9 +6,9 @@ namespace Avalonia.Controls.DragDrop
     {
         public DragDropEffects DragEffects { get; set; }
 
-        public IDragData Data { get; private set; }
+        public IDataObject Data { get; private set; }
 
-        public DragEventArgs(RoutedEvent<DragEventArgs> routedEvent, IDragData data)
+        public DragEventArgs(RoutedEvent<DragEventArgs> routedEvent, IDataObject data)
             : base(routedEvent)
         {
             this.Data = data;

+ 1 - 1
src/Avalonia.Controls/DragDrop/IDragData.cs → src/Avalonia.Controls/DragDrop/IDataObject.cs

@@ -2,7 +2,7 @@
 
 namespace Avalonia.Controls.DragDrop
 {
-    public interface IDragData
+    public interface IDataObject
     {
         IEnumerable<string> GetDataFormats();
 

+ 3 - 3
src/Avalonia.Controls/DragDrop/IDragDispatcher.cs

@@ -7,9 +7,9 @@ namespace Avalonia.Controls.DragDrop
     /// </summary>
     public interface IDragDispatcher
     {
-        DragDropEffects DragEnter(IInputElement inputRoot, Point point, IDragData data, DragDropEffects effects);
-        DragDropEffects DragOver(IInputElement inputRoot, Point point, IDragData data, DragDropEffects effects);
+        DragDropEffects DragEnter(IInputElement inputRoot, Point point, IDataObject data, DragDropEffects effects);
+        DragDropEffects DragOver(IInputElement inputRoot, Point point, IDataObject data, DragDropEffects effects);
         void DragLeave(IInputElement inputRoot);
-        DragDropEffects Drop(IInputElement inputRoot, Point point, IDragData data, DragDropEffects effects);
+        DragDropEffects Drop(IInputElement inputRoot, Point point, IDataObject data, DragDropEffects effects);
     }
 }

+ 1 - 1
src/OSX/Avalonia.MonoMac/DraggingInfo.cs

@@ -7,7 +7,7 @@ using MonoMac.Foundation;
 
 namespace Avalonia.MonoMac
 {
-    class DraggingInfo : IDragData
+    class DraggingInfo : IDataObject
     { 
         private readonly NSDraggingInfo _info;
 

+ 3 - 21
src/Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs

@@ -1335,25 +1335,7 @@ namespace Avalonia.Win32.Interop
         Scroll = -2147483648,
     }
     
-    [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
-    [Guid("0000010E-0000-0000-C000-000000000046")]
-    [ComImport]
-    internal interface IOleDataObject
-    {
-        void GetData([In] ref FORMATETC format, out STGMEDIUM medium);
-        void GetDataHere([In] ref FORMATETC format, ref STGMEDIUM medium);
-        [PreserveSig]
-        int QueryGetData([In] ref FORMATETC format);
-        [PreserveSig]
-        int GetCanonicalFormatEtc([In] ref FORMATETC formatIn, out FORMATETC formatOut);
-        void SetData([In] ref FORMATETC formatIn, [In] ref STGMEDIUM medium, [MarshalAs(UnmanagedType.Bool)] bool release);
-        IEnumFORMATETC EnumFormatEtc(DATADIR direction);
-        [PreserveSig]
-        int DAdvise([In] ref FORMATETC pFormatetc, ADVF advf, IAdviseSink adviseSink, out int connection);
-        void DUnadvise(int connection);
-        [PreserveSig]
-        int EnumDAdvise(out IEnumSTATDATA enumAdvise);
-    }
+    
     
     [ComImport]
     [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
@@ -1361,12 +1343,12 @@ namespace Avalonia.Win32.Interop
     internal interface IDropTarget
     {
         [PreserveSig]
-        UnmanagedMethods.HRESULT DragEnter([MarshalAs(UnmanagedType.Interface)] [In] IOleDataObject pDataObj, [MarshalAs(UnmanagedType.U4)] [In] int grfKeyState, [MarshalAs(UnmanagedType.U8)] [In] long pt, [In] [Out] ref DropEffect pdwEffect);
+        UnmanagedMethods.HRESULT DragEnter([MarshalAs(UnmanagedType.Interface)] [In] IDataObject pDataObj, [MarshalAs(UnmanagedType.U4)] [In] int grfKeyState, [MarshalAs(UnmanagedType.U8)] [In] long pt, [In] [Out] ref DropEffect pdwEffect);
         [PreserveSig]
         UnmanagedMethods.HRESULT DragOver([MarshalAs(UnmanagedType.U4)] [In] int grfKeyState, [MarshalAs(UnmanagedType.U8)] [In] long pt, [In] [Out] ref DropEffect pdwEffect);
         [PreserveSig]
         UnmanagedMethods.HRESULT DragLeave();
         [PreserveSig]
-        UnmanagedMethods.HRESULT Drop([MarshalAs(UnmanagedType.Interface)] [In] IOleDataObject pDataObj, [MarshalAs(UnmanagedType.U4)] [In] int grfKeyState, [MarshalAs(UnmanagedType.U8)] [In] long pt, [In] [Out] ref DropEffect pdwEffect);
+        UnmanagedMethods.HRESULT Drop([MarshalAs(UnmanagedType.Interface)] [In] IDataObject pDataObj, [MarshalAs(UnmanagedType.U4)] [In] int grfKeyState, [MarshalAs(UnmanagedType.U8)] [In] long pt, [In] [Out] ref DropEffect pdwEffect);
     }
 }

+ 4 - 3
src/Windows/Avalonia.Win32/OleDataObject.cs

@@ -6,14 +6,15 @@ using System.Runtime.InteropServices.ComTypes;
 using System.Text;
 using Avalonia.Controls.DragDrop;
 using Avalonia.Win32.Interop;
+using IDataObject = System.Runtime.InteropServices.ComTypes.IDataObject;
 
 namespace Avalonia.Win32
 {
-    class OleDataObject : IDragData
+    class OleDataObject : Avalonia.Controls.DragDrop.IDataObject
     {
-        private IOleDataObject _wrapped;
+        private IDataObject _wrapped;
 
-        public OleDataObject(IOleDataObject wrapped)
+        public OleDataObject(IDataObject wrapped)
         {
             _wrapped = wrapped;
         }

+ 4 - 7
src/Windows/Avalonia.Win32/OleDropTarget.cs

@@ -1,11 +1,8 @@
-using System;
-using System.Runtime.InteropServices.ComTypes;
-using Avalonia.Controls;
-using Avalonia.Controls.DragDrop;
+using Avalonia.Controls.DragDrop;
 using Avalonia.Input;
-using Avalonia.Interactivity;
-using Avalonia.VisualTree;
 using Avalonia.Win32.Interop;
+using IDataObject = Avalonia.Controls.DragDrop.IDataObject;
+using IOleDataObject = System.Runtime.InteropServices.ComTypes.IDataObject;
 
 namespace Avalonia.Win32
 {
@@ -14,7 +11,7 @@ namespace Avalonia.Win32
         private readonly IDragDispatcher _dragDispatcher;
         private readonly IInputElement _target;
         
-        private IDragData _currentDrag = null;
+        private IDataObject _currentDrag = null;
 
         public OleDropTarget(IInputElement target)
         {