protected internal override void OnMouseMoved(BasicMouseEventArgs e) { if (xpos == null || ypos == null) { return; } int indX = GetSeparatorInd(xpos, e.X); int indY = GetSeparatorInd(ypos, e.Y); if (indX >= 0) { indY = -1; } if (indX >= 0 || indY >= 0) { Cursor = indX >= 0 ? Cursors.VSplit : Cursors.HSplit; currentComponentX = -1; currentComponentY = -1; } else { ResetCursor(); currentComponentX = GetCurrentComponentInd(xpos, e.X); currentComponentY = GetCurrentComponentInd(ypos, e.Y); Tuple <int, int> key = new Tuple <int, int>(currentComponentY, currentComponentX); if (components.ContainsKey(key)) { BasicView v = components[key]; v.OnMouseMoved(new BasicMouseEventArgs(e, xpos[currentComponentX], ypos[currentComponentY], widths[currentComponentX], heights[currentComponentY])); } } }
protected internal override void OnMouseIsDown(BasicMouseEventArgs e) { int indX1 = GetSeparatorInd(xpos, e.X); int indY1 = GetSeparatorInd(ypos, e.Y); if (indX1 >= 0) { indY1 = -1; } if (indX1 >= 0 || indY1 >= 0) { dragging = true; dragX = indX1 >= 0; dragIndex = indX1 >= 0 ? indX1 : indY1; return; } int indX; int indY; BasicView v = GetComponentAt(e.X, e.Y, out indX, out indY); if (v != null) { v.OnMouseIsDown(new BasicMouseEventArgs(e, xpos[indX], ypos[indY], widths[indX], heights[indY])); mouseDownX = indX; mouseDownY = indY; } }
protected internal override void OnMouseIsDown(BasicMouseEventArgs e) { ScrollBarState newState = ScrollBarState.Neutral; if (e.X < CompoundScrollableControl.scrollBarWidth - 1) { newState = ScrollBarState.PressFirstBox; MoveLeft(main.DeltaX); leftThread = new Thread(() => WalkLeft(main.DeltaX)); leftThread.Start(); } else if (e.X > e.Width - CompoundScrollableControl.scrollBarWidth) { newState = ScrollBarState.PressSecondBox; MoveRight(main.DeltaX); rightThread = new Thread(() => WalkRight(main.DeltaX)); rightThread.Start(); } else if (HasBar) { int s = CalcBarStart(e.Width); int l = CalcBarSize(e.Width); if (e.X >= s && e.X <= s + l) { newState = ScrollBarState.PressBar; dragStart = e.X; visibleDragStart = main.VisibleX; } else if (e.X < s) { MoveLeft(main.VisibleWidth); leftThread = new Thread(() => WalkLeft(main.VisibleWidth)); leftThread.Start(); } else { MoveRight(main.VisibleWidth); rightThread = new Thread(() => WalkRight(main.VisibleWidth)); rightThread.Start(); } } if (newState != state) { state = newState; Invalidate(); } }
public BasicMouseEventArgs(BasicMouseEventArgs e, int dx, int dy, int width, int height) { x = e.X - dx; y = e.Y - dy; this.width = width; this.height = height; isMainButton = e.isMainButton; modifierKeys = e.modifierKeys; showTip = e.showTip; }
protected internal override void OnMouseWheel(BasicMouseEventArgs e) { int indX; int indY; BasicView v = GetComponentAt(e.X, e.Y, out indX, out indY); if (v != null) { v.OnMouseWheel(new BasicMouseEventArgs(e, xpos[indX], ypos[indY], widths[indX], heights[indY])); } }
// ReSharper restore FunctionNeverReturns protected internal override void OnMouseDragged(BasicMouseEventArgs e) { if (state != ScrollBarState.PressBar) { return; } int hx = e.Width - 2 * CompoundScrollableControl.scrollBarWidth + 2; int x = visibleDragStart + (int)Math.Round((e.X - dragStart) / (double)hx * main.TotalWidth); x = Math.Max(0, x); x = Math.Min(main.TotalWidth - main.VisibleWidth, x); main.VisibleX = x; Invalidate(); }
// ReSharper restore FunctionNeverReturns protected internal override void OnMouseDragged(BasicMouseEventArgs e) { if (state != ScrollBarState.PressBar) { return; } int hx = e.Height - 2 * CompoundScrollableControl.scrollBarWidth + 2; int y = visibleDragStart + (int)Math.Round((e.Y - dragStart) / (double)hx * main.TotalHeight); y = Math.Max(0, y); y = Math.Min(main.TotalHeight - main.VisibleHeight, y); main.VisibleY = y; Invalidate(); }
protected internal override void OnMouseDragged(BasicMouseEventArgs e) { if (dragging) { } BasicView v = GetComponentAt(mouseDownX, mouseDownY); if (v != null) { v.OnMouseDragged(new BasicMouseEventArgs(e, xpos[mouseDownX], ypos[mouseDownY], widths[mouseDownX], heights[mouseDownY])); } //TODO: splitter }
protected internal override void OnMouseIsUp(BasicMouseEventArgs e) { if (dragging) { dragging = false; return; } BasicView v = GetComponentAt(mouseDownX, mouseDownY); if (v != null) { v.OnMouseIsUp(new BasicMouseEventArgs(e, xpos[mouseDownX], ypos[mouseDownY], widths[mouseDownX], heights[mouseDownY])); } }
protected internal override void OnMouseIsDown(BasicMouseEventArgs e) { ScrollBarState newState = ScrollBarState.Neutral; bool ctrl = e.ControlPressed; if (e.Y < CompoundScrollableControl.scrollBarWidth - 1) { if (ctrl) { newState = ScrollBarState.PressFirstBox; MoveUp(main.DeltaUpToSelection()); } else { newState = ScrollBarState.PressFirstBox; MoveUp(main.DeltaY); upThread = new Thread(() => WalkUp(main.DeltaY)); upThread.Start(); } } else if (e.Y > e.Height - CompoundScrollableControl.scrollBarWidth) { if (ctrl) { newState = ScrollBarState.PressSecondBox; MoveDown(main.DeltaDownToSelection()); } else { newState = ScrollBarState.PressSecondBox; MoveDown(main.DeltaY); downThread = new Thread(() => WalkDown(main.DeltaY)); downThread.Start(); } } else if (HasBar) { int s = CalcBarStart(e.Height); int l = CalcBarSize(e.Height); if (e.Y >= s && e.Y <= s + l) { newState = ScrollBarState.PressBar; dragStart = e.Y; visibleDragStart = main.VisibleY; } else if (e.Y < s) { MoveUp(main.VisibleHeight); upThread = new Thread(() => WalkUp(main.VisibleHeight)); upThread.Start(); } else { MoveDown(main.VisibleHeight); downThread = new Thread(() => WalkDown(main.VisibleHeight)); downThread.Start(); } } if (newState != state) { state = newState; Invalidate(); } }
protected internal virtual void OnMouseMoveMiddleCornerView(BasicMouseEventArgs e) { }
protected internal virtual void OnMouseMoveColumnHeaderView(BasicMouseEventArgs e) { }
protected internal virtual void OnMouseIsUpColumnSpacerView(BasicMouseEventArgs e) { }
protected internal virtual void OnMouseDraggedRowFooterView(BasicMouseEventArgs e) { }
protected internal virtual void OnMouseDoubleClickMiddleCornerView(BasicMouseEventArgs e) { }
protected internal override void OnMouseDoubleClick(BasicMouseEventArgs e) { main.OnMouseDoubleClickMainView(e); }
protected internal virtual void OnMouseMoved(BasicMouseEventArgs e) { }
protected internal virtual void OnMouseWheel(BasicMouseEventArgs e) { }
protected internal virtual void OnMouseDoubleClick(BasicMouseEventArgs e) { }
protected internal override void OnMouseMoved(BasicMouseEventArgs e) { ScrollBarState newState = ScrollBarState.Neutral; if (e.X < CompoundScrollableControl.scrollBarWidth - 1) { newState = ScrollBarState.HighlightFirstBox; } else if (e.X > e.Width - CompoundScrollableControl.scrollBarWidth) { newState = ScrollBarState.HighlightSecondBox; } else if (HasBar) { int s = CalcBarStart(e.Width); int l = CalcBarSize(e.Width); if (e.X >= s && e.X <= s + l) { newState = ScrollBarState.HighlightBar; } } if (newState != state) { state = newState; Invalidate(); } }
protected internal override void OnMouseMoved(BasicMouseEventArgs e) { main.OnMouseMoveMainView(e); }
protected internal virtual void OnMouseIsDown(BasicMouseEventArgs e) { }
protected internal virtual void OnMouseDoubleClickColumnHeaderView(BasicMouseEventArgs e) { }
protected internal override void OnMouseIsDown(BasicMouseEventArgs e) { main.OnMouseIsDownMainView(e); }
protected internal override void OnMouseClick(BasicMouseEventArgs e) { switch (MouseMode){ case ScatterPlotMouseMode.Zoom: case ScatterPlotMouseMode.Select: if (!HasMoved()){ bool add = e.ControlPressed; SelectAt(e.X, e.Y, add, e.Width, e.Height); Invalidate(); } break; } }
protected internal virtual void OnMouseClickCornerView(BasicMouseEventArgs e) { }
protected internal override void OnMouseDoubleClick(BasicMouseEventArgs e) { indicatorX1 = -1; indicatorX2 = -1; indicatorY1 = -1; indicatorY2 = -1; FireZoom(false, e.Width, e.Height); Invalidate(); }
protected internal virtual void OnMouseDoubleClickMainView(BasicMouseEventArgs e) { }
protected internal override void OnMouseDragged(BasicMouseEventArgs e) { indicatorX2 = e.X; indicatorX2 = Math.Max(0, indicatorX2); indicatorX2 = Math.Min(e.Width - 1, indicatorX2); indicatorY2 = e.Y; indicatorY2 = Math.Max(0, indicatorY2); indicatorY2 = Math.Min(e.Height - 1, indicatorY2); Invalidate(); }
protected internal virtual void OnMouseDoubleClickRowSpacerView(BasicMouseEventArgs e) { }
protected internal override void OnMouseIsDown(BasicMouseEventArgs e) { indicatorX1 = e.X; indicatorX2 = indicatorX1; indicatorY1 = e.Y; indicatorY2 = indicatorY1; }
protected internal virtual void OnMouseIsDownRowFooterView(BasicMouseEventArgs e) { }
protected internal override void OnMouseIsUp(BasicMouseEventArgs e) { switch (MouseMode){ case ScatterPlotMouseMode.Zoom: FireZoom(true, e.Width, e.Height); break; case ScatterPlotMouseMode.Select: if (HasMoved()){ bool add = e.ControlPressed; Select(MinIndicatorX, MaxIndicatorX, MaxIndicatorY, MinIndicatorY, add, e.Width, e.Height); } break; } indicatorX1 = -1; indicatorX2 = -1; indicatorY1 = -1; indicatorY2 = -1; Invalidate(); }
protected internal virtual void OnMouseIsUpRowHeaderView(BasicMouseEventArgs e) { }
protected internal override void OnMouseMoved(BasicMouseEventArgs e) { main.OnMouseMoveColumnHeaderView(e); }
protected internal virtual void OnMouseMoveMainView(BasicMouseEventArgs e) { }
protected internal override void OnMouseIsUp(BasicMouseEventArgs e) { main.OnMouseIsUpColumnFooterView(e); }
protected internal virtual void OnMouseMoveRowSpacerView(BasicMouseEventArgs e) { }
protected internal override void OnMouseIsUp(BasicMouseEventArgs e) { if (leftThread != null) { leftThread.Abort(); leftThread = null; } if (rightThread != null) { rightThread.Abort(); rightThread = null; } const ScrollBarState newState = ScrollBarState.Neutral; OnMouseMoved(e); state = newState; Invalidate(); }