Files
aego/editor/core/command/menu.go
sanspie 5dd9cc91bb editor: refine agent, scene controls and curves
Improve mentions and the default Design workspace, clarify scene lighting controls, and polish editor workflows for 0.12.5-dev.
2026-11-05 20:14:53 +03:00

31 lines
527 B
Go

package command
import (
"aego/ui/core"
"aego/ui/widgets"
)
func MenuItem(ui *core.Context, reg *Registry, id, label string) bool {
d, ok := reg.Get(id)
if !ok {
return false
}
if label == "" {
label = d.Title()
}
it := widgets.Item{
Label: label,
Shortcut: d.Shortcut.String(),
Icon: d.Icon,
Tip: d.TipText(),
Enabled: reg.Enabled(id),
Checked: d.Checked != nil && d.Checked(),
KeepOpen: d.Checked != nil,
}
if widgets.Entry(ui, it) {
reg.Run(id)
return true
}
return false
}