public virtual void Collapse(bool collapse, bool shouldRedraw) { if (this.Collapsed == collapse || !this.Collapsable) { return; } using (RedrawAccumulator a = new RedrawAccumulator(this.Root)) { this.Collapsed = collapse; Layout(); RaiseCollapseChanged(); // now the logic of removing focus // from the collapsed children if (this.Root == null) { return; } // check if the focus was inside this control // and now is hidden if (this.Collapsed && Root.IsFocusInsideControl(this)) { this.SetFocus(); } } }
protected virtual void OnKeyDownBack(KeyEventArgs e) { if (e.Handled) { return; } using (RedrawAccumulator a = new RedrawAccumulator(this.Root, false)) { if (HasSelection) { DeleteSelection(); a.ShouldRedrawAtTheEnd = true; e.Handled = true; } else if (!CaretIsAtBeginning) { this.CaretPosition = GoToLeft(e.Control); DeleteSelection(); a.ShouldRedrawAtTheEnd = true; e.Handled = true; } if (!e.Handled) { RaiseKeyDown(e); if (e.Handled) { a.ShouldRedrawAtTheEnd = true; } } } }
public override void OnMouseDown(MouseWithKeysEventArgs e) { using (RedrawAccumulator a = new RedrawAccumulator(this)) { base.OnMouseDown(e); FindFocusedControl(e); } }
public override void OnMouseDown(MouseWithKeysEventArgs e) { using (RedrawAccumulator a = new RedrawAccumulator(this.Root)) { this.State = ButtonState.Pushed; base.OnMouseDown(e); } }
public override void OnMouseUp(MouseWithKeysEventArgs e) { if (this.State == ButtonState.Normal) { return; } using (RedrawAccumulator a = new RedrawAccumulator(this.Root)) { this.State = ButtonState.Normal; base.OnMouseUp(e); RaisePushed(); } }
public override void OnKeyUp(System.Windows.Forms.KeyEventArgs e) { bool shouldRedraw = ShouldPushByKeydown(e); using (RedrawAccumulator a = new RedrawAccumulator(this.Root, shouldRedraw)) { if (shouldRedraw) { this.State = ButtonState.Normal; } base.OnKeyUp(e); } }
public override void OnKeyPress(KeyPressEventArgs e) { RaisePreviewKeyPress(e); if (e.Handled) { return; } using (RedrawAccumulator a = new RedrawAccumulator(this.Root, false)) { if (IsCharAcceptable(e.KeyChar) && !char.IsControl(e.KeyChar)) { InsertText(e.KeyChar.ToString()); a.ShouldRedrawAtTheEnd = true; } RaiseKeyPress(e); if (e.Handled) { a.ShouldRedrawAtTheEnd = true; } } }
protected virtual void OnKeyDownDelete(KeyEventArgs e) { if (e.Handled) { return; } using (RedrawAccumulator a = new RedrawAccumulator(this.Root, false)) { if (!e.Shift && !e.Alt) { if (HasSelection) { DeleteSelection(); a.ShouldRedrawAtTheEnd = true; e.Handled = true; } else if (!CaretIsAtEnd) { this.CaretPosition = GoToRight(e.Control); DeleteSelection(); a.ShouldRedrawAtTheEnd = true; e.Handled = true; } } if (!e.Handled) { RaiseKeyDown(e); if (e.Handled) { a.ShouldRedrawAtTheEnd = true; } } } }