示例#1
0
        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 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();
                }
            }
        }
 public override void OnMouseDown(MouseWithKeysEventArgs e)
 {
     using (RedrawAccumulator a = new RedrawAccumulator(this))
     {
         base.OnMouseDown(e);
         FindFocusedControl(e);
     }
 }
示例#5
0
 public override void OnMouseDown(MouseWithKeysEventArgs e)
 {
     using (RedrawAccumulator a = new RedrawAccumulator(this))
     {
         base.OnMouseDown(e);
         FindFocusedControl(e);
     }
 }
示例#6
0
 public override void OnMouseDown(MouseWithKeysEventArgs e)
 {
     using (RedrawAccumulator a = new RedrawAccumulator(this.Root))
     {
         this.State = ButtonState.Pushed;
         base.OnMouseDown(e);
     }
 }
示例#7
0
 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();
     }
 }
示例#8
0
        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;
                }
            }
        }
示例#10
0
 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();
     }
 }
示例#11
0
 public override void OnMouseDown(MouseWithKeysEventArgs e)
 {
     using (RedrawAccumulator a = new RedrawAccumulator(this.Root))
     {
         this.State = ButtonState.Pushed;
         base.OnMouseDown(e);
     }
 }
示例#12
0
 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);
     }
 }
        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;
                    }
                }
            }
        }
        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;
                }
            }
        }