internal void FireDrag(Gdk.EventMotion evt, int dx, int dy) { if (Drag != null) { Drag(evt, dx, dy); } }
static void MotionNotifyEvent(object obj, MotionNotifyEventArgs args) { int x, y; Gdk.ModifierType state; Gdk.EventMotion ev = args.Event; Gdk.Window window = ev.Window; if (ev.IsHint) { Gdk.ModifierType s; window.GetPointer(out x, out y, out s); state = s; } else { x = (int)ev.X; y = (int)ev.Y; state = ev.State; } if ((state & Gdk.ModifierType.Button1Mask) != 0 && pixmap != null) { DrawBrush(x, y, true); } else if ((state & Gdk.ModifierType.Button3Mask) != 0 && pixmap != null) { DrawBrush(x, y, false); } args.RetVal = true; }
protected override bool OnMotionNotifyEvent(Gdk.EventMotion em) { bool result = base.OnMotionNotifyEvent(em); // if (debug) Console.Out.WriteLine ("ZoomableCairoArea: OnMotionNotifyEvent at {0}, {1}", em.X, em.Y); this.currentMouseX = em.X; this.currentMouseY = em.Y; this.isScrollWheelScaling = false; if (this.isTranslating) { double deltaX, deltaY; deltaX = this.currentMouseX - this.lastMouseX; deltaY = this.currentMouseY - this.lastMouseY; this.transformMatrix.Translate(deltaX / this.ScaleFactor, deltaY / this.ScaleFactor); } else if (this.isScaling) { double scaleAdj = 1.0 - ((this.currentMouseY - this.lastMouseY) * 0.005); ValidateScaleAdj(ref scaleAdj); this.transformMatrix.Translate(mousePressedUserX, mousePressedUserY); this.transformMatrix.Scale(scaleAdj, scaleAdj); this.transformMatrix.Translate(-mousePressedUserX, -mousePressedUserY); } this.lastMouseX = this.currentMouseX; this.lastMouseY = this.currentMouseY; this.QueueDraw(); return(result); }
protected override bool OnMotionNotifyEvent(Gdk.EventMotion e) { int xpos = 0; int ypos = 0; HideTooltipWindow(); var oldItem = mouseOverItem; mouseOverItem = null; this.mouseX = (int)e.X + (int)(this.hAdjustement != null ? this.hAdjustement.Value : 0); this.mouseY = (int)e.Y + (int)(this.vAdjustement != null ? this.vAdjustement.Value : 0); Iterate(ref xpos, ref ypos, delegate(Category category, Gdk.Size itemDimension) { if (xpos <= mouseX && mouseX <= xpos + itemDimension.Width && ypos <= mouseY && mouseY <= ypos + itemDimension.Height) { mouseOverItem = category; ShowTooltip(mouseOverItem, TipTimer, (int)e.X + 2, (int)e.Y + 16); } }, delegate(Category curCategory, Item item, Gdk.Size itemDimension) { if (xpos <= mouseX && mouseX <= xpos + itemDimension.Width && ypos <= mouseY && mouseY <= ypos + itemDimension.Height) { mouseOverItem = item; ShowTooltip(mouseOverItem, TipTimer, (int)e.X + 2, (int)e.Y + 16); } }); if (oldItem != mouseOverItem) { this.QueueDraw(); } return(base.OnMotionNotifyEvent(e)); }
protected override bool OnMotionNotifyEvent(Gdk.EventMotion args) { double x = args.X + action.X; double y = args.Y + action.Y; //Rectangle box = glass.Bounds (); //Console.WriteLine ("please {0} and {1} in box {2}", x, y, box); if (glass == null) { return(base.OnMotionNotifyEvent(args)); } if (glass.Dragging) { glass.UpdateDrag(x, y); } else if (min_limit.Dragging) { min_limit.UpdateDrag(x, y); } else if (max_limit.Dragging) { max_limit.UpdateDrag(x, y); } else { glass.State = glass.Contains(x, y) ? StateType.Prelight : StateType.Normal; min_limit.State = min_limit.Contains(x, y) ? StateType.Prelight : StateType.Normal; max_limit.State = max_limit.Contains(x, y) ? StateType.Prelight : StateType.Normal; } return(base.OnMotionNotifyEvent(args)); }
protected override bool OnMotionNotifyEvent(Gdk.EventMotion args) { base.OnMotionNotifyEvent(args); this.GdkWindow.Cursor = busy; hide.Start(); return(true); }
protected override bool OnWidgetEvent (Gdk.Event evnt) { // This method is hooked to block the event as soon as possible if required if(evnt.Window.Equals (this.GdkWindow)) { switch(evnt.Type) { case Gdk.EventType.ButtonPress: case Gdk.EventType.ButtonRelease: case Gdk.EventType.ThreeButtonPress: case Gdk.EventType.TwoButtonPress: Gdk.EventButton eb = new Gdk.EventButton (evnt.Handle); return PropagateEventGivenCoordinate (evnt, eb.X, eb.XRoot, eb.Y, eb.YRoot); case Gdk.EventType.MotionNotify: Gdk.EventMotion em = new Gdk.EventMotion (evnt.Handle); return PropagateEventGivenCoordinate (evnt, em.X, em.XRoot, em.Y, em.YRoot); case Gdk.EventType.LeaveNotify: foreach(Widget w in lastHoveredWidgets) { w.ProcessEvent (evnt); } lastHoveredWidgets.Clear(); return base.OnWidgetEvent (evnt); } } return base.OnWidgetEvent (evnt); }
protected override bool OnMotionNotifyEvent(Gdk.EventMotion evnt) { bool res = base.OnMotionNotifyEvent(evnt); UpdateLanguageItemWindow(); return(res); }
protected override bool OnWidgetEvent(Gdk.Event evnt) { // This method is hooked to block the event as soon as possible if required if (evnt.Window.Equals(this.GdkWindow)) { switch (evnt.Type) { case Gdk.EventType.ButtonPress: case Gdk.EventType.ButtonRelease: case Gdk.EventType.ThreeButtonPress: case Gdk.EventType.TwoButtonPress: Gdk.EventButton eb = new Gdk.EventButton(evnt.Handle); return(PropagateEventGivenCoordinate(evnt, eb.X, eb.XRoot, eb.Y, eb.YRoot)); case Gdk.EventType.MotionNotify: Gdk.EventMotion em = new Gdk.EventMotion(evnt.Handle); return(PropagateEventGivenCoordinate(evnt, em.X, em.XRoot, em.Y, em.YRoot)); case Gdk.EventType.LeaveNotify: foreach (Widget w in lastHoveredWidgets) { w.ProcessEvent(evnt); } lastHoveredWidgets.Clear(); return(base.OnWidgetEvent(evnt)); } } return(base.OnWidgetEvent(evnt)); }
protected override bool OnMotionNotifyEvent(Gdk.EventMotion e) { int xpos = 0; int ypos = 0; HideTooltipWindow(); var oldItem = mouseOverItem; mouseOverItem = null; Gdk.Rectangle newItemExtents = Gdk.Rectangle.Zero; this.mouseX = (int)e.X + (int)(this.hAdjustement != null ? this.hAdjustement.Value : 0); this.mouseY = (int)e.Y + (int)(this.vAdjustement != null ? this.vAdjustement.Value : 0); Iterate(ref xpos, ref ypos, (category, itemDimension) => { if (xpos <= mouseX && mouseX <= xpos + itemDimension.Width && ypos <= mouseY && mouseY <= ypos + itemDimension.Height) { mouseOverItem = category; GdkWindow.Cursor = handCursor; if (!e.State.HasFlag(ModifierType.Button1Mask)) { ShowTooltip(mouseOverItem, TipTimer, (int)e.X + 2, (int)e.Y + 16); } newItemExtents = new Gdk.Rectangle(xpos, ypos, itemDimension.Width, itemDimension.Height); return(false); } return(true); }, (curCategory, item, itemDimension) => { if (xpos <= mouseX && mouseX <= xpos + itemDimension.Width && ypos <= mouseY && mouseY <= ypos + itemDimension.Height) { mouseOverItem = item; GdkWindow.Cursor = null; if (!e.State.HasFlag(ModifierType.Button1Mask)) { ShowTooltip(mouseOverItem, TipTimer, (int)e.X + 2, (int)e.Y + 16); } newItemExtents = new Gdk.Rectangle(xpos, ypos, itemDimension.Width, itemDimension.Height); return(false); } return(true); }); if (mouseOverItem == null) { GdkWindow.Cursor = null; } if (oldItem != mouseOverItem) { this.QueueDraw(); var oldItemExtents = GetItemExtends(oldItem); QueueDrawArea(oldItemExtents.X, oldItemExtents.Y, oldItemExtents.Width, oldItemExtents.Height); QueueDrawArea(newItemExtents.X, newItemExtents.Y, newItemExtents.Width, newItemExtents.Height); } return(base.OnMotionNotifyEvent(e)); }
public void SendManualUpdate(Gdk.EventMotion evnt) { if (Math.Abs(evnt.XRoot - Cursor.X) > 100 || Math.Abs(evnt.YRoot - Cursor.Y) > 100) { OnTimerTick(); return; } Update(evnt.Window.Screen, (int)evnt.XRoot, (int)evnt.YRoot, evnt.State); }
public override void MouseDrag(MouseEvent ev) { if (active) { Gdk.EventMotion motion = ev.GdkEvent as Gdk.EventMotion; View.ScrollCanvas((int)(last_point.X - motion.XRoot), (int)(last_point.Y - motion.YRoot)); last_point = new PointD(motion.XRoot, motion.YRoot); } }
protected override bool OnMotionNotifyEvent(Gdk.EventMotion args) { // // We look for motion events on the popup window so that // if the pointer manages to get over the window we can // Update the image properly and/or get out of the way. // UpdateItem(); return(false); }
protected override bool OnMotionNotifyEvent(Gdk.EventMotion e) { Margin margin = GetMarginAtX((int)e.X); if (margin != null) { margin.MouseHover(new MarginMouseEventArgs(this, pressedButton, (int)(e.X - margin.XOffset), (int)e.Y, EventType.MotionNotify, e.State)); } return(base.OnMotionNotifyEvent(e)); }
private void OnMotionNotifyEvent(object sender, MotionNotifyEventArgs a) { Gdk.EventMotion ev = a.Event; //if ((ev.State & Gdk.ModifierType.Button1Mask) != 0) { if (button1Pressed) { mouseMode = GLWidget.MouseOpMode.Drag; GdkWindow.Cursor = cursorDrag; } else { mouseMode = GLWidget.MouseOpMode.None; GdkWindow.Cursor = cursorCross; } /* * testX = (float) (ev.X - width / 2f) / width *2f ; * testY = (float) -(ev.Y - height/ 2f) / height*2f ; * Console.WriteLine("state: "+ev.State.ToString()); */ switch (mouseMode) { case MouseOpMode.Drag: int ix, iy; double x, y; Gdk.ModifierType m; // Find the current mouse X and Y positions if (ev.IsHint) { ev.Window.GetPointer(out ix, out iy, out m); x = (double)ix; y = (double)iy; } else { x = ev.X; y = ev.Y; } cameraAngleX += (float)(x - beginX); cameraAngleY += (float)(y - beginY); // Reset the "old" X and Y positions beginX = x; beginY = y; break; } mX = ev.X; mY = ev.Y; Redraw(); }
protected virtual void OnMotionNotifyEvent(object o, Gtk.MotionNotifyEventArgs args) { if (test_running) { Gdk.ModifierType state; Gdk.EventMotion ev = args.Event; Gdk.Window window = ev.Window; test.StoreMousePosition(ev.X, ev.Y); args.RetVal = true; } }
/** * Invoked when mouse moves across window */ protected void OnMainDrawingAreaMotionNotifyEvent(object o, Gtk.MotionNotifyEventArgs args) { Gdk.EventMotion e = args.Event; if (transport.isConnected() && sessionClient.GetSessionId() != 0) { if (inputClient.Active) { inputClient.SendMouseMotionEvent((int)e.X, (int)e.Y); } } }
protected override bool OnMotionNotifyEvent(Gdk.EventMotion e) { if (dragging) { int newpos = (dockGroup.Type == DockGroupType.Horizontal) ? (int)e.XRoot : (int)e.YRoot; if (newpos != dragPos) { int nsize = dragSize + (newpos - dragPos); dockGroup.ResizeItem(dockIndex, nsize); } } return(base.OnMotionNotifyEvent(e)); }
protected override bool OnMotionNotifyEvent(Gdk.EventMotion evnt) { HalfCell hc = GetHalfCell((int)evnt.X, (int)evnt.Y); if (!mouseOnCell.Equals(hc)) { mouseOnCell = hc; ActivateOrDeactivateHalfCell(GetHalfCell((int)evnt.X, (int)evnt.Y), isDraw); this.QueueDraw(); } return(base.OnMotionNotifyEvent(evnt)); }
protected override bool OnMotionNotifyEvent(Gdk.EventMotion evnt) { if (editable) { // TODO draw highlights onmouseover a rating? (and clear on leaveNotify) if (evnt.State != Gdk.ModifierType.Button1Mask) { return(false); } Value = RatingFromPosition(evnt.X); } return(true); }
static void MotionNotifyEvent(object obj, MotionNotifyEventArgs args) { Gdk.EventMotion ev = args.Event; Widget widget = (Widget)obj; if ((ev.State & Gdk.ModifierType.Button1Mask) != 0 && pixmap != null) { double pressure; if (!ev.Device.GetAxis(ev.Axes, AxisUse.Pressure, out pressure)) { pressure = 0.5; } DrawBrush(widget, ev.Device.Source, ev.X, ev.Y, pressure); } args.RetVal = true; }
// Update the cursor image if the pointer is moved protected override bool OnMotionNotifyEvent(Gdk.EventMotion eventMotion) { int x, y; Gdk.ModifierType state; this.WindowToBufferCoords(TextWindowType.Widget, (int)eventMotion.X, (int)eventMotion.Y, out x, out y); SetTextViewCursorIfAppropriate(x, y); this.GdkWindow.GetPointer(out x, out y, out state); return(false); }
protected override bool OnMotionNotifyEvent(Gdk.EventMotion evnt) { base.OnMotionNotifyEvent(evnt); if (lastX == evnt.X && lastY == evnt.Y) { return(true); } lastX = (int)evnt.X; lastY = (int)evnt.Y; renderer.OnMouseEvent("mousemove", (int)evnt.X, (int)evnt.Y); return(true); }
protected override bool OnMotionNotifyEvent(Gdk.EventMotion ev) { if (resizingX || resizingY) { if (resizingX) { int nw = (int)(ev.X - difX - padding - selectionBorder); if (nw < currentSizeRequest.Width) { nw = currentSizeRequest.Width; } child.WidthRequest = nw; } if (resizingY) { int nh = (int)(ev.Y - difY - padding - selectionBorder); if (nh < currentSizeRequest.Height) { nh = currentSizeRequest.Height; } child.HeightRequest = nh; } QueueDraw(); } else if (AllowResize) { if (GetAreaResizeXY().Contains((int)ev.X, (int)ev.Y)) { GdkWindow.Cursor = cursorXY; } else if (GetAreaResizeX().Contains((int)ev.X, (int)ev.Y)) { GdkWindow.Cursor = cursorX; } else if (GetAreaResizeY().Contains((int)ev.X, (int)ev.Y)) { GdkWindow.Cursor = cursorY; } else { GdkWindow.Cursor = null; } } return(base.OnMotionNotifyEvent(ev)); }
protected override bool OnMotionNotifyEvent(Gdk.EventMotion e) { if (dragging) { NotifySeparatorsChanged(); int newpos = (currentHandleGrp.Type == DockGroupType.Horizontal) ? (int)e.XRoot : (int)e.YRoot; if (newpos != dragPos) { int nsize = dragSize + (newpos - dragPos); currentHandleGrp.ResizeItem(currentHandleIndex, nsize); layout.DrawSeparators(Allocation, currentHandleGrp, currentHandleIndex, true, null); } } else if (layout != null && placeholderWindow == null) { int index; DockGroup grp; if (FindHandle(layout, (int)e.X, (int)e.Y, out grp, out index)) { if (currentHandleGrp != grp || currentHandleIndex != index) { if (grp.Type == DockGroupType.Horizontal) { this.GdkWindow.Cursor = hresizeCursor; } else { this.GdkWindow.Cursor = vresizeCursor; } currentHandleGrp = grp; currentHandleIndex = index; layout.DrawSeparators(Allocation, currentHandleGrp, currentHandleIndex, true, null); } } else if (currentHandleGrp != null) { ResetHandleHighlight(); } } return(base.OnMotionNotifyEvent(e)); }
protected override bool OnMotionNotifyEvent(Gdk.EventMotion evm) { if ((evm.State & Gdk.ModifierType.Button1Mask) == 0) { return(false); } if (!Gtk.Drag.CheckThreshold(this, clickX, clickY, (int)evm.XRoot, (int)evm.YRoot)) { return(false); } if (ParentBox.ObjectSelection != null && ParentBox.ObjectSelection.AllowDrag) { int dx = Allocation.X - ox + localClickX; int dy = Allocation.Y - oy + localClickY; ParentBox.ObjectSelection.FireDrag(evm, dx, dy); } return(true); }
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); }
protected override bool OnMotionNotifyEvent(EventMotion evnt) { State = IsInside (evnt.X, evnt.Y) ? hoverState : StateType.Normal;; return base.OnMotionNotifyEvent (evnt); }
protected override bool OnMotionNotifyEvent (EventMotion evnt) { foreach (HotSpot hp in hostSpots) { if (hp.Rect.Contains ((int)evnt.X, (int)evnt.Y) && hp.OnMouseOver != null) { if (!hp.IsOver && hp.OnMouseOver != null) { hp.IsOver = true; hp.OnMouseOver (); } } else if (hp.IsOver) { if (hp.IsOver && hp.OnMouseLeave != null) { hp.IsOver = false; hp.OnMouseLeave (); } } } return base.OnMotionNotifyEvent (evnt); }
void ShowTooltip(EventMotion evnt) { HideTooltip (); tooltipTimeout = GLib.Timeout.Add (500, delegate { ShowTooltipWindow ((int)evnt.X, (int)evnt.Y); return false; }); }
protected override bool OnMotionNotifyEvent (EventMotion e) { if (dragBar != null) { int sx,sy; this.GdkWindow.GetOrigin (out sx, out sy); int rx = (int)e.XRoot - sx; int ry = (int)e.YRoot - sy; if (dragBar.Floating) { bool foundPanel = false; dragBar.FloatingDock.Move ((int)e.XRoot + xDragDif, (int)e.YRoot + yDragDif); Rectangle barRect = new Rectangle (rx + xDragDif, ry + yDragDif, dragBar.Allocation.Width, dragBar.DefaultHeight); foreach (DockToolbarPanel p in panels) { if (p.Allocation.IntersectsWith (barRect)) { if (targetPanel != null && targetPanel != p) targetPanel.EndDragBar (dragBar); p.Reposition (dragBar, rx, ry, xDragDif, yDragDif); targetPanel = p; foundPanel = true; break; } } if (!foundPanel && targetPanel != null) targetPanel.EndDragBar (dragBar); } else { DockToolbarPanel panel = (DockToolbarPanel) dragBar.Parent; panel.Reposition (dragBar, rx, ry, xDragDif, yDragDif); } } return base.OnMotionNotifyEvent (e); }
bool OnSelectionMotionNotifyEvent(EventMotion evnt) { int x, y; ModifierType mod; if (evnt.IsHint) GdkWindow.GetPointer (out x, out y, out mod); else { x = (int)evnt.X; y = (int)evnt.Y; } Point img = WindowCoordsToImage (new Point (x, y)); if (is_dragging_selection) { Point win_anchor = ImageCoordsToWindow (selection_anchor); if (Selection == Rectangle.Zero && Math.Abs (evnt.X - win_anchor.X) < SELECTION_THRESHOLD && Math.Abs (evnt.Y - win_anchor.Y) < SELECTION_THRESHOLD) { SelectionSetPointer (x, y); return true; } if (selection_xy_ratio == 0) Selection = new Rectangle (fixed_width ? Selection.X : Math.Min (selection_anchor.X, img.X), fixed_height ? Selection.Y : Math.Min (selection_anchor.Y, img.Y), fixed_width ? Selection.Width : Math.Abs (selection_anchor.X - img.X), fixed_height ? Selection.Height : Math.Abs (selection_anchor.Y - img.Y)); else Selection = ConstrainSelection (new Rectangle (Math.Min (selection_anchor.X, img.X), Math.Min (selection_anchor.Y, img.Y), Math.Abs (selection_anchor.X - img.X), Math.Abs (selection_anchor.Y - img.Y)), fixed_width, fixed_height); SelectionSetPointer (x, y); return true; } if (is_moving_selection) { Selection = new Rectangle (Clamp (Selection.X + img.X - selection_anchor.X, 0, Pixbuf.Width - Selection.Width), Clamp (Selection.Y + img.Y - selection_anchor.Y, 0, Pixbuf.Height - Selection.Height), Selection.Width, Selection.Height); selection_anchor = img; SelectionSetPointer (x, y); return true; } SelectionSetPointer (x, y); return true; }
protected override bool OnMotionNotifyEvent(EventMotion evnt) { in_thumbnail_region = evnt.X <= Allocation.Height; return ShowHideCoverArt (); }
protected override bool OnMotionNotifyEvent (EventMotion evnt) { if (button != 0) MouseMove (evnt.Y); int h = Allocation.Height - Allocation.Width - 3; if (TextEditor.HighlightSearchPattern) { if (evnt.Y > h) this.TooltipText = string.Format (GettextCatalog.GetPluralString ("{0} match", "{0} matches", TextEditor.TextViewMargin.SearchResultMatchCount), TextEditor.TextViewMargin.SearchResultMatchCount); } else { if (evnt.Y > h) { int errors = 0, warnings = 0; foreach (var task in AllTasks) { switch (task.Severity) { case QuickTaskSeverity.Error: errors++; break; case QuickTaskSeverity.Warning: warnings++; break; } } string text = null; if (errors == 0 && warnings == 0) { text = GettextCatalog.GetString ("No errors or warnings"); } else if (errors == 0) { text = string.Format (GettextCatalog.GetPluralString ("{0} warning", "{0} warnings", warnings), warnings); } else if (warnings == 0) { text = string.Format (GettextCatalog.GetPluralString ("{0} error", "{0} errors", errors), errors); } else { text = string.Format (GettextCatalog.GetString ("{0} errors and {1} warnings"), errors, warnings); } this.TooltipText = text; } else { TextEditorData editorData = TextEditor.GetTextEditorData (); foreach (var tasks in providerTasks.Values) { foreach (var task in tasks) { double y = h * TextEditor.LineToY (task.Location.Line) / Math.Max (TextEditor.EditorLineThreshold * editorData.LineHeight + editorData.TotalHeight, TextEditor.Allocation.Height); if (Math.Abs (y - evnt.Y) < 3) { hoverTask = task; } } } base.TooltipText = hoverTask != null ? hoverTask.Description : null; } } return base.OnMotionNotifyEvent (evnt); }
protected override bool OnMotionNotifyEvent(EventMotion evnt) { if (placeholderVisible) { int sx,sy; this.Window.GetOrigin (out sx, out sy); int rx = (int)evnt.XRoot - sx; int ry = (int)evnt.YRoot - sy; int xDragDif=0; int yDragDif=0; ShowPlaceholder(false,rx,ry,xDragDif, yDragDif); setPlaceholderWindowsize(rx,ry); } return base.OnMotionNotifyEvent (evnt); }
protected override bool OnMotionNotifyEvent (EventMotion evnt) { string newTooltip = null; if (!draggingTab) { var t = FindTab ((int)evnt.X, (int)evnt.Y); // If the user clicks and drags on the 'x' which closes the current // tab we can end up with a null tab here if (t == null) return base.OnMotionNotifyEvent (evnt); SetHighlightedTab (t); var newOver = IsOverCloseButton (t, (int)evnt.X, (int)evnt.Y); if (newOver != overCloseButton) { overCloseButton = newOver; QueueDraw (); } if (!overCloseButton && !draggingTab && buttonPressedOnTab) { draggingTab = true; dragXProgress = 1.0f; int x = (int)evnt.X; dragOffset = x - t.Allocation.X; dragX = x - dragOffset; lastDragX = (int)evnt.X; } else if (t != null) newTooltip = t.Tooltip; } else if (evnt.State.HasFlag (ModifierType.Button1Mask)) { dragX = (int)evnt.X - dragOffset; QueueDraw (); var t = FindTab ((int)evnt.X, TopPadding + 3); if (t == null) { var last = (DockNotebookTab)notebook.Tabs.Last (); if (dragX > last.Allocation.Right) t = last; if (dragX < 0) t = (DockNotebookTab)notebook.Tabs.First (); } if (t != null && t != notebook.CurrentTab && ( ((int)evnt.X > lastDragX && t.Index > notebook.CurrentTab.Index) || ((int)evnt.X < lastDragX && t.Index < notebook.CurrentTab.Index))) { t.SaveAllocation (); t.SaveStrength = 1; notebook.ReorderTab ((DockNotebookTab)notebook.CurrentTab, t); t.Animate ("TabMotion", f => t.SaveStrength = f, 1.0f, 0.0f, easing: Easing.CubicInOut); } lastDragX = (int)evnt.X; } if (newTooltip != null && TooltipText != null && TooltipText != newTooltip) TooltipText = null; else TooltipText = newTooltip; return base.OnMotionNotifyEvent (evnt); }
protected override bool OnMotionNotifyEvent (EventMotion evnt) { if (!item.Disabled && !Selected) { Selected = true; if (SelectedChanged != null) SelectedChanged (this, EventArgs.Empty); QueueDraw (); } return false; }
protected override bool OnMotionNotifyEvent (EventMotion e) { if (!buttonPressed) return base.OnMotionNotifyEvent (e); int winWidth, winHeight; this.GdkWindow.GetSize (out winWidth, out winHeight); int row = GetRowByPosition ((int) e.Y); if ((e.State & ModifierType.ControlMask) == ModifierType.ControlMask) SelectRow (row); else this.SelectedRow = row; return true; }
/// <summary> /// Called on mouse move events. /// </summary> /// <param name="e">An instance that contains the event data.</param> /// <returns><c>true</c> if the event was handled.</returns> protected override bool OnMotionNotifyEvent(EventMotion e) { return this.ActualController.HandleMouseMove(this, e.ToMouseEventArgs()); }
protected override bool OnMotionNotifyEvent(EventMotion evnt) { var position = new Point(evnt.X, evnt.Y); GtkMouseDevice.Instance.SetClientPosition(position); var e = new RawMouseEventArgs( GtkMouseDevice.Instance, evnt.Time, _inputRoot, RawMouseEventType.Move, position, GetModifierKeys(evnt.State)); Input(e); return true; }
protected override bool OnMotionNotifyEvent(EventMotion evnt) { if ((evnt.State & (ModifierType.Button1Mask | ModifierType.Button3Mask)) == 0) return false; if (! Gtk.Drag.CheckThreshold (this, selection_start.X, selection_start.Y, (int) evnt.X, (int) evnt.Y)) return false; if (isRectSelection) { // scroll if out of window double d_x, d_y; deltaVscroll = 30; if (EventHelper.GetCoords (evnt, out d_x, out d_y)) { int new_y = (int) d_y; if ((new_y <= 0) || (new_y >= Allocation.Height)) { if (scroll_timeout == 0) scroll_timeout = GLib.Timeout.Add (100, new GLib.TimeoutHandler (HandleMotionTimeout)); } else if (scroll_timeout != 0) { GLib.Source.Remove (scroll_timeout); scroll_timeout = 0; } } else if (scroll_timeout != 0) { GLib.Source.Remove (scroll_timeout); scroll_timeout = 0; } // handle selection UpdateRubberband (); //SelectMotion (new Point ((int) args.Event.X, (int) args.Event.Y)); } else { int cell_num = CellAtPosition (selection_start); if (Selection.Contains (cell_num)) { // on a selected cell : do drag&drop isDragDrop = true; if (StartDrag != null) { uint but; if ((evnt.State & ModifierType.Button1Mask) != 0) but = 1; else but = 3; StartDrag (this, new StartDragArgs(but, start_select_event)); } } else { // not on a selected cell : do rectangular select isRectSelection = true; // ctrl : toggle selected, shift : keep selected if ((evnt.State & (ModifierType.ShiftMask | ModifierType.ControlMask)) == 0) Selection.Clear (); start_select_selection = Selection.Ids; // keep initial selection // no rect draw at beginning rect_select = Rectangle.Zero; return false; } } return true; }
protected override bool OnMotionNotifyEvent(EventMotion evnt) { bool handled = false; handled = handled || OnPanMotionNotifyEvent (evnt); if (can_select) handled = handled || OnSelectionMotionNotifyEvent (evnt); return handled || base.OnMotionNotifyEvent (evnt); }
protected override bool OnMotionNotifyEvent (EventMotion evnt) { RemovePreviewPopupTimeout (); if (button != 0) MouseMove (evnt.Y); var h = IndicatorHeight; if (TextEditor.HighlightSearchPattern) { hoverOverIndicator = false; if (evnt.Y < h) this.TooltipText = string.Format (GettextCatalog.GetPluralString ("{0} match", "{0} matches", TextEditor.TextViewMargin.SearchResultMatchCount), TextEditor.TextViewMargin.SearchResultMatchCount); } else { hoverOverIndicator = evnt.Y < h; if (hoverOverIndicator) { int errors = 0, warnings = 0, hints = 0, suggestions = 0; foreach (var task in AllTasks) { switch (task.Severity) { case Severity.Error: errors++; break; case Severity.Warning: warnings++; break; case Severity.Hint: hints++; break; case Severity.Suggestion: suggestions++; break; } } string text = null; if (errors == 0 && warnings == 0) { text = GettextCatalog.GetString ("No errors or warnings"); } else if (errors == 0) { text = string.Format (GettextCatalog.GetPluralString ("{0} warning", "{0} warnings", warnings), warnings); } else if (warnings == 0) { text = string.Format (GettextCatalog.GetPluralString ("{0} error", "{0} errors", errors), errors); } else { text = string.Format (GettextCatalog.GetString ("{0} errors and {1} warnings"), errors, warnings); } if (errors > 0) { text += Environment.NewLine + GettextCatalog.GetString ("Click to navigate to the next error"); currentHoverMode = QuickTaskStrip.HoverMode.NextError; } else if (warnings > 0) { text += Environment.NewLine + GettextCatalog.GetString ("Click to navigate to the next warning"); currentHoverMode = QuickTaskStrip.HoverMode.NextWarning; } else if (warnings + hints > 0) { text += Environment.NewLine + GettextCatalog.GetString ("Click to navigate to the next message"); currentHoverMode = QuickTaskStrip.HoverMode.NextMessage; } TooltipText = text; } else { // TextEditorData editorData = TextEditor.GetTextEditorData (); foreach (var task in AllTasks) { double y = GetYPosition (task.Location.Line); if (Math.Abs (y - evnt.Y) < 3) { hoverTask = task; } } base.TooltipText = hoverTask != null ? hoverTask.Description : null; } } if (button == 0 && evnt.State.HasFlag (ModifierType.ShiftMask)) { int line = YToLine (evnt.Y); line = Math.Max (1, line - 2); int lastLine = Math.Min (TextEditor.LineCount, line + 5); var start = TextEditor.GetLine (line); var end = TextEditor.GetLine (lastLine); if (start == null || end == null) { return base.OnMotionNotifyEvent (evnt); } var showSegment = new TextSegment (start.Offset, end.Offset + end.Length - start.Offset); if (previewWindow != null) { previewWindow.SetSegment (showSegment, false); PositionPreviewWindow ((int)evnt.Y); } else { var popup = new PreviewPopup (this, showSegment, TextEditor.Allocation.Width * 4 / 7, (int)evnt.Y); previewPopupTimeout = GLib.Timeout.Add (450, new GLib.TimeoutHandler (popup.Run)); } } else { RemovePreviewPopupTimeout (); DestroyPreviewWindow (); } return base.OnMotionNotifyEvent (evnt); }
protected override bool OnMotionNotifyEvent (EventMotion evnt) { SetHover (GetItemAt ((int)evnt.X, (int)evnt.Y)); return true; }
protected override bool OnMotionNotifyEvent (EventMotion e) { if (!buttonPressed) return base.OnMotionNotifyEvent (e); int winWidth, winHeight; this.GdkWindow.GetSize (out winWidth, out winHeight); SelectedItem = GetRowByPosition ((int)e.Y); return true; }
protected override bool OnMotionNotifyEvent (EventMotion evnt) { var item = GetItemAt (evnt.X, evnt.Y); if (item != hoverItem) { hoverItem = item; QueueDraw (); } return base.OnMotionNotifyEvent (evnt); }
protected override bool OnMotionNotifyEvent(EventMotion evnt) { // First check if we need to draw a box for multiple selection via dragging if (_dragStartTime != 0 && evnt.Time - _dragStartTime > 500) { Console.WriteLine("Motion {0}", _dragStartTime); TreePath endPath; GetPathAtPos((int)evnt.X, (int)evnt.Y, out endPath); if (!GetPathAtPos((int)evnt.X, (int)evnt.Y, out endPath)) { GetPathAtPos(1, 1, out endPath); } if (_dragStartPath.Compare(endPath) < 0) { Selection.UnselectAll(); Selection.SelectRange(_dragStartPath, endPath); } else { Selection.UnselectAll(); Selection.SelectRange(endPath, _dragStartPath); } } // Now start logic for tooltips if (!evnt.Window.Equals(BinWindow)) goto hide; if (DateTime.Now.Subtract(TimeSpan.FromMilliseconds(500)) < _scrollStarted) goto hide; TreePath path; TreeViewColumn column; int cellX, cellY; if (!GetPathAtPos((int) evnt.X, (int) evnt.Y, out path, out column, out cellX, out cellY)) goto hide; var cellRenderers = column.CellRenderers.Where(c => { int startPos, width; column.CellGetPosition(c, out startPos, out width); return startPos < cellX && cellX < startPos + width; }); var cellRendererText = (CellRendererText)cellRenderers.FirstOrDefault(); TreeIter iter; Model.GetIter(out iter, path); column.CellSetCellData(Model, iter, false, false); if (cellRendererText != null) { Label label = Tooltip.Label; label.Text = cellRendererText.Text; label.SetPadding((int)cellRendererText.Xpad, (int)cellRendererText.Ypad); label.SizeRequest(); label.Show(); int listOriginX, listOriginY, labelWidth, labelHeight, labelLayoutOffsetX, labelLayoutOffsetY; BinWindow.GetOrigin(out listOriginX, out listOriginY); Rectangle cellRectangle = GetCellArea(path, column); var x = listOriginX + cellRectangle.X; var y = listOriginY + cellRectangle.Y; label.Layout.GetPixelSize(out labelWidth, out labelHeight); label.GetLayoutOffsets(out labelLayoutOffsetX, out labelLayoutOffsetY); labelWidth += labelLayoutOffsetX; labelWidth += (int)cellRendererText.Xpad; var height = cellRectangle.Height; Tooltip.Move(x, y); Tooltip.SetSizeRequest(labelWidth, height); Tooltip.Resize(labelWidth, height); if (labelWidth < cellRectangle.Width) goto hide; Tooltip.Show(); goto returnBase; } hide: Tooltip.Hide(); returnBase: return base.OnMotionNotifyEvent(evnt); }
protected override bool OnMotionNotifyEvent(Gdk.EventMotion evnt) { //GdkWindow.Cursor = new Gdk.Cursor(Gdk.CursorType.Hand2); return(base.OnMotionNotifyEvent(evnt)); }
bool OnPanMotionNotifyEvent(EventMotion evnt) { if (!InPanMotion) { return false; } // Calculate the direction of the panning, scroll accordingly. int pan_x = pan_anchor.X - (int)evnt.X; int pan_y = pan_anchor.Y - (int)evnt.Y; ScrollBy (pan_x, pan_y); // Reset starting point. pan_anchor.X = (int)evnt.X; pan_anchor.Y = (int)evnt.Y; return true; }
protected override bool OnMotionNotifyEvent (EventMotion evnt) { TooltipText = null; if (dragPosition >= 0) { int x, y; widget.GetPointer (out x, out y); int newWidthRequest = widget.Allocation.Width - x; newWidthRequest = Math.Min (widget.Allocation.Width - (int)widget.Editor.TextViewMargin.XOffset, Math.Max (leftSpacer, newWidthRequest)); WidthRequest = newWidthRequest; QueueResize (); } int startLine = widget.Editor.YToLine (widget.Editor.VAdjustment.Value + evnt.Y); var ann = startLine > 0 && startLine <= annotations.Count ? annotations[startLine - 1] : null; if (ann != null) TooltipText = GetCommitMessage (startLine); highlightPositon = evnt.Y; if (highlightAnnotation != ann) { highlightAnnotation = ann; widget.QueueDraw (); } return base.OnMotionNotifyEvent (evnt); }
protected override bool OnMotionNotifyEvent(EventMotion ev) { Gdk.ModifierType state = (Gdk.ModifierType)ev.State; if ((state & Gdk.ModifierType.Button1Mask) != 0) { if ((state & Gdk.ModifierType.ShiftMask) != 0) { X = dragStartX + (int)((dragStartMouseX - ev.X) / Scale); Y = dragStartY + (int)((dragStartMouseY - ev.Y) / Scale); } else { if (PixelQueried != null) { int pixelX, pixelY; MouseToImageCoords (ev.X, ev.Y, out pixelX, out pixelY); PixelQueried (this, pixelX, pixelY); } } return true; } return false; }
protected override bool OnMotionNotifyEvent (EventMotion evnt) { if (draggingTab && mouseHasLeft) { var sr = GetScreenRect (); sr.Height = BarHeight; sr.Inflate (30, 30); int x, y; Gdk.Display.Default.GetPointer (out x, out y); if (x < sr.Left || x > sr.Right || y < sr.Top || y > sr.Bottom) { draggingTab = false; mouseHasLeft = false; CreatePlaceholderWindow (); } } string newTooltip = null; if (placeholderWindow != null) { int x, y; Gdk.Display.Default.GetPointer (out x, out y); placeholderWindow.MovePosition (x, y); return base.OnMotionNotifyEvent (evnt); } if (!draggingTab) { var t = FindTab ((int)evnt.X, (int)evnt.Y); // If the user clicks and drags on the 'x' which closes the current // tab we can end up with a null tab here if (t == null) { TooltipText = null; return base.OnMotionNotifyEvent (evnt); } SetHighlightedTab (t); var newOver = IsOverCloseButton (t, (int)evnt.X, (int)evnt.Y); if (newOver != overCloseButton) { overCloseButton = newOver; QueueDraw (); } if (!overCloseButton && !draggingTab && buttonPressedOnTab) { draggingTab = true; mouseHasLeft = false; dragXProgress = 1.0f; int x = (int)evnt.X; dragOffset = x - t.Allocation.X; dragX = x - dragOffset; lastDragX = (int)evnt.X; } else if (t != null) newTooltip = t.Tooltip; } else if (evnt.State.HasFlag (ModifierType.Button1Mask)) { dragX = (int)evnt.X - dragOffset; QueueDraw (); var t = FindTab ((int)evnt.X, TopPadding + 3); if (t == null) { var last = (DockNotebookTab)notebook.Tabs.Last (); if (dragX > last.Allocation.Right) t = last; if (dragX < 0) t = (DockNotebookTab)notebook.Tabs.First (); } if (t != null && t != notebook.CurrentTab && ( ((int)evnt.X > lastDragX && t.Index > notebook.CurrentTab.Index) || ((int)evnt.X < lastDragX && t.Index < notebook.CurrentTab.Index))) { t.SaveAllocation (); t.SaveStrength = 1; notebook.ReorderTab ((DockNotebookTab)notebook.CurrentTab, t); t.Animate ("TabMotion", f => t.SaveStrength = f, 1.0f, 0.0f, easing: Easing.CubicInOut); } lastDragX = (int)evnt.X; } if (newTooltip != null && TooltipText != null && TooltipText != newTooltip) TooltipText = null; else TooltipText = newTooltip; return base.OnMotionNotifyEvent (evnt); }
protected override bool OnMotionNotifyEvent(EventMotion e) { if (draggingCursor) { double x, y; GetValue ((int)e.X, (int)e.Y, out x, out y); if (activeCursor.Dimension == AxisDimension.X) { if (x < startX) x = startX; else if (x > endX) x = endX; activeCursor.Value = x; } else { if (y < startY) y = startY; else if (y > endY) y = endY; activeCursor.Value = y; } return true; } return base.OnMotionNotifyEvent (e); }
protected override bool OnMotionNotifyEvent (EventMotion evnt) { bool hideButton = widget.OriginalEditor.Document.ReadOnly || !widget.DiffEditor.Document.ReadOnly; Diff.Hunk selectedHunk = null; if (!hideButton) { int delta = widget.OriginalEditor.Allocation.Y - Allocation.Y; foreach (Diff.Hunk hunk in widget.Diff) { if (!hunk.Same) { int y1 = delta + widget.OriginalEditor.LineToVisualY (hunk.Right.Start) - (int)widget.OriginalEditor.VAdjustment.Value; int y2 = delta + widget.OriginalEditor.LineToVisualY (hunk.Right.Start + hunk.Right.Count) - (int)widget.OriginalEditor.VAdjustment.Value; if (y1 == y2) y2 = y1 + 1; int z1 = delta + widget.DiffEditor.LineToVisualY (hunk.Left.Start) - (int)widget.DiffEditor.VAdjustment.Value; int z2 = delta + widget.DiffEditor.LineToVisualY (hunk.Left.Start + hunk.Left.Count) - (int)widget.DiffEditor.VAdjustment.Value; if (z1 == z2) z2 = z1 + 1; int x, y, r; GetButtonPosition (hunk, z1, z2, y1, y2, out x, out y, out r); if (evnt.X >= x && evnt.X - x < r && evnt.Y >= y && evnt.Y - y < r) { selectedHunk = hunk; TooltipText = GettextCatalog.GetString ("Revert this change"); break; } } } } else { selectedHunk = null; } if (selectedHunk == null) TooltipText = null; if (this.selectedHunk != selectedHunk) { this.selectedHunk = selectedHunk; QueueDraw (); } return base.OnMotionNotifyEvent (evnt); }
protected override bool OnMotionNotifyEvent (EventMotion evnt) { bool hideButton = widget.MainEditor.Document.ReadOnly; Mono.TextEditor.Utils.Hunk selectedHunk = Mono.TextEditor.Utils.Hunk.Empty; if (!hideButton) { int delta = widget.MainEditor.Allocation.Y - Allocation.Y; if (Diff != null) { foreach (var hunk in Diff) { double z1 = delta + fromEditor.LineToY (hunk.RemoveStart) - fromEditor.VAdjustment.Value; double z2 = delta + fromEditor.LineToY (hunk.RemoveStart + hunk.Removed) - fromEditor.VAdjustment.Value; if (z1 == z2) z2 = z1 + 1; double y1 = delta + toEditor.LineToY (hunk.InsertStart) - toEditor.VAdjustment.Value; double y2 = delta + toEditor.LineToY (hunk.InsertStart + hunk.Inserted) - toEditor.VAdjustment.Value; if (y1 == y2) y2 = y1 + 1; double x, y, w, h; GetButtonPosition (hunk, y1, y2, z1, z2, out x, out y, out w, out h); if (evnt.X >= x && evnt.X < x + w && evnt.Y >= y && evnt.Y < y + h) { selectedHunk = hunk; TooltipText = GettextCatalog.GetString ("Revert this change"); QueueDrawArea ((int)x, (int)y, (int)w, (int)h); break; } } } } else { selectedHunk = Mono.TextEditor.Utils.Hunk.Empty; } if (selectedHunk.IsEmpty) TooltipText = null; if (this.selectedHunk != selectedHunk) { this.selectedHunk = selectedHunk; QueueDraw (); } return base.OnMotionNotifyEvent (evnt); }
protected override bool OnMotionNotifyEvent (EventMotion evnt) { RemovePreviewPopupTimeout (); if (IsInGrab ()) { var yDelta = evnt.Y - grabY; MovePosition (grabCenter + yDelta); } else { UpdatePrelightState (evnt.X, evnt.Y); } const ModifierType buttonMask = ModifierType.Button1Mask | ModifierType.Button2Mask | ModifierType.Button3Mask | ModifierType.Button4Mask | ModifierType.Button5Mask; if ((evnt.State & buttonMask & ModifierType.ShiftMask) == ModifierType.ShiftMask) { int line = YToLine (evnt.Y); line = Math.Max (1, line - 2); int lastLine = Math.Min (TextEditor.LineCount, line + 5); var start = TextEditor.GetLine (line); var end = TextEditor.GetLine (lastLine); if (start == null || end == null) { return base.OnMotionNotifyEvent (evnt); } var showSegment = new TextSegment (start.Offset, end.Offset + end.Length - start.Offset); if (previewWindow != null) { previewWindow.SetSegment (showSegment, false); PositionPreviewWindow ((int)evnt.Y); } else { var popup = new PreviewPopup (this, showSegment, TextEditor.Allocation.Width * 4 / 7, (int)evnt.Y); previewPopupTimeout = GLib.Timeout.Add (450, new GLib.TimeoutHandler (popup.Run)); } } else { RemovePreviewPopupTimeout (); DestroyPreviewWindow (); } return base.OnMotionNotifyEvent (evnt); }
protected override bool OnMotionNotifyEvent (EventMotion evnt) { if (button != 0) MouseMove (evnt.Y); return base.OnMotionNotifyEvent (evnt); }