using System.Collections.Generic; namespace ElectronNET.API.Entities { using ElectronNET.Converter; using System.Text.Json.Serialization; /// /// Input event payload as used by webContents 'input-event' and 'before-input-event'. /// Fields map to KeyboardEvent properties where noted, and type/modifiers follow Electron's InputEvent structure. /// /// Up-to-date with Electron API 39.2 public class InputEvent { /// /// Equivalent to KeyboardEvent.key. /// public string Key { get; set; } = ""; /// /// Equivalent to KeyboardEvent.code. /// public string Code { get; set; } = ""; /// /// Equivalent to KeyboardEvent.repeat. /// public bool IsAutoRepeat { get; set; } = false; /// /// Equivalent to KeyboardEvent.isComposing. /// public bool IsComposing { get; set; } = false; /// /// Equivalent to KeyboardEvent.shiftKey. /// public bool Shift { get; set; } = false; /// /// Equivalent to KeyboardEvent.controlKey. /// public bool Control { get; set; } = false; /// /// Equivalent to KeyboardEvent.altKey. /// public bool Alt { get; set; } = false; /// /// Equivalent to KeyboardEvent.metaKey. /// public bool Meta { get; set; } = false; /// /// Equivalent to KeyboardEvent.location. /// public int Location { get; set; } = 0; /// /// An array of modifiers of the event, can be `shift`, `control`, `ctrl`, `alt`, /// `meta`, `command`, `cmd`, `iskeypad`, `isautorepeat`, `leftbuttondown`, /// `middlebuttondown`, `rightbuttondown`, `capslock`, `numlock`, `left`, `right`. /// [JsonConverter(typeof(ModifierTypeListConverter))] public List Modifiers { get; set; } /// /// For MouseInputEvent: The x-coordinate of the event (Integer). /// public int? X { get; set; } /// /// For MouseInputEvent: The y-coordinate of the event (Integer). /// public int? Y { get; set; } /// /// For MouseInputEvent: The button pressed, can be 'left', 'middle', or 'right' (optional). /// public string Button { get; set; } /// /// For MouseInputEvent: Global x in screen coordinates (Integer, optional). /// public int? GlobalX { get; set; } /// /// For MouseInputEvent: Global y in screen coordinates (Integer, optional). /// public int? GlobalY { get; set; } /// /// For MouseInputEvent: Movement delta on x-axis since last event (Integer, optional). /// public int? MovementX { get; set; } /// /// For MouseInputEvent: Movement delta on y-axis since last event (Integer, optional). /// public int? MovementY { get; set; } /// /// For MouseInputEvent: Click count (Integer, optional). /// public int? ClickCount { get; set; } /// /// For MouseWheelInputEvent: Horizontal scroll delta (Integer, optional). /// public int? DeltaX { get; set; } /// /// For MouseWheelInputEvent: Vertical scroll delta (Integer, optional). /// public int? DeltaY { get; set; } /// /// For MouseWheelInputEvent: Horizontal wheel ticks (Integer, optional). /// public int? WheelTicksX { get; set; } /// /// For MouseWheelInputEvent: Vertical wheel ticks (Integer, optional). /// public int? WheelTicksY { get; set; } /// /// For MouseWheelInputEvent: Horizontal acceleration ratio (Integer, optional). /// public int? AccelerationRatioX { get; set; } /// /// For MouseWheelInputEvent: Vertical acceleration ratio (Integer, optional). /// public int? AccelerationRatioY { get; set; } /// /// For MouseWheelInputEvent: True if wheel deltas are precise (optional). /// public bool? HasPreciseScrollingDeltas { get; set; } /// /// For MouseWheelInputEvent: True if the target can scroll (optional). /// public bool? CanScroll { get; set; } /// /// Can be `undefined`, `mouseDown`, `mouseUp`, `mouseMove`, `mouseEnter`, /// `mouseLeave`, `contextMenu`, `mouseWheel`, `rawKeyDown`, `keyDown`, `keyUp`, `char`, /// `gestureScrollBegin`, `gestureScrollEnd`, `gestureScrollUpdate`, /// `gestureFlingStart`, `gestureFlingCancel`, `gesturePinchBegin`, /// `gesturePinchEnd`, `gesturePinchUpdate`, `gestureTapDown`, `gestureShowPress`, /// `gestureTap`, `gestureTapCancel`, `gestureShortPress`, `gestureLongPress`, /// `gestureLongTap`, `gestureTwoFingerTap`, `gestureTapUnconfirmed`, /// `gestureDoubleTap`, `touchStart`, `touchMove`, `touchEnd`, `touchCancel`, /// `touchScrollStarted`, `pointerDown`, `pointerUp`, `pointerMove`, /// `pointerRawUpdate`, `pointerCancel` or `pointerCausedUaAction`. /// public InputEventType Type { get; set; } } }