protected override void OnKeyDown(NKeyCode keyCode, NModifierKey modifierKey, bool autoRepeat) { if (keyCode == NKeyCode.Space && modifierKey == NModifierKey.None && !autoRepeat) { Pressed = true; } }
protected override void OnKeyDown(NKeyCode keyCode, NModifierKey modifierKey, bool autoRepeat) { if (keyCode == NKeyCode.Tab && modifierKey == NModifierKey.None) { MoveFocus(true); content?.Update(); return; } if (keyCode == NKeyCode.Tab && modifierKey == NModifierKey.Shift) { MoveFocus(false); content?.Update(); return; } focusedControl?.KeyDown(keyCode, modifierKey, autoRepeat); content?.Update(); }
protected override void OnKeyDown(NKeyCode keyCode, NModifierKey modifierKey, bool autoRepeat) { if (keyCode == NKeyCode.A && modifierKey == NModifierKey.Control) { state.SelectAll(); coordinatesCalculated = false; InvalidatePainting(); } else if (keyCode == NKeyCode.Z && modifierKey == NModifierKey.Control) { if (undoLog.Count != 0) { redoLog.AddFirst(state); state = undoLog.Last.Value; undoLog.RemoveLast(); } lastActionType = ActionType.Undefined; coordinatesCalculated = false; InvalidatePainting(); } else if (keyCode == NKeyCode.Z && modifierKey == (NModifierKey.Control | NModifierKey.Shift)) { if (redoLog.Count != 0) { undoLog.AddLast(state); state = redoLog.First.Value; redoLog.RemoveFirst(); } lastActionType = ActionType.Undefined; coordinatesCalculated = false; InvalidatePainting(); } else if (keyCode == NKeyCode.LeftArrow && modifierKey == NModifierKey.None) { // todo: handle num-pad arrow keys SaveState(ActionType.Undefined); state.MoveCursorLeft(); coordinatesCalculated = false; InvalidatePainting(); } else if (keyCode == NKeyCode.RightArrow && modifierKey == NModifierKey.None) { // todo: handle num-pad arrow keys SaveState(ActionType.Undefined); state.MoveCursorRight(); coordinatesCalculated = false; InvalidatePainting(); } else if (keyCode == NKeyCode.LeftArrow && modifierKey == NModifierKey.Shift) { // todo: handle num-pad arrow keys SaveState(ActionType.Undefined); state.SelectLeft(); coordinatesCalculated = false; InvalidatePainting(); } else if (keyCode == NKeyCode.RightArrow && modifierKey == NModifierKey.Shift) { // todo: handle num-pad arrow keys SaveState(ActionType.Undefined); state.SelectRight(); coordinatesCalculated = false; InvalidatePainting(); } else if (keyCode == NKeyCode.Home && modifierKey == NModifierKey.None) { // todo: handle num-pad home key SaveState(ActionType.Undefined); state.GoHome(); coordinatesCalculated = false; InvalidatePainting(); } else if (keyCode == NKeyCode.End && modifierKey == NModifierKey.None) { // todo: handle num-pad end key SaveState(ActionType.Undefined); state.GoEnd(); coordinatesCalculated = false; InvalidatePainting(); } else if (keyCode == NKeyCode.Backspace && modifierKey == NModifierKey.None) { // todo: handle num-pad end key SaveState(ActionType.Deletion); state.DeleteLeft(); coordinatesCalculated = false; InvalidatePainting(); } else if (keyCode == NKeyCode.Delete && modifierKey == NModifierKey.None) { // todo: handle num-pad end key SaveState(ActionType.Deletion); state.DeleteRight(); coordinatesCalculated = false; InvalidatePainting(); } else if (keyCode == NKeyCode.C && modifierKey == NModifierKey.Control) { if (state.HasSelection) { Application.Clipboard.PutText(state.SelectedText); } } else if (keyCode == NKeyCode.X && modifierKey == NModifierKey.Control) { if (state.HasSelection) { Application.Clipboard.PutText(state.SelectedText); SaveState(ActionType.Undefined); state.DeleteRight(); coordinatesCalculated = false; InvalidatePainting(); } } else if (keyCode == NKeyCode.V && modifierKey == NModifierKey.Control) { if (Application.Clipboard.TryGetText(out var text)) { SaveState(ActionType.Undefined); state.EnterText(text); coordinatesCalculated = false; InvalidatePainting(); } } }
protected override void OnKeyUp(NKeyCode keyCode) { ReleaseButton(keyCode == NKeyCode.Space); }
protected override void OnKeyUp(NKeyCode keyCode) { base.OnKeyUp(keyCode); eventsExampleControl.HandleKeyUp(keyCode); }
protected override void OnKeyDown(NKeyCode keyCode, NModifierKey modifierKey, bool autoRepeat) { base.OnKeyDown(keyCode, modifierKey, autoRepeat); eventsExampleControl.HandleKeyDown(keyCode, modifierKey, autoRepeat); }
protected override void OnKeyUp(NKeyCode keyCode) { focusedControl?.KeyUp(keyCode); content?.Update(); }
protected virtual void OnKeyUp(NKeyCode keyCode) { }
protected virtual void OnKeyDown(NKeyCode keyCode, NModifierKey modifierKey, bool autoRepeat) { }
internal void KeyUp(NKeyCode keyCode) { OnKeyUp(keyCode); }
internal void KeyDown(NKeyCode keyCode, NModifierKey modifierKey, bool autoRepeat) { OnKeyDown(keyCode, modifierKey, autoRepeat); }