KeyBindingScope.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using Terminal.Gui.Analyzers.Internal.Attributes;
  2. namespace Terminal.Gui;
  3. /// <summary>
  4. /// Defines the scope of a <see cref="Command"/> that has been bound to a key with
  5. /// <see cref="KeyBindings.Add(Key, Terminal.Gui.Command[])"/>.
  6. /// </summary>
  7. /// <remarks>
  8. /// <para>Key bindings are scoped to the most-focused view (<see cref="Focused"/>) by default.</para>
  9. /// </remarks>
  10. [Flags]
  11. [GenerateEnumExtensionMethods (FastHasFlags = true)]
  12. public enum KeyBindingScope
  13. {
  14. /// <summary>The key binding is disabled.</summary>
  15. Disabled = 0,
  16. /// <summary>The key binding is scoped to just the view that has focus.</summary>
  17. Focused = 1,
  18. /// <summary>
  19. /// The key binding is scoped to the View's Superview hierarchy and will be triggered even when the View does not have
  20. /// focus, as
  21. /// long as the SuperView does have focus. This is typically used for <see cref="View.HotKey"/>s.
  22. /// <remarks>
  23. /// <para>
  24. /// The View must be visible.
  25. /// </para>
  26. /// <para>
  27. /// HotKey-scoped key bindings are only invoked if the key down event was not handled by the focused view or
  28. /// any of its subviews.
  29. /// </para>
  30. /// </remarks>
  31. /// </summary>
  32. HotKey = 2,
  33. /// <summary>
  34. /// The key binding will be triggered regardless of which view has focus. This is typically used for global
  35. /// commands, which are called Shortcuts.
  36. /// </summary>
  37. /// <remarks>
  38. /// <para>
  39. /// Application-scoped key bindings are only invoked if the key down event was not handled by the focused view or
  40. /// any of its subviews, and if the key was not bound to a <see cref="View.HotKey"/>.
  41. /// </para>
  42. /// </remarks>
  43. Application = 4
  44. }