KeyBindingScope.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. 
  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. public enum KeyBindingScope
  12. {
  13. /// <summary>The key binding is disabled.</summary>
  14. Disabled = 0,
  15. /// <summary>The key binding is scoped to just the view that has focus.</summary>
  16. Focused = 1,
  17. /// <summary>
  18. /// The key binding is scoped to the View's Superview hierarchy and will be triggered even when the View does not have
  19. /// focus, as
  20. /// long as the SuperView does have focus. This is typically used for <see cref="View.HotKey"/>s.
  21. /// <remarks>
  22. /// <para>
  23. /// The View must be visible.
  24. /// </para>
  25. /// <para>
  26. /// HotKey-scoped key bindings are only invoked if the key down event was not handled by the focused view or
  27. /// any of its subviews.
  28. /// </para>
  29. /// </remarks>
  30. /// </summary>
  31. HotKey = 2,
  32. /// <summary>
  33. /// The key binding will be triggered regardless of which view has focus. This is typically used for global
  34. /// commands, which are called Shortcuts.
  35. /// </summary>
  36. /// <remarks>
  37. /// <para>
  38. /// Application-scoped key bindings are only invoked if the key down event was not handled by the focused view or
  39. /// any of its subviews, and if the key was not bound to a <see cref="View.HotKey"/>.
  40. /// </para>
  41. /// </remarks>
  42. Application = 4,
  43. }