-
Notifications
You must be signed in to change notification settings - Fork 0
/
tray.go
executable file
·53 lines (48 loc) · 1.36 KB
/
tray.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
49
50
51
52
53
package tray
type (
TrayOption struct {
Icon string
Title string // not supported on Windows
ToolTip string
Invisible bool
LeftClickCallback func() // not supported on Linux
RightClickCallback func() // not supported on Linux
Children []ItemOption
}
ItemOption struct {
Icon string
Title string
Disabled bool
Checkable bool
Checked bool
Invisible bool
Callback func() // On Linux, callback() when submenu is selected
Children []ItemOption
}
Tray interface {
Run()
SetIcon(icon string) error
SetTitle(title string) error // not supported on Windows
SetToolTip(toolTip string) error
SetVisible(visible bool) error
SetLeftClickCallback(callback func()) error // not supported on Linux
SetRightClickCallback(callback func()) error // not supported on Linux
AddItem(option ItemOption) (Item, error)
AddItems(options ...ItemOption) ([]Item, error)
Close() error
}
Item interface {
Checked() bool
SetIcon(img string) error
SetTitle(title string) error
SetEnabled(enabled bool) error
SetVisible(visible bool) error
SetChecked(checked bool) error
SetCallback(callback func()) error
AddItem(option ItemOption) (Item, error)
AddItems(options ...ItemOption) ([]Item, error)
}
)
func NewTray(option TrayOption) (Tray, error) {
return newTray(option)
}