-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsystemtrayimpl.go
50 lines (40 loc) · 1015 Bytes
/
systemtrayimpl.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
//go:build impl
package faithtop
import (
"github.com/therecipe/qt/gui"
"github.com/therecipe/qt/widgets"
)
type SystemTrayImpl struct {
tray *widgets.QSystemTrayIcon
}
func init() {
newSystemTrayImpl = func() ISystemTray {
return &SystemTrayImpl{
tray: widgets.NewQSystemTrayIcon(nil),
}
}
}
func (s *SystemTrayImpl) Assign(v *ISystemTray) ISystemTray {
*v = s
return s
}
func (s *SystemTrayImpl) Icon(fileName string) ISystemTray {
s.tray.SetIcon(gui.NewQIcon5(fileName))
return s
}
func (s *SystemTrayImpl) Tooltip(tooltip string) ISystemTray {
s.tray.SetToolTip(tooltip)
return s
}
func (s *SystemTrayImpl) Menu(menu IMenu) ISystemTray {
s.tray.SetContextMenu(menu.(*MenuImpl).menu)
return s
}
func (s *SystemTrayImpl) Show() ISystemTray {
s.tray.Show()
return s
}
func (s *SystemTrayImpl) ShowMessage(title, message string, icon MessageIcon, millseconds int) ISystemTray {
s.tray.ShowMessage(title, message, widgets.QSystemTrayIcon__MessageIcon(icon), millseconds)
return s
}