예제 #1
0
        void ITopWindowEventRoot.RootMouseUp(int x, int y, UIMouseButtons button)
        {
            int xdiff = x - _prevLogicalMouseX;
            int ydiff = y - _prevLogicalMouseY;

            _prevLogicalMouseX = x;
            _prevLogicalMouseY = y;
            UIMouseEventArgs e = GetFreeMouseEvent();

            SetUIMouseEventArgsInfo(e, x, y, button, 0);

            e.SetDiff(xdiff, ydiff);
            //----------------------------------
            e.IsDragging = _isDragging;
            _isMouseDown = _isDragging = false;
            DateTime snapMouseUpTime = DateTime.Now;
            TimeSpan timediff        = snapMouseUpTime - _lastTimeMouseUp;

            _lastTimeMouseUp = snapMouseUpTime;

            if (_isDragging)
            {
                if (_draggingElement != null)
                {
                    //send this to dragging element first
                    _draggingElement.GetGlobalLocation(out int d_GlobalX, out int d_globalY);
                    e.SetLocation(e.GlobalX - d_GlobalX, e.GlobalY - d_globalY);
                    e.CapturedMouseX = _localMouseDownX;
                    e.CapturedMouseY = _localMouseDownY;
                    var iportal = _draggingElement as IEventPortal;
                    if (iportal != null)
                    {
                        iportal.PortalMouseUp(e);
                        if (!e.IsCanceled)
                        {
                            _draggingElement.ListenMouseUp(e);
                        }
                    }
                    else
                    {
                        _draggingElement.ListenMouseUp(e);
                    }
                }
            }
            else
            {
                e.IsAlsoDoubleClick = timediff.Milliseconds < _dblClickSense;
                if (e.IsAlsoDoubleClick)
                {
                }
                _iTopBoxEventPortal.PortalMouseUp(e);
            }


            _localMouseDownX  = _localMouseDownY = 0;
            _mouseCursorStyle = e.MouseCursorStyle;
            ReleaseMouseEvent(e);
        }
예제 #2
0
        void ITopWindowEventRoot.RootMouseUp(int x, int y, int button)
        {
            int xdiff = x - prevLogicalMouseX;
            int ydiff = y - prevLogicalMouseY;

            this.prevLogicalMouseX = x;
            this.prevLogicalMouseY = y;


            UIMouseEventArgs e = GetFreeMouseEvent();

            SetUIMouseEventArgsInfo(e, x, y, 0, button);
            e.SetDiff(xdiff, ydiff);
            //----------------------------------
            e.IsDragging = isDragging;

            this.isMouseDown = this.isDragging = false;

            DateTime snapMouseUpTime = DateTime.Now;
            TimeSpan timediff        = snapMouseUpTime - lastTimeMouseUp;

            this.lastTimeMouseUp = snapMouseUpTime;

            if (this.isDragging)
            {
                if (draggingElement != null)
                {
                    //send this to dragging element first
                    int d_GlobalX, d_globalY;
                    draggingElement.GetGlobalLocation(out d_GlobalX, out d_globalY);
                    e.SetLocation(e.GlobalX - d_GlobalX, e.GlobalY - d_globalY);
                    e.CapturedMouseX = this.localMouseDownX;
                    e.CapturedMouseY = this.localMouseDownY;
                    var iportal = draggingElement as IEventPortal;
                    if (iportal != null)
                    {
                        iportal.PortalMouseUp(e);
                        if (!e.IsCanceled)
                        {
                            draggingElement.ListenMouseUp(e);
                        }
                    }
                    else
                    {
                        draggingElement.ListenMouseUp(e);
                    }
                }
            }
            else
            {
                e.IsAlsoDoubleClick = timediff.Milliseconds < dblClickSense;
                iTopBoxEventPortal.PortalMouseUp(e);
            }

            this.localMouseDownX  = this.localMouseDownY = 0;
            this.mouseCursorStyle = e.MouseCursorStyle;
            ReleaseMouseEvent(e);
        }
예제 #3
0
        void ITopWindowEventRoot.RootMouseMove(int x, int y, UIMouseButtons button)
        {
            int xdiff = x - prevLogicalMouseX;
            int ydiff = y - prevLogicalMouseY;

            this.prevLogicalMouseX = x;
            this.prevLogicalMouseY = y;
            if (xdiff == 0 && ydiff == 0)
            {
                return;
            }

            //-------------------------------------------------------
            //when mousemove -> reset hover!
            hoverMonitoringTask.Reset();
            hoverMonitoringTask.Enabled = true;
            UIMouseEventArgs e = GetFreeMouseEvent();

            SetUIMouseEventArgsInfo(e, x, y, button, 0);
            e.SetDiff(xdiff, ydiff);
            //-------------------------------------------------------
            e.IsDragging = this.isDragging = this.isMouseDown;
            if (this.isDragging)
            {
                if (draggingElement != null)
                {
                    //send this to dragging element first
                    int d_GlobalX, d_globalY;
                    draggingElement.GetGlobalLocation(out d_GlobalX, out d_globalY);
                    e.SetLocation(e.GlobalX - d_GlobalX, e.GlobalY - d_globalY);
                    e.CapturedMouseX = this.localMouseDownX;
                    e.CapturedMouseY = this.localMouseDownY;
                    var iportal = draggingElement as IEventPortal;
                    if (iportal != null)
                    {
                        iportal.PortalMouseMove(e);
                        if (!e.IsCanceled)
                        {
                            draggingElement.ListenMouseMove(e);
                        }
                    }
                    else
                    {
                        draggingElement.ListenMouseMove(e);
                    }
                }
            }
            else
            {
                iTopBoxEventPortal.PortalMouseMove(e);
                draggingElement = null;
            }
            //-------------------------------------------------------

            this.mouseCursorStyle = e.MouseCursorStyle;
            ReleaseMouseEvent(e);
        }
예제 #4
0
        protected override void OnMouseDown(UIMouseEventArgs e)
        {
            //check if cell content
            //find grid item
            GridLayer layer   = _gridViewRenderE.GridLayer;
            GridCell  hitCell = layer.GetGridItemByPosition(e.X, e.Y);

            if (hitCell != null)
            {
                var box = hitCell.ContentElement as RenderBoxBase;
                if (box != null)
                {
                    if (box.ContainPoint(e.X - hitCell.X, e.Y - hitCell.Y))
                    {
                        IUIEventListener evenListener = box.GetController() as IUIEventListener;
                        if (evenListener != null)
                        {
                            int tmpX = e.X;
                            int tmpY = e.Y;
                            e.SetLocation(tmpX - hitCell.X, tmpY - hitCell.Y);
                            evenListener.ListenMouseDown(e);
                            e.SetLocation(tmpX, tmpY);
                        }
                    }
                }
                //
                //move _dragController to the selected cell?
                //
                if (EnableGridCellSelection)
                {
                    //--------
                    if (_gridSelectionSession == null)
                    {
                        _gridSelectionSession = new GridSelectionSession();
                        _gridSelectionSession.SetTargetGridView(this);
                    }
                    _gridSelectionSession.StartAt(hitCell);
                }
            }

            base.OnMouseDown(e);
        }