aboutsummaryrefslogtreecommitdiffstats
path: root/systray.go
diff options
context:
space:
mode:
authorjoesis2017-09-12 22:37:40 +0800
committerGitHub2017-09-12 22:37:40 +0800
commit060c06f22e631c46a2d738532bc81c37b0f31595 (patch)
tree174769c64d8b1254d4f4203655b42b38f0c0c63e /systray.go
parent66e6fad5eea92d7adda31abfae7a5a52070dfae5 (diff)
parente00812af2c109a6cfa4c9a4774e4f805b6119290 (diff)
downloadsystray-060c06f22e631c46a2d738532bc81c37b0f31595.tar.bz2
Merge pull request #31 from getlantern/issue881
Add ability to show/hide menu items
Diffstat (limited to 'systray.go')
-rw-r--r--systray.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/systray.go b/systray.go
index 33f6172..7fc72df 100644
--- a/systray.go
+++ b/systray.go
@@ -46,7 +46,7 @@ var (
menuItems = make(map[int32]*MenuItem)
menuItemsLock sync.RWMutex
- currentID int32
+ currentID = int32(-1)
)
// Run initializes GUI and starts the event loop, then invokes the onReady
@@ -129,6 +129,16 @@ func (item *MenuItem) Disable() {
item.update()
}
+// Hide hides a menu item
+func (item *MenuItem) Hide() {
+ hideMenuItem(item)
+}
+
+// Show shows a previously hidden menu item
+func (item *MenuItem) Show() {
+ showMenuItem(item)
+}
+
// Checked returns if the menu item has a check mark
func (item *MenuItem) Checked() bool {
return item.checked