MCPcopy Create free account
hub / github.com/cogentcore/core / DragDrop

Method DragDrop

core/tree.go:1522–1539  ·  view source on GitHub ↗

DragDrop handles drag drop event

(e events.Event)

Source from the content-addressed store, hash-verified

1520
1521// DragDrop handles drag drop event
1522func (tr *Tree) DragDrop(e events.Event) {
1523 // todo: some kind of validation for source
1524 tr.UnselectAll()
1525 de := e.(*events.DragDrop)
1526 stv := AsTree(de.Source.(Widget))
1527 if stv != nil {
1528 stv.dragClearStates()
1529 }
1530 md := de.Data.(mimedata.Mimes)
1531 mf := func(m *Scene) {
1532 tr.Scene.Events.dragMenuAddModText(m, de.DropMod)
1533 tr.makePasteMenu(m, md, func() {
1534 tr.DropFinalize(de)
1535 })
1536 }
1537 pos := tr.ContextMenuPos(nil)
1538 NewMenu(mf, tr.This.(Widget), pos).Run()
1539}
1540
1541// DropFinalize is called to finalize Drop actions on the Source node.
1542// Only relevant for DropMod == DropMove.

Callers

nothing calls this directly

Calls 9

UnselectAllMethod · 0.95
makePasteMenuMethod · 0.95
DropFinalizeMethod · 0.95
ContextMenuPosMethod · 0.95
AsTreeFunction · 0.85
NewMenuFunction · 0.85
dragClearStatesMethod · 0.80
dragMenuAddModTextMethod · 0.80
RunMethod · 0.45

Tested by

no test coverage detected