package ui import "fyne.io/fyne/v2" // Shortcut represents a shortcut composed of a modifier + key combination // Implements: fyne.Shortcut type Shortcut struct { key fyne.KeyName modifier fyne.KeyModifier name string } // Create a new shortcut func NewShortcut( name string, key fyne.KeyName, modifier ...fyne.KeyModifier, ) *Shortcut { sc := &Shortcut{ key: key, name: name, } for _, mod := range modifier { sc.modifier |= mod } return sc } // Key returns the shortcut key func (s *Shortcut) Key() fyne.KeyName { return s.key } // Mod returns the shortcut modifier combination func (s *Shortcut) Mod() fyne.KeyModifier { return s.modifier } // ShortcutName returs the modifier shortcut combination func (s *Shortcut) ShortcutName() string { return s.name }