Skip to content

Commit

Permalink
feat(dragdrop): Import the core drag and drop classes
Browse files Browse the repository at this point in the history
  • Loading branch information
dr1rrb committed Oct 16, 2020
1 parent 0242a0e commit 756d278
Show file tree
Hide file tree
Showing 9 changed files with 137 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#nullable enable

using System;
using Windows.Foundation;
using Windows.System;
using Windows.UI.Core;
using Windows.UI.Input;

namespace Windows.ApplicationModel.DataTransfer.DragDrop.Core
{
public partial class CoreDragInfo
{
private readonly CoreWindow _window;
private readonly Action<DataPackageOperation> _complete;

internal CoreDragInfo(
CoreWindow window,
DataPackageView data,
DataPackageOperation allowedOperations,
Action<DataPackageOperation> complete)
{
_window = window;
_complete = complete;
Data = data;
AllowedOperations = allowedOperations;
}

public DataPackageView Data { get; }

public DataPackageOperation AllowedOperations { get; }

public DragDropModifiers Modifiers
{
get
{
var mods = DragDropModifiers.None;
if (_window.LastPointerEvent is {} args)
{
var props = args.GetLocation(null).Properties;
if (props.IsLeftButtonPressed)
{
mods |= DragDropModifiers.LeftButton;
}
if (props.IsMiddleButtonPressed)
{
mods |= DragDropModifiers.MiddleButton;
}
if (props.IsRightButtonPressed)
{
mods |= DragDropModifiers.RightButton;
}
}

if (_window.GetAsyncKeyState(VirtualKey.Shift) == CoreVirtualKeyStates.Down)
{
mods |= DragDropModifiers.Shift;
}
if (_window.GetAsyncKeyState(VirtualKey.Control) == CoreVirtualKeyStates.Down)
{
mods |= DragDropModifiers.Control;
}
if (_window.GetAsyncKeyState(VirtualKey.Menu) == CoreVirtualKeyStates.Down)
{
mods |= DragDropModifiers.Alt;
}

return mods;
}
}

public Point Position => _window.PointerPosition;

internal void Complete(DataPackageOperation result)
=> _complete(result);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#nullable enable

namespace Windows.ApplicationModel.DataTransfer.DragDrop.Core
{
public partial class CoreDragUIOverride
{
public bool IsGlyphVisible { get; set; }
public bool IsContentVisible { get; set; }
public bool IsCaptionVisible { get; set; }
public string Caption { get; set; } = string.Empty;

public void Clear()
{
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#nullable enable

namespace Windows.ApplicationModel.DataTransfer.DragDrop.Core
{
public partial class CoreDropOperationTargetRequestedEventArgs
{
internal ICoreDropOperationTarget? Target { get; private set; }

public void SetTarget(ICoreDropOperationTarget target)
=> Target = target;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#nullable enable

using Windows.Foundation;

namespace Windows.ApplicationModel.DataTransfer.DragDrop.Core
{
public partial interface ICoreDropOperationTarget
{
IAsyncOperation<DataPackageOperation> EnterAsync(CoreDragInfo dragInfo, CoreDragUIOverride dragUIOverride);
IAsyncOperation<DataPackageOperation> OverAsync(CoreDragInfo dragInfo, CoreDragUIOverride dragUIOverride);
IAsyncAction LeaveAsync( CoreDragInfo dragInfo);
IAsyncOperation<DataPackageOperation> DropAsync(CoreDragInfo dragInfo);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Windows.ApplicationModel.DataTransfer.DragDrop.Core
#endif
public partial class CoreDragDropManager
{
#if gfalse
#if false
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public bool AreConcurrentOperationsEnabled
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
#pragma warning disable 114 // new keyword hiding
namespace Windows.ApplicationModel.DataTransfer.DragDrop.Core
{
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
#if false
[global::Uno.NotImplemented]
#endif
public partial class CoreDragInfo
{
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
#if false
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public global::Windows.ApplicationModel.DataTransfer.DataPackageView Data
{
Expand All @@ -17,7 +17,7 @@ public partial class CoreDragInfo
}
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
#if false
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public global::Windows.ApplicationModel.DataTransfer.DragDrop.DragDropModifiers Modifiers
{
Expand All @@ -27,7 +27,7 @@ public partial class CoreDragInfo
}
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
#if false
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public global::Windows.Foundation.Point Position
{
Expand All @@ -37,7 +37,7 @@ public partial class CoreDragInfo
}
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
#if false
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public global::Windows.ApplicationModel.DataTransfer.DataPackageOperation AllowedOperations
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
#pragma warning disable 114 // new keyword hiding
namespace Windows.ApplicationModel.DataTransfer.DragDrop.Core
{
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
#if false
[global::Uno.NotImplemented]
#endif
public partial class CoreDragUIOverride
{
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
#if false
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public bool IsGlyphVisible
{
Expand All @@ -21,7 +21,7 @@ public bool IsGlyphVisible
}
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
#if false
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public bool IsContentVisible
{
Expand All @@ -35,7 +35,7 @@ public bool IsContentVisible
}
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
#if false
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public bool IsCaptionVisible
{
Expand All @@ -49,7 +49,7 @@ public bool IsCaptionVisible
}
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
#if false
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public string Caption
{
Expand Down Expand Up @@ -85,7 +85,7 @@ public void SetContentFromSoftwareBitmap( global::Windows.Graphics.Imaging.Soft
// Forced skipping of method Windows.ApplicationModel.DataTransfer.DragDrop.Core.CoreDragUIOverride.IsCaptionVisible.set
// Forced skipping of method Windows.ApplicationModel.DataTransfer.DragDrop.Core.CoreDragUIOverride.IsGlyphVisible.get
// Forced skipping of method Windows.ApplicationModel.DataTransfer.DragDrop.Core.CoreDragUIOverride.IsGlyphVisible.set
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
#if false
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public void Clear()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
#pragma warning disable 114 // new keyword hiding
namespace Windows.ApplicationModel.DataTransfer.DragDrop.Core
{
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
#if false
[global::Uno.NotImplemented]
#endif
public partial class CoreDropOperationTargetRequestedEventArgs
{
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
#if false
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public void SetTarget( global::Windows.ApplicationModel.DataTransfer.DragDrop.Core.ICoreDropOperationTarget target)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@
#pragma warning disable 114 // new keyword hiding
namespace Windows.ApplicationModel.DataTransfer.DragDrop.Core
{
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
#if false
[global::Uno.NotImplemented]
#endif
public partial interface ICoreDropOperationTarget
{
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
#if false
global::Windows.Foundation.IAsyncOperation<global::Windows.ApplicationModel.DataTransfer.DataPackageOperation> EnterAsync( global::Windows.ApplicationModel.DataTransfer.DragDrop.Core.CoreDragInfo dragInfo, global::Windows.ApplicationModel.DataTransfer.DragDrop.Core.CoreDragUIOverride dragUIOverride);
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
#if false
global::Windows.Foundation.IAsyncOperation<global::Windows.ApplicationModel.DataTransfer.DataPackageOperation> OverAsync( global::Windows.ApplicationModel.DataTransfer.DragDrop.Core.CoreDragInfo dragInfo, global::Windows.ApplicationModel.DataTransfer.DragDrop.Core.CoreDragUIOverride dragUIOverride);
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
#if false
global::Windows.Foundation.IAsyncAction LeaveAsync( global::Windows.ApplicationModel.DataTransfer.DragDrop.Core.CoreDragInfo dragInfo);
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
#if false
global::Windows.Foundation.IAsyncOperation<global::Windows.ApplicationModel.DataTransfer.DataPackageOperation> DropAsync( global::Windows.ApplicationModel.DataTransfer.DragDrop.Core.CoreDragInfo dragInfo);
#endif
}
Expand Down

0 comments on commit 756d278

Please sign in to comment.