public FlyoutDockablePane(DockableContent content)
        {
            _referencedPane = content.ContainerPane as DockablePane;
            _manager        = _referencedPane.GetManager();

            //save current content position in container pane
            _arrayIndexPreviousPane = _referencedPane.Items.IndexOf(content);
            Anchor = _referencedPane.Anchor;

            SetValue(ResizingPanel.ResizeWidthProperty, new GridLength(ResizingPanel.GetEffectiveSize(_referencedPane).Width));
            SetValue(ResizingPanel.ResizeHeightProperty, new GridLength(ResizingPanel.GetEffectiveSize(_referencedPane).Height));


            //if (double.IsInfinity(ResizingPanel.GetResizeWidth(this)))
            //    ResizingPanel.SetResizeWidth(this, 200);
            //if (double.IsInfinity(ResizingPanel.GetResizeHeight(this)))
            //    ResizingPanel.SetResizeHeight(this, 200);

            this.Style = _referencedPane.Style;

            //remove content from container pane
            //and add content to my temporary pane
            _referencedPane.Items.RemoveAt(_arrayIndexPreviousPane);
            this.Items.Add(content);


            //select the single content in this pane
            SelectedItem = this.Items[0];
        }
Esempio n. 2
0
        internal void OnDragOver(OverlayWindowDockingButton owdDock, Point point)
        {
            if (selectionBox == null)
            {
                return;
            }

            Rect rectPane;

            if (owdDock == owdBottom ||
                owdDock == owdLeft ||
                owdDock == owdTop ||
                owdDock == owdRight)
            {
                rectPane = (_manager as IDropSurface).SurfaceRectangle;
            }
            else
            {
                rectPane = (CurrentDropPane as IDropSurface).SurfaceRectangle;
            }

            double selectionBoxWidth = Math.Min(
                rectPane.Width / 2.0,
                ResizingPanel.GetEffectiveSize(_manager.DragPaneServices.FloatingWindow.HostedPane).Width);
            double selectionBoxHeight = Math.Min(
                rectPane.Height / 2.0,
                ResizingPanel.GetEffectiveSize(_manager.DragPaneServices.FloatingWindow.HostedPane).Height);


            Point myScreenTopLeft = this.PointToScreenDPI(new Point());

            rectPane.Offset(-myScreenTopLeft.X, -myScreenTopLeft.Y);//relative to me

            if (owdDock == owdBottom || owdDock == owdPaneBottom)
            {
                selectionBox.SetValue(Canvas.LeftProperty, rectPane.Left);
                selectionBox.SetValue(Canvas.TopProperty, rectPane.Top + rectPane.Height - selectionBoxHeight);
                selectionBox.Width  = rectPane.Width;
                selectionBox.Height = selectionBoxHeight;
            }
            if (owdDock == owdLeft || owdDock == owdPaneLeft)
            {
                selectionBox.SetValue(Canvas.LeftProperty, rectPane.Left);
                selectionBox.SetValue(Canvas.TopProperty, rectPane.Top);
                selectionBox.Width  = selectionBoxWidth;
                selectionBox.Height = rectPane.Height;
            }
            if (owdDock == owdRight || owdDock == owdPaneRight)
            {
                selectionBox.SetValue(Canvas.LeftProperty, rectPane.Left + rectPane.Width - selectionBoxWidth);
                selectionBox.SetValue(Canvas.TopProperty, rectPane.Top);
                selectionBox.Width  = selectionBoxWidth;
                selectionBox.Height = rectPane.Height;
            }
            if (owdDock == owdTop || owdDock == owdPaneTop)
            {
                selectionBox.SetValue(Canvas.LeftProperty, rectPane.Left);
                selectionBox.SetValue(Canvas.TopProperty, rectPane.Top);
                selectionBox.Width  = rectPane.Width;
                selectionBox.Height = selectionBoxHeight;
            }
            if (owdDock == owdPaneInto)
            {
                selectionBox.SetValue(Canvas.LeftProperty, rectPane.Left);
                selectionBox.SetValue(Canvas.TopProperty, rectPane.Top);
                selectionBox.Width  = rectPane.Width;
                selectionBox.Height = rectPane.Height;
            }

            if (owdDock == owdLeft)
            {
                SetOverlayButtonHover(OverlayButtonHover.DropBorderLeft);//OverlayButtonHover = OverlayButtonHover.DropBorderLeft;
            }
            else if (owdDock == owdRight)
            {
                SetOverlayButtonHover(OverlayButtonHover.DropBorderRight);//OverlayButtonHover = OverlayButtonHover.DropBorderRight;
            }
            else if (owdDock == owdTop)
            {
                SetOverlayButtonHover(OverlayButtonHover.DropBorderTop);//OverlayButtonHover = OverlayButtonHover.DropBorderTop;
            }
            else if (owdDock == owdBottom)
            {
                SetOverlayButtonHover(OverlayButtonHover.DropBorderBottom);//OverlayButtonHover = OverlayButtonHover.DropBorderBottom;
            }
            else if (owdDock == owdPaneInto)
            {
                SetOverlayButtonHover(OverlayButtonHover.DropPaneInto);//OverlayButtonHover = OverlayButtonHover.DropPaneInto;
            }
            else if (owdDock == owdPaneRight)
            {
                SetOverlayButtonHover(OverlayButtonHover.DropPaneRight);//OverlayButtonHover = OverlayButtonHover.DropPaneRight;
            }
            else if (owdDock == owdPaneTop)
            {
                SetOverlayButtonHover(OverlayButtonHover.DropPaneTop);//OverlayButtonHover = OverlayButtonHover.DropPaneTop;
            }
            else if (owdDock == owdPaneLeft)
            {
                SetOverlayButtonHover(OverlayButtonHover.DropPaneLeft);//OverlayButtonHover = OverlayButtonHover.DropPaneLeft;
            }
            else if (owdDock == owdPaneBottom)
            {
                SetOverlayButtonHover(OverlayButtonHover.DropPaneBottom);//OverlayButtonHover = OverlayButtonHover.DropPaneBottom;
            }
            else
            {
                SetOverlayButtonHover(OverlayButtonHover.None);//OverlayButtonHover = OverlayButtonHover.None;
            }
            selectionBox.Visibility = Visibility.Visible;

            _manager.DragPaneServices.FloatingWindow.OnShowSelectionBox();
        }
Esempio n. 3
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);
        }