Esempio n. 1
0
            public DragEventSource(long pointerId, NSDraggingInfo draggingInfo, NSWindow window)
            {
                Id = pointerId;

                _macOSDraggingInfo = draggingInfo;
                _window            = window;
            }
Esempio n. 2
0
 [Export("performDragOperation:")]         // Do not remove
 internal virtual bool PerformDragOperation(NSDraggingInfo draggingInfo)
 {
     try
     {
         return(PerformDragOperationAction.Invoke(draggingInfo));
     }
     catch
     {
         return(false);
     }
 }
Esempio n. 3
0
 [Export("draggingUpdated:")]         // Do not remove
 internal virtual NSDragOperation DraggingUpdated(NSDraggingInfo draggingInfo)
 {
     try
     {
         return(DraggingUpdatedAction.Invoke(draggingInfo));
     }
     catch
     {
         return(NSDragOperation.None);
     }
 }
Esempio n. 4
0
        [Export("draggingExited:")]         // Do not remove
        internal virtual void DraggingExited(NSDraggingInfo draggingInfo)
        {
            try
            {
                DraggingExitedAction.Invoke(draggingInfo);
            }
            catch
            {
                // Simply return if an error occurred, it is unrecoverable
            }

            return;
        }
Esempio n. 5
0
        private NSDragOperation OnDraggingEnteredEvent(NSDraggingInfo draggingInfo)
        {
            var source            = new DragEventSource(_fakePointerId, draggingInfo, _window);
            var data              = DataPackage.CreateFromNativeDragDropData(draggingInfo);
            var allowedOperations = DataPackageOperation.Copy;             // Should match with return value
            var info              = new CoreDragInfo(source, data, allowedOperations);

            CoreDragDropManager.GetForCurrentView()?.DragStarted(info);

            // Note: No need to _manager.ProcessMove, the DragStarted will actually have the same effect

            // To allow the macOS drag to continue, we must assume drop is supported here.
            // This will immediately be updated within the OnDraggingUpdated method.
            return(NSDragOperation.Copy);
        }
Esempio n. 6
0
 private void OnDraggingEnded(NSDraggingInfo draggingInfo)
 {
     return;
 }
Esempio n. 7
0
        private bool OnPerformDragOperation(NSDraggingInfo draggingInfo)
        {
            var operation = _manager.ProcessDropped(new DragEventSource(_fakePointerId, draggingInfo, _window));

            return(operation != DataPackageOperation.None);
        }
Esempio n. 8
0
 private void OnDraggingExited(NSDraggingInfo draggingInfo)
 {
     _ = _manager.ProcessAborted(new DragEventSource(_fakePointerId, draggingInfo, _window));
     return;
 }
Esempio n. 9
0
        private NSDragOperation OnDraggingUpdated(NSDraggingInfo draggingInfo)
        {
            var operation = _manager.ProcessMoved(new DragEventSource(_fakePointerId, draggingInfo, _window));

            return(ToNSDragOperation(operation));
        }
Esempio n. 10
0
 [Export("prepareForDragOperation:")]         // Do not remove
 internal virtual bool PrepareForDragOperation(NSDraggingInfo draggingInfo)
 {
     // Always return true as UWP doesn't really have an equivalent step.
     // Drop is accepted within DraggingEntered (drag entered event in UWP).
     return(true);
 }
Esempio n. 11
0
 internal static DataPackageView CreateFromNativeDragDropData(NSDraggingInfo draggingInfo)
 {
     return(GetFromNative(draggingInfo.DraggingPasteboard));
 }