/// <summary> /// Looks for a handler within the composed ones and the link-handler, if enabled, and picks the first one that /// confirms it can handle the situation in response to the dragover event. /// That handler is then returned. /// Note that the drag-over operation is thus already executed for that handler. /// </summary> protected DragDropEffects GetDragOverHandler(IResource targetResource, IDataObject data, DragDropEffects allowedEffect, int keyState, out IResourceDragDropHandler handlerFit) { DragDropEffects effect; // Try the composed handlers foreach (IResourceDragDropHandler handler in _handlers) { handlerFit = handler; if ((effect = handlerFit.DragOver(targetResource, data, allowedEffect, keyState)) != DragDropEffects.None) { return(effect); } } // Try the link-handler if (_bAddLink) { handlerFit = _linkhandler; if ((effect = handlerFit.DragOver(targetResource, data, allowedEffect, keyState)) != DragDropEffects.None) { return(effect); } } // None has fit handlerFit = null; return(DragDropEffects.None); }
public DragDropEffects DragOver(IResource targetResource, IDataObject data, DragDropEffects allowedEffect, int keyState) { // Get the wrapped handler's opinion on the operation DragDropEffects baseEffects = _baseHandler.DragOver(targetResource, data, allowedEffect, keyState); // If base can handle, let it; otherwise, query the link-adapter return(baseEffects != DragDropEffects.None ? baseEffects : _linkhandler.DragOver(targetResource, data, allowedEffect, keyState)); }
/// <summary> /// Handles the DnD <see cref="JetListView.DragOver"/> event from the underlying <see cref="JetListView"/>, and fires the own <see cref="ResourceDragOver"/> event for the external handlers (if none available, invokes the default handler). /// </summary> private void HandleDragOver(object sender, JetListViewDragEventArgs args) { try { IResource targetRes; if (!CheckDragDropMode(args, out targetRes)) { return; // Operation cancelled } // Call the outer handler for the drag-over operation if ((ResourceDragOver != null) && (args.Data.GetDataPresent(typeof(IResourceList)))) { // Call the custom handler IResourceList dragResources = (IResourceList)args.Data.GetData(typeof(IResourceList)); ResourceDragEventArgs resourceDragEventArgs = new ResourceDragEventArgs(targetRes, dragResources); ResourceDragOver(this, resourceDragEventArgs); args.Effect = resourceDragEventArgs.Effect; } else { // No custom handler defined, invoke the default handler if ((targetRes == RootResource) && (_rootResourceDropHandler != null)) // Empty/Root special handler { args.Effect = _rootResourceDropHandler.DragOver(targetRes, args.Data, args.AllowedEffect, args.KeyState); } else // Normal d'n'd handler { args.Effect = Core.UIManager.ProcessDragOver(targetRes, args.Data, args.AllowedEffect, args.KeyState, (args.Data.GetData(typeof(ResourceListView2)) == this)); } } } catch (Exception ex) { Core.ReportException(ex, ExceptionReportFlags.AttachLog); } }
public DragDropEffects DragOver(IResource targetResource, IDataObject data, DragDropEffects allowedEffect, int keyState) { if (targetResource.HasProp(PROP.Imported)) { IResourceList dragResources = data.GetData(typeof(IResourceList)) as IResourceList; if (dragResources.AllResourcesOfType("Contact")) { foreach (IResource resource in dragResources.ValidResources) { if (resource.HasProp(PROP.EntryID)) { return(DragDropEffects.Copy); } } } } return(parentHandler.DragOver(targetResource, data, allowedEffect, keyState)); }