mirror of
https://github.com/wailsapp/wails.git
synced 2026-03-14 14:45:49 +01:00
Support Hidden attribute. Add SetTooltip & SetIcons to SystemTray. Add Show & Hide to menuItem
This commit is contained in:
parent
d6f20d5f0b
commit
5fab671af3
3 changed files with 31 additions and 0 deletions
|
|
@ -16,6 +16,9 @@ type PopupMenu struct {
|
|||
|
||||
func (p *PopupMenu) buildMenu(parentMenu win32.PopupMenu, inputMenu *menu.Menu, startindex int) error {
|
||||
for index, item := range inputMenu.Items {
|
||||
if item.Hidden {
|
||||
continue
|
||||
}
|
||||
var ret bool
|
||||
itemID := index + startindex
|
||||
flags := win32.MF_STRING
|
||||
|
|
|
|||
|
|
@ -77,3 +77,21 @@ func (t *SystemTray) Update() error {
|
|||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (t *SystemTray) SetTooltip(s string) {
|
||||
if t.impl != nil {
|
||||
t.impl.SetTooltip(s)
|
||||
} else {
|
||||
t.tooltip = s
|
||||
}
|
||||
}
|
||||
|
||||
func (t *SystemTray) SetIcons(lightModeIcon *options.SystemTrayIcon, darkModeIcon *options.SystemTrayIcon) {
|
||||
if t.impl != nil {
|
||||
t.impl.SetIcons(lightModeIcon, darkModeIcon)
|
||||
} else {
|
||||
t.lightModeIcon = lightModeIcon
|
||||
t.darkModeIcon = darkModeIcon
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -257,6 +257,16 @@ func (m *MenuItem) SetChecked(value bool) *MenuItem {
|
|||
return m
|
||||
}
|
||||
|
||||
func (m *MenuItem) Hide() *MenuItem {
|
||||
m.Hidden = true
|
||||
return m
|
||||
}
|
||||
|
||||
func (m *MenuItem) Show() *MenuItem {
|
||||
m.Hidden = false
|
||||
return m
|
||||
}
|
||||
|
||||
func Label(label string) *MenuItem {
|
||||
return &MenuItem{
|
||||
Type: TextType,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue