Exemplo n.º 1
0
        protected virtual void OnHover(MouseMoveActionInfo info)
        {
            State = ControlState.Hovered;

            if (MouseOver != null)
            {
                MouseOver.Invoke(this, info);
            }
        }
Exemplo n.º 2
0
        public SessionCircle()
        {
            Ellipse = new Ellipse {
                Tag = this
            };
            selectedEllipse = new Ellipse();
            canvas          = new Canvas();
            canvas.Children.Add(Ellipse);
            canvas.Children.Add(selectedEllipse);

            UiElement = canvas;

            canvas.MouseEnter += (sender, e) => MouseOver?.Invoke(this);
            canvas.MouseLeave += (sender, e) => MouseLeave?.Invoke(this);
            canvas.MouseDown  += (sender, e) => MouseDown?.Invoke(this);
            canvas.MouseUp    += (sender, e) => MouseUp?.Invoke(this);
        }
Exemplo n.º 3
0
        /// <summary>
        ///     Called when some number of bodies are underneath the mouse for a certain amount of time.
        /// </summary>
        /// <param name="entities">A list of bodies that were underneath the mouse.</param>
        public void OnMouseOver(IEnumerable <Body> entities)
        {
            MouseOver.Invoke(entities);
            string desc  = "";
            bool   first = true;

            foreach (Body body in entities)
            {
                if (!first)
                {
                    desc += "\n";
                }
                desc += body.GetDescription();
                first = false;
            }
            // Create a description of the body and display it on the screen.
            World.ShowInfo(desc);
        }
Exemplo n.º 4
0
        public virtual void Update(GameTime time)
        {
            MouseState state = Mouse.GetState();

            (float x, float y) = PositionV2 - originOffset;

            if (MainTexture != null && state.X >= x && state.Y >= y &&
                state.X <= x + MainTexture.Width &&
                state.Y <= y + MainTexture.Height)
            {
                IsMouseOver = true;
                MouseOver?.Invoke(this, state);
            }
            else
            {
                IsMouseOver = false;
            }
        }
Exemplo n.º 5
0
        public override void Update(GameTime gameTime)
        {
            // Save the MouseOverStatus to only send this once per cycle
            _prevMouseOverStatus = _curMouseOverStatus;

            // Save the previous mouse state
            _previousMouse = _currentMouse;

            // Get the current mouse state
            _currentMouse = Mouse.GetState();

            // Create a rectangle (for "collision") on the current mouse position (1x1 pixel)
            var mouseRectangle = new Rectangle(_currentMouse.X, _currentMouse.Y, 1, 1);

            // By default, set isHovering to false as we want to set it true if the mouse is actually hovering the button
            _isHovering = false;

            // Check if the mouse is indeed inside the button (Rectangle of it)
            if (mouseRectangle.Intersects(BoundingBox))
            {
                _isHovering = true;

                _curMouseOverStatus = true;

                if (_curMouseOverStatus == true && _prevMouseOverStatus == false)
                {
                    MouseOver?.Invoke(this, new EventArgs());
                }

                // If the mouse has been released and it was previously pressed (one "firing" event when one release the buttom)
                if (_currentMouse.LeftButton == ButtonState.Released && _previousMouse.LeftButton == ButtonState.Pressed)
                {
                    // If the CLICK event handler is not null, invoke it -- equivalent would be if(Click != null) > Click(this, new EventArgs())
                    Click?.Invoke(this, new EventArgs());
                }
            }
            else
            {
                _curMouseOverStatus = false;
            }
        }
Exemplo n.º 6
0
 /// <summary>
 /// Raises the <see cref="E:MouseOver"/> event.
 /// </summary>
 /// <param name="e">The <see cref="MouseEventArgs"/> instance containing the event data.</param>
 protected virtual void OnMouseOver(MouseEventArgs e)
 {
     MouseOver?.Invoke(this, e);
 }
Exemplo n.º 7
0
 /// <summary>
 /// Invokes MouseOver event.
 /// </summary>
 /// <param name="args">Event arguments.</param>
 internal void InvokeMouseOver(MouseEventArgs args)
 {
     this.isMouseOver = true;
     MouseOver.Invoke(args);
 }
Exemplo n.º 8
0
 private void OnMouseOver()
 {
     MouseOver?.Invoke(this, EventArgs.Empty);
 }
Exemplo n.º 9
0
 private void tableLayoutPanel1_MouseEnter(object sender, EventArgs e)
 {
     tableLayoutPanel1.BackColor = System.Drawing.Color.FromArgb(255, 221, 221, 221);
     MouseOver?.Invoke(this, EventArgs.Empty);
 }
Exemplo n.º 10
0
 public void MouseOverCB(WindowEvent e)
 {
     MouseOver?.Invoke(e);
 }
Exemplo n.º 11
0
 //over
 protected void RaiseMouseOver(object sender, MouseArg args)
 {
     MouseOver?.Invoke(sender, args);
 }