Some Updates

This commit is contained in:
2025-10-02 12:12:52 -05:00
parent 998531f95d
commit 4b647d9d41
9 changed files with 150 additions and 24 deletions

View File

@@ -220,10 +220,11 @@ func (w *TopMenuLayout) Log(txt string, args ...any) {
}
}
func (w *TopMenuLayout) CreateMenuItem(id, lbl string, do func() bool, subItems ...*MenuItem) *MenuItem {
func (w *TopMenuLayout) CreateMenuItem(id, lbl string, do func() bool, hotKey rune, subItems ...*MenuItem) *MenuItem {
d := NewMenuItem(id, tcell.StyleDefault)
d.SetLabel(lbl)
d.SetOnPressed(do)
d.SetHotKey(hotKey)
if len(subItems) > 0 {
d.AddItems(subItems...)
}
@@ -247,3 +248,9 @@ func (w *TopMenuLayout) SetItemDisabled(id string, d bool) bool {
}
func (w *TopMenuLayout) FindItem(id string) *MenuItem { return w.menu.FindItem(id) }
func (w *TopMenuLayout) CloseMenu() {
if w.menu != nil && w.menu.Active() {
w.menu.SetActive(false)
w.widget.SetActive(true)
}
}