Пример #1
0
        public override bool MouseUp(MouseButtonEventArgs e)
        {
            if (disposing || !IsVisible())
            {
                return(false);
            }
            if (scrollbarH.MouseUp(e))
            {
                return(true);
            }
            if (scrollbarV.MouseUp(e))
            {
                return(true);
            }

            if (ClientArea.Contains(e.X, e.Y))
            {
                MouseButtonEvent mbe = new MouseButtonEvent();
                mbe.X      = e.X - (Position.X + (int)scrollbarH.Value);
                mbe.Y      = e.Y - (Position.Y + (int)scrollbarV.Value);
                mbe.Button = e.Button;

                MouseButtonEventArgs modArgs = new MouseButtonEventArgs(mbe);

                foreach (GuiComponent component in components)
                {
                    component.MouseUp(modArgs);
                }
            }
            return(false);
        }
Пример #2
0
        private static void OnMouseClick(Screen w, MouseButtonEvent e)
        {
            if (e.State == ButtonState.Pressed)
            {
                if (e.Position.Y < 30 && e.Position.X < _window.Size.Width - 40)
                {
                    _windowStart  = _window.Position;
                    _dragStart    = _windowStart + e.Position;
                    _isMoveWindow = true;
                }

                //
                var cardBounds = new Rectangle(_cardPos - (Vector)_card.Size / 2F, _card.Size);
                if (cardBounds.Contains(e.Position - (8, 30))) // minus viewport
                {
                    _isMoveCard = true;
                    _dragStart  = e.Position;
                }
            }
            else
            if (e.State == ButtonState.Released)
            {
                if (_isHoverClose)
                {
                    // Bye!
                    _window.Close();
                }

                _isMoveWindow = false;
                _isMoveCard   = false;
            }
        }
Пример #3
0
        protected internal override void OnMouseDown(MouseButtonEvent e)
        {
            // Handle non interactive state.
            if (!IsInteractive)
            {
                e.IsHandled = true;
                return;
            }

            // We only care about left ButtonBase presses
            if (e.Button != MouseButton.Left)
            {
                return;
            }

            // Mark the event as handled so it does not propegate further
            e.IsHandled = true;

            // Set the button as focused
            // TODO: Focus
            //if (IsFocusable) Focus();

            // Set the capture to this node to ensure all future events are routed to it.
            Capture();

            OnPress();

            // Fire click event if click mode is press
            if (ClickMode == ClickMode.Press)
            {
                OnClick();
            }
        }
Пример #4
0
        private void OnClick(MouseButtonEvent e)
        {
            var button = ServerInput.ToServerButton(e.Button);
            var mods   = ServerInput.ToServerModifiers(e.Modifiers);

            SendMessage("click", e.Position, button, mods);
        }
Пример #5
0
        /// <summary>
        /// Finishes the current blueprint selection.
        /// </summary>
        /// <param name="e">The mouse event which triggered end of selection.</param>
        /// <returns>Whether a click selection was active.</returns>
        private bool endClickSelection(MouseButtonEvent e)
        {
            if (!clickSelectionBegan && !isDraggingBlueprint)
            {
                // if a selection didn't occur, we may want to trigger a deselection.
                if (e.ControlPressed && e.Button == MouseButton.Left)
                {
                    // Iterate from the top of the input stack (blueprints closest to the front of the screen first).
                    // Priority is given to already-selected blueprints.
                    foreach (SelectionBlueprint <T> blueprint in SelectionBlueprints.AliveChildren.Reverse().OrderByDescending(b => b.IsSelected))
                    {
                        if (!blueprint.IsHovered)
                        {
                            continue;
                        }

                        return(clickSelectionBegan = SelectionHandler.MouseUpSelectionRequested(blueprint, e));
                    }
                }

                return(false);
            }

            return(true);
        }
Пример #6
0
        private void HandleMouseButtonEvent(IntPtr window, int button, int action, int mods)
        {
            if (this.MouseButtonPressedHandler.HasSubscribers || this.MouseButtonReleasedHandler.HasSubscribers)
            {
                var commonButton = MouseButton.Other;

                if (button == GLFW_MOUSE_BUTTON_LEFT)
                {
                    commonButton = MouseButton.Left;
                }
                else if (button == GLFW_MOUSE_BUTTON_RIGHT)
                {
                    commonButton = MouseButton.Right;
                }
                else if (button == GLFW_MOUSE_BUTTON_MIDDLE)
                {
                    commonButton = MouseButton.Middle;
                }

                var mbe = new MouseButtonEvent(button, commonButton);

                if (action == GLFW_PRESS)
                {
                    this.MouseButtonPressedHandler.Notify(mbe);
                }
                else if (action == GLFW_RELEASE)
                {
                    this.MouseButtonReleasedHandler.Notify(mbe);
                }
            }
        }
Пример #7
0
 private void OnButtonClick(object sender, MouseButtonEvent e)
 {
     if (sender == back)
     {
         Current = Current.Parent;
     }
     else if (sender == next)
     {
         currentOffset += (PageRows * PageColumns) - 2;
         UpdateButtons();
     }
     else
     {
         var button = (MenuButton)sender;
         if (button.Node != null)
         {
             if (button.Node.Children.Any())
             {
                 Current = button.Node;
             }
             else
             {
                 button.Node.Activate();
             }
         }
     }
 }
Пример #8
0
 private void ProcessMouseDownEvent(MouseButtonEvent pMouseDownEvent)
 {
     if (_processMouseDown != null)
     {
         _processMouseDown(new Point(pMouseDownEvent.X, pMouseDownEvent.Y));
     }
 }
Пример #9
0
 protected override void OnMouseButtonDown(MouseButtonEvent e)
 {
     if (e.Button == MouseButton.Left)
     {
         Click.Raise(this, EventArgs.Empty);
     }
 }
Пример #10
0
 protected override void OnMouseButtonDown(MouseButtonEvent e)
 {
     if (e.Button == MouseButton.Left)
     {
         IsChecked = !IsChecked;
     }
 }
Пример #11
0
        protected override void OnMouseButtonDown(MouseButtonEvent e)
        {
            if (Session == null)
            {
                return;
            }

            camera.OnMouseButtonDown(e);
            if (e.Handled)
            {
                return;
            }

            var sc  = ToAbsolute(e.Position);
            var mc  = Geometry.ScreenToMap(sc);
            var gob = Session.Scene.GetObjectAt(sc);

            if (placeGob != null)
            {
                Placed.Raise(new MapPlaceEvent(e, placeGob.Position));
                Session.Objects.RemoveLocal(placeGob);
                placeGob = null;
            }
            else
            {
                MapClick.Raise(new MapClickEvent(e, mc, e.Position, gob));
            }
            e.Handled = true;
        }
Пример #12
0
 private void OnMouseDown(MouseButtonEvent e)
 {
     if (e.Down)
     {
         mousePos = new Vector2(e.MouseState.X, e.MouseState.Y);
     }
 }
Пример #13
0
 public void HandleMouseButtonUp(MouseButtonEvent e)
 {
     OnMouseButtonUp(e);
     if (!e.Handled && Parent != null)
     {
         Parent.OnMouseButtonUp(e);
     }
 }
Пример #14
0
        private void SendMouseButtonMessage(MouseButtonEvent buttonEvent, int button, Vector2 mousePosition)
        {
            MouseButtonMessage message = m_messageDispatcher.AddMessage <MouseButtonMessage>();

            message.buttonEvent   = buttonEvent;
            message.button        = button;
            message.mousePosition = mousePosition;
        }
Пример #15
0
        private void OnAvatarClick(AvatarView sender, MouseButtonEvent e)
        {
            var pair = avatars.FirstOrDefault(x => x.Value == sender);

            if (pair.Value != null)
            {
                PartyMemberClick.Raise(new PartyMemberClickEvent(pair.Key, e.Button));
            }
        }
Пример #16
0
 protected override void OnMouseButtonDown(MouseButtonEvent e)
 {
     if (e.Button == MouseButton.Left)
     {
         isPressed    = true;
         dragPosition = e.Position;
         Host.GrabMouse(this);
     }
 }
Пример #17
0
        private void OnSlotClick(object sender, MouseButtonEvent e)
        {
            int index = slots.IndexOf((BeltSlot)sender);

            if (index != -1)
            {
                Click.Raise(new BeltClickEvent(index, e.Button, e.Modifiers));
            }
        }
Пример #18
0
 protected override void OnMouseButtonDown(MouseButtonEvent e)
 {
     if (e.Button == MouseButton.Left)
     {
         dragging = true;
         Host.GrabMouse(this);
     }
     e.Handled = true;
 }
Пример #19
0
 protected override void OnMouseButtonUp(MouseButtonEvent e)
 {
     if (e.Button == MouseButton.Left)
     {
         dragging = false;
         Host.ReleaseMouse();
     }
     e.Handled = true;
 }
Пример #20
0
    public void AddMouse(MouseButton newMouse, MouseButtonEvent newMouseEvent)
    {
        var index     = InputComponentsLookup.Mouse;
        var component = (MouseComponent)CreateComponent(index, typeof(MouseComponent));

        component.mouse      = newMouse;
        component.MouseEvent = newMouseEvent;
        AddComponent(index, component);
    }
Пример #21
0
    public void ReplaceInterActionMouse(MouseButton newMouse, MouseButtonEvent newMouseEvent)
    {
        var index     = InputComponentsLookup.InterActionMouse;
        var component = (InterAction.MouseComponent)CreateComponent(index, typeof(InterAction.MouseComponent));

        component.mouse      = newMouse;
        component.MouseEvent = newMouseEvent;
        ReplaceComponent(index, component);
    }
Пример #22
0
 public override void OnMouseButtonUp(MouseButtonEvent e)
 {
     if (e.Button == MouseButton.Middle)
     {
         mv.Host.ReleaseMouse();
         dragging  = false;
         e.Handled = true;
     }
 }
Пример #23
0
        public virtual bool mouseReleased(MouseButtonEvent evt)
        {
            bool ret = (SwigDerivedClassHasMethod("mouseReleased", swigMethodTypes9) ? BitesPINVOKE.InputListener_mouseReleasedSwigExplicitInputListener(swigCPtr, MouseButtonEvent.getCPtr(evt)) : BitesPINVOKE.InputListener_mouseReleased(swigCPtr, MouseButtonEvent.getCPtr(evt)));

            if (BitesPINVOKE.SWIGPendingException.Pending)
            {
                throw BitesPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Пример #24
0
        /// <summary>
        /// Handle a blueprint requesting selection.
        /// </summary>
        /// <param name="blueprint">The blueprint.</param>
        /// <param name="e">The mouse event responsible for deselection.</param>
        /// <returns>Whether a deselection was performed.</returns>
        internal bool MouseUpSelectionRequested(SelectionBlueprint <T> blueprint, MouseButtonEvent e)
        {
            if (blueprint.IsSelected)
            {
                blueprint.ToggleSelection();
                return(true);
            }

            return(false);
        }
Пример #25
0
        public override bool mousePressed(MouseButtonEvent evt)
        {
            bool ret = BitesPINVOKE.InputListenerChain_mousePressed(swigCPtr, MouseButtonEvent.getCPtr(evt));

            if (BitesPINVOKE.SWIGPendingException.Pending)
            {
                throw BitesPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Пример #26
0
        public override bool mouseReleased(MouseButtonEvent evt)
        {
            bool ret = BitesPINVOKE.CameraMan_mouseReleased(swigCPtr, MouseButtonEvent.getCPtr(evt));

            if (BitesPINVOKE.SWIGPendingException.Pending)
            {
                throw BitesPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Пример #27
0
 protected override void OnMouseButtonDown(MouseButtonEvent e)
 {
     if (e.Button != MouseButton.Left)
     {
         return;
     }
     Host.GrabMouse(this);
     isPressed = true;
     e.Handled = true;
 }
Пример #28
0
 public override void OnMouseButtonDown(MouseButtonEvent e)
 {
     if (e.Button == MouseButton.Middle)
     {
         mv.Host.GrabMouse(mv);
         dragging         = true;
         dragPosition     = e.Position;
         dragCameraOffset = Position;
         e.Handled        = true;
     }
 }
Пример #29
0
 private void selectionRequested(PathControlPointPiece piece, MouseButtonEvent e)
 {
     if (e.Button == MouseButton.Left && inputManager.CurrentState.Keyboard.ControlPressed)
     {
         piece.IsSelected.Toggle();
     }
     else
     {
         SetSelectionTo(piece.ControlPoint);
     }
 }
Пример #30
0
    public InputEntity SetInterActionMouse(MouseButton newMouse, MouseButtonEvent newMouseEvent)
    {
        if (hasInterActionMouse)
        {
            throw new Entitas.EntitasException("Could not set InterActionMouse!\n" + this + " already has an entity with InterAction.MouseComponent!",
                                               "You should check if the context already has a interActionMouseEntity before setting it or use context.ReplaceInterActionMouse().");
        }
        var entity = CreateEntity();

        entity.AddInterActionMouse(newMouse, newMouseEvent);
        return(entity);
    }
Пример #31
0
 void ProcessMouseButtonReleased(MouseButtonEvent mouseButtonEvent)
 {
     canvas.Input_MouseButton((int) mouseButtonEvent.Button, false);
 }
Пример #32
0
 void ProcessMouseButtonPressed(MouseButtonEvent mouseButtonEvent)
 {
     canvas.Input_MouseButton((int) mouseButtonEvent.Button, true);
 }
Пример #33
0
 ////////////////////////////////////////////////////////////
 /// <summary>
 /// Construct the mouse button arguments from a mouse button event
 /// </summary>
 /// <param name="e">Mouse button event</param>
 ////////////////////////////////////////////////////////////
 public MouseButtonEventArgs(MouseButtonEvent e)
 {
     Button = e.Button;
     X      = e.X;
     Y      = e.Y;
 }
Пример #34
0
 public MouseButtonEventArgs(Point point, MouseButton button, MouseButtonEvent buttonEvent)
 {
     _point = point;
     _button = button;
     _buttonEvent = buttonEvent;
 }