public ControlRect GetPrevControl(ControlRect current) { int tab = current == null ? int.MaxValue : current.TabIndex; int currTab = -1; ControlRect currControl = null; EnumerateChilds((item, status) => { var cr = (item as ControlRect); if (cr != null && cr.TabStop) { if (cr != current && cr.TabIndex < tab && cr.TabIndex > currTab) { currTab = cr.TabIndex; currControl = cr; } } }); if (currControl != null) { if (currControl.CanSelect()) { return(currControl); } return(GetPrevControl(currControl)); } return(null); }
internal ControlRect MouseChild(Point pt) { ControlRect ch; if (m_captureControl != null) { return(m_captureControl); } if (pt.X < 0 || pt.Y < 0) { ch = null; } else { ch = GetChildControlEt(pt); } if (ch != m_lastMouseControl) { if (m_lastMouseControl != null) { m_lastMouseControl.OnMouseLeave(new EventArgs()); } if (ch != null) { ch.OnMouseEnter(new EventArgs()); } } m_lastMouseControl = ch; m_lastMousePos = pt; return(ch); }
protected void Capture(ControlRect rect, bool value) { var pctrl = this.ParentControlRect; if (pctrl != null) { pctrl.Capture(rect, value); return; } if (LockControl != null) { LockControl.Capture = value; if (value) { m_captureControl = rect; } else { m_captureControl = null; MouseChild(LockControl.PointToClient(Control.MousePosition)); } } }
internal void OnMouseEnter(EventArgs e) { if (!Enabled) { return; } if (m_lastMouseControl != null) { m_lastMouseControl.OnMouseLeave(e); m_lastMouseControl = null; } if (MouseEnter != null) { MouseEnter(this, e); } }
private void Select(ControlRect control) { var rect = ParentControlRect; if (rect != null) { ((ControlRect)rect).Select(control); } else { if (m_focusedControl != null) { m_focusedControl.OnLeave(); } m_focusedControl = control; m_focusedControl.OnEnter(); } }
internal void OnMouseLeave(EventArgs e) { if (!Enabled) { return; } if (m_lastMouseControl != null) { m_lastMouseControl.OnMouseLeave(e); m_lastMouseControl = null; } if (MouseLeave != null) { MouseLeave(this, e); } m_lastMousePos = InvalidPoint; }
public void SelectPrev() { var rect = ParentControlRect; if (rect != null) { ((ControlRect)rect).SelectPrev(); } else { if (m_focusedControl != null) { m_focusedControl.OnLeave(); } m_focusedControl = GetPrevControl(m_focusedControl); if (m_focusedControl != null) { m_focusedControl.OnEnter(); } } }
internal void OnGotFocus(EventArgs e) { if (m_focusedControl != null) { m_focusedControl.OnEnter(); } else { if (Control.ModifierKeys != Keys.Shift) { m_focusedControl = GetNextControl(null); } else { m_focusedControl = GetPrevControl(null); } if (m_focusedControl != null) { m_focusedControl.OnEnter(); } } }