void HandleMotionNotifyEvent(object o, MotionNotifyEventArgs args) { if (hoverTimerID != 0) { GLib.Source.Remove(hoverTimerID); hoverTimerID = 0; } hoverTimerID = GLib.Timeout.Add(100, EmitShowTooltip); widget.HasTooltip = false; lastX = args.Event.X; lastY = args.Event.Y; if (MotionEvent != null) { if (!inButtonPress || canMove) { MotionEvent(new Point(lastX, lastY)); } } }
void HandleMotionNotifyEvent(object o, MotionNotifyEventArgs args) { TreeIter iter; if (!elementsTreeview.Selection.GetSelected(out iter)) { return; } Gdk.Rectangle rect = elementsTreeview.GetCellArea(elementsStore.GetPath(iter), elementsTreeview.GetColumn(0)); int x, y; this.GdkWindow.GetOrigin(out x, out y); x += rect.X; y += rect.Y; if (this.tooltipWindow == null || ox != x || oy != y) { ShowTooltipForSelectedEntry(); ox = x; oy = y; } }
protected override void OnMouseMove(object o, MotionNotifyEventArgs args, Cairo.PointD point) { ctrlKey = (args.Event.State & ModifierType.ControlMask) != 0; lastMousePosition = point.ToGdkPoint(); // If we're dragging the text around, do that if (tracking) { Cairo.PointD delta = new Cairo.PointD(point.X - startMouseXY.X, point.Y - startMouseXY.Y); clickPoint = new Point((int)(startClickPoint.X + delta.X), (int)(startClickPoint.Y + delta.Y)); CurrentTextEngine.Origin = clickPoint; RedrawText(true, true); } else { UpdateMouseCursor(); } }
private void OnMotionNotify(object o, MotionNotifyEventArgs args) { try { Vector pos = new Vector((float)args.Event.X, (float)args.Event.Y); MousePos = MouseToWorld(pos); if (dragging) { SetTranslation(dragStartTranslation + (pos - dragStartMouse) / Zoom); } else if (Editor != null) { Editor.OnMouseMotion(MousePos, args.Event.State); } args.RetVal = true; } catch (Exception e) { ErrorDialog.Exception(e); } }
static void HandleMotionNotifyEvent(object o, MotionNotifyEventArgs args) { TreeView tree = (TreeView)o; TreeViewTooltipsData data; if (!treeData.TryGetValue(tree, out data)) { return; } HideTooltip(tree); int cx, cy; TreePath path; TreeViewColumn col; if (!tree.GetPathAtPos((int)args.Event.X, (int)args.Event.Y, out path, out col, out cx, out cy)) { return; } data.Path = path; data.ShowTimer = GLib.Timeout.Add(300, delegate { data.ShowTimer = 0; int ox, oy; tree.BinWindow.GetOrigin(out ox, out oy); Gdk.Rectangle rect = tree.GetCellArea(path, col); data.Tooltip = new CellTooltipWindow(tree, col, path); if (rect.X + data.Tooltip.SizeRequest().Width > tree.Allocation.Width) { data.Tooltip.Move(ox + rect.X - 1, oy + rect.Y); data.Tooltip.ShowAll(); } else { data.Tooltip.Destroy(); data.Tooltip = null; } return(false); }); }
protected void OnMoveMouse(object o, MotionNotifyEventArgs args) { int x, y; Gdk.ModifierType state; args.Event.Window.GetPointer(out x, out y, out state); int nextHoveringIndex; if (IsInBounds(x, y)) { Cairo.Point p = GetGridPosition(x, y); nextHoveringIndex = p.X + p.Y * Width; } else { nextHoveringIndex = -1; } if (nextHoveringIndex != hoveringIndex) { // Update hovering cursor Cairo.Rectangle rect = GetTileRectWithPadding(HoveringX, HoveringY); this.QueueDrawArea((int)rect.X, (int)rect.Y, (int)rect.Width, (int)rect.Height); hoveringIndex = nextHoveringIndex; rect = GetTileRectWithPadding(HoveringX, HoveringY); this.QueueDrawArea((int)rect.X, (int)rect.Y, (int)rect.Width, (int)rect.Height); if (HoverChangedEvent != null) { HoverChangedEvent(this, hoveringIndex); } // Drag actions if (activeAction != null && activeAction.mod.HasFlag(MouseModifier.Drag) && IsInBounds(x, y)) { HandleTileGridAction(activeAction, nextHoveringIndex); } } }
//Updates every time the mouse is moved while button is pressed void OnMouseMotion(object source, MotionNotifyEventArgs args) { if (isDrawing) { End.X = args.Event.X; End.Y = args.Event.Y; using (Context ctx = new Context(surface)) { //Reset of end's points so there are no accidental if (isDot) { Start.X = args.Event.X; Start.Y = args.Event.Y; } Painter(ctx, Start, End); ((IDisposable)ctx.GetTarget()).Dispose(); ((IDisposable)ctx).Dispose(); } dArea.QueueDraw(); } }
private void OnMotionNotify(object o, MotionNotifyEventArgs args) { if (OnMouseMove != null && field != null) { // Generate OnMouseMove events. FieldPoint p; p.X = (uint)Math.Max(0, args.Event.X); p.Y = (uint)Math.Max(0, args.Event.Y); if (!Calc.ScreenPosToFieldPos(ref p, field, zoomLevel)) { OnMouseMove(this, -1, -1); } else { OnMouseMove(this, (int)p.X, (int)p.Y); } } if (creatingSelection) { // Update selection. RedrawFieldRegion(selection); FieldPoint p; p.X = (uint)Math.Max(0, args.Event.X); p.Y = (uint)Math.Max(0, args.Event.Y); Calc.ScreenPosToFieldPos(ref p, field, zoomLevel); selection.SetEndPoint(p.X, p.Y); RedrawFieldRegion(selection); if (OnSelectionChanged != null) { OnSelectionChanged(this, selection); } } }
/// <summary>Mouse has been moved</summary> private void OnMouseMove(object o, MotionNotifyEventArgs args) { try { // Get the point clicked by the mouse. PointD movePoint = new PointD(args.Event.X, args.Event.Y); // If an object is under the mouse then move it if (mouseDown && selectedObject != null) { lastPos.X = movePoint.X; lastPos.Y = movePoint.Y; selectedObject.Location = movePoint; // Redraw area. (o as DrawingArea).QueueDraw(); } } catch (Exception err) { ShowError(err); } }
void MotionHandler(object o, MotionNotifyEventArgs args) { Gdk.EventMotion pos = args.Event; int pixc = (int)pos.X % cell_width; int pixr = (int)pos.Y % cell_height; mouse_col = (int)pos.X / cell_width; mouse_row = top_row * visible_cols + (int)pos.Y / cell_height; if (((pixc > x_margin && pixc < (cell_width - x_margin)) && (pixr > y_margin && pixr < (cell_height - y_margin)))) { highlight_mouse = true; } else { highlight_mouse = false; } //Console.WriteLine ("File: " + ((DirectoryProvider) provider).images [ItemAt (mouse_col, mouse_row)].File); //DrawCell (mouse_col, mouse_row); }
private void ChildMotionNotifyEventHandler(object sender, MotionNotifyEventArgs args) { NodeViewChild child = GetChild((Widget)sender); Debug.Assert(child != null); if (_action == NodeViewAction.None) { bool inside = PointInRectangle(child.SouthEast, (int)args.Event.X, (int)args.Event.Y); NodeCursorSet(inside ? NodeViewAction.Resize : NodeViewAction.None); } if ((args.Event.State & ModifierType.Button1Mask) != 0) { if (_action == NodeViewAction.DragChild) { ((Node)child.Child).BlockExpander(); MoveChild(child, (int)args.Event.X - child.DragStart.X, (int)args.Event.Y - child.DragStart.Y); } if (_action == NodeViewAction.Resize) { int w = (int)args.Event.X - child.Rectangle.X - child.DragDelta.X; int h = (int)args.Event.Y - child.Rectangle.Y - child.DragDelta.Y; child.Rectangle.Width = Math.Max(0, w); child.Rectangle.Height = Math.Max(0, h); child.Width = child.Rectangle.Width; child.Height = child.Rectangle.Height; child.Child.QueueResize(); QueueDraw(); } } args.RetVal = true; }
private void OnYHeaderMotionNotifyEvent(object o, MotionNotifyEventArgs a) { int x = (int)a.Event.X; if (o == tda) { x += LeftWidth; } (o as Widget).GdkWindow.Cursor = drag_col >= 0 || DragX(x) >= 0 ? new Cursor(CursorType.SbHDoubleArrow) : null; if (drag_col >= 0 && x > ColumnX(drag_col) + 12) { int prev_width = (int)widths[drag_col]; widths[drag_col] = x - ColumnX(drag_col); /** * make sure that we don't cause the grid's size request * to increase **/ if (drag_col <= XSpan && ColumnX(XSpan) + (int)widths[XSpan] + (XSpan + 1 < widths.Count ? (int)widths[XSpan + 1] : 0) + BorderWidth + (vbar.Visible ? vbar.SizeRequest().Width : 0) + 6 >= Allocation.Width) { widths[drag_col] = prev_width; return; } UpdateDrawingAreaSizeRequests(); } }
private void OnWindowMotionEvent(object o, MotionNotifyEventArgs args) // a.k.a. move { try { switch (args.Event.Type) { case Gdk.EventType.MotionNotify: var properties = BuildProperties(args.Event); var modifiers = GetKeyModifiers(); _ownerEvents.RaisePointerMoved( new PointerEventArgs( new Windows.UI.Input.PointerPoint( frameId: GetNextFrameId(), timestamp: args.Event.Time, device: PointerDevice.For(PointerDeviceType.Mouse), pointerId: 0, rawPosition: new Windows.Foundation.Point(args.Event.X, args.Event.Y), position: new Windows.Foundation.Point(args.Event.X, args.Event.Y), isInContact: properties.HasPressedButton, properties: properties ), modifiers ) ); break; default: Console.WriteLine($"Unknown event: {args.Event.State}"); break; } } catch (Exception e) { this.Log().Error("Failed to raise PointerMoved", e); } }
/// <summary> /// Called when the mouse pointer has moved. /// </summary> public void OnMotion(MotionNotifyEventArgs args) { ModifierType modifierMask = Accelerator.DefaultModMask; bool ctrl = (args.Event.State & modifierMask) == ModifierType.ControlMask; bool shift = (args.Event.State & modifierMask) == ModifierType.ShiftMask; bool middleMouse = (args.Event.State & ModifierType.Button2Mask) != 0; if (middleMouse && !m_easing) { // get the amount the mouse has moved since last event Vector2d newMousePos = new Vector2d(args.Event.X, args.Event.Y); Vector2d delta = newMousePos - m_lastMousePos; m_lastMousePos = newMousePos; if (ctrl) // zoom { ZoomCamera((float)delta.Y * m_zoom * DRAG_ZOOM_SENSITIVITY); } else if (shift) // pan { // scale sensitivity by the vertical resolution when panning int resX, resY; m_camera.GetResolution(out resX, out resY); float sensitivity = m_zoom * (DRAG_PAN_SENSITIVITY / resY); m_camPivot.LocalPosition += m_camPivot.Right * (float)delta.X * sensitivity; m_camPivot.LocalPosition += m_camPivot.Up * (float)delta.Y * sensitivity; } else // rotate { YawCamera((float)delta.X * -DRAG_ROTATE_SENSITIVITY); PitchCamera((float)delta.Y * -DRAG_ROTATE_SENSITIVITY); } } }
protected override void OnMouseMove(object o, MotionNotifyEventArgs args, Cairo.PointD point) { Document doc = PintaCore.Workspace.ActiveDocument; if (!is_drawing) { CheckHandlerCursor(point); return; } double x = Utility.Clamp(point.X, 0, doc.ImageSize.Width - 1); double y = Utility.Clamp(point.Y, 0, doc.ImageSize.Height - 1); controls[active_control.Value].HandleMouseMove(x, y, args.Event.State); ReDraw(args.Event.State); if (doc.Selection != null) { SelectionModeHandler.PerformSelectionMode(combine_mode, DocumentSelection.ConvertToPolygonSet(doc.Selection.SelectionPolygons)); PintaCore.Workspace.Invalidate(); } }
private void OnMotionNotify(object o, MotionNotifyEventArgs args) { if (tilegroup == null) { return; } Vector MousePos = new Vector((float)args.Event.X, (float)args.Event.Y); int newtile = PosToTile(MousePos); if (newtile != hovertile) { if (multiselectInProgress) { MultiSelect(MousePos, StartPos); } else { QueueDraw(); } } hovertile = newtile; }
protected void OnDrawingareaMotionNotifyEvent(object o, MotionNotifyEventArgs args) { toolbar.OnButtonMotionEvent(args.Event); }
void HandleKeyTreeMotionNotifyEvent(object o, MotionNotifyEventArgs args) { HandleKeyTreeMotion(args.Event.X, args.Event.Y); }
void HandleTreeMotionNotifyEvent(object o, MotionNotifyEventArgs args) { PlacePinWindow(); }
void MotionNotify(object sender, MotionNotifyEventArgs args) { TextView view = sender as TextView; int x, y; Gdk.ModifierType state; view.WindowToBufferCoords (TextWindowType. Widget, (int) args.Event.X, (int) args.Event.Y, out x, out y); SetCursorIfAppropriate (view, x, y); view.GdkWindow.GetPointer (out x, out y, out state); }
void OnMotionNotify(object o, MotionNotifyEventArgs args) { OnMove((o as Preview).GetXY(args)); }
// // // // // // // // // // // // // // // // // // // // // // // // // // // // // UPDATE MOUSE POSITION // // // // // // // // // // // // // // // // // // // // // // // // // // // // // protected void OnMainDrawingAreaMotionNotifyEvent(object o, MotionNotifyEventArgs args) { WidgetContainer.CheckAllWidgetHover(args.Event.X, args.Event.Y, false); }
void HandleOwnerMotionNotifyEvent(object o, MotionNotifyEventArgs args) { ExternalDragActive = false; }
protected void OnTitlebarMotionNotifyEvent(object sender, MotionNotifyEventArgs args) { this.RedrawControls(GetState(args.Event.X, args.Event.Y, _closeStart, _titleBarMouseDown, _closeState), GetState(args.Event.X, args.Event.Y, _minimizeStart, _titleBarMouseDown, _minimizeState), false); }
void HandleMotionNotifyEvent(object o, MotionNotifyEventArgs args) { this.mouse_loc.X = args.Event.X; this.mouse_loc.Y = args.Event.Y; this.QueueDraw(); }
private void OnMotion(object sender, MotionNotifyEventArgs e) { e.RetVal = CommonHandler(sender, SKTouchAction.Moved, e.Event); }
void MotionNotifyHandler(object obj, MotionNotifyEventArgs args) { _tt.DoWork(args.Event.X, args.Event.Y, _list.Selected, _cm); }
private void DrawingArea_MotionNotifyEvent(object o, MotionNotifyEventArgs args) { CurrentTool?.MouseMoved(this, new Vector2d(args.Event.X, args.Event.Y)); }
protected void effectMotion(object o, MotionNotifyEventArgs args) { setStatus("Позиция указателя на полотне (в пикселях): {0}; {1}", args.Event.X, args.Event.Y); }
private void PictureBox_MotionNotifyEvent(object o, MotionNotifyEventArgs args) { var e = args.Event; ChangeColor(o as ScaledImage, (int)e.X, (int)e.Y); }
void OnMouseMotionEvent(object o, MotionNotifyEventArgs ev_args) { SendMouseEvent(ev_args.Event.X, ev_args.Event.Y, MouseEventType.Move); }
void OnMotionNotify(object sender, MotionNotifyEventArgs args) { int x, y; int px, py; GetPointer (out px, out py); ConvertToGraphCoords (px, py, out x, out y); SetCursorIfAppropriate (x, y); }