diff options
| author | joesis | 2018-10-17 03:05:42 -0700 |
|---|---|---|
| committer | GitHub | 2018-10-17 03:05:42 -0700 |
| commit | 89b3d9c45cc69f861868cc7f3159eba2b4cdfb22 (patch) | |
| tree | d44d0e0f1eaba23282d2f15f602aba0941cd33b9 /systray_nonwindows.go | |
| parent | 3fd1443dac5c8297999189fe28d5836b2b075b66 (diff) | |
| parent | 1a665b2c73c12a4cdf5402daef46b1082a822e0d (diff) | |
| download | systray-89b3d9c45cc69f861868cc7f3159eba2b4cdfb22.tar.bz2 | |
Merge pull request #65 from jefvel/menu-item-icons
Made it possible to add icons to menu items on Mac
Diffstat (limited to 'systray_nonwindows.go')
| -rw-r--r-- | systray_nonwindows.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/systray_nonwindows.go b/systray_nonwindows.go index 0ed03b4..4868b55 100644 --- a/systray_nonwindows.go +++ b/systray_nonwindows.go @@ -60,6 +60,13 @@ func addOrUpdateMenuItem(item *MenuItem) { ) } +// SetIcon sets the icon of a menu item. Only available on Mac. +// iconBytes should be the content of .ico/.jpg/.png +func (item *MenuItem) SetIcon(iconBytes []byte) { + cstr := (*C.char)(unsafe.Pointer(&iconBytes[0])) + C.setMenuItemIcon(cstr, (C.int)(len(iconBytes)), C.int(item.id)) +} + func addSeparator(id int32) { C.add_separator(C.int(id)) } |
