DragService - wesley7child/OuterPlugin GitHub Wiki
Overview
The DragService class in the LayoutFloatingWindowControl manages the drag & drop behavior when the user drags a document (LayoutDocument) or toolwindow (LayoutAnchoreable) and drops it in an alternative position. This behavior is implemented via the LayoutFloatingWindowControl which can in turn contain other elements, such as:
- Tool Windows (Anchoreables)
- Documents
Initiating Drag & Drop
A drag & drop action for Anchoreables or Documents is usually initiated through one of the methods listed below:
Anchorable
- AnchorablePaneTitle.OnMouseLeftButtonDown() LayoutAnchorableTabItem.OnMouseLeftButtonDown()
Document
- LayoutDocumentControl.OnMouseLeftButtonDown() LayoutDocumentPaneControl.OnMouseLeftButtonDown() LayoutDocumentTabItem.OnMouseLeftButtonDown()
Methods
Public Methods
Update Mouse Position
public void UpdateMouseLocation( Point dragPosition )
TBD
Drop
public void Drop( Point dropLocation, out bool dropHandled )
The Drop method is executed when a LayoutAnchorable or LayoutDocument is dragged out of its current position and dropped into a new docking position.
This code in the Drop() method checks whether there is a new docking position and handles the drop:
private IDropTarget _currentDropTarget;
...
if( _currentDropTarget != null )
{
_currentWindow.DragDrop( _currentDropTarget );
root.CollectGarbage();
dropHandled = true;
}
The call to OverlayWindow.DragDrop( _currentDropTarget ) is relayed to the:
- DropTarget<T>.Drop(...) method (via the IDropTarget interface)
using the LayoutFloatingWindowControl _floatingWindow.Model as LayoutFloatingWindow
of the OverlayWindow as parameter.
Internal Methods
Abort
internal void Abort()
TBD