protected void Gc_MouseUp(object sender, GLMouseEventArgs e) { SetViewScreenCoord(ref e); if (currentmouseover != null) { currentmouseover.MouseButtonsDown = GLMouseEventArgs.MouseButtons.None; SetControlLocation(ref e, currentmouseover); // reset location etc if (currentmouseover.Enabled) { currentmouseover.OnMouseUp(e); } } else { if (this.Enabled) // not over any control (due to screen coord clip space), so send thru the displaycontrol { this.OnMouseUp(e); } } mousedowninitialcontrol = null; }
protected void Gc_MouseDown(object sender, GLMouseEventArgs e) { // System.Diagnostics.Debug.WriteLine("GC Mouse down"); if (currentmouseover != null) { currentmouseover.FindControlUnderDisplay()?.BringToFront(); // this brings to the front of the z-order the top level element holding this element and makes it visible. SetViewScreenCoord(ref e); SetControlLocation(ref e, currentmouseover); OnGlobalMouseDown(currentmouseover, e); if (currentmouseover.Enabled) { currentmouseover.MouseButtonsDown = e.Button; currentmouseover.OnMouseDown(e); } mousedowninitialcontrol = currentmouseover; } else { OnGlobalMouseDown(null, e); if (this.Enabled) // not over any control (due to screen coord clip space), so send thru the displaycontrol { this.OnMouseDown(e); } } }
protected void Gc_MouseDoubleClick(object sender, GLMouseEventArgs e) { SetViewScreenCoord(ref e); if (mousedowninitialcontrol == currentmouseover && currentmouseover != null) // clicks only occur if mouse is still over initial control { e.WasFocusedAtClick = currentmouseover == currentfocus; // record if clicking on a focused item SetFocus(currentmouseover); if (currentmouseover != null) // set focus could have force a loss, thru the global focus hook { SetControlLocation(ref e, currentmouseover); // reset location etc if (currentmouseover.Enabled) { currentmouseover.OnMouseDoubleClick(e); } } } else if (currentmouseover == null) // not over any control, even control display, but still click, (due to screen coord clip space), so send thru the displaycontrol { SetFocus(null); if (this.Enabled) { this.OnMouseDoubleClick(e); } } }
protected override void OnMouseMove(GLMouseEventArgs e) { base.OnMouseMove(e); GLDataGridView dgv = Parent as GLDataGridView; int xoff = e.Location.X + HorzScroll; if (dragging == 0) { dgv.RowHeaderWidth = xoff + initialrowheaderwidth; } else if (dragging == -2) { dgv.ColumnHeaderHeight = e.Location.Y; } else if (dragging > 0) { int colx = xoff - dgv.ColumnPixelLeft(dragging - 1); dgv.SetColumnWidth(dragging - 1, colx); } else { var over = Over(e.Location); Cursor = (over != null && over.Item1 == ClickOn.Divider) ? GLWindowControl.GLCursorType.EW : (over != null && over.Item1 == ClickOn.Height) ? GLWindowControl.GLCursorType.NS : GLWindowControl.GLCursorType.Normal; } return; }
private void GLSurface_GLMouseMove(object sender, GLMouseEventArgs e) { try { MouseManager.UpdateLocation(e.Location); if (e.Button.HasFlag(MouseButtons.Left)) { int tx = (int)Math.Round(-OffsetX + e.X + GLSurface.FieldW / 2 - 0.5); int ty = (int)Math.Round(-OffsetY + e.Y + GLSurface.FieldH / 2 - 0.5); if (MouseState == MouseStatus.Placing) { GLSurface.PlaceTile(TileComboBox.SelectedIndex <= 0 ? TileName : (string)TileComboBox.SelectedItem, tx, ty); } else { GLSurface.PlaceTile(null, tx, ty); } } if (e.Button.HasFlag(MouseButtons.Right)) { OffsetX += MouseManager.CurrentDelta.X; OffsetY += MouseManager.CurrentDelta.Y; RepairOffset(); } } catch (Exception ex) { MessageBox.Show(this, ex.ToString(), "Error: Can not handle MouseMove event.", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void MoveToCell(GLMouseEventArgs e) { GLDataGridView dgv = Parent as GLDataGridView; var g = GridRowCol(e.Location); // find row/col if (g != null) { if (g.Column < dgv.Rows[g.Row].CellCount) // if within the range of cells of the current row { var newcell = CellPara(g, e); // get cell and set up mouse event args if (newcell == currentcell) { currentcell.OnMouseCellMove(e); // same cell, its a move } else { if (currentcell != null) // different cell, its a leave on last { currentcell.OnMouseCellLeave(e); } currentcell = newcell; currentcell?.OnMouseCellEnter(e); // if we have a new cell, enter. } return; // stop } } if (currentcell != null) // did not get a cell, but if we have a current cell, we need to leave { currentcell.OnMouseCellLeave(e); currentcell = null; } }
void modelCanvas_MouseMove(object sender, GLMouseEventArgs e) { if (!this.linesNode.IsMouseDown) { this.linesNode.MouseMove(e.X, e.Y, this.modelCanvas.Width, this.modelCanvas.Height); } }
protected override void OnMouseClick(GLMouseEventArgs e) { base.OnMouseClick(e); if (e.Button == GLMouseEventArgs.MouseButtons.Left) { if (dragging == -1) { var over = Over(e.Location); if (over != null && over.Item1 != ClickOn.Divider) { MouseClickColumnHeader(over.Item2, e); } } } else if (e.Button == GLMouseEventArgs.MouseButtons.Right) { GLDataGridView dgv = Parent as GLDataGridView; if (dgv.ContextMenuColumnHeaders != null) { var over = Over(e.Location); if (over != null && over.Item1 == ClickOn.Header) { dgv.ContextMenuColumnHeaders.Show(FindDisplay(), e.ScreenCoord, opentag: new GLDataGridView.RowColPos() { Column = over.Item2, Row = -1, Location = over.Item3 }); } } } }
protected override void OnMouseMove(GLMouseEventArgs e) { base.OnMouseMove(e); GLDataGridView dgv = Parent as GLDataGridView; if (selectionstart != null) { if (!dgv.AllowUserToDragSelectCells) // disable drag { return; } if (e.Location.Y >= 0 && e.Location.Y <= ClientHeight) // if within window, no scroll { autoscroll.Stop(); } else if (!autoscroll.Running) { autoscroll.Start(50, 200); // else autoscroll } lastmousemove = e.Location; // record this for autoscroll purposes UpdateSelection(e.Location); } else { MoveToCell(e); } }
protected override void OnMouseWheel(GLMouseEventArgs e) { base.OnMouseWheel(e); GLDataGridView dgv = Parent as GLDataGridView; dgv.Scroll(e.Delta); }
private void GLSurface_GLMouseDown(object sender, GLMouseEventArgs e) { try { MouseManager.BeginDrag(e.Location); if (e.Button.HasFlag(MouseButtons.Left)) { int tx = (int)Math.Round(-OffsetX + e.X + GLSurface.FieldW / 2 - 0.5); int ty = (int)Math.Round(-OffsetY + e.Y + GLSurface.FieldH / 2 - 0.5); if (GLSurface.GetTile(tx, ty) == null) { GLSurface.PlaceTile(TileComboBox.SelectedIndex <= 0 ? TileName : (string)TileComboBox.SelectedItem, tx, ty); MouseState = MouseStatus.Placing; } else { GLSurface.PlaceTile(null, tx, ty); MouseState = MouseStatus.Removing; } } } catch (Exception ex) { MessageBox.Show(this, ex.ToString(), "Error: Can not handle MouseDown event.", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void MouseClickOnMap(Object s, GLMouseEventArgs e) { int distmovedsq = gl3dcontroller.MouseMovedSq(e); if (distmovedsq >= 4) { System.Diagnostics.Debug.WriteLine($"Moved mouse {distmovedsq}, reject click"); return; } // System.Diagnostics.Debug.WriteLine("map click"); Object item = FindObjectOnMap(e.ViewportLocation); if (item != null) { if (e.Button == GLMouseEventArgs.MouseButtons.Left) { if (item is HistoryEntry) { travelpath.SetSystem(item as HistoryEntry); } var nl = NameLocationDescription(item); System.Diagnostics.Debug.WriteLine("Click on and slew to " + nl.Item1); SetEntryText(nl.Item1); gl3dcontroller.SlewToPosition(nl.Item2, -1); } else if (e.Button == GLMouseEventArgs.MouseButtons.Right) { rightclickmenu.Tag = item; rightclickmenu.Show(displaycontrol, e.Location); } } }
private void GLSurface_GLMouseDown(object sender, GLMouseEventArgs e) { try { MouseManager.BeginDrag(e.Location); float b = LoadedResource.PointBoundsX / GLSurface.Zoom; float x1 = LoadedResource.FirePointX; float y1 = LoadedResource.FirePointY; float x2 = x1 + LoadedResource.FireVectorX; float y2 = y1 + LoadedResource.FireVectorY; if (MouseManager.CurrentLocation.X >= OffsetX + x2 - b && MouseManager.CurrentLocation.X <= OffsetX + x2 + b && MouseManager.CurrentLocation.Y >= OffsetY + y2 - b && MouseManager.CurrentLocation.Y <= OffsetY + y2 + b) { CapturedPoint = 2; } else if (MouseManager.CurrentLocation.X >= OffsetX + x1 - b && MouseManager.CurrentLocation.X <= OffsetX + x1 + b && MouseManager.CurrentLocation.Y >= OffsetY + y1 - b && MouseManager.CurrentLocation.Y <= OffsetY + y1 + b) { CapturedPoint = 1; } } catch (Exception ex) { MessageBox.Show(this, ex.ToString(), "Error: Can not handle MouseDown event.", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <inheritdoc cref="GLOFC.GL4.Controls.GLBaseControl.OnMouseDown(GLMouseEventArgs)"/> protected override void OnMouseDown(GLMouseEventArgs e) { base.OnMouseDown(e); if (!Enabled || !thumbenable) { return; } if (decreasebuttonarea.Contains(e.Location)) { mousepressed = MouseOver.MouseOverDecrease; Invalidate(); MoveThumb(-smallchange); } else if (increasebuttonarea.Contains(e.Location)) { mousepressed = MouseOver.MouseOverIncrease; Invalidate(); MoveThumb(smallchange); } else if (thumbbuttonarea.Contains(e.Location)) { mousepressed = MouseOver.MouseOverThumb; Invalidate(); thumbmove = true; // and mouseover should be on as well thumbmovecaptureoffset = HorizontalScroll ? (e.Location.X - thumbbuttonarea.X) : (e.Location.Y - thumbbuttonarea.Y); // pixels down the thumb when captured.. // System.Diagnostics.Debug.WriteLine("Thumb captured at " + thumbmovecaptureoffset); } else if (sliderarea.Contains(e.Location)) // slider, but not thumb.. { bool decdir = HorizontalScroll ? (e.Location.X < thumbbuttonarea.X) : (e.Location.Y < thumbbuttonarea.Y); MoveThumb(decdir ? -largechange : largechange); } }
protected void GLMouseClick(object v, GLMouseEventArgs e) { if (sl != null) { var index = sl.Find(findshader, glwfc.RenderState, e.WindowLocation, gl3dcontroller.MatrixCalc.ViewPort.Size); if (index != null) { System.Diagnostics.Debug.WriteLine($"found {index.Item1} {index.Item2}"); //var namelist = sl.UserTags[index.Item1] as string[]; // System.Diagnostics.Debug.WriteLine($"... {namelist[index.Item2]}"); } } if (slset != null) { var find = slset.FindBlock(findshader, glwfc.RenderState, e.WindowLocation, gl3dcontroller.MatrixCalc.ViewPort.Size); if (find != null) { System.Diagnostics.Debug.WriteLine($"SLSet {find.Item2} {find.Item3} {find.Item4} {find.Item5}"); var userdata = slset.UserData[find.Item1[0].tag] as string[]; System.Diagnostics.Debug.WriteLine($"... {userdata[find.Item4]}"); } } }
protected override void OnMouseClick(GLMouseEventArgs e) { base.OnMouseClick(e); GLDataGridView dgv = Parent as GLDataGridView; var g = contentpanel.GridRowCol(e.Location); if (e.Button == GLMouseEventArgs.MouseButtons.Left) { if (dragging == -1 && lastselectionstart == lastselectionend) // if not dragging sizing or area { if (g != null) { //System.Diagnostics.Debug.WriteLine($"Click valid {g.Row}"); MouseClickRowHeader(g.Row, e); } } } else if (e.Button == GLMouseEventArgs.MouseButtons.Right) { if (g != null && dgv.ContextMenuRowHeaders != null) { g.Column = -1; dgv.ContextMenuRowHeaders.Show(FindDisplay(), e.ScreenCoord, opentag: g); } } }
/// <inheritdoc cref="GLOFC.GL4.Controls.GLBaseControl.OnMouseClick(GLMouseEventArgs)"/> protected override void OnMouseClick(GLMouseEventArgs e) { base.OnMouseClick(e); if (e.Button == GLMouseEventArgs.MouseButtons.Left) { OnClick(e); } }
void winCanvas_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e) { if (this.currentControl != null) { GLMouseEventArgs args = e.Translate(); this.currentControl.InvokeEvent(EventType.MouseUp, args); } }
// NOTE: if inherited document had no comment, it does not appear in output! Good! /// <inheritdoc cref="GLOFC.GL4.Controls.GLBaseControl.OnMouseClick(GLMouseEventArgs)"/> protected override void OnMouseClick(GLMouseEventArgs e) // clicking on this needs to see if checkonclick is on { base.OnMouseClick(e); if (!e.Handled && e.Button == GLMouseEventArgs.MouseButtons.Left) { OnClick(); } }
protected override void OnMouseClick(GLMouseEventArgs e) { base.OnMouseClick(e); GLDataGridView dgv = Parent as GLDataGridView; var g = GridRowCol(e.Location); if (e.Button == GLMouseEventArgs.MouseButtons.Left) { if (lastselectionstart == lastselectionend) { if (g != null) { var orgbounds = e.Bounds; var orgbloc = e.BoundsLocation; var orgloc = e.Location; var newcell = CellPara(g, e); // may return null if cell not there newcell?.OnMouseCellClick(e); if (e.Handled == false) // and if it did not, call global click { e.Bounds = orgbounds; e.BoundsLocation = orgbloc; e.Location = orgloc; MouseClickOnGrid(g.Row, g.Column, e); } } else { MouseClickOnGrid(-1, -1, e); } } } else if (e.Button == GLMouseEventArgs.MouseButtons.Right) { if (dgv.ContextMenuGrid != null) { if (g == null) // out of cell, return pos of click { g = new GLDataGridView.RowColPos() { Column = -1, Row = -1, Location = e.Location } } ; else { if (dgv.SelectRowOnRightClick) { dgv.Rows[g.Row].Selected = true; } } dgv.ContextMenuGrid.Show(FindDisplay(), e.ScreenCoord, opentag: g); } } }
protected override void OnMouseLeave(GLMouseEventArgs e) { base.OnMouseLeave(e); if (currentcell != null) { currentcell.OnMouseCellLeave(e); currentcell = null; } }
/// <inheritdoc cref="GLOFC.GL4.Controls.GLBaseControl.OnGlobalMouseClick(GLBaseControl, GLMouseEventArgs)"/> protected override void OnGlobalMouseClick(GLBaseControl ctrl, GLMouseEventArgs e) { base.OnGlobalMouseClick(ctrl, e); // do heirarchy before we mess with it if (InDropDown && (ctrl == null || !IsThisOrChildOf(ctrl))) // if its not part of us, close { Deactivate(); } }
/// <inheritdoc cref="GLOFC.GL4.Controls.GLBaseControl.OnMouseLeave(GLMouseEventArgs)"/> protected override void OnMouseLeave(GLMouseEventArgs e) { base.OnMouseLeave(e); if (!thumbmove && mouseover != MouseOver.MouseOverNone) { mouseover = MouseOver.MouseOverNone; Invalidate(); } }
/// <inheritdoc cref="GLOFC.GL4.Controls.GLBaseControl.OnMouseLeave(GLMouseEventArgs)"/> protected override void OnMouseLeave(GLMouseEventArgs e) { base.OnMouseLeave(e); if (hoveredpos >= 0) { hoveredpos = -1; Invalidate(); } }
private void GLSurface_GLMouseMove(object sender, GLMouseEventArgs e) { try { MouseManager.UpdateLocation(e.Location); if (e.Button.HasFlag(MouseButtons.Left)) { if (CapturedPoint == 1) { if (LoadedResource.PixelPerfect) { LoadedResource.FirePointX += MouseManager.CurrentStepDelta.X; LoadedResource.FirePointY += MouseManager.CurrentStepDelta.Y; FirePointXNumeric.Value = (decimal)LoadedResource.FirePointX; FirePointYNumeric.Value = (decimal)LoadedResource.FirePointY; } else { LoadedResource.FirePointX += MouseManager.CurrentDelta.X; LoadedResource.FirePointY += MouseManager.CurrentDelta.Y; FirePointXNumeric.Value = (decimal)LoadedResource.FirePointX; FirePointYNumeric.Value = (decimal)LoadedResource.FirePointY; } } else if (CapturedPoint == 2) { if (LoadedResource.PixelPerfect) { LoadedResource.FireVectorX += MouseManager.CurrentStepDelta.X; LoadedResource.FireVectorY += MouseManager.CurrentStepDelta.Y; FireVectorXNumeric.Value = (decimal)LoadedResource.FireVectorX; FireVectorYNumeric.Value = (decimal)LoadedResource.FireVectorY; } else { LoadedResource.FireVectorX += MouseManager.CurrentDelta.X; LoadedResource.FireVectorY += MouseManager.CurrentDelta.Y; FireVectorXNumeric.Value = (decimal)LoadedResource.FireVectorX; FireVectorYNumeric.Value = (decimal)LoadedResource.FireVectorY; } } else { OffsetX += MouseManager.CurrentDelta.X; OffsetY += MouseManager.CurrentDelta.Y; } } RepairOffset(); } catch (Exception ex) { MessageBox.Show(this, ex.ToString(), "Error: Can not handle MouseMove event.", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private bool IsOver(GLMouseEventArgs e) { Rectangle drawarea = DrawArea(e.Bounds); Point point = new Point(e.BoundsLocation.X + e.Bounds.X, e.BoundsLocation.Y + e.Bounds.Y); bool inside = drawarea.Contains(point); //System.Diagnostics.Debug.WriteLine($"..Draw area {point} {drawarea} {inside}"); return(inside); }
/// <inheritdoc cref="GLOFC.GL4.Controls.GLBaseControl.OnMouseClick(GLMouseEventArgs)"/> protected override void OnMouseClick(GLMouseEventArgs e) { base.OnMouseLeave(e); if (!e.Handled && e.Button == GLMouseEventArgs.MouseButtons.Left && mouseover != -1) { SelectedTab = mouseover; } }
protected virtual void OnMouseDown(GLMouseEventArgs e) { //System.Diagnostics.Debug.WriteLine("down " + Name + " " + e.Location + " " + e.Button + " " + MouseButtonsDown); MouseDown?.Invoke(this, e); if (InvalidateOnMouseDownUp) { Invalidate(); } }
/// <inheritdoc cref="GLOFC.GL4.Controls.GLDataGridViewCell.OnMouseCellClick(GLMouseEventArgs)"/> public virtual void OnMouseCellClick(GLMouseEventArgs e) { //System.Diagnostics.Debug.WriteLine($"Click in cell {RowParent.Index} {Index} {e.Bounds} {e.BoundsLocation} {e.Location}"); if (IsOver(e)) { e.Handled = true; OnMouseClick(e); } }
protected virtual void OnMouseMove(GLMouseEventArgs e) { //System.Diagnostics.Debug.WriteLine("Over " + Name + " " + e.Location); MouseMove?.Invoke(this, e); if (InvalidateOnMouseMove) { Invalidate(); } }