In the application I’m working on, we use drag and drop to rearrange panes on the workspace. There’s a manipulator in the top left corner of each pane that we drag around and then drop the dragged pane in a space between other panes (see attached image).
Currently I’m implementing drag and drop behaviour between different undocked windows (which are regular document windows). The problem is that I don’t know how to correctly identify and switch drag and drop targets. When the dragged manipulator is dragged over another drag and drop container than the original one, there’s no way to switch to using the drag and drop container under the mouse cursor.
void WorkPaneManipulator::mouseDrag(
const juce::MouseEvent &event)
{
// I would like to identify the correct drag and drop container and switch to another drag
// and drop container when the mouse goes over another one.
juce::DragAndDropContainer *container =
juce::DragAndDropContainer::findParentDragContainerFor(event.eventComponent);
OCTANE_ASSERT(container, "no drag & drop container found");
container->startDragging(WORK_PANE_DRAG_AND_DROP_EVENT,
&mWorkPane,
createComponentSnapshot(getLocalBounds()),
true);
}
cheers,
Thomas