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

            switch (OverlayButtonHover)
            {
            case HeBianGu.Control.DockPanelControl.OverlayButtonHover.DropBorderBottom:
            case HeBianGu.Control.DockPanelControl.OverlayButtonHover.DropBorderLeft:
            case HeBianGu.Control.DockPanelControl.OverlayButtonHover.DropBorderTop:
            case HeBianGu.Control.DockPanelControl.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 HeBianGu.Control.DockPanelControl.OverlayButtonHover.DropBorderBottom:
                _manager.Anchor(
                    _manager.DragPaneServices.FloatingWindow.ClonePane() as DockablePane,
                    AnchorStyle.Bottom);
                break;

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

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

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

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

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

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

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

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

            default:
                return(false);
            }


            return(true);
        }