protected override bool OnButtonPressEvent(Gdk.EventButton evnt) { if (evnt.TriggersContextMenu()) { item.ShowDockPopupMenu(this, evnt); return(false); } else if (evnt.Button == 1) { if (evnt.Type == Gdk.EventType.ButtonPress) { tabPressed = true; pressX = evnt.X; pressY = evnt.Y; TabPressed?.Invoke(this, EventArgs.Empty); } else if (evnt.Type == Gdk.EventType.TwoButtonPress) { tabActivated = true; } } return(base.OnButtonPressEvent(evnt)); }
private new EditState KeyPressed(Event e) { bool onlyControl = (e.control || e.command) && !e.shift && !e.alt; switch (e.keyCode) { case KeyCode.Home: if (e.control || e.command) { MoveTextStart(e.shift); } else { var startOfLine = caretSelectPositionInternal <= 2 ? 0 : text.LastIndexOf('\n', caretSelectPositionInternal - 2) + 1; if (!e.shift) { caretPositionInternal = startOfLine; } caretSelectPositionInternal = startOfLine; } return(EditState.Continue); case KeyCode.End: if (e.control || e.command) { MoveTextEnd(e.shift); } else { var endOfLine = caretSelectPositionInternal + 1 >= text.Length ? text.Length : text.IndexOf('\n', caretSelectPositionInternal + 1); if (endOfLine < 0) { endOfLine = text.Length; } if (!e.shift) { caretPositionInternal = endOfLine; } caretSelectPositionInternal = endOfLine; } return(EditState.Continue); case KeyCode.Backspace when onlyControl: ProcessEvent(Event.KeyboardEvent("^#left")); ProcessEvent(Event.KeyboardEvent("backspace")); return(EditState.Continue); case KeyCode.Delete when onlyControl: ProcessEvent(Event.KeyboardEvent("^#right")); ProcessEvent(Event.KeyboardEvent("backspace")); return(EditState.Continue); case KeyCode.Z when onlyControl: UndoManager.State state = undoManager.Undo(); if (state != null) { text = state.Text; caretPosition = state.CursorPosition; } return(EditState.Continue); case KeyCode.Y when onlyControl: UndoManager.State state2 = undoManager.Redo(); if (state2 != null) { text = state2.Text; caretPosition = state2.CursorPosition; } return(EditState.Continue); default: switch (e.character) { case '\t': var e2 = new TabPressedEventArgs(); TabPressed?.Invoke(this, e2); if (e2.SuppressKeyPress) { return(EditState.Continue); } goto default; case '\n': case '\r': if (e.control || e.command) { Submit?.Invoke(this, EventArgs.Empty); return(EditState.Finish); } goto default; default: return(base.KeyPressed(e)); } } }
void HandlePress(object sender, EventArgs args) { TabPressed?.Invoke(this, EventArgs.Empty); }
protected override void OnActivate() { TabPressed?.Invoke(this, EventArgs.Empty); base.OnActivate(); }
protected void OnTabPressed(KeyPressedEventArgs e) { TabPressed?.Invoke(this, e); }