protected override bool OnMotionNotifyEvent(Gdk.EventMotion evnt) { if (DragGripper < 0) { int gripper = HitGripper((int)evnt.X); if (gripper >= 0 && evnt.Y >= 0 && evnt.Y < TotalHeight) { EventBox.GdkWindow.Cursor = CursorSizing; } else { EventBox.GdkWindow.Cursor = null; } } else { int dx = (int)(evnt.X) - LastDragX; if (dx != 0) { var kvp = mColumns.ElementAt(DragGripper); Widget widget = kvp.Key; Column c = kvp.Value; if (c.Width + dx >= c.MinWidth) { LastDragX = (int)(evnt.X); SetColumnWidth(DragGripper, widget, c.Width + dx); if (ColumnChanged != null) { ColumnChanged(this, null); } } } } return(true); }
void OnMotionNotify(object o, MotionNotifyEventArgs args) { Gdk.EventMotion e = args.Event; int x, y; Gdk.ModifierType state; if (e.IsHint) { this.GdkWindow.GetPointer(out x, out y, out state); } else { x = (int)e.X; y = (int)e.Y; state = e.State; } Gdk.Rectangle alloc = this.Allocation; //Console.WriteLine("x {0} freq {1} width{2}", x, freqWidth, alloc.Width); currentHighlight = (int)((x / (freqWidth * alloc.Width))) + 1; Console.WriteLine(currentHighlight); if (previousHighlight != currentHighlight) { UpdateHighlight(); previousHighlight = currentHighlight; } }
protected override bool OnMotionNotifyEvent(Gdk.EventMotion evnt) { // copied this code from the net // don't really understand it, but for some reason if the event is a hint then // the pointer coords/state must be read using the GetPointer method rather than from the // event itself double x, y; Gdk.ModifierType state = Gdk.ModifierType.None; if (evnt.IsHint) { int ix = 0, iy = 0; evnt.Window.GetPointer(out ix, out iy, out state); x = ix; y = iy; } else { x = evnt.X; y = evnt.Y; state = evnt.State; } _physicalWorkspace.OnMouseMove(ConvertToXMouseEventArgs(_lastButtonPressed, evnt.Type, state, x, y)); return(base.OnMotionNotifyEvent(evnt)); }
protected override bool OnMotionNotifyEvent(Gdk.EventMotion evnt) { // Save the mouse position when moving Mouse.Position = new Point2d(evnt.X, evnt.Y); return(true); }
protected override bool OnMotionNotifyEvent(Gdk.EventMotion evnt) { int x = (int)evnt.X - header_interaction_alloc.X; if (pressed_column_index >= 0 && !pressed_column_is_dragging && Gtk.Drag.CheckThreshold(this, pressed_column_x_start, 0, x, 0)) { pressed_column_is_dragging = true; pressed_column_drag_started = true; InvalidateHeader(); InvalidateList(); } pressed_column_x = x; if (OnMotionNotifyEvent(x)) { return(true); } GdkWindow.Cursor = header_interaction_alloc.Contains((int)evnt.X, (int)evnt.Y) && (resizing_column_index >= 0 || GetColumnForResizeHandle(x) != null) ? resize_x_cursor : null; if (resizing_column_index >= 0) { ResizeColumn(x); } ProxyEventToCell(evnt, false); return(true); }
protected override bool OnMotionNotifyEvent(Gdk.EventMotion ev) { SelectItem(null); Gdk.Point pt = new Gdk.Point((int)ev.X, (int)ev.Y); if (prelight_item != null) { if (prelight_item.Bounds.Contains(pt)) { return(true); } else { LinkItem item = prelight_item; prelight_item = null; QueueDrawArea(item.Bounds.X, item.Bounds.Y, item.Bounds.Width, item.Bounds.Height); } } foreach (Item item in items) { if (item is LinkItem && item.Bounds.Contains(pt)) { prelight_item = item as LinkItem; QueueDrawArea(item.Bounds.X, item.Bounds.Y, item.Bounds.Width, item.Bounds.Height); break; } } return(true); }
protected override bool OnMotionNotifyEvent(Gdk.EventMotion evnt) { SelectedWidget = null; foreach (EventBox child in children) { int x = child.Allocation.X; int y = child.Allocation.Y; int width = child.Allocation.Width; int height = child.Allocation.Height; int e_x = (int)evnt.X + Allocation.X; int e_y = (int)evnt.Y + Allocation.Y; if (e_x >= x && e_x <= x + width && e_y >= y && e_y <= y + height) { SelectedWidget = child; QueueDraw(); break; } } if (SelectedWidget == null) { QueueDraw(); } return(base.OnMotionNotifyEvent(evnt)); }
protected override bool OnMotionNotifyEvent(Gdk.EventMotion evnt) { Link link = GetLinkAtPos(evnt.X, evnt.Y); if (link != null) { if (activeLink == null) { TooltipText = link.Title; GetWindow(Gtk.TextWindowType.Text).Cursor = HandCursor; } else if (activeLink.Title != link.Title) { TooltipText = link.Title; } activeLink = link; } else if (activeLink != null) { activeLink = null; TooltipText = null; SetDefaultCursor(); } if (selectable) { return(base.OnMotionNotifyEvent(evnt)); } return(false); }
protected override bool OnMotionNotifyEvent(Gdk.EventMotion evnt) { int pointerX, pointerY; Gdk.ModifierType pointerMask; Gdk.Window window = GetWindow(TextWindowType.Text); window.GetPointer(out pointerX, out pointerY, out pointerMask); int x, y; this.WindowToBufferCoords(TextWindowType.Widget, pointerX, pointerY, out x, out y); TextIter iter = GetIterAtLocation(x, y); bool hovering = iter.HasTag(linkTag); if (hovering != hoveringOverLink) { hoveringOverLink = hovering; if (hoveringOverLink) { window.Cursor = handCursor; } else { window.Cursor = normalCursor; } } return(base.OnMotionNotifyEvent(evnt)); }
protected override bool OnMotionNotifyEvent(Gdk.EventMotion evnt) { if (DragGripper < 0) { int gripper = HitGripper((int)evnt.X); if (gripper >= 0 && evnt.Y >= 0 && evnt.Y < TotalHeight) { EventBox.GdkWindow.Cursor = CursorSizing; } else { EventBox.GdkWindow.Cursor = null; } } else { int dx = (int)(evnt.X) - LastDragX; Widget widget = GetWidgetFromGripperIndex(DragGripper); if (widget != null) { Column c = mColumns[widget]; if (c != null && c.Width + dx >= c.MinWidth) { LastDragX = (int)(evnt.X); SetColumnWidth(widget, c.Width + dx); if (ColumnChanged != null) { ColumnChanged(this, null); } } } } return(true); }
protected override bool OnMotionNotifyEvent(Gdk.EventMotion evnt) { if (!m_bDragging) // Only respond when the mouse is dragging the marker. { return(false); } int y; y = (int)evnt.Y; y -= 4; // Calculate slider position if (y < 0) { y = 0; } if (y > this.Allocation.Height - 9) { y = this.Allocation.Height - 9; } m_iMarker_Start_Y = y; this.QueueDraw(); ResetHSLRGB(); // Reset the color if (Scroll != null) // Notify anyone who cares that the controls slider(color) has changed { Scroll(this, new EventArgs()); } return(base.OnMotionNotifyEvent(evnt)); }
protected override bool OnMotionNotifyEvent(Gdk.EventMotion evnt) { if (cursor_is_hidden) { if (Math.Abs(hide_cursor_x - evnt.X) > CursorShowMovementThreshold || Math.Abs(hide_cursor_y - evnt.Y) > CursorShowMovementThreshold) { ShowCursor(); ShowControls(); } else { if (cursor_update_position_timeout_id > 0) { GLib.Source.Remove(cursor_update_position_timeout_id); } cursor_update_position_timeout_id = GLib.Timeout.Add(CursorUpdatePositionDelay, OnCursorUpdatePositionTimeout); } } else if (!ControlsActive) { if (hide_cursor_timeout_id > 0) { GLib.Source.Remove(hide_cursor_timeout_id); } hide_cursor_timeout_id = GLib.Timeout.Add(CursorHideDelay, OnHideCursorTimeout); } return(base.OnMotionNotifyEvent(evnt)); }
public override void ProcessDragBegin(Gdk.DragContext ctx, Gdk.EventMotion evt) { if (HasSubmenu) { HideSubmenu(); } base.ProcessDragBegin(ctx, evt); }
private void base_MotionNotifyEvent(object sender, Gtk.MotionNotifyEventArgs args) { Gdk.EventMotion em = args.Event; if (debug) { Console.Out.WriteLine("Motion event: nodeDragging {0}, user coords {1},{2}", nodeDragging, em.X, em.Y); } double mouseX = em.X; double mouseY = em.Y; DeviceToUser(ref mouseX, ref mouseY); PointD thePoint = new PointD(mouseX, mouseY); hoverNode = null; foreach (Network network in networkZOrder) { foreach (Node n in network.Nodes.Values) { if (n.Properties.ContainsKey("position")) { PointD np = (PointD)n.Properties["position"]; if (Inside(thePoint, np, AvatarSizeD)) { hoverNode = n; break; } } } } //if (debug) Console.Out.WriteLine ("MotionNotifyEventHandler called!"); if (!nodeDragging) { if (debug) { Console.Out.WriteLine("not nodedragging motion!"); } this.QueueDraw(); return; } mouseX = em.X; mouseY = em.Y; double deltaX, deltaY; deltaX = mouseX - nodeDraggingLastX; deltaY = mouseY - nodeDraggingLastY; PointD pos = selectedGroup.Position; pos.X += (deltaX / this.ScaleFactor); pos.Y += (deltaY / this.ScaleFactor); nodeDraggingLastX = em.X; nodeDraggingLastY = em.Y; selectedGroup.Position = pos; this.QueueDraw(); }
protected override bool OnMotionNotifyEvent(Gdk.EventMotion mea) { bool ret = base.OnMotionNotifyEvent(mea); bool bContentModified = false; if ((mea.X > CloseBitmapLocation.X) & (mea.X < CloseBitmapLocation.X + CloseBitmapSize.Width) & (mea.Y > CloseBitmapLocation.Y) & (mea.Y < CloseBitmapLocation.Y + CloseBitmapSize.Height) & CloseClickable) { if (!bIsMouseOverClose) { bIsMouseOverClose = true; bIsMouseOverTitle = false; bIsMouseOverContent = false; this.GdkWindow.Cursor = new Gdk.Cursor(Gdk.CursorType.Hand1); bContentModified = true; } } else if (RealContentRectangle.Contains(new Point((int)mea.X, (int)mea.Y)) & ContentClickable) { if (!bIsMouseOverContent) { bIsMouseOverClose = false; bIsMouseOverTitle = false; bIsMouseOverContent = true; this.GdkWindow.Cursor = new Gdk.Cursor(Gdk.CursorType.Hand1); bContentModified = true; } } else if (RealTitleRectangle.Contains(new Point((int)mea.X, (int)mea.Y)) & TitleClickable) { if (!bIsMouseOverTitle) { bIsMouseOverClose = false; bIsMouseOverTitle = true; bIsMouseOverContent = false; this.GdkWindow.Cursor = new Gdk.Cursor(Gdk.CursorType.Hand1); bContentModified = true; } } else { if (bIsMouseOverClose | bIsMouseOverTitle | bIsMouseOverContent) { bContentModified = true; } bIsMouseOverClose = false; bIsMouseOverTitle = false; bIsMouseOverContent = false; this.GdkWindow.Cursor = null; } if (bContentModified) { Refresh(true); } return(ret); }
protected override bool OnMotionNotifyEvent(Gdk.EventMotion evnt) { int winWidth, winHeight; GdkWindow.GetSize(out winWidth, out winHeight); curMouseY = (int)evnt.Y; Selection = GetRowByPosition(curMouseY); return(base.OnMotionNotifyEvent(evnt)); }
public bool MotionEvent(int x, int y, Gdk.EventMotion evnt) { if (last_pressed_bound == BoundObject) { Points.Add(new Gdk.Point(x, y)); return(true); } return(false); }
protected override bool OnMotionNotifyEvent(Gdk.EventMotion e) { int winWidth, winHeight; this.GdkWindow.GetSize(out winWidth, out winHeight); Selection = GetRowByPosition((int)e.Y); return(base.OnMotionNotifyEvent(e)); }
protected override bool OnMotionNotifyEvent(Gdk.EventMotion evnt) { if (!pressing) { return(false); } entry.SetValueFromPosition(TransformX(evnt.X)); return(true); }
public bool MotionEvent(int x, int y, Gdk.EventMotion evnt) { if (last_hover_bound == BoundObjectParent) { return(false); } last_hover_bound = BoundObjectParent; return(true); }
protected override bool OnMotionNotifyEvent(Gdk.EventMotion evnt) { var so = starRect.Contains(Allocation.X + (int)evnt.X, Allocation.Y + (int)evnt.Y); if (so != mouseOverStar) { mouseOverStar = so; QueueDraw(); } return(base.OnMotionNotifyEvent(evnt)); }
protected override bool OnMotionNotifyEvent(Gdk.EventMotion evnt) { TreePath path; //We want effect that when user has mouse button pressed and is moving over tree to autoselect exception if (evnt.State == Gdk.ModifierType.Button1Mask && GetPathAtPos((int)evnt.X, (int)evnt.Y, out path)) { Selection.SelectPath(path); } return(base.OnMotionNotifyEvent(evnt)); }
protected override bool OnMotionNotifyEvent(Gdk.EventMotion evnt) { if (TypeValidator.IsCompatible(this.GetType(), typeof(IEditable)) == true) { if ((this as IEditable).Editable == false) { return(base.OnMotionNotifyEvent(evnt)); } } MouseOverCell = box.CellAtCoordinates(System.Convert.ToInt32(evnt.X), System.Convert.ToInt32(evnt.Y)); return(base.OnMotionNotifyEvent(evnt)); }
protected override bool OnMotionNotifyEvent(Gdk.EventMotion evnt) { if (evnt.State.HasFlag(Gdk.ModifierType.Button1Mask)) { HighlightColor = GetColorAtPosition((int)evnt.X, (int)evnt.Y); if (HighlightColor.HasValue) { SelectedColor = HighlightColor.Value; } } return(base.OnMotionNotifyEvent(evnt)); }
protected override bool OnMotionNotifyEvent(Gdk.EventMotion evnt) { if (mouse_down && mouse_button == 1) { SelectNewDarkTone(evnt.X, evnt.Y); } else if (mouse_down && mouse_button == 3) { SelectNewLightTone(evnt.X, evnt.Y); } return(base.OnMotionNotifyEvent(evnt)); }
protected override bool OnMotionNotifyEvent(Gdk.EventMotion evnt) { if (getIndexFromX(evnt.X) != -1) { this.GdkWindow.Cursor = new Gdk.Cursor(Gdk.CursorType.Hand1); } else { this.GdkWindow.Cursor = new Gdk.Cursor(Gdk.CursorType.Arrow); } return(base.OnMotionNotifyEvent(evnt)); }
protected override bool OnMotionNotifyEvent(Gdk.EventMotion evnt) { if (isLeftDown) { transformX += evnt.X - lastMouseX; transformY += evnt.Y - lastMouseY; QueueDraw(); } lastMouseX = evnt.X; lastMouseY = evnt.Y; return(base.OnMotionNotifyEvent(evnt)); }
protected override bool OnMotionNotifyEvent(Gdk.EventMotion evnt) { var item = GetItemAt(evnt.X, evnt.Y); if (item == null && selectedItem != null || item != null && selectedItem == null || item != null && !item.Equals(selectedItem)) { selectedItem = item; ShowTooltip(); QueueDraw(); } return(base.OnMotionNotifyEvent(evnt)); }
public static TEMouseArgs ToTEMouseArgs(this Gdk.EventMotion e) { return(new TEMouseArgs() { ClickCount = e.Type == Gdk.EventType.ButtonPress ? 1 : e.Type == Gdk.EventType.TwoButtonPress ? 2 : e.Type == Gdk.EventType.ThreeButtonPress ? 3 : 0, Handled = false, //LeftButtonPressed = e. == MouseButtonConsts.Left, // todo //RightButtonPressed = e.Button == MouseButtonConsts.Right, //MiddleButtonPressed = e.Button == MouseButtonConsts.Middle }); }
///<summary>Handle mouse motion</summary> internal void OnMotionNotify(object o, MotionNotifyEventArgs args) { Gdk.EventMotion e = args.Event; Gtk.DrawingArea da = (Gtk.DrawingArea)o; int x, y; Gdk.ModifierType state; if (e.IsHint) { da.GdkWindow.GetPointer(out x, out y, out state); } else { x = (int)e.X; y = (int)e.Y; state = e.State; } // if left mouse button is not down if ((state & Gdk.ModifierType.Button1Mask) == 0) { return; } // find in which area the pointer is Area clickArea = GetAreaByXY(x, y); if (clickArea == null) { return; } // get the position in the file Position pos = new Position(); CalculatePosition(clickArea, (int)(x - clickArea.X), (int)(y - clickArea.Y), ref pos); // update selection and cursor if they have changed externally UpdateSelection(pos.First != pos.Second); // Evaluate selection before moving the cursor // for better visual result selEndPos = pos; // give the focus to the appropriate area // do this before setting the new cursor/selection UpdateFocus(clickArea); EvaluateSelection(DataViewDisplay.ShowType.Closest); }