Some Updates
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user