Ejemplo n.º 1
0
        protected override void OnMouseLeftButtonDown(System.Windows.Input.MouseButtonEventArgs e)
        {
            base.OnMouseLeftButtonDown(e);

            _isMouseDown  = true;
            _draggingItem = this;
        }
Ejemplo n.º 2
0
        protected override void OnMouseMove(System.Windows.Input.MouseEventArgs e)
        {
            base.OnMouseMove(e);

            if (e.LeftButton != MouseButtonState.Pressed)
            {
                _isMouseDown  = false;
                _draggingItem = null;
            }
        }
Ejemplo n.º 3
0
        protected override void OnMouseLeave(System.Windows.Input.MouseEventArgs e)
        {
            base.OnMouseLeave(e);

            if (_isMouseDown && e.LeftButton == MouseButtonState.Pressed)
            {
                _draggingItem = this;
            }

            _isMouseDown = false;
        }
Ejemplo n.º 4
0
        protected override void OnMouseLeave(System.Windows.Input.MouseEventArgs e)
        {
            if (e.LeftButton == System.Windows.Input.MouseButtonState.Pressed &&
                LayoutAnchorableTabItem.IsDraggingItem())
            {
                var contentModel = LayoutAnchorableTabItem.GetDraggingItem().Model as LayoutAnchorable;
                var manager      = contentModel.Root.Manager;
                LayoutAnchorableTabItem.ResetDraggingItem();

                manager.StartDraggingFloatingWindowForContent(contentModel);
            }

            base.OnMouseLeave(e);
        }
Ejemplo n.º 5
0
 internal static void ResetDraggingItem()
 {
     _draggingItem = null;
 }
Ejemplo n.º 6
0
        IEnumerable <IDropTarget> IOverlayWindow.GetTargets()
        {
            foreach (var visibleArea in _visibleAreas)
            {
                switch (visibleArea.Type)
                {
                case DropAreaType.DockingManager:
                {
                    var dropAreaDockingManager = visibleArea as DropArea <DockingManager>;
                    yield return(new DockingManagerDropTarget(dropAreaDockingManager.AreaElement, _dockingManagerDropTargetLeft.GetScreenArea(), DropTargetType.DockingManagerDockLeft));

                    yield return(new DockingManagerDropTarget(dropAreaDockingManager.AreaElement, _dockingManagerDropTargetTop.GetScreenArea(), DropTargetType.DockingManagerDockTop));

                    yield return(new DockingManagerDropTarget(dropAreaDockingManager.AreaElement, _dockingManagerDropTargetBottom.GetScreenArea(), DropTargetType.DockingManagerDockBottom));

                    yield return(new DockingManagerDropTarget(dropAreaDockingManager.AreaElement, _dockingManagerDropTargetRight.GetScreenArea(), DropTargetType.DockingManagerDockRight));
                }
                break;

                case DropAreaType.AnchorablePane:
                {
                    var dropAreaAnchorablePane = visibleArea as DropArea <LayoutAnchorablePaneControl>;
                    yield return(new AnchorablePaneDropTarget(dropAreaAnchorablePane.AreaElement, _anchorablePaneDropTargetLeft.GetScreenArea(), DropTargetType.AnchorablePaneDockLeft));

                    yield return(new AnchorablePaneDropTarget(dropAreaAnchorablePane.AreaElement, _anchorablePaneDropTargetTop.GetScreenArea(), DropTargetType.AnchorablePaneDockTop));

                    yield return(new AnchorablePaneDropTarget(dropAreaAnchorablePane.AreaElement, _anchorablePaneDropTargetRight.GetScreenArea(), DropTargetType.AnchorablePaneDockRight));

                    yield return(new AnchorablePaneDropTarget(dropAreaAnchorablePane.AreaElement, _anchorablePaneDropTargetBottom.GetScreenArea(), DropTargetType.AnchorablePaneDockBottom));

                    yield return(new AnchorablePaneDropTarget(dropAreaAnchorablePane.AreaElement, _anchorablePaneDropTargetInto.GetScreenArea(), DropTargetType.AnchorablePaneDockInside));

                    var parentPaneModel = dropAreaAnchorablePane.AreaElement.Model as LayoutAnchorablePane;
                    LayoutAnchorableTabItem lastAreaTabItem = null;
                    foreach (var dropAreaTabItem in dropAreaAnchorablePane.AreaElement.FindVisualChildren <LayoutAnchorableTabItem>())
                    {
                        var tabItemModel = dropAreaTabItem.Model as LayoutAnchorable;
                        lastAreaTabItem = lastAreaTabItem == null || lastAreaTabItem.GetScreenArea().Right < dropAreaTabItem.GetScreenArea().Right ?
                                          dropAreaTabItem : lastAreaTabItem;
                        int tabIndex = parentPaneModel.Children.IndexOf(tabItemModel);
                        yield return(new AnchorablePaneDropTarget(dropAreaAnchorablePane.AreaElement, dropAreaTabItem.GetScreenArea(), DropTargetType.AnchorablePaneDockInside, tabIndex));
                    }

                    if (lastAreaTabItem != null)
                    {
                        var lastAreaTabItemScreenArea = lastAreaTabItem.GetScreenArea();
                        var newAreaTabItemScreenArea  = new Rect(lastAreaTabItemScreenArea.TopRight, new Point(lastAreaTabItemScreenArea.Right + lastAreaTabItemScreenArea.Width, lastAreaTabItemScreenArea.Bottom));
                        if (newAreaTabItemScreenArea.Right < dropAreaAnchorablePane.AreaElement.GetScreenArea().Right)
                        {
                            yield return(new AnchorablePaneDropTarget(dropAreaAnchorablePane.AreaElement, newAreaTabItemScreenArea, DropTargetType.AnchorablePaneDockInside, parentPaneModel.Children.Count));
                        }
                    }

                    var dropAreaTitle = dropAreaAnchorablePane.AreaElement.FindVisualChildren <AnchorablePaneTitle>().FirstOrDefault();
                    if (dropAreaTitle != null)
                    {
                        yield return(new AnchorablePaneDropTarget(dropAreaAnchorablePane.AreaElement, dropAreaTitle.GetScreenArea(), DropTargetType.AnchorablePaneDockInside));
                    }
                }
                break;

                case DropAreaType.DocumentPane:
                {
                    bool isDraggingAnchorables = _floatingWindow.Model is LayoutAnchorableFloatingWindow;
                    if (isDraggingAnchorables && _gridDocumentPaneFullDropTargets != null)
                    {
                        var dropAreaDocumentPane = visibleArea as DropArea <LayoutDocumentPaneControl>;
                        if (_documentPaneFullDropTargetLeft.IsVisible)
                        {
                            yield return(new DocumentPaneDropTarget(dropAreaDocumentPane.AreaElement, _documentPaneFullDropTargetLeft.GetScreenArea(), DropTargetType.DocumentPaneDockLeft));
                        }
                        if (_documentPaneFullDropTargetTop.IsVisible)
                        {
                            yield return(new DocumentPaneDropTarget(dropAreaDocumentPane.AreaElement, _documentPaneFullDropTargetTop.GetScreenArea(), DropTargetType.DocumentPaneDockTop));
                        }
                        if (_documentPaneFullDropTargetRight.IsVisible)
                        {
                            yield return(new DocumentPaneDropTarget(dropAreaDocumentPane.AreaElement, _documentPaneFullDropTargetRight.GetScreenArea(), DropTargetType.DocumentPaneDockRight));
                        }
                        if (_documentPaneFullDropTargetBottom.IsVisible)
                        {
                            yield return(new DocumentPaneDropTarget(dropAreaDocumentPane.AreaElement, _documentPaneFullDropTargetBottom.GetScreenArea(), DropTargetType.DocumentPaneDockBottom));
                        }
                        if (_documentPaneFullDropTargetInto.IsVisible)
                        {
                            yield return(new DocumentPaneDropTarget(dropAreaDocumentPane.AreaElement, _documentPaneFullDropTargetInto.GetScreenArea(), DropTargetType.DocumentPaneDockInside));
                        }

                        var parentPaneModel = dropAreaDocumentPane.AreaElement.Model as LayoutDocumentPane;
                        LayoutDocumentTabItem lastAreaTabItem = null;
                        foreach (var dropAreaTabItem in dropAreaDocumentPane.AreaElement.FindVisualChildren <LayoutDocumentTabItem>())
                        {
                            var tabItemModel = dropAreaTabItem.Model;
                            lastAreaTabItem = lastAreaTabItem == null || lastAreaTabItem.GetScreenArea().Right < dropAreaTabItem.GetScreenArea().Right ?
                                              dropAreaTabItem : lastAreaTabItem;
                            int tabIndex = parentPaneModel.Children.IndexOf(tabItemModel);
                            yield return(new DocumentPaneDropTarget(dropAreaDocumentPane.AreaElement, dropAreaTabItem.GetScreenArea(), DropTargetType.DocumentPaneDockInside, tabIndex));
                        }

                        if (lastAreaTabItem != null)
                        {
                            var lastAreaTabItemScreenArea = lastAreaTabItem.GetScreenArea();
                            var newAreaTabItemScreenArea  = new Rect(lastAreaTabItemScreenArea.TopRight, new Point(lastAreaTabItemScreenArea.Right + lastAreaTabItemScreenArea.Width, lastAreaTabItemScreenArea.Bottom));
                            if (newAreaTabItemScreenArea.Right < dropAreaDocumentPane.AreaElement.GetScreenArea().Right)
                            {
                                yield return(new DocumentPaneDropTarget(dropAreaDocumentPane.AreaElement, newAreaTabItemScreenArea, DropTargetType.DocumentPaneDockInside, parentPaneModel.Children.Count));
                            }
                        }

                        if (_documentPaneDropTargetLeftAsAnchorablePane.IsVisible)
                        {
                            yield return(new DocumentPaneDropAsAnchorableTarget(dropAreaDocumentPane.AreaElement, _documentPaneDropTargetLeftAsAnchorablePane.GetScreenArea(), DropTargetType.DocumentPaneDockAsAnchorableLeft));
                        }
                        if (_documentPaneDropTargetTopAsAnchorablePane.IsVisible)
                        {
                            yield return(new DocumentPaneDropAsAnchorableTarget(dropAreaDocumentPane.AreaElement, _documentPaneDropTargetTopAsAnchorablePane.GetScreenArea(), DropTargetType.DocumentPaneDockAsAnchorableTop));
                        }
                        if (_documentPaneDropTargetRightAsAnchorablePane.IsVisible)
                        {
                            yield return(new DocumentPaneDropAsAnchorableTarget(dropAreaDocumentPane.AreaElement, _documentPaneDropTargetRightAsAnchorablePane.GetScreenArea(), DropTargetType.DocumentPaneDockAsAnchorableRight));
                        }
                        if (_documentPaneDropTargetBottomAsAnchorablePane.IsVisible)
                        {
                            yield return(new DocumentPaneDropAsAnchorableTarget(dropAreaDocumentPane.AreaElement, _documentPaneDropTargetBottomAsAnchorablePane.GetScreenArea(), DropTargetType.DocumentPaneDockAsAnchorableBottom));
                        }
                    }
                    else
                    {
                        var dropAreaDocumentPane = visibleArea as DropArea <LayoutDocumentPaneControl>;
                        if (_documentPaneDropTargetLeft.IsVisible)
                        {
                            yield return(new DocumentPaneDropTarget(dropAreaDocumentPane.AreaElement, _documentPaneDropTargetLeft.GetScreenArea(), DropTargetType.DocumentPaneDockLeft));
                        }
                        if (_documentPaneDropTargetTop.IsVisible)
                        {
                            yield return(new DocumentPaneDropTarget(dropAreaDocumentPane.AreaElement, _documentPaneDropTargetTop.GetScreenArea(), DropTargetType.DocumentPaneDockTop));
                        }
                        if (_documentPaneDropTargetRight.IsVisible)
                        {
                            yield return(new DocumentPaneDropTarget(dropAreaDocumentPane.AreaElement, _documentPaneDropTargetRight.GetScreenArea(), DropTargetType.DocumentPaneDockRight));
                        }
                        if (_documentPaneDropTargetBottom.IsVisible)
                        {
                            yield return(new DocumentPaneDropTarget(dropAreaDocumentPane.AreaElement, _documentPaneDropTargetBottom.GetScreenArea(), DropTargetType.DocumentPaneDockBottom));
                        }
                        if (_documentPaneDropTargetInto.IsVisible)
                        {
                            yield return(new DocumentPaneDropTarget(dropAreaDocumentPane.AreaElement, _documentPaneDropTargetInto.GetScreenArea(), DropTargetType.DocumentPaneDockInside));
                        }

                        var parentPaneModel = dropAreaDocumentPane.AreaElement.Model as LayoutDocumentPane;
                        LayoutDocumentTabItem lastAreaTabItem = null;
                        foreach (var dropAreaTabItem in dropAreaDocumentPane.AreaElement.FindVisualChildren <LayoutDocumentTabItem>())
                        {
                            var tabItemModel = dropAreaTabItem.Model;
                            lastAreaTabItem = lastAreaTabItem == null || lastAreaTabItem.GetScreenArea().Right < dropAreaTabItem.GetScreenArea().Right ?
                                              dropAreaTabItem : lastAreaTabItem;
                            int tabIndex = parentPaneModel.Children.IndexOf(tabItemModel);
                            yield return(new DocumentPaneDropTarget(dropAreaDocumentPane.AreaElement, dropAreaTabItem.GetScreenArea(), DropTargetType.DocumentPaneDockInside, tabIndex));
                        }

                        if (lastAreaTabItem != null)
                        {
                            var lastAreaTabItemScreenArea = lastAreaTabItem.GetScreenArea();
                            var newAreaTabItemScreenArea  = new Rect(lastAreaTabItemScreenArea.TopRight, new Point(lastAreaTabItemScreenArea.Right + lastAreaTabItemScreenArea.Width, lastAreaTabItemScreenArea.Bottom));
                            if (newAreaTabItemScreenArea.Right < dropAreaDocumentPane.AreaElement.GetScreenArea().Right)
                            {
                                yield return(new DocumentPaneDropTarget(dropAreaDocumentPane.AreaElement, newAreaTabItemScreenArea, DropTargetType.DocumentPaneDockInside, parentPaneModel.Children.Count));
                            }
                        }
                    }
                }
                break;

                case DropAreaType.DocumentPaneGroup:
                {
                    var dropAreaDocumentPane = visibleArea as DropArea <LayoutDocumentPaneGroupControl>;
                    if (_documentPaneDropTargetInto.IsVisible)
                    {
                        yield return(new DocumentPaneGroupDropTarget(dropAreaDocumentPane.AreaElement, _documentPaneDropTargetInto.GetScreenArea(), DropTargetType.DocumentPaneGroupDockInside));
                    }
                }
                break;
                }
            }
            yield break;
        }