-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmenu.go
More file actions
30 lines (25 loc) · 707 Bytes
/
menu.go
File metadata and controls
30 lines (25 loc) · 707 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package impress
import (
"github.com/codeation/impress/driver"
"github.com/codeation/impress/event"
)
// Menu represents any menu node.
type Menu struct {
menuer driver.Menuer
}
// NewMenu returns a new top-level menu node with the specified label.
func (app *Application) NewMenu(label string) *Menu {
return &Menu{
menuer: app.driver.NewMenu(label),
}
}
// NewMenu returns a new submenu node with the specified label.
func (m *Menu) NewMenu(label string) *Menu {
return &Menu{
menuer: m.menuer.NewMenu(label),
}
}
// NewItem adds an item to the menu node with the specified label and event.
func (m *Menu) NewItem(label string, event event.Menu) {
m.menuer.NewItem(label, event.Action)
}