UnmanagedMethods.HRESULT IDropTarget.DragEnter(IOleDataObject pDataObj, int grfKeyState, long pt, ref DropEffect pdwEffect) { var dispatch = _tl?.Input; if (dispatch == null) { pdwEffect = DropEffect.None; return(UnmanagedMethods.HRESULT.S_OK); } _currentDrag = pDataObj as IDataObject; if (_currentDrag == null) { _currentDrag = new OleDataObject(pDataObj); } var args = new RawDragEvent( _dragDevice, RawDragEventType.DragEnter, _target, GetDragLocation(pt), _currentDrag, ConvertDropEffect(pdwEffect), ConvertKeyState(grfKeyState) ); dispatch(args); pdwEffect = ConvertDropEffect(args.Effects); return(UnmanagedMethods.HRESULT.S_OK); }
public AvnDragDropEffects DragEvent(AvnDragEventType type, AvnPoint position, AvnInputModifiers modifiers, AvnDragDropEffects effects, IAvnClipboard clipboard, IntPtr dataObjectHandle) { var device = AvaloniaLocator.Current.GetService <IDragDropDevice>(); IDataObject dataObject = null; if (dataObjectHandle != IntPtr.Zero) { dataObject = GCHandle.FromIntPtr(dataObjectHandle).Target as IDataObject; } using (var clipboardDataObject = new ClipboardDataObject(clipboard)) { if (dataObject == null) { dataObject = clipboardDataObject; } var args = new RawDragEvent(device, (RawDragEventType)type, _parent._inputRoot, position.ToAvaloniaPoint(), dataObject, (DragDropEffects)effects, (RawInputModifiers)modifiers); _parent.Input(args); return((AvnDragDropEffects)args.Effects); } }
unsafe void Win32Com.IDropTarget.Drop(Win32Com.IDataObject pDataObj, int grfKeyState, UnmanagedMethods.POINT pt, DropEffect *pdwEffect) { try { var dispatch = _tl?.Input; if (dispatch == null) { *pdwEffect = (int)DropEffect.None; } SetDataObject(pDataObj); var args = new RawDragEvent( _dragDevice, RawDragEventType.Drop, _target, GetDragLocation(pt), _currentDrag, ConvertDropEffect(*pdwEffect), ConvertKeyState(grfKeyState) ); dispatch(args); *pdwEffect = ConvertDropEffect(args.Effects); } finally { ReleaseDataObject(); } }
private DragDropEffects RaiseEventAndUpdateCursor(RawDragEventType type, IInputRoot root, Point pt, RawInputModifiers modifiers) { _lastPosition = pt; RawDragEvent rawEvent = new RawDragEvent(_dragDrop, type, root, pt, _draggedData, _allowedEffects, modifiers); var tl = root.GetSelfAndVisualAncestors().OfType <TopLevel>().FirstOrDefault(); tl.PlatformImpl?.Input(rawEvent); var effect = GetPreferredEffect(rawEvent.Effects & _allowedEffects, modifiers); UpdateCursor(root, effect); return(effect); }
private NSDragOperation SendRawDragEvent(NSDraggingInfo sender, RawDragEventType type) { Action <RawInputEventArgs> input = _tl.Input; IDragDropDevice dragDevice = _tl._dragDevice; IInputRoot root = _tl?.InputRoot; if (root == null || dragDevice == null || input == null) { return(NSDragOperation.None); } var dragOp = DraggingInfo.ConvertDragOperation(sender.DraggingSourceOperationMask); DraggingInfo info = new DraggingInfo(sender); var pt = TranslateLocalPoint(info.Location); var args = new RawDragEvent(dragDevice, type, root, pt, info, dragOp); input(args); return(DraggingInfo.ConvertDragOperation(args.Effects)); }
private void ProcessRawEvent(RawDragEvent e) { switch (e.Type) { case RawDragEventType.DragEnter: e.Effects = DragEnter(e.InputRoot, e.Location, e.Data, e.Effects); break; case RawDragEventType.DragOver: e.Effects = DragOver(e.InputRoot, e.Location, e.Data, e.Effects); break; case RawDragEventType.DragLeave: DragLeave(e.InputRoot); break; case RawDragEventType.Drop: e.Effects = Drop(e.InputRoot, e.Location, e.Data, e.Effects); break; } }
unsafe void Win32Com.IDropTarget.DragOver(int grfKeyState, UnmanagedMethods.POINT pt, DropEffect *pdwEffect) { var dispatch = _tl?.Input; if (dispatch == null) { *pdwEffect = (int)DropEffect.None; } var args = new RawDragEvent( _dragDevice, RawDragEventType.DragOver, _target, GetDragLocation(pt), _currentDrag, ConvertDropEffect(*pdwEffect), ConvertKeyState(grfKeyState) ); dispatch(args); *pdwEffect = ConvertDropEffect(args.Effects); }