-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmenubar.go
48 lines (41 loc) · 965 Bytes
/
menubar.go
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package faithtop
type (
IMenuBar interface {
Menus(menus ...IMenu) IMenuBar
}
IMenu interface {
Assign(v *IMenu) IMenu
Title(title string) IMenu
Actions(actions ...IAction) IMenu
AddAction(action IAction) IMenu
Clear() IMenu
RemoveAction(action IAction) IMenu
}
IAction interface {
Assign(v *IAction) IAction
Text(text string) IAction
GetText() string
OnClick(fn func()) IAction
}
)
var (
newMenuBarImpl func() IMenuBar
newMenuImpl func() IMenu
newActionImpl func(text string) IAction
showPopupMenuImpl func(win IWindow, anchor IWidget, menu IMenu)
)
func MenuBar(menus ...IMenu) IMenuBar {
return newMenuBarImpl().Menus(menus...)
}
func Menu() IMenu {
return newMenuImpl()
}
func Menu2(text string) IMenu {
return newMenuImpl().Title(text)
}
func Action(text string) IAction {
return newActionImpl(text)
}
func ShowPopupMenu(win IWindow, anchor IWidget, menu IMenu) {
showPopupMenuImpl(win, anchor, menu)
}