Esempio n. 1
0
        private static Rectangle GetBounds(ViewHost dockHost, ViewHost dockClient)
        {
            var loc  = dockHost.PointToScreen(Point.Empty);
            var size = dockHost.Size;

            if (dockHost.IsDocumentWell)
            {
                if (dockClient.IsDocumentWell || (dockClient.ViewsCount == 1 && dockClient.GetView(0).IsDocument))
                {
                    return(new Rectangle(
                               loc.X + (size.Width - 112) / 2,
                               loc.Y + (size.Height - 112) / 2,
                               112, 112));
                }
                else
                {
                    return(new Rectangle(
                               loc.X + (size.Width - 184) / 2,
                               loc.Y + (size.Height - 184) / 2,
                               184, 184));
                }
            }
            else
            {
                return(new Rectangle(
                           loc.X + (size.Width - 112) / 2,
                           loc.Y + (size.Height - 112) / 2,
                           112, 112));
            }
        }
Esempio n. 2
0
        private static DockMarkerButton[] GetButtons(ViewHost dockHost, ViewHost dockClient)
        {
            if (dockHost.IsDocumentWell)
            {
                if (dockClient.IsDocumentWell || (dockClient.ViewsCount == 1 && dockClient.GetView(0).IsDocument))
                {
                    return(new []
                    {
                        new DockMarkerButton(new Rectangle(40, 4, 32, 32), DockResult.DocumentTop),

                        new DockMarkerButton(new Rectangle(4, 40, 32, 32), DockResult.DocumentLeft),
                        new DockMarkerButton(new Rectangle(40, 40, 32, 32), DockResult.Fill),
                        new DockMarkerButton(new Rectangle(76, 40, 32, 32), DockResult.DocumentRight),

                        new DockMarkerButton(new Rectangle(40, 76, 32, 32), DockResult.DocumentBottom),
                    });
                }
                else
                {
                    return(new []
                    {
                        new DockMarkerButton(new Rectangle(76, 4, 32, 32), DockResult.Top),
                        new DockMarkerButton(new Rectangle(76, 40, 32, 32), DockResult.DocumentTop),

                        new DockMarkerButton(new Rectangle(4, 76, 32, 32), DockResult.Left),
                        new DockMarkerButton(new Rectangle(40, 76, 32, 32), DockResult.DocumentLeft),

                        new DockMarkerButton(new Rectangle(76, 76, 32, 32), DockResult.Fill),

                        new DockMarkerButton(new Rectangle(112, 76, 32, 32), DockResult.DocumentRight),
                        new DockMarkerButton(new Rectangle(148, 76, 32, 32), DockResult.Right),

                        new DockMarkerButton(new Rectangle(76, 112, 32, 32), DockResult.DocumentBottom),
                        new DockMarkerButton(new Rectangle(76, 148, 32, 32), DockResult.Bottom),
                    });
                }
            }
            else
            {
                return(new []
                {
                    new DockMarkerButton(new Rectangle(40, 4, 32, 32), DockResult.Top),

                    new DockMarkerButton(new Rectangle(4, 40, 32, 32), DockResult.Left),
                    new DockMarkerButton(new Rectangle(40, 40, 32, 32), DockResult.Fill),
                    new DockMarkerButton(new Rectangle(76, 40, 32, 32), DockResult.Right),

                    new DockMarkerButton(new Rectangle(40, 76, 32, 32), DockResult.Bottom),
                });
            }
        }
        /// <summary>Gets another view in the task UI.</summary>
        /// <typeparam name="T">The type of the desired view.</typeparam>
        /// <returns>The view, if found.</returns>
        protected T GetView <T> () where T : class, IDTSTaskUIView
        {
            foreach (TreeNode node in ViewNode.TreeView.Nodes)
            {
                var view = ViewHost.GetView(node) as T;
                if (view != null)
                {
                    return(view);
                }
            }
            ;

            return(null);
        }
Esempio n. 4
0
        /// <summary>Docks <paramref name="viewHost"/> into this <see cref="IDockHost"/>.</summary>
        /// <param name="viewHost"><see cref="ViewHost"/> to dock.</param>
        /// <param name="dockResult">Position for docking.</param>
        public void PerformDock(ViewHost viewHost, DockResult dockResult)
        {
            Verify.Argument.IsNotNull(viewHost, nameof(viewHost));
            Verify.Argument.IsFalse(viewHost.IsDocumentWell, "viewHost");
            Verify.Argument.IsFalse(viewHost.ViewsCount == 1 && viewHost.GetView(0).IsDocument, "viewHost");

            switch (dockResult)
            {
            case DockResult.Left:
                DockSide(AnchorStyles.Left, viewHost, false);
                viewHost.Status = ViewHostStatus.Docked;
                break;

            case DockResult.Top:
                DockSide(AnchorStyles.Top, viewHost, false);
                viewHost.Status = ViewHostStatus.Docked;
                break;

            case DockResult.Right:
                DockSide(AnchorStyles.Right, viewHost, false);
                viewHost.Status = ViewHostStatus.Docked;
                break;

            case DockResult.Bottom:
                DockSide(AnchorStyles.Bottom, viewHost, false);
                viewHost.Status = ViewHostStatus.Docked;
                break;

            case DockResult.AutoHideLeft:
                GetCreateDockSide(AnchorStyles.Left).AddHost(viewHost);
                break;

            case DockResult.AutoHideTop:
                GetCreateDockSide(AnchorStyles.Top).AddHost(viewHost);
                break;

            case DockResult.AutoHideRight:
                GetCreateDockSide(AnchorStyles.Right).AddHost(viewHost);
                break;

            case DockResult.AutoHideBottom:
                GetCreateDockSide(AnchorStyles.Bottom).AddHost(viewHost);
                break;

            default:
                throw new ArgumentException(
                          "Unsupported DockResult value: {0}".UseAsFormat(dockResult),
                          "dockResult");
            }
        }
Esempio n. 5
0
 /// <summary>Creates the markers.</summary>
 /// <param name="dockClient">The dock client.</param>
 /// <returns>Created dock markers.</returns>
 protected override GridDockMarker[] CreateMarkers(ViewHost dockClient)
 {
     if (dockClient.IsDocumentWell || (dockClient.ViewsCount == 1 && dockClient.GetView(0).IsDocument))
     {
         return(null);
     }
     else
     {
         return(new GridDockMarker[]
         {
             new GridDockMarker(Grid, dockClient, AnchorStyles.Left),
             new GridDockMarker(Grid, dockClient, AnchorStyles.Top),
             new GridDockMarker(Grid, dockClient, AnchorStyles.Right),
             new GridDockMarker(Grid, dockClient, AnchorStyles.Bottom),
         });
     }
 }
Esempio n. 6
0
 private static Point[] GetBorder(ViewHost dockHost, ViewHost dockClient)
 {
     if (dockHost.IsDocumentWell)
     {
         if (dockClient.IsDocumentWell || (dockClient.ViewsCount == 1 && dockClient.GetView(0).IsDocument))
         {
             return(SmallCrossPolygon);
         }
         else
         {
             return(LargeCrossPolygon);
         }
     }
     else
     {
         return(SmallCrossPolygon);
     }
 }
Esempio n. 7
0
        /// <summary>Determines if <see cref="ViewHost"/> cn be docked into this <see cref="IDockHost"/>.</summary>
        /// <param name="viewHost"><see cref="ViewHost"/> to dock.</param>
        /// <param name="dockResult">Position for docking.</param>
        /// <returns>true if docking is possible.</returns>
        public bool CanDock(ViewHost viewHost, DockResult dockResult)
        {
            Verify.Argument.IsNotNull(viewHost, nameof(viewHost));

            if (viewHost.IsDocumentWell || (viewHost.ViewsCount == 1 && viewHost.GetView(0).IsDocument))
            {
                return(false);
            }
            switch (dockResult)
            {
            case DockResult.Left:
            case DockResult.Top:
            case DockResult.Right:
            case DockResult.Bottom:
                return(true);

            default:
                return(false);
            }
        }
Esempio n. 8
0
 private static Region GetRegion(ViewHost dockHost, ViewHost dockClient)
 {
     using (var gp = new GraphicsPath())
     {
         if (dockHost.IsDocumentWell)
         {
             if (dockClient.IsDocumentWell || (dockClient.ViewsCount == 1 && dockClient.GetView(0).IsDocument))
             {
                 gp.AddPolygon(RegionSmallCrossPolygon);
             }
             else
             {
                 gp.AddPolygon(RegionLargeCrossPolygon);
             }
         }
         else
         {
             gp.AddPolygon(RegionSmallCrossPolygon);
         }
         return(new Region(gp));
     }
 }
Esempio n. 9
0
 /// <summary>Creates the markers.</summary>
 /// <param name="dockClient">The dock client.</param>
 /// <returns>Created markers.</returns>
 protected override ViewHostDockMarker[] CreateMarkers(ViewHost dockClient)
 {
     if (_dockHost.IsDocumentWell || (!dockClient.IsDocumentWell && !(dockClient.ViewsCount == 1 && dockClient.GetView(0).IsDocument)))
     {
         return(new ViewHostDockMarker[] { new ViewHostDockMarker(_dockHost, dockClient) });
     }
     else
     {
         return(null);
     }
 }