Class WindowsDrag
IDropTarget is registered for it, and a drag out of it is DoDragDrop with a
data object and an IDropSource.
The two objects are made here, each a table of callbacks; the data object is the shell's
(SHCreateDataObject), filled with what a copy would put on the clipboard, in the same
formats by a data object of ours inside it, which makes each format when a target asks for it.
DoDragDrop does not return until the drag is over, and runs a loop of its own
meanwhile: the application's loop does not turn. It is called from a task posted to the UI
thread, so that the scene has heard its drag was taken before the first answer is asked of it,
and the destination paints the window itself after each answer, as on macOS.
The modifier keys do not reach the window during that loop. They arrive with each call, and choose among what the source allows as the platform has it: Control copies, Shift moves, both or Alt link.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Stops the window being a destination.static @Nullable WindowsDraginstall(long hwnd, UiRuntime ui, Supplier<WindowInput> input, Supplier<float[]> pointer, Runnable paint, BooleanSupplier animate) Makes a window a source and a destination of the system's drags.booleanstart(DragRequest request) Begins a drag the system drives.
-
Method Details
-
install
public static @Nullable WindowsDrag install(long hwnd, UiRuntime ui, Supplier<WindowInput> input, Supplier<float[]> pointer, Runnable paint, BooleanSupplier animate) Makes a window a source and a destination of the system's drags. UI thread.- Parameters:
hwnd- the windowui- the UI runtimeinput- the window's input, as it is at the time of each call; may answer nullpointer- the pointer in the window's logical points, x then ypaint- paints the window now, from inside OLE's own loopanimate- paints the frame the window is waiting for, if any, and says whether it now waits for another- Returns:
- the window's drag, or null where OLE would not have it, which is logged
-
close
public void close()Stops the window being a destination. UI thread. -
start
Begins a drag the system drives. UI thread.- Parameters:
request- what is dragged- Returns:
- whether it was taken: the drag itself runs from the UI thread's queue, and the request hears its end
-