Documentation
¶
Overview ¶
Package command shares an action between a toolbar, shortcuts and a native menu.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Command ¶
type Command struct {
// ID is a stable identifier, unique among the commands in a menu or toolbar.
ID string
// Label names the action in buttons and menus.
Label string
// Icon is optional artwork for the toolbar button.
Icon *ui.SVG
// Shortcut uses Hotkey syntax, such as "mod+shift+i".
Shortcut string
// Enabled reports the current availability. Nil enables the action when Execute is set.
Enabled func() bool
// Checked makes the command a toggle and reports its current value.
Checked func() bool
// Execute performs the action, including updating the value of a toggle.
Execute func()
}
func (Command) MenuItem ¶
MenuItem builds a MyGo native menu item with the same action and shortcut.
func (Command) SyncMenuItem ¶
SyncMenuItem updates a menu item after the app changes the command's availability or value.