Пример #1
0
        public override void HandleMouseMovingEvent(object sender, MouseMotionEventArgs e)
        {
            if (!Visible)
            {
                return;
            }
            base.HandleMouseMovingEvent(sender, e);

            if (iconScroller.IsClicked)
            {
                // allow scrolling under three conditions
                // 1) mouse is between min/max scroller positions (don't scroll if mouse is outside the bounds)
                // 2) mouse is outside bounds, but scroller isn't at the minimum and should be
                // 3) mouse is outside bounds, but scroller isn't at the maximum and should be
                if (IsMouseBetweenMinAndMax(e) || IsScrollerNotAtMinimumButShouldBe(e) || IsScrollerNotAtMaximumButShouldBe(e))
                {
                    int scrollDistance = GetScrollDistance(e);

                    Vector iconScrollerPosition = GetNewScrollerPosition(scrollDistance);
                    ScrollItemsAndScroller(iconScrollerPosition, scrollDistance);
                }
            }

            HandleMouseMovingEventForItems(sender, e);
        }
Пример #2
0
 void _MouseMotion(object source, MouseMotionEventArgs e)
 {
     if (MouseMotion != null)
     {
         MouseMotion(source, e);
     }
 }
Пример #3
0
 /// <summary>
 /// Raises the mouse motion event.
 /// </summary>
 /// <param name='ergs'>
 /// Ergs.
 /// </param>
 private static void OnMouseMotion(MouseMotionEventArgs ergs)
 {
     if (MouseMotion != null)
     {
         MouseMotion(__instance, ergs);
     }
 }
Пример #4
0
 static void OnMouseMotion(MouseMotionEventArgs e)
 {
     if (MouseMotion != null)
     {
         MouseMotion(instance, e);
     }
 }
Пример #5
0
 public virtual void HandleMouseMovingEvent(object sender, MouseMotionEventArgs e)
 {
     if (Visible)
     {
         IsHovered = GetHovered(e.RelativeToWindowX, e.RelativeToWindowY);
     }
 }
Пример #6
0
        public override void PointerMotion(MouseMotionEventArgs args)
        {
            /* if the dropdown is visible, see if we're inside it */
            if (!dropdown_visible)
            {
                return;
            }

            if (            /*
                             * starcraft doesn't include this check..  should we?
                             * args.X >= X1 && args.X < X1 + dropdownSurface.Width &&
                             */
                args.Y >= Y1 + Height && args.Y < Y1 + Height + dropdownSurface.Height)
            {
                int new_selected_item = (args.Y - (Y1 + Height)) / Font.LineSize;

                if (selected_item != new_selected_item)
                {
                    selected_item = new_selected_item;
                    CreateDropdownSurface();
                    Painter.Invalidate(new Rectangle(new Point(X1, Y1 + Height),
                                                     dropdownSurface.Size));
                }
            }
        }
Пример #7
0
 /// <summary>
 /// Processes a mouse motion event. This event is triggered by
 /// SDL. Only
 /// sprites that are MouseSensitive are processed.
 /// </summary>
 /// <param name="sender">Object that sent event</param>
 /// <param name="e">Event arguments</param>
 private void Update(object sender, MouseMotionEventArgs e)
 {
     foreach (Sprite s in this)
     {
         s.Update(e);
     }
 }
Пример #8
0
		public void HandlePointerMotion (MouseMotionEventArgs args)
		{
			if (dialog != null)
				dialog.HandlePointerMotion (args);
			else
				PointerMotion (args);
		}
Пример #9
0
        public bool doEvent(object caller, MouseMotionEventArgs mmData, Point offset)
        {
            if (SubMenu != null && SubMenu.doEvent(this, mmData))
            {
                return(true);
            }

            Point p = mmData.Position;

            selected = -1;

            if (p.X < offset.X ||
                p.Y < offset.Y ||
                p.X >= displaySize.Width + offset.X ||
                p.Y >= displaySize.Height + offset.Y)
            {
                // Out of focus, brute force clear
                Clear();
                return(false);
            }

            int scanX = Compound.IconSize.Width + Compound.Padding * 2 + offset.X;
            int index = 0;

            foreach (MenuItem mi in menuEntries)
            {
                if (!(mi is MenuSeperator))
                {
                    DisplayCaption caption = mi.Caption;
                    caption.SizeWithIcon = false;

                    int newX = scanX + Compound.Padding * 3 + caption.Width;

                    if (newX > p.X)
                    {
                        selected = index;

                        if (mi.IsPopup())
                        {
                            if (SubMenu != null)
                            {
                                SubMenu.Clear();
                            }

                            SubMenu          = (PopupMenu)mi;
                            SubMenu.Position = new Point(scanX + Compound.Padding * 3, displaySize.Height - Compound.Padding + offset.Y);
                            SubMenu.Show();
                        }

                        return(true);
                    }

                    scanX = newX;
                }
                index++;
            }

            return(true);
        }
Пример #10
0
 private void MouseMotion(object sender, MouseMotionEventArgs e)
 {
     if (down)
     {
         Gl.glRotatef(lastX - e.X, 0, 1, 0);
         lastX = e.X;
     }
 }
Пример #11
0
 private void MouseMotion(object sender, MouseMotionEventArgs e)
 {
     // Fix the emitter and the vortex manipulator to the mouse.
     emit.X = e.X;
     emit.Y = e.Y;
     vort.X = e.X;
     vort.Y = e.Y;
 }
Пример #12
0
        public void HandleMouseMovingEvent(object sender, MouseMotionEventArgs e)
        {
            int x = e.RelativeToLastMotionEventX;

            if (player.Position.X >= 0 && player.Position.X <= MainGame.SCREEN_WIDTH_LOGICAL)
            {
                player.AdjustPosition(new Vector(x, 0));
            }
        }
Пример #13
0
 void renderer_MouseMotion(object sender, MouseMotionEventArgs e)
 {
     _mousex = e.X;
     _mousey = e.Y;
     if (MouseMove != null)
     {
         MouseMove();
     }
 }
Пример #14
0
 void MouseMotion(object source, MouseMotionEventArgs e)
 {
     if (e.Button == MouseButton.PrimaryButton)
     {
         zRot  += (e.X - mousex);
         yRot  += (e.Y - mousey);
         mousex = e.X;
         mousey = e.Y;
     }
 }
Пример #15
0
        private void MouseMotion(object sender, MouseMotionEventArgs e)
        {
            _Player.NewRotationLeft -= e.RelativeX * Configuration.Input.MouseSensitivity;
            _Player.NewRotationUp   += e.RelativeY * Configuration.Input.MouseSensitivity;

            if (_MouseGrab)
            {
                CenterMouseCursor();
            }
        }
Пример #16
0
		public override void PointerMotion (MouseMotionEventArgs args)
		{
			if (!selecting)
				return;

			int index = (args.Y - Y1) / Font.LineSize + first_visible;
			if (index < items.Count) {
				selectionIndex = index;
				Invalidate ();
			}
		}
        private void UpdateMousePositionDiagnostics(MouseMotionEventArgs e)
        {
            var mousePositionAbsolute  = new Vector(e.RelativeToWindowX, e.RelativeToWindowY);
            var mousePositionIsometric = CoordinateHelper.ScreenSpaceToWorldSpace(e.RelativeToWindowX, e.RelativeToWindowY,
                                                                                  CoordinateHelper.ScreenOffset, CoordinateHelper.ScreenProjectionType.Orthogonal);

            labelMousePositionAbsolute.Text = String.Format("Mouse Position (Absolute): ({0}, {1})", mousePositionAbsolute.X,
                                                            mousePositionAbsolute.Y);
            labelMousePositionIsometric.Text = String.Format("Mouse Position (Isometric): ({0}, {1})", mousePositionIsometric.X,
                                                             mousePositionIsometric.Y);
        }
Пример #18
0
 /// <summary>
 /// Mouse movement event arguments passed to the active popup or screen
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public virtual void HandleMouseMovingEvent(object sender, MouseMotionEventArgs e)
 {
     if (IsActivePopupAvailable)
     {
         ActivePopup.HandleMouseMovingEvent(sender, e);
     }
     else if (IsActiveScreenAvailable)
     {
         ActiveScreen.HandleMouseMovingEvent(sender, e);
     }
 }
Пример #19
0
        //		private void Resize (object sender, VideoResizeEventArgs e)
        //		{
        //			Video.SetVideoMode(e.Width, e.Height, true);
        //			if (screen.Width != e.Width || screen.Height != e.Height)
        //			{
        //				//this.Init();
        //				this.RedBook t = new RedBook(); t.Reshape();
        //			}
        //		}

        private void MouseMotion(object sender, MouseMotionEventArgs e)
        {
            if (e.ButtonPressed)
            {
                Gl.glRasterPos2i(100, 100);
                Gl.glPixelZoom((float)zoomFactor, (float)zoomFactor);
                Gl.glCopyPixels(0, 0, CHECKWIDTH, CHECKHEIGHT, Gl.GL_COLOR);
                Gl.glPixelZoom(1.0f, 1.0f);
                Gl.glFlush();
            }
        }
Пример #20
0
        public override void HandleMouseMovingEvent(object sender, MouseMotionEventArgs e)
        {
            // get the map cell that the user's mouse is hovering over
            if (userInterfaceManager.CurrentState == UserInterfaceState.PlaceEquipmentActive || userInterfaceManager.CurrentState == UserInterfaceState.PlaceRoomActive)
            {
                IPurchasable selectedPurchasable = userInterfaceManager.SelectedPurchasableItem;
                hoveredMapCells = GetHoveredMapCellAndNeighbors(e.RelativeToWindowX, e.RelativeToWindowY, selectedPurchasable.HorizontalMapCellCount, selectedPurchasable.VerticalMapCellCount);
                userInterfaceManager.SetHoveredMapCells(hoveredMapCells);
            }

            userInterfaceManager.HandleMouseMovingEvent(sender, e);
        }
Пример #21
0
        private void OnMouseMotion(object sender, MouseMotionEventArgs mouseEventArgs)
        {
            short relativeX = mouseEventArgs.RelativeX;
            short relativeY = mouseEventArgs.RelativeY;

            inputState.MouseMotionX = (short)(relativeX - inputState.RecenterOffsetX);
            inputState.MouseMotionY = (short)(relativeY - inputState.RecenterOffsetY);

            Mouse.MousePosition = this.screenCenterPosition;

            inputState.RecenterOffsetX = (Mouse.MousePosition.X - this.screenCenterPosition.X);
            inputState.RecenterOffsetY = (Mouse.MousePosition.Y - this.screenCenterPosition.Y);
        }
Пример #22
0
 public override void HandleMouseMovingEvent(object sender, MouseMotionEventArgs e)
 {
     if (Visible)
     {
         foreach (var control in controls)
         {
             if (control != null)
             {
                 control.HandleMouseMovingEvent(sender, e);
             }
         }
     }
 }
Пример #23
0
        public override void HandleMouseMovingEvent(object sender, MouseMotionEventArgs e)
        {
            if (!Visible)
            {
                return;
            }
            base.HandleMouseMovingEvent(sender, e);

            foreach (var tab in tabs)
            {
                tab.HandleMouseMovingEvent(sender, e);
            }
        }
Пример #24
0
        public override bool doEvent(object caller, MouseMotionEventArgs e)
        {
            if (e.X < 0 || e.X > Width ||
                e.Y < 0 || e.Y > Height)
            {
                selectedAtom     = null;
                decompressedSize = 0;
                return(false);
            }

            Point p = new Point(0, 0);

            foreach (Atom a in docked)
            {
                DisplayCaption dc;

                if (a == null)
                {
                    dc = DisplaySettings.defaultCaption;
                }
                else
                {
                    dc = a.Caption;
                    dc.UseDefaultIcon = true;
                }

                if (selectedAtom != a)
                {
                    p.X += dc.Icon.Width + Compound.Padding;
                }
                else
                {
                    p.X += dc.Width + Compound.Padding;
                }

                if (e.X < p.X)
                {
                    if (selectedAtom != a)
                    {
                        selectedAtom     = a;
                        decompressedSize = a.Caption.Icon.Width;
                    }
                    return(true);
                }
            }

            selectedAtom     = null;
            decompressedSize = 0;

            return(true);
        }
Пример #25
0
        private void MouseMotionEvent(object sender, MouseMotionEventArgs move)
        {
            if (!ButtonPressed)
            {
                return;
            }

            if (PressedButton == MouseButton.PrimaryButton)
            {
                board.clickedX = (move.X / board.squareSize);
                board.clickedY = (move.Y / board.squareSize);
                gEngine.DrawScreen(board, surfaceControl1);
            }
        }
Пример #26
0
        void PointerMotion(object o, MouseMotionEventArgs args)
        {
            cached_cursor_x = args.X;
            cached_cursor_y = args.Y;

            if (cursor != null)
            {
                cursor.SetPosition(cached_cursor_x, cached_cursor_y);
            }

            if (currentScreen != null)
            {
                currentScreen.HandlePointerMotion(args);
            }
        }
Пример #27
0
        /// <summary>
        /// Determines the distance that the listbox and the scroller image should scroll based on the mouse movement. The distance at which we scroll is limited
        /// to within the bounds of the minimum and maximum scroll positions.
        /// </summary>
        /// <param name="e"></param>
        /// <returns></returns>
        private int GetScrollDistance(MouseMotionEventArgs e)
        {
            int scrollDistance = e.RelativeToLastMotionEventY;

            if (iconScroller.Position.Y + scrollDistance < iconScrollerMinPosition.Y)
            {
                scrollDistance = (int)(iconScrollerMinPosition.Y - iconScroller.Position.Y);
            }
            else if (iconScroller.Position.Y + scrollDistance > iconScrollerMaxPosition.Y)
            {
                scrollDistance = (int)(iconScrollerMaxPosition.Y - iconScroller.Position.Y);
            }

            return(scrollDistance);
        }
Пример #28
0
 private void Events_MouseMotion(object sender, MouseMotionEventArgs e)
 {
     if (gEngine.highScores.IntersectsWith(new Point(e.X, e.Y)) ||
         gEngine.newGame.IntersectsWith(new Point(e.X, e.Y)) ||
         gEngine.quitGame.IntersectsWith(new Point(e.X, e.Y)) ||
         gEngine.exitButton.IntersectsWith(new Point(e.X, e.Y)) ||
         gEngine.switchMode.IntersectsWith(new Point(e.X, e.Y)))
     {
         Cursor.Current = Cursors.Hand;
     }
     else
     {
         Cursor.Current = Cursors.Default;
     }
 }
Пример #29
0
        //		private void Resize (object sender, VideoResizeEventArgs e)
        //		{
        //			Video.SetVideoMode(e.Width, e.Height, true);
        //			if (screen.Width != e.Width || screen.Height != e.Height)
        //			{
        //				//this.Init();
        //				this.RedBook t = new RedBook(); t.Reshape();
        //			}
        //		}

        private void MouseButtonPressed(object sender, MouseMotionEventArgs e)
        {
            if (e.ButtonPressed)
            {
                switch (e.Button)
                {
                case MouseButton.PrimaryButton:
                    spinning = true;
                    break;

                case MouseButton.SecondaryButton:
                    spinning = false;
                    break;
                }
            }
        }
Пример #30
0
 private void MouseMotion(object sender, MouseMotionEventArgs e)
 {
     if (dragMode)
     {
         ScrollByDrag(new Point(e.X, e.Y));
     }
     else
     {
         if (controller != null)
         {
             Point ab = qView.fromClientToAB(e.X + ScrollPosition.X, e.Y + ScrollPosition.Y);
             controller.OnMouseMove(null, qView.fromABToXYZ(ab, controller), ab);
         }
         oldX = e.X;
         oldY = e.Y;
     }
 }
Пример #31
0
		public override void PointerMotion (MouseMotionEventArgs args)
		{
			if (buttonDownInMinimap) {
				RecenterFromMinimap (args.X, args.Y);
			}
			else {
				base.PointerMotion (args);

				// if the mouse is over one of the
				// normal UIElements in the HUD, deal
				// with it
				if (mouseOverElement != null) {
					// XXX for now, just return.
					return;
				}

				// if the mouse is over the hud area, return
				int hudIndex = (args.X + args.Y * hudElement.Pcx.Width) * 4;
				if (hudElement.Pcx.RgbaData [hudIndex] == 0xff) {
					Game.Instance.Cursor = Cursor;
					return;
				}

				if (args.X < MOUSE_MOVE_BORDER) {
					horiz_delta = -SCROLL_DELTA;
				}
				else if (args.X + MOUSE_MOVE_BORDER > Painter.SCREEN_RES_X) {
					horiz_delta = SCROLL_DELTA;
				}
				else {
					horiz_delta = 0;
				}

				if (args.Y < MOUSE_MOVE_BORDER) {
					vert_delta = -SCROLL_DELTA;
				}
				else if (args.Y + MOUSE_MOVE_BORDER > Painter.SCREEN_RES_Y) {
					vert_delta = SCROLL_DELTA;
				}
				else {
					vert_delta = 0;
				}

				// we update the cursor to show the
				// scrolling animations here, since it
				// only happens on pointer motion.
				if (horiz_delta < 0)
					if (vert_delta < 0)
						Game.Instance.Cursor = ScrollCursors[SCROLL_CURSOR_UL];
					else if (vert_delta > 0)
						Game.Instance.Cursor = ScrollCursors[SCROLL_CURSOR_DL];
					else
						Game.Instance.Cursor = ScrollCursors[SCROLL_CURSOR_L];
				else if (horiz_delta > 0)
					if (vert_delta < 0)
						Game.Instance.Cursor = ScrollCursors[SCROLL_CURSOR_UR];
					else if (vert_delta > 0)
						Game.Instance.Cursor = ScrollCursors[SCROLL_CURSOR_DR];
					else
						Game.Instance.Cursor = ScrollCursors[SCROLL_CURSOR_R];
				else
					if (vert_delta < 0)
						Game.Instance.Cursor = ScrollCursors[SCROLL_CURSOR_U];
					else if (vert_delta > 0)
						Game.Instance.Cursor = ScrollCursors[SCROLL_CURSOR_D];
					else
						Game.Instance.Cursor = Cursor;


				UpdateCursor ();
			}
		}
Пример #32
0
 void _MouseMotion(object source, MouseMotionEventArgs e)
 {
     if (MouseMotion != null)
     {
         MouseMotion(source, e);
     }
 }
Пример #33
0
        public override void PointerMotion(MouseMotionEventArgs args)
        {
            /* if the dropdown is visible, see if we're inside it */
            if (!dropdown_visible)
                return;

            if (/*
                  starcraft doesn't include this check..  should we?
                  args.X >= X1 && args.X < X1 + dropdownSurface.Width &&
                */
                args.Y >= Y1 + Height && args.Y < Y1 + Height + dropdownSurface.Height) {

                int new_selected_item = (args.Y - (Y1 + Height)) / Font.LineSize;

                if (selected_item != new_selected_item) {
                    selected_item = new_selected_item;
                    CreateDropdownSurface ();
                    Painter.Invalidate (new Rectangle (new Point (X1, Y1 + Height),
                                       dropdownSurface.Size));
                }
            }
        }
Пример #34
0
 public virtual void PointerMotion(MouseMotionEventArgs args)
 {
 }
Пример #35
0
        public override void PointerMotion(MouseMotionEventArgs args)
        {
            if (!selecting)
                return;

            int index = (args.Y - Y1) / Font.LineSize + first_visible;
            if (index < items.Count) {
                selectionIndex = index;
                Invalidate ();
            }
        }
Пример #36
0
        void PointerMotion(object o, MouseMotionEventArgs args)
        {
            cached_cursor_x = args.X;
            cached_cursor_y = args.Y;

            if (cursor != null)
                cursor.SetPosition (cached_cursor_x, cached_cursor_y);

            if (currentScreen != null)
                currentScreen.HandlePointerMotion (args);
        }
Пример #37
0
 void MouseMotion( object source, MouseMotionEventArgs e )
 {
     if( e.Button == MouseButton.PrimaryButton )
     {
         zRot += (e.X - mousex);
         yRot += (e.Y - mousey);
         mousex = e.X;
         mousey = e.Y;
     }
 }
Пример #38
0
 void renderer_MouseMotion(object sender, MouseMotionEventArgs e)
 {
     _mousex = e.X;
     _mousey = e.Y;
     if( MouseMove != null )
     {
         MouseMove();
     }
 }
Пример #39
0
        public virtual void PointerMotion(MouseMotionEventArgs args)
        {
            if (mouseDownElement != null) {
                mouseDownElement.PointerMotion (args);
            }
            else {
                UIElement newMouseOverElement = XYToElement (args.X, args.Y, true);

                if (newMouseOverElement != mouseOverElement) {
                    if (mouseOverElement != null)
                        MouseLeaveElement (mouseOverElement);
                    if (newMouseOverElement != null)
                        MouseEnterElement (newMouseOverElement);
                }

                mouseOverElement = newMouseOverElement;
            }
        }
Пример #40
0
 public void HandlePointerMotion(MouseMotionEventArgs args)
 {
     if (dialog != null)
         dialog.HandlePointerMotion (args);
     else
         PointerMotion (args);
 }