This commit is contained in:
2025-11-15 14:43:52 -06:00
parent 4b179ba2f5
commit 197df3e029
3 changed files with 151 additions and 1 deletions

View File

@@ -388,6 +388,18 @@ func (w *Menu) CreateMenuItem(lbl string, do func() bool, hotKey rune, subItems
return d
}
func (w *Menu) CreateMenuItemWithId(id, lbl string, do func() bool, hotKey rune, subItems ...*MenuItem) *MenuItem {
d := NewMenuItem(fmt.Sprintf("menuitem-%s", id), tcell.StyleDefault)
d.SetMenuType(MenuTypeV)
d.SetHotKey(hotKey)
d.SetLabel(lbl)
d.SetOnPressed(do)
if len(subItems) > 0 {
d.AddItems(subItems...)
}
return d
}
func (w *Menu) FindItem(id string) *MenuItem {
for _, itm := range w.items {
if itm.Id() == id {