2
0

KeyBinding.cs 1004 B

123456789101112131415161718192021222324
  1. #nullable enable
  2. // These classes use a key binding system based on the design implemented in Scintilla.Net which is an
  3. // MIT licensed open source project https://github.com/jacobslusser/ScintillaNET/blob/master/src/ScintillaNET/Command.cs
  4. namespace Terminal.Gui;
  5. /// <summary>Provides a collection of <see cref="Command"/> objects that are scoped to <see cref="KeyBindingScope"/>.</summary>
  6. public record struct KeyBinding
  7. {
  8. /// <summary>Initializes a new instance.</summary>
  9. /// <param name="commands"></param>
  10. /// <param name="scope"></param>
  11. public KeyBinding (Command [] commands, KeyBindingScope scope)
  12. {
  13. Commands = commands;
  14. Scope = scope;
  15. }
  16. /// <summary>The actions which can be performed by the application or bound to keys in a <see cref="View"/> control.</summary>
  17. public Command [] Commands { get; set; }
  18. /// <summary>The scope of the <see cref="Commands"/> bound to a key.</summary>
  19. public KeyBindingScope Scope { get; set; }
  20. }