Пример #1
0
        //****************************************************************
        // Event Handling - Methods for handling events
        //
        // The dispatch manager updates the focus nodes based on the
        // incoming events, and dispatches those events to the appropriate
        // focus nodes.
        //****************************************************************

        /// <summary>
        /// Create a new PInputEvent based on the next windows event and dispatch it to Piccolo.
        /// </summary>
        public virtual void ProcessInput()
        {
            if (nextInput == null)
            {
                return;
            }

            PInputEventArgs e = new PInputEventArgs(this, nextInput, nextType);

            //The EventArgs object for a Click event does not provide the position, so
            //we just ignore it here.
            if (e.IsMouseEvent || e.IsDragDropEvent)
            {
                lastCanvasPosition = currentCanvasPosition;

                if (e.IsMouseEvent)
                {
                    currentCanvasPosition = new PointF(((MouseEventArgs)nextInput).X, ((MouseEventArgs)nextInput).Y);
                }
                else
                {
                    Point pt = new Point((int)((DragEventArgs)nextInput).X, (int)((DragEventArgs)nextInput).Y);
                    currentCanvasPosition = nextWindowsSource.PointToClient(pt);
                }

                PPickPath pickPath = nextInputSource.Pick(currentCanvasPosition.X, currentCanvasPosition.Y, 1);
                MouseOver = pickPath;
            }

            nextInput       = null;
            nextInputSource = null;

            Dispatch(e);
        }