KeyBindingScope.cs 2.1 KB

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