public MouseEvent(Scene scene, Coord viewportPos, InteractionModifier modifier) : base(scene) { ViewportPos = viewportPos; Pos = viewportPos.Copy(); Modifier = modifier; }
/// <summary> /// Default constructor. /// </summary> public KeyEvent(Scene scene, int keyVal, InteractionModifier modifier) : base(scene) { Value = keyVal; Modifier = modifier; }
public MouseButtonEvent(Scene scene, Coord viewportPos, int button, InteractionModifier modifier, ClickMultiplicity multiplicity) : base(scene, viewportPos, modifier) { Button = button; Multiplicity = multiplicity; }
public MouseButtonEvent(Scene scene, Coord viewportPos, int button, InteractionModifier modifier) : this(scene, viewportPos, button, modifier, ClickMultiplicity.Single) { }
public MouseWheelEvent(Scene scene, WheelDirection direction, InteractionModifier modifier) : base(scene) { Direction = direction; Modifier = modifier; }
/// <summary> /// Moves the cursor down or more lines up, depending on the modifier. /// </summary> public virtual void CursorDown(InteractionModifier modifier) { if (Anchor != null) Anchor = null; if (Cursor == null) { Cursor = new TextCursor() { Column = 0, Row = NumLines - 1, IsDirty = true }; } else if (Cursor.Row < NumLines - 1 ) { Cursor.Row++; Cursor.IsDirty = true; } }
/// <summary> /// Moves the cursor one or more lines up, depending on the modifier. /// </summary> public virtual void CursorUp(InteractionModifier modifier) { if (Anchor != null) Anchor = null; if (Cursor == null) { Cursor = new TextCursor() { Column = 0, Row = 0, IsDirty = true }; } else if (Cursor.Row > 0 ) { Cursor.Row--; Cursor.IsDirty = true; } }
/// <summary> /// Moves the cursor one or more characters to the right, depending on the modifier. /// </summary> public virtual void CursorRight(InteractionModifier modifier) { if (Anchor != null && modifier != InteractionModifier.Shift) Anchor = null; else if (Anchor == null && modifier == InteractionModifier.Shift) Anchor = Cursor.Copy(); if (Cursor == null) { Cursor = new TextCursor() { Column = 0, Row = 0, IsDirty = true }; } else { if (Cursor.Column < CurrentLine.Length ) { Cursor.Column++; Cursor.IsDirty = true; } else if (Cursor.Row < Lines.Length - 1) { Cursor.Row++; Cursor.Column = 0; Cursor.IsDirty = true; } } }
/// <summary> /// Moves the cursor one or more characters to the left, depending on the modifier. /// </summary> public virtual void CursorLeft(InteractionModifier modifier) { if (Anchor != null && modifier != InteractionModifier.Shift) Anchor = null; else if (Anchor == null && modifier == InteractionModifier.Shift) Anchor = Cursor.Copy(); // make sure there is a cursor if (Cursor == null) { Cursor = new TextCursor() { Column = 0, Row = 0, IsDirty = true }; } else { if (Cursor.Column > 0) { Cursor.Column--; Cursor.IsDirty = true; } else if (Cursor.Row > 0) { Cursor.Row--; Cursor.Column = CurrentLine.Length; Cursor.IsDirty = true; } } }
/// <summary> /// Deletes one or more characters to the right depending on the modifier. /// </summary> public virtual void CursorDelete(InteractionModifier modifier) { if (Cursor == null) return; if (Anchor != null) { DeleteSelection(); return; } if (modifier == InteractionModifier.None) { if (Cursor.Column == CurrentLine.Length) { if (Cursor.Row < NumLines - 1) // there's a line break to delete { throw new NotImplementedException(); } } else { CurrentLine = CurrentLine.Remove(Cursor.Column, 1); SetBodyFromLines(); } } else // another modifier { throw new NotImplementedException(); } }