public static bool HandleMouseDown(this IViewObject view, NSEvent theEvent) { if (view == null) { throw new ArgumentNullException(nameof(view)); } if (theEvent == null) { throw new ArgumentNullException(nameof(theEvent)); } if (view.View == null) { throw new InvalidOperationException(); } CGPoint p = view.View.ConvertPointFromEvent(theEvent); if (!view.View.Bounds.Contains(p)) { return(false); } ButtonEventArgs args = new ButtonEventArgs(); args.X = p.X; args.Y = p.Y; args.Button = theEvent.GetPointerButton(); args.IsContextMenuTrigger = theEvent.TriggersContextMenu(); args.MultiplePress = (int)theEvent.ClickCount; view.Backend.ApplicationContext.InvokeUserCode(delegate { view.Backend.EventSink.OnButtonPressed(args); }); return(args.Handled); }
public override void MouseDown (NSEvent theEvent) { base.MouseDown (theEvent); var p = ConvertPointFromView (theEvent.LocationInWindow, null); ButtonEventArgs args = new ButtonEventArgs (); args.X = p.X; args.Y = p.Y; args.Button = PointerButton.Left; args.IsContextMenuTrigger = theEvent.TriggersContextMenu (); context.InvokeUserCode (delegate { eventSink.OnButtonPressed (args); }); }
public override void MouseDown(NSEvent theEvent) { CGPoint p = this.ConvertPointFromEvent(theEvent); if (!Bounds.Contains(p)) { return; } ButtonEventArgs args = new ButtonEventArgs(); args.X = p.X; args.Y = p.Y; args.Button = PointerButton.Left; args.IsContextMenuTrigger = theEvent.TriggersContextMenu(); context.InvokeUserCode(delegate { eventSink.OnButtonPressed(args); }); }