Exemplo n.º 1
0
        /// <summary>
        /// Initializes the Singleton instance
        /// </summary>
        private void Init()
        {
            ZIndex       = StageManager.GUI_INSPECTOR_STAGE_DEPTH;
            Id           = "InspectorOverlayStage";
            Layout       = new AbsoluteLayout();
            FocusEnabled = false;
            Enabled      = true;

            Register();

            CoordinateProcessor.ExcludeStage(this); // NONO: it should be mouse-sensitive because of the toolbar!
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes the Singleton instance
        /// </summary>
        private void Init()
        {
            ZIndex       = STYLING_OVERLAY_STAGE_DEPTH;
            Id           = "StylingOverlayStage";
            Layout       = new AbsoluteLayout();
            FocusEnabled = false;
            Enabled      = true;

            Register();

            CoordinateProcessor.ExcludeStage(this);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Initializes the Singleton instance
        /// </summary>
        private void Init()
        {
            ZIndex = StageManager.TOOLTIP_STAGE_DEPTH;
            Id     = "TooltipManagerStage";
            //LayoutDescriptor = LayoutDescriptor.Absolute;
            Layout       = new AbsoluteLayout();
            FocusEnabled = false;
            //ScrollContent = false;
            Enabled = true;

            //StageManager.Instance.RegisterStage(this);
            Register();

            CoordinateProcessor.ExcludeStage(this);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Initializes the Singleton instance
        /// </summary>
        private void Init()
        {
            ZIndex = StageManager.CURSOR_STAGE_DEPTH;
            Id     = "CursorManagerStage";
            //LayoutDescriptor = LayoutDescriptor.Absolute;
            Layout       = new AbsoluteLayout();
            FocusEnabled = false;
            //ScrollContent = false;
            Enabled = true;
            Visible = false;

            //StageManager.Instance.RegisterStage(this);
            Register();

            CoordinateProcessor.ExcludeStage(this);

            /* Important: in some circumstances we have to get the stage size right
             * (for instance the popup manager creares the stage just before the first popup is created
             * and the stage has to be sized right for centering popup */
            ValidateNow(); // TODO: not needed for this stage for size is irrelevant?
        }
Exemplo n.º 5
0
        private static void OnMouseDrag(Event e)
        {
#if DEBUG
            if (DebugMode)
            {
                Debug.Log("DragDropManager.OnMouseDrag: " + _dragInitiator);
            }
#endif

            MouseEvent input = (MouseEvent)e;

            DragEvent de;

            /**
             * 1) Check for drag start
             * */
            if (!_dragging) // if not yet dragging
            {
                _dragOverComponent = null;
                _dragging          = true;  // we're dragging now
                if (null != _dragInitiator) // if dragging something
                {
#if DEBUG
                    if (DebugMode)
                    {
                        Debug.Log("DragEvent.DRAG_START: " + _dragInitiator);
                    }
#endif
                    de = BuildEvent(DragEvent.DRAG_START);
                    _dragInitiator.DispatchEvent(de);
                }

                return;
            }

            _dragOverComponent = CoordinateProcessor.GetComponentUnderCoordinatesOnAllStages(input.GlobalPosition, delegate(DisplayListMember dlm)
            {
                Component component = dlm as Component;
                return(null != component && component.MouseEnabled); // && !(component is Stage); // commented 20130307
            }, true, true) as Component;                             // stopOnDisabled, stopOnInvisible

            bool isDragEnter = null != _dragOverComponent &&
                               _dragOverComponent != _lastDragOverComponent &&
                               _dragInitiator != null &&
                               _dragInitiator != _dragOverComponent;

            /**
             * 2) Check for drag enter
             * */
            if (isDragEnter)
            {
                // nullify accepted target, and allow the user to react on DRAG_ENTER event (to call AcceptDragDrop)
                _acceptedTarget = null;
                _action         = Action.None;
                //Debug.Log("DragEvent.DRAG_ENTER: " + _dragOverComponent.GetType().Name);
#if DEBUG
                if (DebugMode)
                {
                    Debug.Log("DragEvent.DRAG_ENTER: " + _dragOverComponent.GetType().Name);
                }
#endif
                // dispatch DragEvent.DRAG_EXIT on _lastDragOverComponent
                if (null != _lastDragOverComponent)
                {
                    de = BuildEvent(DragEvent.DRAG_EXIT);
                    _lastDragOverComponent.DispatchEvent(de);
                }

                // dispatch DragEvent.DRAG_ENTER on _dragOverComponent
                de = BuildEvent(DragEvent.DRAG_ENTER);
                _dragOverComponent.DispatchEvent(de);

                // set _lastDragOverComponent
                _lastDragOverComponent = _dragOverComponent;
            }

            /**
             * 3) Handle feedback to the user
             * By this point, if the user was subscribed to DragEvent.DRAG_ENTER, he could have react with AcceptDragDrop() and (optionally) ShowFeedback()
             * */

            // check if the user has accepted drag and drop
            if (null != _acceptedTarget)
            {
                // if drop is accepted, show overlay, and show CursorType.AcceptDrop cursor
                Overlay.Visible = _overlayShouldBeVisible;
                //_overlay.SetBounds(_acceptedTarget.GlobalBounds); // fix? .MoveBy(new Point(-1, 0)),
                //Overlay.Bounds = (Rectangle)_acceptedTarget.Transform.GlobalBounds.Clone(); // consider cloning bounds 20120415

                if (_feedbackShouldBeVisible)
                {
                    if (Action.None == _action)
                    {
                        ChangeCursorTo(CursorType.AcceptDrop);
                    }
                    else
                    {
                        ProcessFeedback(_action);
                    }
                }
                else
                {
                    ChangeCursorTo(CursorType.Normal);
                }
            }
            else
            {
                // if drop is rejected (meaning not accepted by developer), hide overlay, and show CursorType.RejectDrop cursor
                Overlay.Visible = false;
                if (_feedbackShouldBeVisible)
                {
                    ChangeCursorTo(CursorType.RejectDrop);
                }
                else
                {
                    ChangeCursorTo(CursorType.Normal);
                }
            }

            /**
             * 4) Move proxy
             * */
            _proxy.X = input.GlobalPosition.X + Offset.X;
            _proxy.Y = input.GlobalPosition.Y + Offset.Y;
            _proxy.ValidateNow();
        }