Documentation
¶
Overview ¶
Package desktop opens native windows, panels and menus from PureKit desktop apps.
Index ¶
- Variables
- func SaveFile(p mygo.SaveDialogOptions) (string, error)
- func ShowFontPanel(_ FontPanelProps) error
- func ShowPanel(p WindowProps, content func(*ui.Context)) (*mygo.Window, error)
- func ShowQuickLook(_ *mygo.Window, _ []string) error
- func ShowShare(_ *mygo.Window, _ ShareProps) error
- func ShowSheet(parent *mygo.Window, p WindowProps, content func(*ui.Context)) (*mygo.Window, error)
- func SupportsMacPanels() bool
- type Font
- type FontPanelProps
- type ShareProps
- type StatusItem
- type StatusItemProps
- type WindowProps
Constants ¶
This section is empty.
Variables ¶
var ( ErrUnavailable = errors.New("native control is unavailable on this platform") // ErrNotReady means the MyGo app has not entered its event loop. ErrNotReady = errors.New("the desktop app is not ready") // ErrWindow means the action needs an open parent window. ErrWindow = errors.New("an open parent window is required") )
Functions ¶
func SaveFile ¶
func SaveFile(p mygo.SaveDialogOptions) (string, error)
SaveFile asks the system for a save location. It returns an empty path on cancellation and leaves writing the file to the caller.
func ShowFontPanel ¶
func ShowFontPanel(_ FontPanelProps) error
ShowFontPanel opens the system font panel on macOS.
func ShowQuickLook ¶
ShowQuickLook previews local files through Quick Look on macOS.
func ShowShare ¶
func ShowShare(_ *mygo.Window, _ ShareProps) error
ShowShare opens the system share picker on macOS.
func ShowSheet ¶
ShowSheet opens a native child window that blocks input to its parent until it closes. On macOS this is a window-attached sheet.
func SupportsMacPanels ¶
func SupportsMacPanels() bool
SupportsMacPanels reports whether the caller can use the AppKit-only panels.
Types ¶
type Font ¶
type Font struct {
// Name is the PostScript font name. Family is the user-facing family name.
Name, Family string
// Size is the font size in points.
Size float64
}
Font describes a typeface selected in the system font panel.
type FontPanelProps ¶
type ShareProps ¶
type StatusItem ¶
StatusItem is an app menu bar item on macOS, or an icon in the notification area elsewhere.
func NewStatusItem ¶
func NewStatusItem(p StatusItemProps) (*StatusItem, error)
NewStatusItem creates a status item whose menu uses the app's shared commands.
func (*StatusItem) Refresh ¶
func (item *StatusItem) Refresh()
Refresh updates the availability and checked state of the status item's commands.
type StatusItemProps ¶
type StatusItemProps struct {
// ID identifies the item across launches.
ID string
// Title and Tooltip describe the item to the system.
Title, Tooltip string
// IconPNG is the icon image. On macOS a template icon follows the menu bar appearance.
IconPNG []byte
IconIsTemplate bool
// Commands are the actions shown in the item's menu.
Commands []command.Command
}