internal bool OnDrop(OverlayWindowDockingButton owdDock, Point point)
        {
            //user has dropped the floating window over a anchor button
            //create a new dockable pane to insert in the main layout
            Pane paneToAnchor = _manager.DragPaneServices.FloatingWindow.ClonePane();

            //floating window is going to be closed..

            if (owdDock == owdBottom)
            {
                _manager.Anchor(paneToAnchor, AnchorStyle.Bottom);
            }
            else if (owdDock == owdLeft)
            {
                _manager.Anchor(paneToAnchor, AnchorStyle.Left);
            }
            else if (owdDock == owdRight)
            {
                _manager.Anchor(paneToAnchor, AnchorStyle.Right);
            }
            else if (owdDock == owdTop)
            {
                _manager.Anchor(paneToAnchor, AnchorStyle.Top);
            }
            else if (owdDock == owdPaneTop)
            {
                _manager.Anchor(paneToAnchor, CurrentDropPane, AnchorStyle.Top);
            }
            else if (owdDock == owdPaneBottom)
            {
                _manager.Anchor(paneToAnchor, CurrentDropPane, AnchorStyle.Bottom);
            }
            else if (owdDock == owdPaneLeft)
            {
                _manager.Anchor(paneToAnchor, CurrentDropPane, AnchorStyle.Left);
            }
            else if (owdDock == owdPaneRight)
            {
                _manager.Anchor(paneToAnchor, CurrentDropPane, AnchorStyle.Right);
            }
            else if (owdDock == owdPaneInto)
            {
                _manager.DropInto(paneToAnchor, CurrentDropPane);
            }

            selectionBox.Visibility = Visibility.Hidden;

            return(true);
        }
Esempio n. 2
0
        internal bool OnDrop(OverlayWindowDockingButton owdDock, Point point)
        {
            //calculate desidered size
            Rect rectPane;

            switch (OverlayButtonHover)
            {
            case AvalonDock.OverlayButtonHover.DropBorderBottom:
            case AvalonDock.OverlayButtonHover.DropBorderLeft:
            case AvalonDock.OverlayButtonHover.DropBorderTop:
            case AvalonDock.OverlayButtonHover.DropBorderRight:
                rectPane = (_manager as IDropSurface).SurfaceRectangle;
                break;

            default:
                rectPane = (CurrentDropPane as IDropSurface).SurfaceRectangle;
                break;
            }

            var desideredWidth = Math.Min(
                rectPane.Width / 2.0,
                ResizingPanel.GetEffectiveSize(_manager.DragPaneServices.FloatingWindow.HostedPane).Width);
            var desideredHeight = Math.Min(
                rectPane.Height / 2.0,
                ResizingPanel.GetEffectiveSize(_manager.DragPaneServices.FloatingWindow.HostedPane).Height);

            var desideredSize = new Size(
                desideredWidth,
                desideredHeight);

            //user has dropped the floating window over a anchor button
            //create a new dockable pane to insert in the main layout
            //FIX: clone pane and return true only if overlayButtonOver is not set to None!!


            //floating window is going to be closed..
            selectionBox.Visibility = Visibility.Hidden;

            //take the overlaybutton hover property to get the right button highlighted
            switch (OverlayButtonHover)
            {
            case AvalonDock.OverlayButtonHover.DropBorderBottom:
                _manager.Anchor(
                    _manager.DragPaneServices.FloatingWindow.ClonePane() as DockablePane,
                    AnchorStyle.Bottom);
                break;

            case AvalonDock.OverlayButtonHover.DropBorderTop:
                _manager.Anchor(
                    _manager.DragPaneServices.FloatingWindow.ClonePane() as DockablePane,
                    AnchorStyle.Top);
                break;

            case AvalonDock.OverlayButtonHover.DropBorderLeft:
                _manager.Anchor(
                    _manager.DragPaneServices.FloatingWindow.ClonePane() as DockablePane,
                    AnchorStyle.Left);
                break;

            case AvalonDock.OverlayButtonHover.DropBorderRight:
                _manager.Anchor(
                    _manager.DragPaneServices.FloatingWindow.ClonePane() as DockablePane,
                    AnchorStyle.Right);
                break;

            case AvalonDock.OverlayButtonHover.DropPaneBottom:
                _manager.Anchor(
                    _manager.DragPaneServices.FloatingWindow.ClonePane(),
                    CurrentDropPane, AnchorStyle.Bottom);
                break;

            case AvalonDock.OverlayButtonHover.DropPaneTop:
                _manager.Anchor(
                    _manager.DragPaneServices.FloatingWindow.ClonePane(),
                    CurrentDropPane, AnchorStyle.Top);
                break;

            case AvalonDock.OverlayButtonHover.DropPaneLeft:
                _manager.Anchor(
                    _manager.DragPaneServices.FloatingWindow.ClonePane(),
                    CurrentDropPane, AnchorStyle.Left);
                break;

            case AvalonDock.OverlayButtonHover.DropPaneRight:
                _manager.Anchor(
                    _manager.DragPaneServices.FloatingWindow.ClonePane(),
                    CurrentDropPane, AnchorStyle.Right);
                break;

            case AvalonDock.OverlayButtonHover.DropPaneInto:
                _manager.DropInto(
                    _manager.DragPaneServices.FloatingWindow.ClonePane(),
                    CurrentDropPane);
                break;

            default:
                return(false);
            }


            return(true);
        }