systray

package module
v0.0.0-...-3fabb26 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 17, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// OnExitChan can be optionally waited on for detecting and handling the shutdown of the tray application
	OnExitChan = make(chan bool)
)

Functions

func AddSeparator

func AddSeparator()

AddSeparator will add a seperator between items in the tray menu

func Quit

func Quit()

Quit will close the tray application, the OnExitChan will be triggered after the application has shut down

func Run

func Run(onRun func())

Run is called to start the tray application and the callback is triggered when it is up and running

func SetIcon

func SetIcon(iconBytes []byte)

SetIcon will set the icon for the tray application in the system tray

func SetTooltip

func SetTooltip(tooltip string)

SetTooltip will set a tooltip on hover over the system tray icon

Types

type Menu struct {
	// contains filtered or unexported fields
}

Menu represents the top level or sub menus of a tray application

func AddSubMenuItem

func AddSubMenuItem(title string) *Menu

AddSubMenuItem will add a new sub menu to the tray menu. The sub menu is returned, allowing the adding of items to it

func (m *Menu) AddMenuItem(title string, onClick func(*MenuItem)) *MenuItem

AddMenuItem will add an item to the menu

func (m *Menu) AddNewMenuItem(menuItem interfaces.MenuItem) int32

AddNewMenuItem implements the interfaces.Menu interface allowing platform specific code to keep track of menu positions when adding or updating a menu

func (m *Menu) AddSeparator()

AddSeparator will add a seperator to the menu

func (m *Menu) AddSubMenuItem(title string) *Menu

AddSubMenuItem will add a sub menu to the menu

func (m Menu) GetHandle() uintptr

GetHandle will return the platform specific pointer to the raw menu resource

func (m *Menu) RemoveMenuItem(menuItem interfaces.MenuItem)

RemoveMenuItem implements the interfaces.Menu interface allowing platform specific code to remove items from the menu in their current positions

type MenuItem struct {
	// contains filtered or unexported fields
}

MenuItem represents an item displayed in the root or a sub menu of the tray application It can be disabled, checked or have the title updated

func AddMenuItem

func AddMenuItem(title string, onClick func(*MenuItem)) *MenuItem

AddMenuItem will add a new item to the tray menu with an on click callback

func (m MenuItem) GetID() int32

GetID will return the unique id of this menu item

func (m MenuItem) GetTitle() string

GetTitle allows retrieving the current title

func (m MenuItem) IsChecked() bool

IsChecked allows checking the checked state of the item

func (m MenuItem) IsDisabled() bool

IsDisabled will allow the checking of the disabled state of the item

func (m *MenuItem) SetTitle(title string)

SetTitle allows the updating of the items title

func (m *MenuItem) ToggleDisabled()

ToggleDisabled will switch the disabled state on the item

func (m *MenuItem) ToogleChecked()

ToogleChecked will switch the checked state on the item

Directories

Path Synopsis
+build windows
+build windows

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL