Exemplo n.º 1
0
 protected virtual void OnLostMouseFocus(UIMouseEventArgs e)
 {
     if (this.evhMouseLostFocus != null)
     {
         this.evhMouseLostFocus(e);
     }
 }
 protected override void OnMouseDown(UIMouseEventArgs e)
 {
     ////test only!!!         
     this.lastX = e.X;
     this.lastY = e.Y;
     pointList.Add(new Point(lastX, lastY));
 }
        void IEventPortal.PortalMouseUp(UIMouseEventArgs e)
        {
            //find hit svg graphics....
            SvgHitChain hitChain = GetFreeHitChain();
            hitChain.SetRootGlobalPosition(e.X, e.Y);
            //1. hit test
            HitTestCore(this.SvgRoot.SvgSpec, hitChain, e.X, e.Y);
            SetEventOrigin(e, hitChain);
            //2. propagate event  portal
            ForEachOnlyEventPortalBubbleUp(e, hitChain, (portal) =>
            {
                portal.PortalMouseUp(e);
                return true;
            });
            if (!e.CancelBubbling)
            {
                //2. propagate events
                ForEachEventListenerBubbleUp(e, hitChain, () =>
                {
                    e.CurrentContextElement.ListenMouseUp(e);
                    return true;
                });
            }

            e.CancelBubbling = true;
            ReleaseHitChain(hitChain);
        }
        void IEventPortal.PortalMouseDown(UIMouseEventArgs e)
        {
            //find hit svg graphics....
            SvgHitChain hitChain = GetFreeHitChain();
            hitChain.SetRootGlobalPosition(e.X, e.Y);
            //1. hit test
            HitTestCore(this.SvgRoot.SvgSpec, hitChain, e.X, e.Y);
            SetEventOrigin(e, hitChain);
            //2. propagate event  portal
            ForEachOnlyEventPortalBubbleUp(e, hitChain, (portal) =>
            {
                portal.PortalMouseDown(e);
                return true;
            });
            if (!e.CancelBubbling)
            {
                //2. propagate events
                ForEachSvgElementBubbleUp(e, hitChain, () =>
                {
                    //-------
                    //temp test only
                    //-------
                    var svgElement = e.ExactHitObject as SvgElement;
                    if (svgElement is SvgRect)
                    {
                        ((SvgRect)svgElement).FillColor = Color.White;
                    }
                    return true;
                });
            }

            e.CancelBubbling = true;
            ReleaseHitChain(hitChain);
        }
Exemplo n.º 5
0
 //----------------------------------------------------
 protected override void OnMouseDown(UIMouseEventArgs e)
 {
     if (this.MouseDown != null)
     {
         this.MouseDown(this, e);
     }
 }
Exemplo n.º 6
0
 protected virtual void OnMouseDown(UIMouseEventArgs e)
 {
     if (this.evhMouseDown != null)
     {
         evhMouseDown(e);
     }
 }
Exemplo n.º 7
0
 protected override void OnMouseUp(UIMouseEventArgs e)
 {
     if (this.MouseUp != null)
     {
         MouseUp(this, e);
     }
     base.OnMouseUp(e);
 }
Exemplo n.º 8
0
 void panel_MouseDoubleClick(object sender, UIMouseEventArgs e)
 {
     //raise event mouse double click
     var src = e.SourceHitElement as ListItem;
     if (src != null && ListItemMouseEvent != null)
     {
         e.UIEventName = UIEventName.DblClick;
         ListItemMouseEvent(this, e);
     }
 }
        public void MouseDown(UIMouseEventArgs e, CssBox startAt)
        {
            if (!_isBinded) return;
            if (startAt == null) return;
            //---------------------------------------------------- 
            ClearPreviousSelection();
            if (_latestMouseDownChain != null)
            {
                ReleaseHitChain(_latestMouseDownChain);
                _latestMouseDownChain = null;
            }
            this.lastDomLayoutVersion = this._htmlContainer.LayoutVersion;
            //----------------------------------------------------
            int x = e.X;
            int y = e.Y;
            this._mouseDownStartAt = startAt;
            this._mousedownX = x;
            this._mousedownY = y;
            CssBoxHitChain hitChain = GetFreeHitChain();
            hitChain.SetRootGlobalPosition(x, y);
            //1. hittest 
            BoxHitUtils.HitTest(startAt, x, y, hitChain);
            //2. propagate events
            SetEventOrigin(e, hitChain);
            ForEachOnlyEventPortalBubbleUp(e, hitChain, (portal) =>
            {
                portal.PortalMouseDown(e);
                return true;
            });
            if (!e.CancelBubbling)
            {
                var prevMouseDownElement = this.currentMouseDown;
                e.CurrentContextElement = this.currentMouseDown = null; //clear
                ForEachEventListenerBubbleUp(e, hitChain, () =>
                {
                    //TODO: check accept keyboard
                    this.currentMouseDown = e.CurrentContextElement;
                    e.CurrentContextElement.ListenMouseDown(e);
                    if (prevMouseDownElement != null &&
                        prevMouseDownElement != currentMouseDown)
                    {
                        prevMouseDownElement.ListenLostMouseFocus(e);
                    }

                    return e.CancelBubbling;
                });
            }
            //----------------------------------
            //save mousedown hitchain
            this._latestMouseDownChain = hitChain;
        }
Exemplo n.º 10
0
        static void MoveWithSnapToGrid(UIControllerBox controllerBox, UIMouseEventArgs e)
        {
            //sample move with snap to grid
            Point pos = controllerBox.Position;
            int newX = pos.X + e.XDiff;
            int newY = pos.Y + e.YDiff;
            //snap to gridsize =5;
            //find nearest snap x 
            int gridSize = 5;
            float halfGrid = (float)gridSize / 2f;
            int nearestX = (int)((newX + halfGrid) / gridSize) * gridSize;
            int nearestY = (int)((newY + halfGrid) / gridSize) * gridSize;
            controllerBox.SetLocation(nearestX, nearestY);
            var targetBox = controllerBox.TargetBox;
            if (targetBox != null)
            {
                //move target box too

                targetBox.SetLocation(nearestX + gridSize, nearestY + gridSize);
            }
        }
Exemplo n.º 11
0
        void ResizeTargetWithSnapToGrid2(SpaceName tinyBoxSpaceName, UIControllerBox controllerBox, UIMouseEventArgs e, int dx, int dy)
        {
            //sample move with snap to grid
            Point pos = controllerBox.Position;
            int newX = pos.X + dx;// e.XDiff;
            int newY = pos.Y + dy;// e.YDiff;
            //snap to gridsize =5;
            //find nearest snap x 
            int gridSize = 5;
            float halfGrid = (float)gridSize / 2f;
            int nearestX = (int)((newX + halfGrid) / gridSize) * gridSize;
            int nearestY = (int)((newY + halfGrid) / gridSize) * gridSize;
            int xdiff = nearestX - pos.X;
            int ydiff = nearestY - pos.Y;
            int diffX = 0, diffY = 0;
            var targetBox = controllerBox.TargetBox;
            if (targetBox != null)
            {
                var targetBoxLocation = targetBox.GetGlobalLocation();
                diffX = this.Left - targetBoxLocation.X;
                diffY = this.Top - targetBoxLocation.Y;
            }


            switch (tinyBoxSpaceName)
            {
                case SpaceName.LeftTop:
                    {
                        if (xdiff != 0 || ydiff != 0)
                        {
                            controllerBox.SetLocation(controllerBox.Left + xdiff, controllerBox.Top + ydiff);
                            controllerBox.SetSize(controllerBox.Width - xdiff, controllerBox.Height - ydiff);
                            if (targetBox != null)
                            {
                                //move target box too 
                                targetBox.SetBounds(targetBox.Left + diffX + 5,
                                    targetBox.Top + diffY + 5,
                                    controllerBox.Width - 10,
                                    controllerBox.Height - 10);
                            }
                        }
                    }
                    break;
                case SpaceName.RightTop:
                    {
                        if (xdiff != 0 || ydiff != 0)
                        {
                            controllerBox.SetLocation(controllerBox.Left, controllerBox.Top + ydiff);
                            controllerBox.SetSize(controllerBox.Width + xdiff, controllerBox.Height - ydiff);
                            if (targetBox != null)
                            {
                                //move target box too 
                                targetBox.SetBounds(targetBox.Left + diffX + 5,
                                   targetBox.Top + diffY + 5,
                                   controllerBox.Width - 10,
                                   controllerBox.Height - 10);
                            }
                        }
                    }
                    break;
                case SpaceName.RightBottom:
                    {
                        if (xdiff != 0 || ydiff != 0)
                        {
                            controllerBox.SetSize(controllerBox.Width + xdiff, controllerBox.Height + ydiff);
                            if (targetBox != null)
                            {
                                //move target box too 
                                targetBox.SetBounds(targetBox.Left + diffX + 5,
                                   targetBox.Top + diffY + 5,
                                   controllerBox.Width - 10,
                                   controllerBox.Height - 10);
                            }
                        }
                    }
                    break;
                case SpaceName.LeftBottom:
                    {
                        if (xdiff != 0 || ydiff != 0)
                        {
                            controllerBox.SetLocation(controllerBox.Left + xdiff, controllerBox.Top);
                            controllerBox.SetSize(controllerBox.Width - xdiff, controllerBox.Height + ydiff);
                            if (targetBox != null)
                            {
                                //move target box too 
                                targetBox.SetBounds(targetBox.Left + diffX + 5,
                                   targetBox.Top + diffY + 5,
                                   controllerBox.Width - 10,
                                   controllerBox.Height - 10);
                            }
                        }
                    }
                    break;
            }
        }
Exemplo n.º 12
0
 void SetUIMouseEventArgsInfo(UIMouseEventArgs mouseEventArg, int x, int y, UIMouseButtons button, int delta)
 {
     mouseEventArg.SetEventInfo(
         x, y,
        (UIMouseButtons)button,
         0,
         delta);
 }
Exemplo n.º 13
0
 protected override void OnMouseMove(UIMouseEventArgs e)
 {
     if (e.IsDragging)
     {
         MoveWithSnapToGrid(this, e.DiffCapturedX, e.DiffCapturedY);
         e.MouseCursorStyle = MouseCursorStyle.Pointer;
         e.CancelBubbling = true;
     }
     base.OnMouseMove(e);
 }
Exemplo n.º 14
0
        protected override void OnMouseUp(UIMouseEventArgs e)
        {
            //create commadn history and add?

            var newBeginPoint = new Point(this.TargetBox.Left, this.TargetBox.Top);
            this.DesignBoardModule.HistoryRecordDzElementNewPosition(
                this.TargetBox,
                new Point(this.beginRect.Left, this.beginRect.Top),
                newBeginPoint);
            this.beginRect = new Rectangle(newBeginPoint.X, newBeginPoint.Y, this.TargetBox.Width, this.TargetBox.Height);
            base.OnMouseUp(e);
        }
 public void OnMouseUp(UIMouseEventArgs e)
 {
 }
Exemplo n.º 16
0
 protected override void OnMouseWheel(UIMouseEventArgs e)
 {
     if (e.Delta < 0)
     {   //scroll down
         this.StepSmallToMax();
     }
     else
     {
         //up
         this.StepSmallToMin();
     }
 }
Exemplo n.º 17
0
 protected virtual void OnMouseUp(UIMouseEventArgs e)
 {
 }
Exemplo n.º 18
0
 internal void InvokeMouseDoubleClick(S sender, T state, UIMouseEventArgs e) => MouseDoubleClick.Invoke(new SenderInfo(sender, state), e);
Exemplo n.º 19
0
 protected virtual void OnLostMouseFocus(UIMouseEventArgs e)
 {
 }
Exemplo n.º 20
0
 protected virtual void OnDoubleClick(UIMouseEventArgs e)
 {
 }
Exemplo n.º 21
0
 protected virtual void OnMouseHover(UIMouseEventArgs e)
 {
 }
Exemplo n.º 22
0
 protected virtual void OnMouseWheel(UIMouseEventArgs e)
 {
 }
Exemplo n.º 23
0
 protected virtual void OnMouseLeave(UIMouseEventArgs e)
 {
 }
 void IEventListener.ListenMouseWheel(UIMouseEventArgs e)
 {
     OnMouseWheel(e);
 }
 void IEventPortal.PortalMouseWheel(UIMouseEventArgs e)
 {
 }
 void IEventListener.ListenMouseClick(UIMouseEventArgs e)
 {
 }
        void IEventPortal.PortalMouseDown(UIMouseEventArgs e)
        {
#if DEBUG
            if (this.dbugRootGraphics.dbugEnableGraphicInvalidateTrace)
            {
                this.dbugRootGraphics.dbugGraphicInvalidateTracer.WriteInfo("================");
                this.dbugRootGraphics.dbugGraphicInvalidateTracer.WriteInfo("MOUSEDOWN");
                this.dbugRootGraphics.dbugGraphicInvalidateTracer.WriteInfo("================");
            }
            dbugMsgChainVersion = 1;
            int local_msgVersion = 1;
#endif


            HitChain hitPointChain = GetFreeHitChain();
            HitTestCoreWithPrevChainHint(hitPointChain, this._previousChain, e.X, e.Y);
            int           hitCount   = hitPointChain.Count;
            RenderElement hitElement = hitPointChain.TopMostElement;
            if (hitCount > 0)
            {
                //------------------------------
                //1. origin object
                SetEventOrigin(e, hitPointChain);
                //------------------------------
                var            prevMouseDownElement = e.PreviousMouseDown;
                IEventListener currentMouseDown     = null;
                //portal
                ForEachOnlyEventPortalBubbleUp(e, hitPointChain, (portal) =>
                {
                    portal.PortalMouseDown(e);
                    //*****
                    currentMouseDown = e.CurrentContextElement;
                    return(true);
                });
                //------------------------------
                //use events
                if (!e.CancelBubbling)
                {
                    e.CurrentContextElement = currentMouseDown = null; //clear
                    ForEachEventListenerBubbleUp(e, hitPointChain, (listener) =>
                    {
                        currentMouseDown = listener;
                        listener.ListenMouseDown(e);
                        //-------------------------------------------------------
                        bool cancelMouseBubbling = e.CancelBubbling;
                        if (prevMouseDownElement != null &&
                            prevMouseDownElement != listener)
                        {
                            prevMouseDownElement.ListenLostMouseFocus(e);
                            prevMouseDownElement = null;//clear
                        }
                        //-------------------------------------------------------
                        return(e.CancelBubbling || !listener.BypassAllMouseEvents);
                    });
                }

                if (prevMouseDownElement != currentMouseDown &&
                    prevMouseDownElement != null)
                {
                    prevMouseDownElement.ListenLostMouseFocus(e);
                    prevMouseDownElement = null;
                }
            }
            //---------------------------------------------------------------

#if DEBUG
            RootGraphic visualroot = this.dbugRootGraphics;
            if (visualroot.dbug_RecordHitChain)
            {
                visualroot.dbug_rootHitChainMsg.Clear();
                HitInfo hitInfo;
                for (int tt = hitPointChain.Count - 1; tt >= 0; --tt)
                {
                    hitInfo = hitPointChain.GetHitInfo(tt);
                    RenderElement ve = hitInfo.hitElement;
                    if (ve != null)
                    {
                        ve.dbug_WriteOwnerLayerInfo(visualroot, tt);
                        ve.dbug_WriteOwnerLineInfo(visualroot, tt);
                        string hit_info = new string('.', tt) + " [" + tt + "] "
                                          + "(" + hitInfo.point.X + "," + hitInfo.point.Y + ") "
                                          + ve.dbug_FullElementDescription();
                        visualroot.dbug_rootHitChainMsg.AddLast(new dbugLayoutMsg(ve, hit_info));
                    }
                }
            }
#endif
            SwapHitChain(hitPointChain);
            e.StopPropagation();
#if DEBUG
            if (local_msgVersion != dbugMsgChainVersion)
            {
                return;
            }
            visualroot.dbugHitTracker.Write("stop-mousedown");
            visualroot.dbugHitTracker.Play = false;
#endif
        }
 void IEventListener.ListenMouseDown(UIMouseEventArgs e)
 {
     OnMouseDown(e);
 }
        //        public override void OnDragStart(UIMouseEventArgs e)
        //        {

        //#if DEBUG
        //            if (this.dbugRootGraphic.dbugEnableGraphicInvalidateTrace)
        //            {
        //                this.dbugRootGraphic.dbugGraphicInvalidateTracer.WriteInfo("================");
        //                this.dbugRootGraphic.dbugGraphicInvalidateTracer.WriteInfo("START_DRAG");
        //                this.dbugRootGraphic.dbugGraphicInvalidateTracer.WriteInfo("================");
        //            }
        //#endif

        //            HitTestCoreWithPrevChainHint(
        //              hitPointChain.LastestRootX,
        //              hitPointChain.LastestRootY);

        //            DisableGraphicOutputFlush = true;
        //            this.currentDragElem = null;

        //            //-----------------------------------------------------------------------

        //            ForEachEventListenerPreviewBubbleUp(this.hitPointChain, (hitobj, listener) =>
        //            {
        //                listener.PortalMouseMove(e);
        //                return true;
        //            });

        //            //-----------------------------------------------------------------------

        //            ForEachEventListenerBubbleUp(this.hitPointChain, (hit, listener) =>
        //            {
        //                currentDragElem = listener;
        //                listener.ListenDragEvent(UIDragEventName.DragStart, e);
        //                return true;
        //            });
        //            DisableGraphicOutputFlush = false;
        //            FlushAccumGraphicUpdate();

        //            hitPointChain.SwapHitChain();
        //        }
        //        public override void OnDrag(UIMouseEventArgs e)
        //        {
        //            if (currentDragElem == null)
        //            {
        //                return;
        //            }

        //#if DEBUG
        //            this.dbugRootGraphic.dbugEventIsDragging = true;
        //#endif

        //            //if (currentDragingElement == null)
        //            //{

        //            //    return;
        //            //}
        //            //else
        //            //{
        //            //}

        //            //--------------

        //            DisableGraphicOutputFlush = true;

        //            currentDragElem.ListenDragEvent(UIDragEventName.Dragging, e);

        //            DisableGraphicOutputFlush = false;
        //            FlushAccumGraphicUpdate();

        //            //Point globalDragingElementLocation = currentDragingElement.GetGlobalLocation();
        //            //e.TranslateCanvasOrigin(globalDragingElementLocation);
        //            //e.SourceHitElement = currentDragingElement;
        //            //Point dragPoint = hitPointChain.PrevHitPoint;
        //            //dragPoint.Offset(currentXDistanceFromDragPoint, currentYDistanceFromDragPoint);
        //            //e.Location = dragPoint;
        //            //e.DragingElement = currentDragingElement;

        //            //IEventListener ui = currentDragingElement.GetController() as IEventListener;
        //            //if (ui != null)
        //            //{
        //            //    ui.ListenDragEvent(UIDragEventName.Dragging, e);
        //            //}
        //            //e.TranslateCanvasOriginBack();


        //        }


        //        public override void OnDragStop(UIMouseEventArgs e)
        //        {

        //            if (currentDragElem == null)
        //            {
        //                return;
        //            }
        //#if DEBUG
        //            this.dbugRootGraphic.dbugEventIsDragging = false;
        //#endif

        //            DisableGraphicOutputFlush = true;

        //            currentDragElem.ListenDragEvent(UIDragEventName.DragStop, e);

        //            DisableGraphicOutputFlush = false;
        //            FlushAccumGraphicUpdate();

        //            //if (currentDragingElement == null)
        //            //{
        //            //    return;
        //            //}

        //            //DisableGraphicOutputFlush = true;

        //            //Point globalDragingElementLocation = currentDragingElement.GetGlobalLocation();
        //            //e.TranslateCanvasOrigin(globalDragingElementLocation);

        //            //Point dragPoint = hitPointChain.PrevHitPoint;
        //            //dragPoint.Offset(currentXDistanceFromDragPoint, currentYDistanceFromDragPoint);
        //            //e.Location = dragPoint;

        //            //e.SourceHitElement = currentDragingElement;
        //            //var script = currentDragingElement.GetController() as IEventListener;
        //            //if (script != null)
        //            //{
        //            //    script.ListenDragEvent(UIDragEventName.DragStop, e);
        //            //}

        //            //e.TranslateCanvasOriginBack();

        //            //UIMouseEventArgs d_eventArg = new UIMouseEventArgs();
        //            //if (hitPointChain.DragHitElementCount > 0)
        //            //{
        //            //    ForEachDraggingObjects(this.hitPointChain, (hitobj, listener) =>
        //            //    {
        //            //        //d_eventArg.TranslateCanvasOrigin(globalLocation);
        //            //        //d_eventArg.SourceHitElement = elem;
        //            //        //d_eventArg.DragingElement = currentDragingElement;

        //            //        //var script2 = elem.GetController();
        //            //        //if (script2 != null)
        //            //        //{
        //            //        //}

        //            //        //d_eventArg.TranslateCanvasOriginBack();
        //            //        return true;
        //            //    });
        //            //    //foreach (RenderElement elem in hitPointChain.GetDragHitElementIter())
        //            //    //{
        //            //    //    Point globalLocation = elem.GetGlobalLocation();
        //            //    //    d_eventArg.TranslateCanvasOrigin(globalLocation);
        //            //    //    d_eventArg.SourceHitElement = elem;
        //            //    //    d_eventArg.DragingElement = currentDragingElement;

        //            //    //    var script2 = elem.GetController();
        //            //    //    if (script2 != null)
        //            //    //    {
        //            //    //    }

        //            //    //    d_eventArg.TranslateCanvasOriginBack();
        //            //    //}
        //            //}
        //            DisableGraphicOutputFlush = false;
        //            FlushAccumGraphicUpdate();
        //        }


        void BroadcastDragHitEvents(UIMouseEventArgs e)
        {
            //Point globalDragingElementLocation = currentDragingElement.GetGlobalLocation();
            //Rectangle dragRect = currentDragingElement.GetGlobalRect();

            //VisualDrawingChain drawingChain = this.WinRootPrepareRenderingChain(dragRect);

            //List<RenderElement> selVisualElements = drawingChain.selectedVisualElements;
            //int j = selVisualElements.Count;
            //LinkedList<RenderElement> underlyingElements = new LinkedList<RenderElement>();
            //for (int i = j - 1; i > -1; --i)
            //{

            //    if (selVisualElements[i].ListeningDragEvent)
            //    {
            //        underlyingElements.AddLast(selVisualElements[i]);
            //    }
            //}

            //if (underlyingElements.Count > 0)
            //{
            //    foreach (RenderElement underlyingUI in underlyingElements)
            //    {

            //        if (underlyingUI.IsDragedOver)
            //        {
            //            hitPointChain.RemoveDragHitElement(underlyingUI);
            //            underlyingUI.IsDragedOver = false;
            //        }
            //    }
            //}
            //UIMouseEventArgs d_eventArg = UIMouseEventArgs.GetFreeDragEventArgs();

            //if (hitPointChain.DragHitElementCount > 0)
            //{
            //    foreach (RenderElement elem in hitPointChain.GetDragHitElementIter())
            //    {
            //        Point globalLocation = elem.GetGlobalLocation();
            //        d_eventArg.TranslateCanvasOrigin(globalLocation);
            //        d_eventArg.SourceVisualElement = elem;
            //        var script = elem.GetController();
            //        if (script != null)
            //        {
            //        }
            //        d_eventArg.TranslateCanvasOriginBack();
            //    }
            //}
            //hitPointChain.ClearDragHitElements();

            //foreach (RenderElement underlyingUI in underlyingElements)
            //{

            //    hitPointChain.AddDragHitElement(underlyingUI);
            //    if (underlyingUI.IsDragedOver)
            //    {
            //        Point globalLocation = underlyingUI.GetGlobalLocation();
            //        d_eventArg.TranslateCanvasOrigin(globalLocation);
            //        d_eventArg.SourceVisualElement = underlyingUI;

            //        var script = underlyingUI.GetController();
            //        if (script != null)
            //        {
            //        }

            //        d_eventArg.TranslateCanvasOriginBack();
            //    }
            //    else
            //    {
            //        underlyingUI.IsDragedOver = true;
            //        Point globalLocation = underlyingUI.GetGlobalLocation();
            //        d_eventArg.TranslateCanvasOrigin(globalLocation);
            //        d_eventArg.SourceVisualElement = underlyingUI;

            //        var script = underlyingUI.GetController();
            //        if (script != null)
            //        {
            //        }

            //        d_eventArg.TranslateCanvasOriginBack();
            //    }
            //}
            //UIMouseEventArgs.ReleaseEventArgs(d_eventArg);
        }
Exemplo n.º 30
0
 //tempfix here
 internal void ChildNotifyMouseWheel(UIMouseEventArgs e)
 {
     if (e.Delta < 0)
     {   //scroll down
         this.StepSmallToMax();
     }
     else
     {
         //up
         this.StepSmallToMin();
     }
 }
Exemplo n.º 31
0
 void ReleaseUIMouseEventArgs(UIMouseEventArgs mouseEventArgs)
 {
     mouseEventArgs.Clear();
     _mouseEventStack.Push(mouseEventArgs);
 }
Exemplo n.º 32
0
 protected override void OnMouseWheel(UIMouseEventArgs e)
 {
     this.OwnerScrollBar.ChildNotifyMouseWheel(e);
 }
 void IEventListener.ListenMouseDoubleClick(UIMouseEventArgs e)
 {
 }
Exemplo n.º 34
0
 protected override void OnMouseLeave(UIMouseEventArgs e)
 {
     if (e.IsDragging)
     {
         MoveWithSnapToGrid(this, e);
         e.MouseCursorStyle = MouseCursorStyle.Pointer;
         e.StopPropagation();
     }
     base.OnMouseLeave(e);
 }
 void IEventListener.ListenMouseWheel(UIMouseEventArgs e)
 {
     OnMouseWheel(e);
 }
Exemplo n.º 36
0
        static void MoveWithSnapToGrid(UIControllerBox controllerBox, UIMouseEventArgs e)
        {
            //sample move with snap to grid

            Point pos = controllerBox.Position;
            int newX = pos.X + e.XDiff;
            int newY = pos.Y + e.YDiff;
            //snap to gridsize =5;
            //find nearest snap x 

            int gridSize = controllerBox.GridSize;
            float halfGrid = (float)gridSize / 2f;
            int nearestX = (int)((newX + halfGrid) / gridSize) * gridSize;
            int nearestY = (int)((newY + halfGrid) / gridSize) * gridSize;
            controllerBox.MoveTo(nearestX, nearestY);
        }
 void IEventListener.ListenMouseUp(UIMouseEventArgs e)
 {
     OnMouseUp(e);
 }
Exemplo n.º 38
0
        static void ResizeTargetWithSnapToGridWhenDragRelease(UIControllerBox controllerBox, UIMouseEventArgs e)
        {
            ////sample move with snap to grid
            //Point pos = controllerBox.Position;
            //int newX = pos.X + e.XDiff;
            //int newY = pos.Y + e.YDiff;
            ////snap to gridsize =5;
            ////find nearest snap x 
            //int gridSize = 5;
            //float halfGrid = (float)gridSize / 2f;
            //int nearestX = (int)((newX + halfGrid) / gridSize) * gridSize;
            //int nearestY = (int)((newY + halfGrid) / gridSize) * gridSize;

            //int xdiff = nearestX - pos.X;

            //if (xdiff == 0)
            //{
            //    return;
            //}


            //controllerBox.SetSize(controllerBox.Width + xdiff, controllerBox.Height);

            var targetBox = controllerBox.TargetBox;
            if (targetBox != null)
            {
                int diffX = 0, diffY = 0;
                var targetBoxLocation = targetBox.GetGlobalLocation();
                diffX = controllerBox.Left - targetBoxLocation.X;
                diffY = controllerBox.Top - targetBoxLocation.Y;
                //move target box too 
                var newRect = new Rectangle(targetBox.Left + diffX + 5,
                    targetBox.Top + diffY + 5,
                    controllerBox.Width - 10,
                    controllerBox.Height - 10);
                controllerBox.DesignBoardModule.HistoryRecordDzElementNewBounds(
                    controllerBox.TargetBox,
                    controllerBox.beginRect,
                    newRect);
                controllerBox.beginRect = newRect;
                targetBox.SetBounds(newRect.Left,
                    newRect.Top,
                    newRect.Width,
                    newRect.Height);
            }
        }
 void IEventListener.ListenLostMouseFocus(UIMouseEventArgs e)
 {
     OnLostMouseFocus(e);
 }
Exemplo n.º 40
0
 void ReleaseMouseEvent(UIMouseEventArgs e)
 {
     e.Clear();
     this.stockMouseEvents.Push(e);
 }
Exemplo n.º 41
0
 internal abstract void ListenMouseClick(object sender, UIMouseEventArgs e);
 void IEventListener.ListenMouseDown(UIMouseEventArgs e)
 {
     OnMouseDown(e);
 }
 void IEventListener.ListenLostMouseFocus(UIMouseEventArgs e)
 {
     OnLostMouseFocus(e);
 }
 void IEventListener.ListenMouseUp(UIMouseEventArgs e)
 {
     //1. mouse up
     OnMouseUp(e);
 }
 void IEventListener.ListenMouseUp(UIMouseEventArgs e)
 {
     OnMouseUp(e);
 }
 void IEventListener.ListenMouseDoubleClick(UIMouseEventArgs e)
 {
     OnDoubleClick(e);
 }
 void IEventListener.ListenMouseLeave(UIMouseEventArgs e)
 {
     OnMouseLeave(e);
 }
 void IEventListener.ListenMouseLeave(UIMouseEventArgs e)
 {
     OnMouseLeave(e);
 }
Exemplo n.º 49
0
        void IEventPortal.PortalMouseUp(UIMouseEventArgs e)
        {
#if DEBUG
            if (this.dbugRootGraphics.dbugEnableGraphicInvalidateTrace)
            {
                this.dbugRootGraphics.dbugGraphicInvalidateTracer.WriteInfo("================");
                this.dbugRootGraphics.dbugGraphicInvalidateTracer.WriteInfo("MOUSEUP");
                this.dbugRootGraphics.dbugGraphicInvalidateTracer.WriteInfo("================");
            }
#endif

            HitChain hitPointChain = GetFreeHitChain();
            HitTestCoreWithPrevChainHint(hitPointChain, this._previousChain, e.X, e.Y);
            int hitCount = hitPointChain.Count;
            if (hitCount > 0)
            {
                SetEventOrigin(e, hitPointChain);
                //---------------------------------------------------------------
                ForEachOnlyEventPortalBubbleUp(e, hitPointChain, (portal) =>
                {
                    portal.PortalMouseUp(e);
                    return(true);
                });
                //---------------------------------------------------------------
                if (!e.CancelBubbling)
                {
                    ForEachEventListenerBubbleUp(e, hitPointChain, (listener) =>
                    {
                        listener.ListenMouseUp(e);
                        return(true);
                    });
                }
                //---------------------------------------------------------------
                if (e.IsAlsoDoubleClick)
                {
                    ForEachEventListenerBubbleUp(e, hitPointChain, listener =>
                    {
                        listener.ListenMouseDoubleClick(e);
                        //-------------------------------------------------------
                        //retrun true to stop this loop (no further bubble up)
                        //return false to bubble this to upper control
                        return(e.CancelBubbling || !listener.BypassAllMouseEvents);
                    });
                }
                if (!e.CancelBubbling)
                {
                    if (e.IsAlsoDoubleClick)
                    {
                        //ForEachEventListenerBubbleUp(e, hitPointChain, listener =>
                        //{
                        //    listener.ListenMouseDoubleClick(e);
                        //    //-------------------------------------------------------
                        //    //retrun true to stop this loop (no further bubble up)
                        //    //return false to bubble this to upper control
                        //    return e.CancelBubbling || !listener.BypassAllMouseEvents;
                        //});
                    }
                    else
                    {
                        ForEachEventListenerBubbleUp(e, hitPointChain, listener =>
                        {
                            listener.ListenMouseClick(e);
                            return(e.CancelBubbling || !listener.BypassAllMouseEvents);
                        });
                    }
                }
            }
            SwapHitChain(hitPointChain);
            e.StopPropagation();
        }