gui/pkg/systray/platform.go
Virgil 274a81689c
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
chore(gui): add AX usage examples
2026-04-02 20:36:02 +00:00

50 lines
1.3 KiB
Go

// pkg/systray/platform.go
package systray
// Platform abstracts the system tray backend.
// Use: var p systray.Platform
type Platform interface {
NewTray() PlatformTray
NewMenu() PlatformMenu // Menu factory for building tray menus
}
// PlatformTray is a live tray handle from the backend.
// Use: var tray systray.PlatformTray
type PlatformTray interface {
SetIcon(data []byte)
SetTemplateIcon(data []byte)
SetTooltip(text string)
SetLabel(text string)
SetMenu(menu PlatformMenu)
AttachWindow(w WindowHandle)
}
// PlatformMenu is a tray menu built by the backend.
// Use: var menu systray.PlatformMenu
type PlatformMenu interface {
Add(label string) PlatformMenuItem
AddSeparator()
AddSubmenu(label string) PlatformMenu
}
// PlatformMenuItem is a single item in a tray menu.
// Use: var item systray.PlatformMenuItem
type PlatformMenuItem interface {
SetTooltip(text string)
SetChecked(checked bool)
SetEnabled(enabled bool)
OnClick(fn func())
AddSubmenu() PlatformMenu
}
// WindowHandle is a cross-package interface for window operations.
// Defined locally to avoid circular imports (display imports systray).
// pkg/window.PlatformWindow satisfies this implicitly.
// Use: var w systray.WindowHandle
type WindowHandle interface {
Name() string
Show()
Hide()
SetPosition(x, y int)
SetSize(width, height int)
}