void NestedInputHandler_Removed(ITextAreaInputHandler handler) { if (isAttached) { handler.Detach(); } }
/// <summary> /// Creates a new TextAreaDefaultInputHandler instance. /// </summary> public TextAreaDefaultInputHandler(TextArea textArea) : base(textArea) { this.NestedInputHandlers.Add(CaretNavigation = CaretNavigationCommandHandler.Create(textArea)); this.NestedInputHandlers.Add(Editing = EditingCommandHandler.Create(textArea)); this.NestedInputHandlers.Add(MouseSelection = new SelectionMouseHandler(textArea)); this.CommandBindings.Add(new CommandBinding(ApplicationCommands.Undo, ExecuteUndo, CanExecuteUndo)); this.CommandBindings.Add(new CommandBinding(ApplicationCommands.Redo, ExecuteRedo, CanExecuteRedo)); }
private void NestedInputHandler_Added(ITextAreaInputHandler handler) { if (handler == null) throw new ArgumentNullException(nameof(handler)); if (handler.TextArea != TextArea) throw new ArgumentException("The nested handler must be working for the same text area!"); if (IsAttached) handler.Attach(); }
void NestedInputHandler_Added(ITextAreaInputHandler handler) { if (handler == null) { throw new ArgumentNullException("handler"); } if (handler.TextArea != textArea) { throw new ArgumentException("The nested handler must be working for the same text area!"); } if (isAttached) { handler.Attach(); } }
/// <summary> /// Handles the PointerPressed event of the TextArea control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="PointerPressedEventArgs" /> instance containing the event data.</param> private void TextArea_PointerPressed(object sender, PointerPressedEventArgs e) { // Avalonia edit is killing RMB var rmb = IsRightMouseButton(e.GetCurrentPoint(null)); if (rmb && editor.ContextMenu != null) { // Aside from forking the whole project over and fixing the mess, we can hack our way around. It just ain't worth it. if (mouseHandler == null) { mouseHandler = NestedInputHandlers.FirstOrDefault(p => p.GetType().Name.Contains("SelectionMouseHandler")); } handleAllEvents = true; NestedInputHandlers.Remove(mouseHandler); editor.ContextMenu.Open(editor); } }
void NestedInputHandler_Removed(ITextAreaInputHandler handler) { if (isAttached) handler.Detach(); }
void NestedInputHandler_Added(ITextAreaInputHandler handler) { if (handler == null) throw new ArgumentNullException("handler"); if (handler.TextArea != textArea) throw new ArgumentException("The nested handler must be working for the same text area!"); if (isAttached) handler.Attach(); }
private void NestedInputHandler_Removed(ITextAreaInputHandler handler) { if (IsAttached) handler.Detach(); }