KeyBindingScope.cs 1.6 KB

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