public override void MouseButtonUp (NSEvent theEvent) { PointF ui_pt = ParentScreen.ScreenToLayer (theEvent.LocationInWindow); if (PointInside (ui_pt)) OnActivate (); }
public override NSMenu menuForEvent(NSEvent @event) { if (menu == null) return base.menuForEvent(@event); // NSLog(@"menuForEvent:"); // Find which row is under the cursor this.window().makeFirstResponder(this); NSPoint menuPoint = this.convertPoint(@event.locationInWindow()) fromView(null); int row = this.rowAtPoint(menuPoint); if (row > -1) { bool currentRowIsSelected = this.selectedRowIndexes().containsIndex(row); if (!currentRowIsSelected) this.selectRowIndexes(NSIndexSet.indexSetWithIndex(row)) byExtendingSelection(false); } else { this.deselectAll(null); } if (this.numberOfSelectedRows() <= 0) { // No rows are selected, so the table should be displayed with all items disabled NSMenu tableViewMenu = this.menu().copy(); for (int i = 0; i < tableViewMenu.numberOfItems; i++) tableViewMenu.itemAtIndex(i).setEnabled(false); return tableViewMenu; } else return this.menu(); }
public override void RightMouseDragged (NSEvent theEvent) { if(theEvent == null) return; base.RightMouseDragged (theEvent); RightMouseDragged (theEvent); }
public override void RightMouseUp (NSEvent theEvent) { if(theEvent == null) return; base.RightMouseUp (theEvent); FireRightMouseUp(theEvent); }
public void KeyboardDown (NSEvent theEvent) { bool selection_changed = false; /* navigation keys */ if (theEvent.CharactersIgnoringModifiers[0] == (char)NSKey.UpArrow) { if (cursor > 0) { cursor--; selection_changed = true; if (cursor < first_visible) first_visible = cursor; } } else if (theEvent.CharactersIgnoringModifiers[0] == (char)NSKey.DownArrow) { if (cursor < items.Count - 1) { cursor++; selection_changed = true; if (cursor >= first_visible + num_visible) first_visible = cursor - num_visible + 1; } } if (selection_changed) { Invalidate (); if (SelectionChanged != null) SelectionChanged (cursor); } }
public override void MouseDown(NSEvent theEvent) { NSPoint locationInSelf = this.ConvertPointFromView (theEvent.LocationInWindow, null); NSRect dragThumbFrame = this.dragThumbView.Frame; if (dragThumbFrame.PointInRect (locationInSelf)) { this.dragOffsetIntoGrowBox = new NSSize (locationInSelf.x - dragThumbFrame.origin.x, locationInSelf.y - dragThumbFrame.origin.y); NSDictionary metrics = NSDictionary.DictionaryWithObjectsAndKeys ( NSNumber.NumberWithFloat (dragThumbFrame.MinX), (NSString)"initialThumbX", NSNumber.NumberWithFloat (dragThumbFrame.MinY), (NSString)"initialThumbY", null); NSDictionary views = NSDictionary.DictionaryWithObjectForKey (this.dragThumbView, (NSString)"dragThumbView"); this.horizontalDragConstraint = NSLayoutConstraint.ConstraintsWithVisualFormatOptionsMetricsViews ("H:|-(initialThumbX)-[dragThumbView]", 0, metrics, views).LastObject.Retain<NSLayoutConstraint> (); this.verticalDragConstraint = NSLayoutConstraint.ConstraintsWithVisualFormatOptionsMetricsViews ("V:|-(initialThumbY)-[dragThumbView]", 0, metrics, views).LastObject.Retain<NSLayoutConstraint> (); // try lowering the priority to NSLayoutPriorityDragThatCannotResizeWindow to see the difference this.horizontalDragConstraint.Priority = NSLayoutPriority.NSLayoutPriorityDragThatCanResizeWindow; this.verticalDragConstraint.Priority = NSLayoutPriority.NSLayoutPriorityDragThatCanResizeWindow; this.AddConstraint (this.horizontalDragConstraint); this.AddConstraint (this.verticalDragConstraint); // just for fun. Try it out! this.Window.VisualizeConstraints (NSArray.ArrayWithObjects (this.horizontalDragConstraint, this.verticalDragConstraint, null)); } }
public override void MouseDragged (NSEvent theEvent) { PointF point = this.ConvertPointFromView (theEvent.LocationInWindow, null); this.Host.FireMouseMove (Host, new MouseEventArgs (MouseButtons.Left, theEvent.ClickCount, (int)point.X, (int)point.Y, 0)); base.MouseDragged (theEvent); }
public override void MouseUp (NSEvent theEvent) { if(theEvent == null) return; //base.MouseUp (theEvent); m_parent.HandleClick(theEvent.ClickCount,new MouseEventArgs(MouseButtons.Left,theEvent.ClickCount,theEvent.AbsoluteX,theEvent.AbsoluteY,theEvent.AbsoluteZ)); }
//Handle right click event for the TableView public override NSMenu MenuForEvent (NSEvent theEvent) { CGPoint pt = this.ConvertPointFromView (theEvent.LocationInWindow, null); _selectedRow = this.GetRow (pt); NSTableViewDataSource ds = (NSTableViewDataSource)this.DataSource; NSMenu menu = new NSMenu (); if (_selectedRow >= (nint)0) { if (ds is NodesListView) { DirectoryNode node = ((ds as NodesListView).Entries [(int)_selectedRow] as DirectoryNode); if (node != null) { if (node.NodeType == DirectoryNode.DirectoryNodeType.User) { NSMenuItem ResetPassword = new NSMenuItem ("Set Password", node.RestUserPassword); menu.AddItem (ResetPassword); NSMenuItem delete = new NSMenuItem ("Delete", node.Delete); menu.AddItem (delete); NSMenuItem Properties = new NSMenuItem ("Properties", node.ViewProperties); menu.AddItem (Properties); } else if (node.NodeType == DirectoryNode.DirectoryNodeType.Groups) { NSMenuItem addUser = new NSMenuItem ("Add user to group", node.AddUserToGroup); menu.AddItem (addUser); } } } } NSMenu.PopUpContextMenu (menu, theEvent, theEvent.Window.ContentView); return base.MenuForEvent (theEvent); }
public override void SwipeWithEvent (NSEvent theEvent) { // We are only interested in horizontal swipe if (theEvent.DeltaX == 0) return; FireSwipeEvent (theEvent.DeltaX > 0 ? SwipeSide.Left : SwipeSide.Right); }
public static MouseButtons GetMouseButtons (NSEvent theEvent) { MouseButtons buttons = MouseButtons.None; switch (theEvent.Type) { case NSEventType.LeftMouseUp: case NSEventType.LeftMouseDown: case NSEventType.LeftMouseDragged: if ((theEvent.ModifierFlags & NSEventModifierMask.ControlKeyMask) > 0) buttons |= MouseButtons.Alternate; else buttons |= MouseButtons.Primary; break; case NSEventType.RightMouseUp: case NSEventType.RightMouseDown: case NSEventType.RightMouseDragged: buttons |= MouseButtons.Alternate; break; case NSEventType.OtherMouseUp: case NSEventType.OtherMouseDown: case NSEventType.OtherMouseDragged: buttons |= MouseButtons.Middle; break; } return buttons; }
public static Point GetLocation (NSView view, NSEvent theEvent) { var loc = view.ConvertPointFromView (theEvent.LocationInWindow, null); if (!view.IsFlipped) loc.Y = view.Frame.Height - loc.Y; return Generator.ConvertF (loc); }
public void ExtendSelection(NSTextView view, NSEvent evt) { int index = DoMouseEventToIndex(view, evt); NSRange range = view.selectedRange(); if (range.length == 0 && index < view.string_().length() && view.string_()[index] == '\n') { // don't extend the selection if the user clicked off to the right side of a line } else if (index >= view.string_().length()) { // don't extend the selection if the user clicked below the last line of text view.setSelectedRange(NSRange.Empty); } else { // Extend the selection so that it contains the entire word the user right-clicked on. if (range.length == 0 || !range.Intersects(index)) { range = new NSRange(index, 1); range = view.selectionRangeForProposedRange_granularity(range, Enums.NSSelectByWord); view.setSelectedRange(range); } } }
public override void MouseMoved (NSEvent theEvent) { if(theEvent == null) return; base.MouseMoved (theEvent); FireMouseMoved (theEvent); }
void HandleKeyAction (NSEvent theEvent, bool isUp) { ulong code = DecodeFromUnicode (theEvent.Characters); NSKey keyPressed; if (code == 32) keyPressed = NSKey.Space; else if (code == 114) keyPressed = NSKey.R; else keyPressed = (NSKey)DecodeFromUnicode (theEvent.Characters); switch (keyPressed) { case NSKey.RightArrow: UpdateKey (RightKey, isUp); break; case NSKey.LeftArrow: UpdateKey (LeftKey, isUp); break; case NSKey.R: UpdateKey (RunKey, isUp); break; case NSKey.Space: UpdateKey (JumpKey, isUp); break; default: break; } }
public override void MouseUp (NSEvent theEvent) { PointF point = this.ConvertPointFromView (theEvent.LocationInWindow, null); var button = (MouseButtons)theEvent.ButtonNumber; this.Host.FireMouseUp (Host, new MouseEventArgs (button, theEvent.ClickCount, (int)point.X, (int)point.Y, 0)); base.MouseUp (theEvent); }
public override void MouseUp (NSEvent theEvent) { var skScene = (InGameScene)OverlayScene; CGPoint p = skScene.ConvertPointFromView (theEvent.LocationInWindow); skScene.TouchUpAtPoint (p); base.MouseUp (theEvent); }
public override void MouseMoved (NSEvent theEvent) { if(theEvent == null) return; PointF point = theEvent.LocationInWindow; this.Host.FireMouseMove (Host, new MouseEventArgs (MouseButtons.Left, theEvent.ClickCount, (int)point.X, (int)point.Y, 0)); //base.MouseMoved (theEvent); }
public override void KeyDown (NSEvent theEvent) { if ((NSKey)theEvent.KeyCode == NSKey.RightArrow) right (); else if ((NSKey)theEvent.KeyCode == NSKey.R) reset (); else base.KeyDown (theEvent); }
public override void KeyDown (NSEvent theEvent) { if ((NSKey)(theEvent.Characters [0]) == NSKey.RightArrow) right (); else if (theEvent.Characters [0] == 'r') reset (); else base.KeyDown (theEvent); }
public override void MouseDragged (NSEvent theEvent) { // Create two items that are dragged: 1) a text string, 2) an image var text = new NSDraggingItem ((NSString)"Hello World"); var images = new NSDraggingItem (homeImage); // Inform the OS that the drag has started and that it contains the two elements // that we created above BeginDraggingSession (new [] { text, images }, theEvent, this); }
public override void MouseUp(NSEvent theEvent) { // Sometimes the MouseUp event is called without prior MouseDown if (!_isMouseDown || !Enabled) return; _isMouseDown = false; base.MouseUp(theEvent); GenericControlHelper.MouseUp(this, _control, theEvent); }
public static bool KeyUp(Control control, NSEvent theEvent) { if (control != null) { var kpea = theEvent.ToEtoKeyEventArgs(); control.OnKeyUp(kpea); return kpea.Handled; } return false; }
public override void mouseDown(NSEvent theEvent) { this.lastLocation = this.target.ConvertPointFromView(theEvent.LocationInWindow, null); if (NSBezierPathExtensions.ClosedPath(this.SelectedPath).ContainsPoint(this.lastLocation)) { this.startMovingAtPoint(this.lastLocation); return; } this.startSelectingAtPoint(this.lastLocation); }
public virtual void mouseDown(NSEvent theEvent) { this.lastLocation = this.target.ConvertPointFromView(theEvent.LocationInWindow, null); if (NSRect.NSPointInRect(this.lastLocation, this.selectedRect)) { this.startMovingAtPoint(this.lastLocation); return; } this.startSelectingAtPoint(this.lastLocation); }
public override void MouseDown(NSEvent theEvent) { /* Animate composition parameters "size" and "primary color" through a Core Animation transaction of 1 second duration */ CATransaction.Begin(); CATransaction.SetValueForKey(NSNumber.NumberWithFloat(1.0f), CATransaction.kCATransactionAnimationDuration); this.Layer.SetValueForKeyPath(NSNumber.NumberWithFloat(this.rand()), "patch.size.value"); Id rgb = new Id(CGColor.CreateGenericRGB(this.rand(), this.rand(), this.rand(), 1.0f)); this.Layer.SetValueForKeyPath(rgb, NSString.StringWithFormat("patch.%@.value", QCComposition.QCCompositionInputPrimaryColorKey)); CATransaction.Commit(); }
public new void mouseDown(NSEvent e) { if ((e.modifierFlags() & Enums.NSAlternateKeyMask) != 0) { DoBuildUsingNamesOrder(); SuperCall(NSPopUpButton.Class, "mouseDown:", e); DoBuildUsingOffsetsOrder(); } else SuperCall(NSPopUpButton.Class, "mouseDown:", e); }
public static void MouseUp(NSView view, IControlMouseInteraction control, NSEvent theEvent, bool isRightButton) { var button = MouseButtonType.Right; if(!isRightButton) button = GetMouseButtonType(theEvent); var point = GetMouseLocation(view, theEvent); var keysHeld = GetKeysHeld(theEvent); //Console.WriteLine("GenericControlHelper - MouseUp - point: {0} button: {1} bounds: {2}", point, button, view.Bounds); control.MouseUp(point.X, point.Y, button, keysHeld); }
public override void MouseDown (NSEvent theEvent) { if (UsesMenu) { RunPopUp (theEvent); } else { base.MouseDown (theEvent); } }
public override void MouseExited(NSEvent theEvent) { _isMouseOver = false; MouseEvent(theEvent, RawMouseEventType.LeaveWindow); base.MouseExited(theEvent); }
public override void ScrollWheel(NSEvent theEvent) { // TODO: use scroll events to pan? base.ScrollWheel(theEvent); this.ActualController.HandleMouseWheel(this, theEvent.ToMouseWheelEventArgs(this.Bounds)); }
public override void RightMouseDown(NSEvent theEvent) { base.RightMouseDown(theEvent); }
public override void TouchesBeganWithEvent(NSEvent theEvent) { base.TouchesBeganWithEvent(theEvent); }
//public override void SmartMagnify (NSEvent withEvent) //{ // base.SmartMagnify (withEvent); //} public override void SwipeWithEvent(NSEvent theEvent) { base.SwipeWithEvent(theEvent); }
public override void RightMouseDown(NSEvent theEvent) { HandleContextActions(theEvent); base.RightMouseDown(theEvent); }
public override void MouseDragged(NSEvent theEvent) { eventResponder.MouseDragged(theEvent); }
public override bool AcceptsFirstMouse(NSEvent theEvent) { return(true); }
public override void OtherMouseDragged(NSEvent theEvent) { PointF loc = theEvent.LocationInWindow; UpdateMousePosition(loc); }
public override void CursorUpdate(NSEvent theEvent) { base.CursorUpdate(theEvent); }
public override void KeyUp(NSEvent theEvent) { KeyboardEvent(RawKeyEventType.KeyUp, theEvent); base.KeyUp(theEvent); }
public override void RightMouseDragged(NSEvent theEvent) { MouseEvent(theEvent, RawMouseEventType.Move); base.RightMouseDragged(theEvent); }
public override void MouseEntered(NSEvent theEvent) { _isMouseOver = true; base.MouseEntered(theEvent); }
uint GetTimeStamp(NSEvent ev) => (uint)(ev.Timestamp * 1000);
public override void MouseDown(NSEvent theEvent) { eventResponder.MouseDown(theEvent); }
public override void OtherMouseUp(NSEvent theEvent) { eventResponder.OtherMouseUp(theEvent); }
public override void MouseUp(NSEvent e) { SparkleShare.Controller.OpenWebsite(this.url.ToString()); }
public override void OtherMouseUp(NSEvent theEvent) { _isMiddlePressed = false; MouseEvent(theEvent, RawMouseEventType.MiddleButtonUp); base.OtherMouseUp(theEvent); }
public override void MagnifyWithEvent(NSEvent theEvent) { base.MagnifyWithEvent(theEvent); // TODO: handle pinch event // https://developer.apple.com/library/mac/documentation/cocoa/conceptual/eventoverview/HandlingTouchEvents/HandlingTouchEvents.html }
public override void MouseDown(NSEvent theEvent) { base.MouseDown(theEvent); this.ActualController.HandleMouseDown(this, theEvent.ToMouseDownEventArgs(this.Bounds)); }
public override void KeyDown(NSEvent theEvent) { base.KeyDown(theEvent); this.ActualController.HandleKeyDown(this, theEvent.ToKeyEventArgs()); }
public override void RightMouseUp(NSEvent theEvent) { _isRightPressed = false; MouseEvent(theEvent, RawMouseEventType.RightButtonUp); base.RightMouseUp(theEvent); }
public override void OtherMouseDown(NSEvent theEvent) { base.OtherMouseDown(theEvent); }
public override void OtherMouseDown(NSEvent theEvent) { _isMiddlePressed = true; MouseEvent(theEvent, RawMouseEventType.MiddleButtonDown); base.OtherMouseDown(theEvent); }
public override void MouseExited(NSEvent theEvent) { base.MouseExited(theEvent); this.ActualController.HandleMouseLeave(this, theEvent.ToMouseEventArgs(this.Bounds)); }
public override void ScrollWheel(NSEvent theEvent) { MouseEvent(theEvent, RawMouseEventType.Wheel); base.ScrollWheel(theEvent); }
public override void MouseMoved(NSEvent theEvent) { MouseEvent(theEvent, RawMouseEventType.Move); base.MouseMoved(theEvent); }
public override void MouseUp(NSEvent theEvent) { _isLeftPressed = false; MouseEvent(theEvent, RawMouseEventType.LeftButtonUp); base.MouseUp(theEvent); }
public override void KeyDown(NSEvent theEvent) { KeyboardEvent(RawKeyEventType.KeyDown, theEvent); InputContext.HandleEvent(theEvent); base.KeyDown(theEvent); }
public override void RightMouseDown(NSEvent theEvent) { _isRightPressed = true; MouseEvent(theEvent, RawMouseEventType.RightButtonDown); base.RightMouseDown(theEvent); }
public new void keyDown(NSEvent evt) { NSString chars = evt.characters(); // TODO: Would be nice to also complete for '.' and ','. This should insert // the punctuation and, for '.', start a new completion. if (chars.Equals("\t") || chars.Equals("\r") || chars.Equals(" ") || chars.Equals("(")) { DoComplete(false, selectedRow()); } else if (evt.keyCode() == Constants.EnterKey) { DoComplete(true, selectedRow()); } else if (chars.Equals(Constants.Escape)) { m_text = null; window().windowController().Call("hide"); } else if (chars.length() == 1 && (char.IsLetterOrDigit(chars[0]) || chars[0] == '_')) { m_completed += chars[0]; int count = DoMatchName(); if (count > 0) { reloadData(); } else if (m_completed.Length == 1) { // It's rather confusing to have completed text without any indication // that there is completed text so if the user's completed text is completely // bogus we'll reset it. m_completed = string.Empty; } } else if (chars.Equals(Constants.Delete)) { if (m_completed.Length > 0) { m_completed = m_completed.Remove(m_completed.Length - 1); DoMatchName(); reloadData(); } else Functions.NSBeep(); } else if (chars.length() == 1 && chars[0] == ' ') { DoMatchName(); // just select the best match } else { Unused.Value = SuperCall(NSTableView.Class, "keyDown:", evt); } }