소스 검색

moved Drag+Drop sources to Avalonia.Input

Also the windows specific DragSource is
only used when the application runs as STA
boombuler 7 년 전
부모
커밋
7032b9b8eb

+ 3 - 2
src/Avalonia.Controls/Application.cs

@@ -12,9 +12,10 @@ using Avalonia.Rendering;
 using Avalonia.Styling;
 using Avalonia.Threading;
 using System.Reactive.Concurrency;
-using Avalonia.Controls.DragDrop;
-using Avalonia.Controls.DragDrop.Raw;
+using Avalonia.Input.DragDrop.Raw;
 using Avalonia.Controls.Platform;
+using Avalonia.Platform;
+using Avalonia.Input.DragDrop;
 
 namespace Avalonia
 {

+ 5 - 5
src/Avalonia.Controls/DragDrop/DragSource.cs → src/Avalonia.Controls/Platform/DragSource.cs

@@ -2,17 +2,17 @@
 using System.Linq;
 using System.Reactive.Linq;
 using System.Reactive.Subjects;
-using System.Text;
 using System.Threading.Tasks;
-using Avalonia.Controls.DragDrop.Raw;
-using Avalonia.Controls.Platform;
+using Avalonia.Controls;
 using Avalonia.Input;
+using Avalonia.Input.DragDrop;
+using Avalonia.Input.DragDrop.Raw;
+using Avalonia.Input.Platform;
 using Avalonia.Input.Raw;
-using Avalonia.Interactivity;
 using Avalonia.Threading;
 using Avalonia.VisualTree;
 
-namespace Avalonia.Controls.DragDrop
+namespace Avalonia.Platform
 {
     class DragSource : IPlatformDragSource
     {

+ 1 - 1
src/Avalonia.Controls/DragDrop/DataFormats.cs → src/Avalonia.Input/DragDrop/DataFormats.cs

@@ -1,4 +1,4 @@
-namespace Avalonia.Controls.DragDrop
+namespace Avalonia.Input.DragDrop
 {
     public static class DataFormats
     {

+ 1 - 1
src/Avalonia.Controls/DragDrop/DataObject.cs → src/Avalonia.Input/DragDrop/DataObject.cs

@@ -2,7 +2,7 @@
 using System.Collections.Generic;
 using System.Text;
 
-namespace Avalonia.Controls.DragDrop
+namespace Avalonia.Input.DragDrop
 {
     public class DataObject : IDataObject
     {

+ 2 - 2
src/Avalonia.Controls/DragDrop/DragDrop.cs → src/Avalonia.Input/DragDrop/DragDrop.cs

@@ -1,8 +1,8 @@
 using System.Threading.Tasks;
-using Avalonia.Controls.Platform;
 using Avalonia.Interactivity;
+using Avalonia.Input.Platform;
 
-namespace Avalonia.Controls.DragDrop
+namespace Avalonia.Input.DragDrop
 {
     public static class DragDrop
     {

+ 4 - 5
src/Avalonia.Controls/DragDrop/DragDropDevice.cs → src/Avalonia.Input/DragDrop/DragDropDevice.cs

@@ -1,13 +1,12 @@
-using Avalonia.Input;
-using Avalonia.Interactivity;
+using Avalonia.Interactivity;
 using Avalonia.VisualTree;
 using System.Linq;
-using Avalonia.Controls.DragDrop.Raw;
+using Avalonia.Input.DragDrop.Raw;
 using Avalonia.Input.Raw;
 
-namespace Avalonia.Controls.DragDrop
+namespace Avalonia.Input.DragDrop
 {
-    class DragDropDevice : IDragDropDevice
+    public class DragDropDevice : IDragDropDevice
     {
         public static readonly DragDropDevice Instance = new DragDropDevice();
         

+ 1 - 1
src/Avalonia.Controls/DragDrop/DragDropEffects.cs → src/Avalonia.Input/DragDrop/DragDropEffects.cs

@@ -1,6 +1,6 @@
 using System;
 
-namespace Avalonia.Controls.DragDrop
+namespace Avalonia.Input.DragDrop
 {
     [Flags]
     public enum DragDropEffects

+ 1 - 1
src/Avalonia.Controls/DragDrop/DragEventArgs.cs → src/Avalonia.Input/DragDrop/DragEventArgs.cs

@@ -1,6 +1,6 @@
 using Avalonia.Interactivity;
 
-namespace Avalonia.Controls.DragDrop
+namespace Avalonia.Input.DragDrop
 {
     public class DragEventArgs : RoutedEventArgs
     {

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

@@ -1,6 +1,6 @@
 using System.Collections.Generic;
 
-namespace Avalonia.Controls.DragDrop
+namespace Avalonia.Input.DragDrop
 {
     public interface IDataObject
     {

+ 1 - 1
src/Avalonia.Controls/DragDrop/Raw/IDragDropDevice.cs → src/Avalonia.Input/DragDrop/Raw/IDragDropDevice.cs

@@ -1,6 +1,6 @@
 using Avalonia.Input;
 
-namespace Avalonia.Controls.DragDrop.Raw
+namespace Avalonia.Input.DragDrop.Raw
 {
     public interface IDragDropDevice : IInputDevice
     {

+ 1 - 1
src/Avalonia.Controls/DragDrop/Raw/RawDragEvent.cs → src/Avalonia.Input/DragDrop/Raw/RawDragEvent.cs

@@ -2,7 +2,7 @@
 using Avalonia.Input;
 using Avalonia.Input.Raw;
 
-namespace Avalonia.Controls.DragDrop.Raw
+namespace Avalonia.Input.DragDrop.Raw
 {
     public class RawDragEvent : RawInputEventArgs
     {

+ 1 - 1
src/Avalonia.Controls/DragDrop/Raw/RawDragEventType.cs → src/Avalonia.Input/DragDrop/Raw/RawDragEventType.cs

@@ -1,4 +1,4 @@
-namespace Avalonia.Controls.DragDrop.Raw
+namespace Avalonia.Input.DragDrop.Raw
 {
     public enum RawDragEventType
     {

+ 2 - 2
src/Avalonia.Controls/Platform/IPlatformDragSource.cs → src/Avalonia.Input/Platform/IPlatformDragSource.cs

@@ -2,10 +2,10 @@
 using System.Collections.Generic;
 using System.Text;
 using System.Threading.Tasks;
-using Avalonia.Controls.DragDrop;
+using Avalonia.Input.DragDrop;
 using Avalonia.Interactivity;
 
-namespace Avalonia.Controls.Platform
+namespace Avalonia.Input.Platform
 {
     public interface IPlatformDragSource
     {

+ 2 - 2
src/OSX/Avalonia.MonoMac/DragSource.cs

@@ -10,8 +10,8 @@ using System.Runtime.InteropServices;
 using System.Runtime.Serialization.Formatters.Binary;
 using System.Threading.Tasks;
 using Avalonia.Controls;
-using Avalonia.Controls.DragDrop;
-using Avalonia.Controls.Platform;
+using Avalonia.Input.DragDrop;
+using Avalonia.Input.Platform;
 using Avalonia.Input;
 using Avalonia.Input.Raw;
 using MonoMac;

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

@@ -1,7 +1,7 @@
 using System;
 using System.Collections.Generic;
 using System.Linq;
-using Avalonia.Controls.DragDrop;
+using Avalonia.Input.DragDrop;
 using MonoMac.AppKit;
 using MonoMac.Foundation;
 

+ 2 - 2
src/OSX/Avalonia.MonoMac/TopLevelImpl.cs

@@ -1,7 +1,7 @@
 using System;
 using System.Collections.Generic;
-using Avalonia.Controls.DragDrop;
-using Avalonia.Controls.DragDrop.Raw;
+using Avalonia.Input.DragDrop;
+using Avalonia.Input.DragDrop.Raw;
 using Avalonia.Input;
 using Avalonia.Input.Raw;
 using Avalonia.Platform;

+ 1 - 1
src/Windows/Avalonia.Win32/ClipboardFormats.cs

@@ -3,7 +3,7 @@ using System.Collections.Generic;
 using System.ComponentModel;
 using System.Linq;
 using System.Text;
-using Avalonia.Controls.DragDrop;
+using Avalonia.Input.DragDrop;
 using Avalonia.Win32.Interop;
 
 namespace Avalonia.Win32

+ 2 - 2
src/Windows/Avalonia.Win32/DataObject.cs

@@ -4,9 +4,9 @@ using System.Collections.Generic;
 using System.Runtime.InteropServices;
 using System.Runtime.InteropServices.ComTypes;
 using System.Text;
-using Avalonia.Controls.DragDrop;
+using Avalonia.Input.DragDrop;
 using Avalonia.Win32.Interop;
-using IDataObject = Avalonia.Controls.DragDrop.IDataObject;
+using IDataObject = Avalonia.Input.DragDrop.IDataObject;
 using IOleDataObject = System.Runtime.InteropServices.ComTypes.IDataObject;
 using System.IO;
 using System.Runtime.Serialization.Formatters.Binary;

+ 2 - 3
src/Windows/Avalonia.Win32/DragSource.cs

@@ -2,9 +2,8 @@
 using System.Collections.Generic;
 using System.Text;
 using System.Threading.Tasks;
-using Avalonia.Controls.DragDrop;
-using Avalonia.Controls.Platform;
-using Avalonia.Interactivity;
+using Avalonia.Input.DragDrop;
+using Avalonia.Input.Platform;
 using Avalonia.Threading;
 using Avalonia.Win32.Interop;
 

+ 2 - 2
src/Windows/Avalonia.Win32/OleDataObject.cs

@@ -6,13 +6,13 @@ using System.Runtime.InteropServices;
 using System.Runtime.InteropServices.ComTypes;
 using System.Runtime.Serialization.Formatters.Binary;
 using System.Text;
-using Avalonia.Controls.DragDrop;
+using Avalonia.Input.DragDrop;
 using Avalonia.Win32.Interop;
 using IDataObject = System.Runtime.InteropServices.ComTypes.IDataObject;
 
 namespace Avalonia.Win32
 {
-    class OleDataObject : Avalonia.Controls.DragDrop.IDataObject
+    class OleDataObject : Avalonia.Input.DragDrop.IDataObject
     {
         private IDataObject _wrapped;
 

+ 3 - 3
src/Windows/Avalonia.Win32/OleDropTarget.cs

@@ -1,9 +1,9 @@
-using Avalonia.Controls.DragDrop;
-using Avalonia.Controls.DragDrop.Raw;
+using Avalonia.Input.DragDrop;
+using Avalonia.Input.DragDrop.Raw;
 using Avalonia.Input;
 using Avalonia.Platform;
 using Avalonia.Win32.Interop;
-using IDataObject = Avalonia.Controls.DragDrop.IDataObject;
+using IDataObject = Avalonia.Input.DragDrop.IDataObject;
 using IOleDataObject = System.Runtime.InteropServices.ComTypes.IDataObject;
 
 namespace Avalonia.Win32

+ 4 - 2
src/Windows/Avalonia.Win32/Win32Platform.cs

@@ -84,8 +84,10 @@ namespace Avalonia.Win32
                 .Bind<IRenderLoop>().ToConstant(new RenderLoop(60))
                 .Bind<ISystemDialogImpl>().ToSingleton<SystemDialogImpl>()
                 .Bind<IWindowingPlatform>().ToConstant(s_instance)
-                .Bind<IPlatformIconLoader>().ToConstant(s_instance)
-                .Bind<IPlatformDragSource>().ToSingleton<DragSource>();
+                .Bind<IPlatformIconLoader>().ToConstant(s_instance);
+
+            if (OleContext.Current != null)
+                AvaloniaLocator.CurrentMutable.Bind<IPlatformDragSource>().ToSingleton<DragSource>();
 
             UseDeferredRendering = deferredRendering;
             _uiThread = UnmanagedMethods.GetCurrentThreadId();