makePasteMenu makes the menu of options for paste events Optional function is typically the DropFinalize but could also be other actions to take after each optional action.
(m *Scene, md mimedata.Mimes, fun func())
| 1345 | // Optional function is typically the DropFinalize but could also be other actions |
| 1346 | // to take after each optional action. |
| 1347 | func (tr *Tree) makePasteMenu(m *Scene, md mimedata.Mimes, fun func()) { |
| 1348 | NewButton(m).SetText("Assign To").OnClick(func(e events.Event) { |
| 1349 | tr.pasteAssign(md) |
| 1350 | if fun != nil { |
| 1351 | fun() |
| 1352 | } |
| 1353 | }) |
| 1354 | NewButton(m).SetText("Add to Children").OnClick(func(e events.Event) { |
| 1355 | tr.pasteChildren(md, events.DropCopy) |
| 1356 | if fun != nil { |
| 1357 | fun() |
| 1358 | } |
| 1359 | }) |
| 1360 | if !tr.IsRoot("") && tr.root.This != tr.This { |
| 1361 | NewButton(m).SetText("Insert Before").OnClick(func(e events.Event) { |
| 1362 | tr.pasteBefore(md, events.DropCopy) |
| 1363 | if fun != nil { |
| 1364 | fun() |
| 1365 | } |
| 1366 | }) |
| 1367 | NewButton(m).SetText("Insert After").OnClick(func(e events.Event) { |
| 1368 | tr.pasteAfter(md, events.DropCopy) |
| 1369 | if fun != nil { |
| 1370 | fun() |
| 1371 | } |
| 1372 | }) |
| 1373 | } |
| 1374 | NewButton(m).SetText("Cancel") |
| 1375 | } |
| 1376 | |
| 1377 | // pasteAssign assigns mime data (only the first one!) to this node |
| 1378 | func (tr *Tree) pasteAssign(md mimedata.Mimes) { |
no test coverage detected