Exemple #1
0
 public void Register(IDropSurface surface)
 {
     if (!Surfaces.Contains(surface))
     {
         Surfaces.Add(surface);
     }
 }
        public void EndDrag(Point point)
        {
            IDropSurface dropSufrace = null;

            foreach (IDropSurface surface in Surfaces)
            {
                if (surface.SurfaceRectangle.Contains(point))
                {
                    if (surface.OnDrop(point))
                    {
                        dropSufrace = surface;
                        break;
                    }
                }
            }

            foreach (IDropSurface surface in SurfacesWithDragOver)
            {
                if (surface != dropSufrace)
                {
                    surface.OnDragLeave(point);
                }
            }

            SurfacesWithDragOver.Clear();

            if (dropSufrace != null)
            {
                _wnd.Close();
            }

            _wnd  = null;
            _pane = null;
        }
Exemple #3
0
        public void EndDrag(Point point)
        {
            IDropSurface dropSufrace = null;

            foreach (IDropSurface surface in Surfaces)
            {
                if (surface.SurfaceRectangle.Contains(point))
                {
                    if (surface.OnDrop(point))
                    {
                        dropSufrace = surface;
                        break;
                    }
                }
            }

            foreach (IDropSurface surface in SurfacesWithDragOver)
            {
                if (surface != dropSufrace)
                {
                    surface.OnDragLeave(point);
                }
            }

            SurfacesWithDragOver.Clear();

            _wnd.OnEndDrag();//notify floating window that drag operation is coming to end

            if (dropSufrace != null)
            {
                _wnd.Close();
            }
            else
            {
                _wnd.IsVisible = true;
                _wnd.Activate();
            }

            _wnd = null;

            IsDragging = false;
        }
Exemple #4
0
 public void Unregister(IDropSurface surface)
 {
     Surfaces.Remove(surface);
 }
 public void Unregister(IDropSurface surface)
 {
     Surfaces.Remove(surface);
 }
 public void Register(IDropSurface surface)
 {
     if (!Surfaces.Contains(surface))
         Surfaces.Add(surface);
 }
Exemple #7
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:
            {
                IDropSurface ds = CurrentDropPane as IDropSurface;
                rectPane = ds == null ? new Rect(0, 0, 0, 0) : ds.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);
        }