60 lines
1.6 KiB
C#
60 lines
1.6 KiB
C#
namespace Dashboard.Events
|
|
{
|
|
[Flags]
|
|
public enum ModifierKeys
|
|
{
|
|
None = 0,
|
|
LeftBitPos = 8,
|
|
RightBitPos = 16,
|
|
|
|
Shift = (1 << 0),
|
|
Control = (1 << 1),
|
|
Alt = (1 << 2),
|
|
Meta = (1 << 3),
|
|
|
|
NumLock = (1 << 4),
|
|
CapsLock = (1 << 5),
|
|
ScrollLock = (1 << 6),
|
|
|
|
LeftShift = (Shift << LeftBitPos),
|
|
LeftControl = (Control << LeftBitPos),
|
|
LeftAlt = (Alt << LeftBitPos),
|
|
LeftMeta = (Meta << LeftBitPos),
|
|
|
|
RightShift = (Shift << RightBitPos),
|
|
RightControl = (Control << RightBitPos),
|
|
RightAlt = (Alt << RightBitPos),
|
|
RightMeta = (Meta << RightBitPos),
|
|
}
|
|
|
|
public enum KeyCode
|
|
{
|
|
// TODO:
|
|
}
|
|
|
|
public enum ScanCode
|
|
{
|
|
// TODO:
|
|
}
|
|
|
|
public class KeyboardButtonEventArgs(KeyCode keyCode, ScanCode scanCode, ModifierKeys modifierKeys, bool up)
|
|
: UiEventArgs(up ? UiEventType.KeyUp : UiEventType.KeyDown)
|
|
{
|
|
public KeyCode KeyCode { get; } = keyCode;
|
|
public ScanCode ScanCode { get; } = scanCode;
|
|
public ModifierKeys ModifierKeys { get; } = modifierKeys;
|
|
}
|
|
|
|
public class TextInputEventArgs(string text) : UiEventArgs(UiEventType.TextEdit)
|
|
{
|
|
public string Text { get; } = text;
|
|
}
|
|
|
|
public class TextEditEventArgs(string candidate, int cursor, int length) : UiEventArgs(UiEventType.TextEdit)
|
|
{
|
|
public string Candidate { get; } = candidate;
|
|
public int Cursor { get; } = cursor;
|
|
public int Length { get; } = length;
|
|
}
|
|
}
|