Ejemplo n.º 1
0
		public override void MouseButtonUp (NSEvent theEvent)
		{
			PointF ui_pt = ParentScreen.ScreenToLayer (theEvent.LocationInWindow);
			
			if (PointInside (ui_pt))
				OnActivate ();
		}
Ejemplo n.º 2
0
		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);
		}
Ejemplo n.º 5
0
		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);
			}
		}
Ejemplo n.º 6
0
        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));
            }
        }
Ejemplo n.º 7
0
		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);
		}
Ejemplo n.º 8
0
		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));
		}	
Ejemplo n.º 9
0
 //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);
 }
Ejemplo n.º 10
0
		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);
		}
Ejemplo n.º 11
0
		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;
		}
Ejemplo n.º 12
0
		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);
		}
Ejemplo n.º 13
0
        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);
                }
            }
        }
Ejemplo n.º 14
0
		public override void MouseMoved (NSEvent theEvent)
		{
			if(theEvent == null)
				return;
			base.MouseMoved (theEvent);
			FireMouseMoved (theEvent);
		}
Ejemplo n.º 15
0
		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;
			}
		}
Ejemplo n.º 16
0
		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);
		}
Ejemplo n.º 17
0
		public override void MouseUp (NSEvent theEvent)
		{
			var skScene = (InGameScene)OverlayScene;
			CGPoint p = skScene.ConvertPointFromView (theEvent.LocationInWindow);
			skScene.TouchUpAtPoint (p);

			base.MouseUp (theEvent);
		}
Ejemplo n.º 18
0
		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);
		}
Ejemplo n.º 19
0
		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);
		}
Ejemplo n.º 20
0
		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);
		}
Ejemplo n.º 21
0
		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);
		}
Ejemplo n.º 22
0
        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);
        }
Ejemplo n.º 23
0
		public static bool KeyUp(Control control, NSEvent theEvent)
		{
			if (control != null)
			{
				var kpea = theEvent.ToEtoKeyEventArgs();
				control.OnKeyUp(kpea);
				return kpea.Handled;
			}
			return false;
		}
Ejemplo n.º 24
0
 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);
 }
Ejemplo n.º 25
0
 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);
 }
Ejemplo n.º 26
0
 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();
 }
Ejemplo n.º 27
0
 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);
 }
Ejemplo n.º 28
0
        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);
        }    
Ejemplo n.º 29
0
		public override void MouseDown (NSEvent theEvent)
		{
			if (UsesMenu)
			{
				RunPopUp (theEvent);
			}
			else
			{
				base.MouseDown (theEvent);
			}
		}
Ejemplo n.º 30
0
 public override void MouseExited(NSEvent theEvent)
 {
     _isMouseOver = false;
     MouseEvent(theEvent, RawMouseEventType.LeaveWindow);
     base.MouseExited(theEvent);
 }
Ejemplo n.º 31
0
 public override void ScrollWheel(NSEvent theEvent)
 {
     // TODO: use scroll events to pan?
     base.ScrollWheel(theEvent);
     this.ActualController.HandleMouseWheel(this, theEvent.ToMouseWheelEventArgs(this.Bounds));
 }
Ejemplo n.º 32
0
 public override void RightMouseDown(NSEvent theEvent)
 {
     base.RightMouseDown(theEvent);
 }
Ejemplo n.º 33
0
 public override void TouchesBeganWithEvent(NSEvent theEvent)
 {
     base.TouchesBeganWithEvent(theEvent);
 }
Ejemplo n.º 34
0
        //public override void SmartMagnify (NSEvent withEvent)
        //{
        //    base.SmartMagnify (withEvent);
        //}

        public override void SwipeWithEvent(NSEvent theEvent)
        {
            base.SwipeWithEvent(theEvent);
        }
Ejemplo n.º 35
0
        public override void RightMouseDown(NSEvent theEvent)
        {
            HandleContextActions(theEvent);

            base.RightMouseDown(theEvent);
        }
Ejemplo n.º 36
0
 public override void MouseDragged(NSEvent theEvent)
 {
     eventResponder.MouseDragged(theEvent);
 }
Ejemplo n.º 37
0
 public override bool AcceptsFirstMouse(NSEvent theEvent)
 {
     return(true);
 }
Ejemplo n.º 38
0
        public override void OtherMouseDragged(NSEvent theEvent)
        {
            PointF loc = theEvent.LocationInWindow;

            UpdateMousePosition(loc);
        }
Ejemplo n.º 39
0
 public override void CursorUpdate(NSEvent theEvent)
 {
     base.CursorUpdate(theEvent);
 }
Ejemplo n.º 40
0
 public override void KeyUp(NSEvent theEvent)
 {
     KeyboardEvent(RawKeyEventType.KeyUp, theEvent);
     base.KeyUp(theEvent);
 }
Ejemplo n.º 41
0
 public override void RightMouseDragged(NSEvent theEvent)
 {
     MouseEvent(theEvent, RawMouseEventType.Move);
     base.RightMouseDragged(theEvent);
 }
Ejemplo n.º 42
0
 public override void MouseEntered(NSEvent theEvent)
 {
     _isMouseOver = true;
     base.MouseEntered(theEvent);
 }
Ejemplo n.º 43
0
 uint GetTimeStamp(NSEvent ev) => (uint)(ev.Timestamp * 1000);
Ejemplo n.º 44
0
 public override void MouseDown(NSEvent theEvent)
 {
     eventResponder.MouseDown(theEvent);
 }
Ejemplo n.º 45
0
 public override void OtherMouseUp(NSEvent theEvent)
 {
     eventResponder.OtherMouseUp(theEvent);
 }
Ejemplo n.º 46
0
 public override void MouseUp(NSEvent e)
 {
     SparkleShare.Controller.OpenWebsite(this.url.ToString());
 }
Ejemplo n.º 47
0
 public override void OtherMouseUp(NSEvent theEvent)
 {
     _isMiddlePressed = false;
     MouseEvent(theEvent, RawMouseEventType.MiddleButtonUp);
     base.OtherMouseUp(theEvent);
 }
Ejemplo n.º 48
0
 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
 }
Ejemplo n.º 49
0
 public override void MouseDown(NSEvent theEvent)
 {
     base.MouseDown(theEvent);
     this.ActualController.HandleMouseDown(this, theEvent.ToMouseDownEventArgs(this.Bounds));
 }
Ejemplo n.º 50
0
 public override void KeyDown(NSEvent theEvent)
 {
     base.KeyDown(theEvent);
     this.ActualController.HandleKeyDown(this, theEvent.ToKeyEventArgs());
 }
Ejemplo n.º 51
0
 public override void RightMouseUp(NSEvent theEvent)
 {
     _isRightPressed = false;
     MouseEvent(theEvent, RawMouseEventType.RightButtonUp);
     base.RightMouseUp(theEvent);
 }
Ejemplo n.º 52
0
 public override void OtherMouseDown(NSEvent theEvent)
 {
     base.OtherMouseDown(theEvent);
 }
Ejemplo n.º 53
0
 public override void OtherMouseDown(NSEvent theEvent)
 {
     _isMiddlePressed = true;
     MouseEvent(theEvent, RawMouseEventType.MiddleButtonDown);
     base.OtherMouseDown(theEvent);
 }
Ejemplo n.º 54
0
 public override void MouseExited(NSEvent theEvent)
 {
     base.MouseExited(theEvent);
     this.ActualController.HandleMouseLeave(this, theEvent.ToMouseEventArgs(this.Bounds));
 }
Ejemplo n.º 55
0
 public override void ScrollWheel(NSEvent theEvent)
 {
     MouseEvent(theEvent, RawMouseEventType.Wheel);
     base.ScrollWheel(theEvent);
 }
Ejemplo n.º 56
0
 public override void MouseMoved(NSEvent theEvent)
 {
     MouseEvent(theEvent, RawMouseEventType.Move);
     base.MouseMoved(theEvent);
 }
Ejemplo n.º 57
0
 public override void MouseUp(NSEvent theEvent)
 {
     _isLeftPressed = false;
     MouseEvent(theEvent, RawMouseEventType.LeftButtonUp);
     base.MouseUp(theEvent);
 }
Ejemplo n.º 58
0
 public override void KeyDown(NSEvent theEvent)
 {
     KeyboardEvent(RawKeyEventType.KeyDown, theEvent);
     InputContext.HandleEvent(theEvent);
     base.KeyDown(theEvent);
 }
Ejemplo n.º 59
0
 public override void RightMouseDown(NSEvent theEvent)
 {
     _isRightPressed = true;
     MouseEvent(theEvent, RawMouseEventType.RightButtonDown);
     base.RightMouseDown(theEvent);
 }
Ejemplo n.º 60
-1
        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);
            }
        }