Documentation ¶
Index ¶
- Constants
- func Stringify(accelerator *Accelerator, platform string) string
- func ToMacModifier(accelerator *Accelerator) int
- type Accelerator
- func CmdOrCtrl(key string) *Accelerator
- func Combo(key string, modifier1 Modifier, modifier2 Modifier, rest ...Modifier) *Accelerator
- func Control(key string) *Accelerator
- func Key(key string) *Accelerator
- func OptionOrAlt(key string) *Accelerator
- func Parse(shortcut string) (*Accelerator, error)
- func Shift(key string) *Accelerator
- type Modifier
Constants ¶
View Source
const ( NSEventModifierFlagShift = 1 << 17 // Set if Shift key is pressed. NSEventModifierFlagControl = 1 << 18 // Set if Control key is pressed. NSEventModifierFlagOption = 1 << 19 // Set if Option or Alternate key is pressed. NSEventModifierFlagCommand = 1 << 20 // Set if Command key is pressed. )
Variables ¶
This section is empty.
Functions ¶
func Stringify ¶
func Stringify(accelerator *Accelerator, platform string) string
func ToMacModifier ¶
func ToMacModifier(accelerator *Accelerator) int
Types ¶
type Accelerator ¶
Accelerator holds the keyboard shortcut for a menu item
func CmdOrCtrl ¶
func CmdOrCtrl(key string) *Accelerator
CmdOrCtrl creates a 'CmdOrCtrl' Accelerator
func Combo ¶
func Combo(key string, modifier1 Modifier, modifier2 Modifier, rest ...Modifier) *Accelerator
Combo creates an Accelerator with multiple Modifiers
func OptionOrAlt ¶
func OptionOrAlt(key string) *Accelerator
OptionOrAlt creates a 'OptionOrAlt' Accelerator
func Parse ¶
func Parse(shortcut string) (*Accelerator, error)
type Modifier ¶
type Modifier string
Modifier is actually a string
const ( // CmdOrCtrlKey represents Command on Mac and Control on other platforms CmdOrCtrlKey Modifier = "cmdorctrl" // OptionOrAltKey represents Option on Mac and Alt on other platforms OptionOrAltKey Modifier = "optionoralt" // ShiftKey represents the shift key on all systems ShiftKey Modifier = "shift" // SuperKey represents Command on Mac and the Windows key on the other platforms //SuperKey Modifier = "super" // ControlKey represents the control key on all systems ControlKey Modifier = "ctrl" )
Click to show internal directories.
Click to hide internal directories.