Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Cut removes the selection and places it on the clipboard. Cut = &CmdAction{ ActionID: ids.CutItemID, ActionTitle: i18n.Text("Cut"), ActionHotKey: keys.X, ActionModifiers: keys.OSMenuCmdModifier(), } // Copy the selection and place it on the clipboard. Copy = &CmdAction{ ActionID: ids.CopyItemID, ActionTitle: i18n.Text("Copy"), ActionHotKey: keys.C, ActionModifiers: keys.OSMenuCmdModifier(), } // Paste the contents of the clipboard, replacing the selection. Paste = &CmdAction{ ActionID: ids.PasteItemID, ActionTitle: i18n.Text("Paste"), ActionHotKey: keys.V, ActionModifiers: keys.OSMenuCmdModifier(), } // Delete the selection. Delete = &CmdAction{ ActionID: ids.DeleteItemID, ActionTitle: i18n.Text("Delete"), ActionHotKey: keys.Backspace, } // SelectAll selects everything in the current focus. SelectAll = &CmdAction{ ActionID: ids.SelectAllItemID, ActionTitle: i18n.Text("Select All"), ActionHotKey: keys.A, ActionModifiers: keys.OSMenuCmdModifier(), } )
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action interface { // ID returns a unique ID for the action. This value should be suitable // for use as a menu item ID. ID() int // Title returns the text to display for this action. Typically used in a // menu item title or tooltip for a button. Title() string // HotKey is the key that will trigger the action. Returns nil if no hot // key is set. HotKey() *keys.Key // HotKeyModifiers returns the modifier keys that must be pressed for the // hot key to be recognized. HotKeyModifiers() keys.Modifiers // Enabled returns true if the action can be used. Care should be made to // keep this method fast to avoid slowing down the user interface. Enabled(source interface{}) bool // Execute the action. Will only be called if the action has been // triggered and Enabled() returns true. Execute(source interface{}) }
Action describes an action that can be performed.
type CmdAction ¶
type CmdAction struct { ActionID int ActionTitle string ActionHotKey *keys.Key ActionModifiers keys.Modifiers }
CmdAction provides a standardized way to issue commands to focused UI elements.
func (*CmdAction) Execute ¶
func (a *CmdAction) Execute(source interface{})
Execute implements action.Action.
func (*CmdAction) HotKeyModifiers ¶
HotKeyModifiers implements action.Action.
Click to show internal directories.
Click to hide internal directories.