#nullable enable
namespace Terminal.Gui.App;
public static partial class Application // Keyboard handling
{
///
public static IKeyboard Keyboard
{
get => ApplicationImpl.Instance.Keyboard;
set => ApplicationImpl.Instance.Keyboard = value ??
throw new ArgumentNullException(nameof(value));
}
///
public static bool RaiseKeyDownEvent (Key key) => ApplicationImpl.Instance.Keyboard.RaiseKeyDownEvent (key);
///
public static bool? InvokeCommandsBoundToKey (Key key) => ApplicationImpl.Instance.Keyboard.InvokeCommandsBoundToKey (key);
///
public static bool? InvokeCommand (Command command, Key key, KeyBinding binding) => ApplicationImpl.Instance.Keyboard.InvokeCommand (command, key, binding);
///
/// Raised when the user presses a key.
///
/// Set to to indicate the key was handled and to prevent
/// additional processing.
///
///
///
/// All drivers support firing the event. Some drivers (Unix) do not support firing the
/// and events.
/// Fired after and before .
///
public static event EventHandler? KeyDown
{
add => ApplicationImpl.Instance.Keyboard.KeyDown += value;
remove => ApplicationImpl.Instance.Keyboard.KeyDown -= value;
}
///
public static bool RaiseKeyUpEvent (Key key) => ApplicationImpl.Instance.Keyboard.RaiseKeyUpEvent (key);
///
public static KeyBindings KeyBindings => ApplicationImpl.Instance.Keyboard.KeyBindings;
}