public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            gridPaneRelativeDockingOptions = GetTemplateChild("PART_gridPaneRelativeDockingOptions") as FrameworkElement;
            selectionBox = GetTemplateChild("PART_SelectionBox") as FrameworkElement;

            owdBottom = new OverlayWindowDockingButton(GetTemplateChild("PART_btnDockBottom") as FrameworkElement, this);
            owdTop    = new OverlayWindowDockingButton(GetTemplateChild("PART_btnDockTop") as FrameworkElement, this);
            owdLeft   = new OverlayWindowDockingButton(GetTemplateChild("PART_btnDockLeft") as FrameworkElement, this);
            owdRight  = new OverlayWindowDockingButton(GetTemplateChild("PART_btnDockRight") as FrameworkElement, this);

            owdPaneBottom = new OverlayWindowDockingButton(GetTemplateChild("PART_btnDockPaneBottom") as FrameworkElement, this);
            owdPaneTop    = new OverlayWindowDockingButton(GetTemplateChild("PART_btnDockPaneTop") as FrameworkElement, this);
            owdPaneLeft   = new OverlayWindowDockingButton(GetTemplateChild("PART_btnDockPaneLeft") as FrameworkElement, this);
            owdPaneRight  = new OverlayWindowDockingButton(GetTemplateChild("PART_btnDockPaneRight") as FrameworkElement, this);
            owdPaneInto   = new OverlayWindowDockingButton(GetTemplateChild("PART_btnDockPaneInto") as FrameworkElement, this);

            _manager.DragPaneServices.Register(owdBottom);
            _manager.DragPaneServices.Register(owdTop);
            _manager.DragPaneServices.Register(owdLeft);
            _manager.DragPaneServices.Register(owdRight);
            _manager.DragPaneServices.Register(owdPaneBottom);
            _manager.DragPaneServices.Register(owdPaneTop);
            _manager.DragPaneServices.Register(owdPaneLeft);
            _manager.DragPaneServices.Register(owdPaneRight);
            _manager.DragPaneServices.Register(owdPaneInto);
        }
        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. 3
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. 4
0
 /// <summary>
 /// Hides the highlighting rectangle
 /// </summary>
 /// <param name="overlayWindowDockingButton"></param>
 /// <param name="point"></param>
 /// <returns></returns>
 internal void OnDragLeave(OverlayWindowDockingButton owdDock, Point point)
 {
     selectionBox.Visibility = Visibility.Hidden;
     _manager.DragPaneServices.FloatingWindow.OnHideSelectionBox();
     SetOverlayButtonHover(OverlayButtonHover.None);
 }
Esempio n. 5
0
 /// <summary>
 /// Shows a highlighting rectangle
 /// </summary>
 /// <param name="overlayWindowDockingButton"></param>
 /// <param name="point"></param>
 /// <returns></returns>
 internal void OnDragEnter(OverlayWindowDockingButton owdDock, Point point)
 {
     OnDragOver(owdDock, point);
 }
Esempio n. 6
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);
        }
Esempio n. 7
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. 8
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;
        }
Esempio n. 9
0
 /// <summary>
 /// Hides the highlighting rectangle
 /// </summary>
 /// <param name="overlayWindowDockingButton"></param>
 /// <param name="point"></param>
 /// <returns></returns>
 internal void OnDragLeave(OverlayWindowDockingButton owdDock, Point point)
 {
     selectionBox.Visibility = Visibility.Hidden;
     _manager.DragPaneServices.FloatingWindow.OnHideSelectionBox();
     SetOverlayButtonHover(OverlayButtonHover.None);
 }
Esempio n. 10
0
 /// <summary>
 /// Shows a highlighting rectangle
 /// </summary>
 /// <param name="overlayWindowDockingButton"></param>
 /// <param name="point"></param>
 /// <returns></returns>
 internal void OnDragEnter(OverlayWindowDockingButton owdDock, Point point)
 {
     OnDragOver(owdDock, point);
 }
Esempio n. 11
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            gridPaneRelativeDockingOptions  = GetTemplateChild("PART_gridPaneRelativeDockingOptions") as FrameworkElement;
            selectionBox = GetTemplateChild("PART_SelectionBox") as FrameworkElement;

            owdBottom = new OverlayWindowDockingButton(GetTemplateChild("PART_btnDockBottom") as FrameworkElement, this);
            owdTop = new OverlayWindowDockingButton(GetTemplateChild("PART_btnDockTop") as FrameworkElement, this);
            owdLeft = new OverlayWindowDockingButton(GetTemplateChild("PART_btnDockLeft") as FrameworkElement, this);
            owdRight = new OverlayWindowDockingButton(GetTemplateChild("PART_btnDockRight") as FrameworkElement, this);

            owdPaneBottom = new OverlayWindowDockingButton(GetTemplateChild("PART_btnDockPaneBottom") as FrameworkElement, this);
            owdPaneTop = new OverlayWindowDockingButton(GetTemplateChild("PART_btnDockPaneTop") as FrameworkElement, this);
            owdPaneLeft = new OverlayWindowDockingButton(GetTemplateChild("PART_btnDockPaneLeft") as FrameworkElement, this);
            owdPaneRight = new OverlayWindowDockingButton(GetTemplateChild("PART_btnDockPaneRight") as FrameworkElement, this);
            owdPaneInto = new OverlayWindowDockingButton(GetTemplateChild("PART_btnDockPaneInto") as FrameworkElement, this);

            var btn = GetTemplateChild("PART_btnDockMainPaneBottom") as FrameworkElement;
            if (btn != null) owdMainPaneBottom = new OverlayWindowDockingButton(btn, this);

            btn = GetTemplateChild("PART_btnDockMainPaneTop") as FrameworkElement;
            if (btn != null) owdMainPaneTop = new OverlayWindowDockingButton(btn, this);

            btn = GetTemplateChild("PART_btnDockMainPaneLeft") as FrameworkElement;
            if (btn != null) owdMainPaneLeft = new OverlayWindowDockingButton(btn, this);

            btn = GetTemplateChild("PART_btnDockMainPaneRight") as FrameworkElement;
            if (btn != null) owdMainPaneRight = new OverlayWindowDockingButton(btn, this);

            _manager.DragPaneServices.Register(owdPaneBottom);
            _manager.DragPaneServices.Register(owdPaneTop);
            _manager.DragPaneServices.Register(owdPaneLeft);
            _manager.DragPaneServices.Register(owdPaneRight);
            _manager.DragPaneServices.Register(owdPaneInto);
            _manager.DragPaneServices.Register(owdBottom);
            _manager.DragPaneServices.Register(owdTop);
            _manager.DragPaneServices.Register(owdLeft);
            _manager.DragPaneServices.Register(owdRight);

            if (owdMainPaneTop != null) _manager.DragPaneServices.Register(owdMainPaneTop);
            if (owdMainPaneLeft != null) _manager.DragPaneServices.Register(owdMainPaneLeft);
            if (owdMainPaneRight != null) _manager.DragPaneServices.Register(owdMainPaneRight);
            if (owdMainPaneBottom != null) _manager.DragPaneServices.Register(owdMainPaneBottom);
        }
Esempio n. 12
0
        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. 13
0
        internal void OnDragOver(OverlayWindowDockingButton owdDock, Point point)
        {
            if (selectionBox == null)
            {
                return;
            }

            Rect rectPane;

            double width  = 200;
            double height = 200;

            if (owdDock == owdBottom ||
                owdDock == owdLeft ||
                owdDock == owdTop ||
                owdDock == owdRight)
            {
                rectPane = _manager.SurfaceRectangle;
            }
            else
            {
                rectPane = CurrentDropPane.SurfaceRectangle;
                height   = Math.Min(rectPane.Height / 2,
                                    ResizingPanel.GetResizeHeight(_manager.DragPaneServices.FloatingWindow.HostedPane));
                width = Math.Min(rectPane.Width / 2,
                                 ResizingPanel.GetResizeWidth(_manager.DragPaneServices.FloatingWindow.HostedPane));
            }

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

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

            //if (CurrentDropPane != null &&
            //    !double.IsInfinity(ResizingPanel.GetResizeWidth(CurrentDropPane)))
            //    width = ResizingPanel.GetResizeWidth(CurrentDropPane);

            //if (CurrentDropPane != null &&
            //    !double.IsInfinity(ResizingPanel.GetResizeHeight(CurrentDropPane)))
            //    height = ResizingPanel.GetResizeHeight(CurrentDropPane);


            if (owdDock == owdBottom || owdDock == owdPaneBottom)
            {
                selectionBox.SetValue(Canvas.LeftProperty, rectPane.Left);
                selectionBox.SetValue(Canvas.TopProperty, rectPane.Top + rectPane.Height - height);
                selectionBox.Width  = rectPane.Width;
                selectionBox.Height = height;
            }
            if (owdDock == owdLeft || owdDock == owdPaneLeft)
            {
                selectionBox.SetValue(Canvas.LeftProperty, rectPane.Left);
                selectionBox.SetValue(Canvas.TopProperty, rectPane.Top);
                selectionBox.Width  = width;
                selectionBox.Height = rectPane.Height;
            }
            if (owdDock == owdRight || owdDock == owdPaneRight)
            {
                selectionBox.SetValue(Canvas.LeftProperty, rectPane.Left + rectPane.Width - width);
                selectionBox.SetValue(Canvas.TopProperty, rectPane.Top);
                selectionBox.Width  = width;
                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 = height;
            }
            if (owdDock == owdPaneInto)
            {
                selectionBox.SetValue(Canvas.LeftProperty, rectPane.Left);
                selectionBox.SetValue(Canvas.TopProperty, rectPane.Top);
                selectionBox.Width  = rectPane.Width;
                selectionBox.Height = rectPane.Height;
            }

            selectionBox.Visibility = Visibility.Visible;

            _manager.DragPaneServices.FloatingWindow.OnShowSelectionBox();
        }