| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- namespace Terminal.Gui.App;
- public static partial class Application // Keyboard handling
- {
- /// <inheritdoc cref="IApplication.Keyboard"/>
- [Obsolete ("The legacy static Application object is going away.")]
- public static IKeyboard Keyboard
- {
- get => ApplicationImpl.Instance.Keyboard;
- set => ApplicationImpl.Instance.Keyboard = value ??
- throw new ArgumentNullException(nameof(value));
- }
- /// <inheritdoc cref="IKeyboard.RaiseKeyDownEvent"/>
- [Obsolete ("The legacy static Application object is going away.")]
- public static bool RaiseKeyDownEvent (Key key) => ApplicationImpl.Instance.Keyboard.RaiseKeyDownEvent (key);
- /// <summary>
- /// Raised when the user presses a key.
- /// <para>
- /// Set <see cref="Key.Handled"/> to <see langword="true"/> to indicate the key was handled and to prevent
- /// additional processing.
- /// </para>
- /// </summary>
- /// <remarks>
- /// All drivers support firing the <see cref="KeyDown"/> event. Some drivers (Unix) do not support firing the
- /// <see cref="KeyDown"/> and <see cref="KeyUp"/> events.
- /// <para>Fired after <see cref="KeyDown"/> and before <see cref="KeyUp"/>.</para>
- /// </remarks>
- [Obsolete ("The legacy static Application object is going away.")]
- public static event EventHandler<Key>? KeyDown
- {
- add => ApplicationImpl.Instance.Keyboard.KeyDown += value;
- remove => ApplicationImpl.Instance.Keyboard.KeyDown -= value;
- }
- /// <inheritdoc cref="IKeyboard.KeyBindings"/>
- [Obsolete ("The legacy static Application object is going away.")]
- public static KeyBindings KeyBindings => ApplicationImpl.Instance.Keyboard.KeyBindings;
- }
|