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

Method contextMenu

filetree/menu.go:61–97  ·  view source on GitHub ↗
(m *core.Scene)

Source from the content-addressed store, hash-verified

59}
60
61func (fn *Node) contextMenu(m *core.Scene) {
62 core.NewFuncButton(m).SetFunc(fn.showFileInfo).SetText("Info").SetIcon(icons.Info).SetEnabled(fn.HasSelection())
63 open := core.NewFuncButton(m).SetFunc(fn.OpenFilesDefault).SetText("Open").SetIcon(icons.Open)
64 open.SetEnabled(fn.HasSelection())
65 if core.TheApp.Platform() == system.Web {
66 open.SetText("Download").SetIcon(icons.Download).SetTooltip("Download this file to your device")
67 }
68 core.NewSeparator(m)
69
70 core.NewFuncButton(m).SetFunc(fn.duplicateFiles).SetText("Duplicate").SetIcon(icons.Copy).SetKey(keymap.Duplicate).SetEnabled(fn.HasSelection())
71 core.NewFuncButton(m).SetFunc(fn.deleteFiles).SetText("Delete").SetIcon(icons.Delete).SetKey(keymap.Delete).SetEnabled(fn.HasSelection())
72 core.NewFuncButton(m).SetFunc(fn.This.(Filer).RenameFiles).SetText("Rename").SetIcon(icons.NewLabel).SetEnabled(fn.HasSelection())
73 core.NewSeparator(m)
74
75 core.NewFuncButton(m).SetFunc(fn.openAll).SetText("Open all").SetIcon(icons.KeyboardArrowDown).SetEnabled(fn.HasSelection() && fn.IsDir())
76 core.NewFuncButton(m).SetFunc(fn.CloseAll).SetIcon(icons.KeyboardArrowRight).SetEnabled(fn.HasSelection() && fn.IsDir())
77 core.NewFuncButton(m).SetFunc(fn.sortBys).SetText("Sort by").SetIcon(icons.Sort).SetEnabled(fn.HasSelection() && fn.IsDir())
78 core.NewSeparator(m)
79
80 core.NewFuncButton(m).SetFunc(fn.newFiles).SetText("New file").SetIcon(icons.OpenInNew).SetEnabled(fn.HasSelection())
81 core.NewFuncButton(m).SetFunc(fn.newFolders).SetText("New folder").SetIcon(icons.CreateNewFolder).SetEnabled(fn.HasSelection())
82 core.NewSeparator(m)
83
84 fn.VCSContextMenu(m)
85 core.NewSeparator(m)
86
87 core.NewFuncButton(m).SetFunc(fn.removeFromExterns).SetIcon(icons.Delete).SetEnabled(fn.HasSelection())
88
89 core.NewSeparator(m)
90 core.NewFuncButton(m).SetFunc(fn.Copy).SetIcon(icons.Copy).SetKey(keymap.Copy).SetEnabled(fn.HasSelection())
91 core.NewFuncButton(m).SetFunc(fn.Cut).SetIcon(icons.Cut).SetKey(keymap.Cut).SetEnabled(fn.HasSelection())
92 paste := core.NewFuncButton(m).SetFunc(fn.Paste).SetIcon(icons.Paste).SetKey(keymap.Paste).SetEnabled(fn.HasSelection())
93 cb := fn.Events().Clipboard()
94 if cb != nil {
95 paste.SetState(cb.IsEmpty(), states.Disabled)
96 }
97}

Callers

nothing calls this directly

Calls 15

IsDirMethod · 0.95
VCSContextMenuMethod · 0.95
NewFuncButtonFunction · 0.92
NewSeparatorFunction · 0.92
SetFuncMethod · 0.80
SetTooltipMethod · 0.80
SetKeyMethod · 0.80
SetIconMethod · 0.65
PlatformMethod · 0.65
ClipboardMethod · 0.65
EventsMethod · 0.65
IsEmptyMethod · 0.65

Tested by

no test coverage detected