Exemplo n.º 1
0
 /// <summary>
 /// マウスが入ったときの処理です
 /// </summary>
 /// <param name="mouseEvent"></param>
 protected void OnMouseEnter(MouseEvent mouseEvent)
 {
     if (MouseEnter != null)
     {
         MouseEnter.Invoke(this, mouseEvent);
     }
 }
Exemplo n.º 2
0
 internal void OnMouseEnter(EventArgs e)
 {
     if (MouseEnter != null)
     {
         MouseEnter.Invoke(this, e);
     }
 }
Exemplo n.º 3
0
 public void OnPointerEnter(PointerEventData eventData)
 {
     if (MouseEnter != null)
     {
         MouseEnter.Invoke(this, eventData);
     }
 }
Exemplo n.º 4
0
        public virtual void OnMouseEnter()
        {
            if (!_Enabled)
            {
                return;
            }

            if (MouseEnter != null)
            {
                MouseEnter.Invoke(this, EventArgs.Empty);
            }
        }
Exemplo n.º 5
0
        protected virtual void OnMouseEnter()
        {
            if (!_enabled)
            {
                return;
            }

            Redraw();

            if (MouseEnter != null)
            {
                MouseEnter.Invoke(this, EventArgs.Empty);
            }
        }
Exemplo n.º 6
0
        private void InitMouseEvents()
        {
            _circle.MouseEnter           += (s, e) => MouseEnter?.Invoke(this, e);
            _circle.MouseLeave           += (s, e) => MouseLeave?.Invoke(this, e);
            _circle.MouseLeftButtonDown  += (s, e) => MouseLeftButtonDown?.Invoke(this, e);
            _circle.MouseLeftButtonUp    += (s, e) => MouseLeftButtonUp?.Invoke(this, e);
            _circle.MouseRightButtonDown += (s, e) => MouseRightButtonDown?.Invoke(this, e);
            _circle.MouseRightButtonUp   += (s, e) => MouseRightButtonUp?.Invoke(this, e);
            _circle.MouseMove            += (s, e) => MouseMove?.Invoke(this, e);

            _label.UILabel.MouseEnter           += (s, e) => MouseEnter?.Invoke(this, e);
            _label.UILabel.MouseLeave           += (s, e) => MouseLeave?.Invoke(this, e);
            _label.UILabel.MouseLeftButtonDown  += (s, e) => MouseLeftButtonDown?.Invoke(this, e);
            _label.UILabel.MouseLeftButtonUp    += (s, e) => MouseLeftButtonUp?.Invoke(this, e);
            _label.UILabel.MouseRightButtonDown += (s, e) => MouseRightButtonDown?.Invoke(this, e);
            _label.UILabel.MouseRightButtonUp   += (s, e) => MouseRightButtonUp?.Invoke(this, e);
            _label.UILabel.MouseMove            += (s, e) => MouseMove?.Invoke(this, e);
        }
Exemplo n.º 7
0
        public virtual void Update(GameTime gameTime)
        {
            var pre  = IsMouseOver;
            var cpos = ComputedPosition;
            var nmp  = MainGame.InputMonitor.MousePosition;

            IsMouseOver = nmp.X >= cpos.X &&
                          nmp.X < cpos.X + Size.X &&
                          nmp.Y >= cpos.Y &&
                          nmp.Y < (cpos.Y + Size.Y);
            if (pre && !IsMouseOver)
            {
                MouseLeave?.Invoke();
                Trigger(UiElementBehaviorTriggers.MouseLeave.I());
            }
            if (!pre && IsMouseOver)
            {
                MouseEnter?.Invoke();
                Trigger(UiElementBehaviorTriggers.MouseEnter.I());
            }
            if (nmp != lastMousePos)
            {
                MouseMove?.Invoke();
                Trigger(UiElementBehaviorTriggers.MouseMove.I());
            }

            var leftMouseDown = MainGame.InputMonitor.IsLeftMouseDown;

            if (IsMouseOver && leftMouseDown && !IsMouseDown)
            {
                IsMouseDown = true;
                MouseDown?.Invoke();
                Trigger(UiElementBehaviorTriggers.MouseDown.I());
            }
            if (IsMouseOver && !leftMouseDown && IsMouseDown)
            {
                IsMouseDown = false;
                MouseUp?.Invoke();
                Trigger(UiElementBehaviorTriggers.MouseUp.I());
            }

            lastMousePos = nmp;
        }
Exemplo n.º 8
0
        /// <inheritdoc />
        public void Update(TimeSpan total, TimeSpan elapsed, bool isRunningSlowly)
        {
            if (!IsVisible)
            {
                return;
            }

            PreUpdate?.Invoke(this, new UpdateEventArgs(total, elapsed, isRunningSlowly));

            if (!IsLoaded)
            {
                Load();
            }

            this.location.X = destination.X;
            this.location.Y = destination.Y;

            if (Intersects(Mouse.X, Mouse.Y))
            {
                if (!isMouseIntersectingPrevious)
                {
                    MouseEnter?.Invoke(this, EventArgs.Empty);
                }

                this.isMouseIntersectingPrevious = true;
            }
            else
            {
                if (isMouseIntersectingPrevious)
                {
                    MouseLeave?.Invoke(this, EventArgs.Empty);
                }

                this.isMouseIntersectingPrevious = false;
            }

            InternalUpdate(total, elapsed, isRunningSlowly);

            PostUpdate?.Invoke(this, new UpdateEventArgs(total, elapsed, isRunningSlowly));
        }
Exemplo n.º 9
0
        public FileViewerInternal()
        {
            InitializeComponent();
            InitializeComplete();

            _currentViewPositionCache = new CurrentViewPositionCache(this);
            TextEditor.ActiveTextAreaControl.TextArea.SelectionManager.SelectionChanged += SelectionManagerSelectionChanged;

            TextEditor.ActiveTextAreaControl.TextArea.PreviewKeyDown += (s, e) =>
            {
                if (e.KeyCode == Keys.Escape && !TextEditor.ActiveTextAreaControl.SelectionManager.HasSomethingSelected)
                {
                    EscapePressed?.Invoke();
                }
            };

            TextEditor.TextChanged += (s, e) => TextChanged?.Invoke(s, e);
            TextEditor.ActiveTextAreaControl.HScrollBar.ValueChanged += (s, e) => OnHScrollPositionChanged(EventArgs.Empty);
            TextEditor.ActiveTextAreaControl.VScrollBar.ValueChanged += (s, e) => OnVScrollPositionChanged(EventArgs.Empty);
            TextEditor.ActiveTextAreaControl.TextArea.KeyUp          += (s, e) => KeyUp?.Invoke(s, e);
            TextEditor.ActiveTextAreaControl.TextArea.DoubleClick    += (s, e) => DoubleClick?.Invoke(s, e);
            TextEditor.ActiveTextAreaControl.TextArea.MouseMove      += (s, e) => MouseMove?.Invoke(s, e);
            TextEditor.ActiveTextAreaControl.TextArea.MouseEnter     += (s, e) => MouseEnter?.Invoke(s, e);
            TextEditor.ActiveTextAreaControl.TextArea.MouseLeave     += (s, e) => MouseLeave?.Invoke(s, e);
            TextEditor.ActiveTextAreaControl.TextArea.MouseDown      += (s, e) =>
            {
                SelectedLineChanged?.Invoke(
                    this,
                    new SelectedLineEventArgs(
                        TextEditor.ActiveTextAreaControl.TextArea.TextView.GetLogicalLine(e.Y)));
            };

            HighlightingManager.Manager.DefaultHighlighting.SetColorFor("LineNumbers",
                                                                        new HighlightColor(SystemColors.ControlText, SystemColors.Control, false, false));
            TextEditor.ActiveTextAreaControl.TextEditorProperties.EnableFolding = false;

            _lineNumbersControl = new DiffViewerLineNumberControl(TextEditor.ActiveTextAreaControl.TextArea);

            VRulerPosition = AppSettings.DiffVerticalRulerPosition;
        }
Exemplo n.º 10
0
        private void MoveListener(object sender, MouseEventArgs e)
        {
            var p = m_group.CursorPos;

            if (p.X > this.Position.X && p.X < this.Position.X + this.Size.Width && p.Y > this.Position.Y && p.Y < this.Position.Y + this.Size.Height)
            {
                if (!isInArea)
                {
                    MouseEnter?.Invoke(this, e);
                }
                isInArea = true;
            }
            else
            {
                if (isInArea)
                {
                    MouseLeft?.Invoke(this, e);
                }
                isInArea = false;
            }
            MouseMove?.Invoke(this, e);
        }
Exemplo n.º 11
0
        private void OnMouseEnter()
        {
            this.isHovered = true;

            if (EventSystem.current.IsPointerOverGameObject())
            {
                return;
            }

            OnPointerEnter();

            MouseEnter?.Invoke();

            if (this.showTooltip)
            {
                ObjectTooltip.Instance.Show(
                    this.tooltipName,
                    this.tooltipInfo,
                    Camera.main.WorldToScreenPoint(transform.position + this.tooltipOffset)
                    );
            }
        }
Exemplo n.º 12
0
        void Viewport_MouseMove(Ray3 ray, System.Windows.Forms.MouseEventArgs e)
        {
            if (SurfaceMesh == null)
            {
                return;
            }

            List <Intersection> Intersections = new List <Intersection>();

            Intersections.AddRange(SurfaceMesh.Intersect(ray));
            foreach (var group in PointGroups)
            {
                if (group.IsVisible)
                {
                    Intersections.AddRange(group.Intersect(ray));
                }
            }

            if (Intersections.Count == 0 && IsMouseOver)
            {
                IsMouseOver = false;
                MouseLeave?.Invoke(this, e);
            }
            else if (Intersections.Count > 0)
            {
                Intersections.Sort((i1, i2) => i1.Distance.CompareTo(i2.Distance));

                if (!IsMouseOver)
                {
                    IsMouseOver = true;
                    MouseEnter?.Invoke(this, Intersections, e);
                }

                MouseMove?.Invoke(this, Intersections, e);
            }
        }
Exemplo n.º 13
0
 public void OnMouseEnter()
 {
     MouseEnter?.Invoke(this, new EventArgs());
 }
Exemplo n.º 14
0
 public void PerformMouseEnter()
 {
     MouseEnter?.Invoke();
 }
Exemplo n.º 15
0
 protected virtual void OnMouseEnter(GameTime g, MouseState m) => MouseEnter?.Invoke(this, g, m);
Exemplo n.º 16
0
 private void OnMouseEnter()
 {
     MouseEnter.Invoke();
 }
Exemplo n.º 17
0
 /// <summary>
 /// Invokes the MouseEnter event.
 /// </summary>
 /// <param name="v">Location of the mouse.</param>
 /// <param name="b">The current state of the mouse buttons.</param>
 internal void DoMouseEnter(Vec2 v, MouseButtons b)
 {
     MouseEnter.Invoke(v, b);
 }
Exemplo n.º 18
0
 protected override void OnCursorEnter() => MouseEnter?.Invoke(this, EventArgs.Empty);
Exemplo n.º 19
0
        private unsafe IntPtr WndProc(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam)
        {
            Message m;

            m.hWnd   = hWnd;
            m.msg    = msg;
            m.wParam = wParam;
            m.lParam = lParam;

            switch (msg)
            {
            case WM.INPUT:
                int sizeOfRawInputData = 0;
                User32.GetRawInputData(
                    lParam, RID_INPUT, (byte *)0, ref sizeOfRawInputData, s_size_of_rawinputheader);

                if (sizeOfRawInputData == 0)
                {
                    return(IntPtr.Zero);
                }

                byte *rawInputDataPtr = stackalloc byte[sizeOfRawInputData];
                if (User32.GetRawInputData(
                        lParam, RID_INPUT, rawInputDataPtr, ref sizeOfRawInputData, s_size_of_rawinputheader) !=
                    RID_ERROR)
                {
                    RAWINPUT *rawInput = (RAWINPUT *)rawInputDataPtr;
                    switch (rawInput->Header.Type)
                    {
                    case RID_INPUT_TYPE_MOUSE:
                        RawMouseInput(in rawInput->Data.Mouse);
                        break;

                    // not supported/needed atm.
                    case RID_INPUT_TYPE_KEYBOARD:
                    case RID_INPUT_TYPE_HID:
                    case RID_INPUT_TYPE_OTHER:
                        break;
                    }
                }
                return(IntPtr.Zero);

            case WM.MOUSELEAVE:
                _state &= ~MOUSE_LE_STATE;
                MouseLeave?.Invoke(_hWnd);
                return(IntPtr.Zero);

            case WM.SIZE:
                _size.X = LowWord(lParam);
                _size.Y = HighWord(lParam);
                return(IntPtr.Zero);

            case WM.CLOSE:
                bool cancel = false;
                FormClosing?.Invoke(ref cancel);
                if (!cancel)
                {
                    FormClosed?.Invoke();
                    User32.DestroyWindow(_hWnd);
                }
                return(IntPtr.Zero);

            case WM.DESTROY:
                MouseLeave?.Invoke(_hWnd);
                User32.PostQuitMessage(0);
                return(IntPtr.Zero);

            case WM.KEYDOWN:
            case WM.KEYUP:
            case WM.CHAR:
            case WM.UNICHAR:
            case WM.SYSKEYDOWN:
            case WM.SYSKEYUP:
                RawKeyMessage(ref m);
                return(IntPtr.Zero);

            case WM.LBUTTONDOWN:
                RawMouseDown(ref m, MouseButtons.Left);
                return(IntPtr.Zero);

            case WM.MBUTTONDOWN:
                RawMouseDown(ref m, MouseButtons.Middle);
                return(IntPtr.Zero);

            case WM.RBUTTONDOWN:
                RawMouseDown(ref m, MouseButtons.Right);
                return(IntPtr.Zero);

            case WM.XBUTTONDOWN:
                RawMouseDown(
                    ref m, HighWord(m.wParam) == 1
                            ? MouseButtons.XButton1
                            : MouseButtons.XButton2);
                return(IntPtr.Zero);

            case WM.LBUTTONUP:
                RawMouseUp(ref m, MouseButtons.Left);
                return(IntPtr.Zero);

            case WM.MBUTTONUP:
                RawMouseUp(ref m, MouseButtons.Middle);
                return(IntPtr.Zero);

            case WM.RBUTTONUP:
                RawMouseUp(ref m, MouseButtons.Right);
                return(IntPtr.Zero);

            case WM.XBUTTONUP:
                RawMouseUp(
                    ref m, HighWord(m.wParam) == 1
                            ? MouseButtons.XButton1
                            : MouseButtons.XButton2);
                return(IntPtr.Zero);

            case WM.MOUSEMOVE:
            {
                if ((_state & MOUSE_LE_STATE) != MOUSE_LE_STATE)
                {
                    _state |= MOUSE_LE_STATE;
                    MouseEnter?.Invoke(_hWnd);

                    TRACKMOUSEEVENT trackMouseEvent = new TRACKMOUSEEVENT(TME.LEAVE, _hWnd, 0);
                    if (!User32.TrackMouseEvent(ref trackMouseEvent))
                    {
                        throw new Win32Exception(
                                  Kernel32.GetLastError(), $"{nameof(User32.TrackMouseEvent)} failed!");
                    }
                }

                MouseEventArgs args = new MouseEventArgs(
                    LowWord(m.lParam), HighWord(m.lParam), (MouseButtons)LowWord(m.wParam), 0, 0);
                for (int i = 0; i < _mouseMovePipe.Count; i++)
                {
                    if (_mouseMovePipe[i].Invoke(args) == EventAction.StopPropagation)
                    {
                        break;
                    }
                }

                return(IntPtr.Zero);
            }

            case WM.MOUSEWHEEL:
            {
                MouseEventArgs args = new MouseEventArgs(
                    LowWord(m.lParam), HighWord(m.lParam), (MouseButtons)LowWord(m.wParam), 0,
                    HighWord(m.wParam));
                for (int i = 0; i < _mouseWheelPipe.Count; i++)
                {
                    if (_mouseWheelPipe[i].Invoke(args) == EventAction.StopPropagation)
                    {
                        break;
                    }
                }
            }
                return(IntPtr.Zero);

            case WM.LBUTTONDBLCLK:
            case WM.MBUTTONDBLCLK:
            case WM.RBUTTONDBLCLK:
            case WM.XBUTTONDBLCLK:
            {
                _state |= 0xC000000;
                MouseEventArgs args = new MouseEventArgs(
                    LowWord(m.lParam), HighWord(m.lParam), (MouseButtons)LowWord(m.wParam), 2, 0);
                for (int i = 0; i < _mouseClickPipe.Count; i++)
                {
                    if (_mouseClickPipe[i].Invoke(args) == EventAction.StopPropagation)
                    {
                        break;
                    }
                }
                return(IntPtr.Zero);
            }
            }
            return(User32.DefWindowProc(hWnd, msg, wParam, lParam));
        }
Exemplo n.º 20
0
 protected void OnMouseEnter()
 {
     MouseEnter?.Invoke();
 }
Exemplo n.º 21
0
 private void TextArea_MouseEnter(object sender, EventArgs e)
 {
     MouseEnter?.Invoke(sender, e);
 }
Exemplo n.º 22
0
 private void DoMouseEnter()
 {
     MouseEnter?.Invoke(this, new EventArgs());
 }
Exemplo n.º 23
0
 /// <summary>
 /// Raise the event <see cref="MouseEnter"/>.
 /// </summary>
 protected virtual void OnMouseEnter(Point location, MouseButton buttons)
 {
     MouseEnter?.Invoke(this, new NativeWindowMouseEventArgs(DeviceContext, GLContext, location, buttons));
 }
Exemplo n.º 24
0
 private void GView_MouseEnter(object sender, MouseEventArgs e)
 {
     MouseEnter?.Invoke();
 }
Exemplo n.º 25
0
 /// <summary>
 /// Raises the <see cref="MouseEnter"/> event.
 /// </summary>
 /// <param name="state">Current mouse state in relation to this console.</param>
 protected virtual void OnMouseEnter(MouseConsoleState state)
 {
     MouseEnter?.Invoke(this, new MouseEventArgs(state));
 }
Exemplo n.º 26
0
 private void OnMouseEnter()
 {
     MouseEnter?.Invoke(this, EventArgs.Empty);
 }
Exemplo n.º 27
0
 internal void FireMouseEnter(MouseEventArgs e)
 {
     OnMouseEnter(e);
     MouseEnter?.Invoke(this, e);
 }
Exemplo n.º 28
0
 void FireMouseEnter(object sender, PointerRoutedEventArgs e)
 {
     MouseEnter?.Invoke(sender, e);
 }
Exemplo n.º 29
0
 public virtual void OnMouseEnter()
 {
     MouseEnter?.Invoke();
 }
Exemplo n.º 30
0
 protected virtual void OnMouseEnter(int x, int y, Input.MouseEventsContext context)
 {
     IsMouseOver = true;
     MouseEnter?.Invoke(this, new Input.MouseEventArgs(context.MouseButtons, context.Clicks, x, y, context.Delta));
     System.Diagnostics.Debug.WriteLine($"{this} OnMouseEnter");
 }