using System;
using System.Diagnostics;
using Robust.Shared.Map;
namespace Robust.Shared.Input
{
///
/// Event data values for a bound key state change.
///
[Virtual]
[DebuggerDisplay("{Function}, {State}, CF: {CanFocus}, H: {Handled}")]
public class BoundKeyEventArgs : EventArgs
{
///
/// Bound key that that is changing.
///
public BoundKeyFunction Function { get; }
///
/// New state of the .
///
public BoundKeyState State { get; }
///
/// Current Pointer location in screen coordinates.
///
public ScreenCoordinates PointerLocation { get; }
///
/// Whether the Bound key can change the focused control.
///
public bool CanFocus { get; internal set; }
public bool Handled { get; private set; }
///
/// Is this a repeated keypress (i.e., are they holding down the key)?
///
public readonly bool IsRepeat;
///
/// Constructs a new instance of .
///
/// Bound key that that is changing.
/// New state of the function.
/// Current Pointer location in screen coordinates.
public BoundKeyEventArgs(BoundKeyFunction function, BoundKeyState state, ScreenCoordinates pointerLocation, bool canFocus)
{
Function = function;
State = state;
PointerLocation = pointerLocation;
CanFocus = canFocus;
}
///
/// Constructs a new instance of .
///
/// Bound key that that is changing.
/// New state of the function.
/// Current Pointer location in screen coordinates.
///
public BoundKeyEventArgs(
BoundKeyFunction function,
BoundKeyState state,
ScreenCoordinates pointerLocation,
bool canFocus,
bool isRepeat = false) : this(function, state, pointerLocation, canFocus)
{
IsRepeat = isRepeat;
}
///
/// Mark this event as handled.
///
public void Handle()
{
Handled = true;
}
}
}