예제 #1
0
        static public DockControlContainerCollection GetCollection(DockingManagerControl manager, Direction direction)
        {
            DockControlContainerCollection containerCollection;

            switch (direction)
            {
            case Direction.Down:
                containerCollection = manager.Panels[DockingType.Bottom] as DockControlContainerCollection;
                break;

            case Direction.Left:
                containerCollection = manager.Panels[DockingType.Left] as DockControlContainerCollection;
                break;

            case Direction.Right:
                containerCollection = manager.Panels[DockingType.Right] as DockControlContainerCollection;
                break;

            case Direction.Up:
                containerCollection = manager.Panels[DockingType.Top] as DockControlContainerCollection;
                break;

            default:
                throw new InvalidOperationException("Invalid dock style");
            }

            return(containerCollection);
        }
예제 #2
0
 public void Initialise(DockingManagerControl manager)
 {
     foreach (IDockingControl control in manager.DockingControls)
     {
         ToolStripMenuItem item = new DockingWindowMenuItem(control);
         this.DropDownItems.Add(item);
     }
 }
예제 #3
0
        public DockControlContainerCollection(DockingManagerControl manager, DockStyle dockStyle, MenuStrip menuStrip, ToolStripRenderer renderer)
        {
            _manager   = manager;
            _dockStyle = dockStyle;
            _menuStrip = menuStrip;
            _renderer  = renderer;

            _panels = new List <IDockingPanel>();
            InsertPanel(0);
        }
예제 #4
0
        public DockingControl(Control child, DockingManagerControl manager)
        {
            manager.AddDockingControlToList(this);

            InitializeComponent();

            child.Parent = _transparentUserControl;
            child.Dock   = DockStyle.Fill;
            _child       = child;
            _manager     = manager;
            _toolStripCaption.Renderer         = manager.Renderer;
            _manager.ToolStripRendererChanged += new ToolStripRendererChangedHandler(_manager_ToolStripRendererChanged);

            SetupControlEvents(this);
        }
예제 #5
0
        static public Rectangle GetDropXorDragRect(DockingManagerControl manager, Point screenDropPoint, int dockingBarSize)
        {
            Point     managerLocalDropPoint = manager.PointToClient(screenDropPoint);
            Rectangle managerClientBounds   = manager.DockingBounds;
            Rectangle dropRect = Rectangle.Empty;

            if (!HasVisibleContainer(manager.Panels[DockingType.Left]))
            {
                if (managerLocalDropPoint.X < managerClientBounds.Left + dockingBarSize)
                {
                    dropRect       = managerClientBounds;
                    dropRect.Width = dockingBarSize;
                }
            }

            if (!HasVisibleContainer(manager.Panels[DockingType.Right]))
            {
                if (managerLocalDropPoint.X > managerClientBounds.Right - dockingBarSize)
                {
                    dropRect       = managerClientBounds;
                    dropRect.X     = dropRect.Right - dockingBarSize;
                    dropRect.Width = dockingBarSize;
                }
            }

            if (!HasVisibleContainer(manager.Panels[DockingType.Top]))
            {
                if (managerLocalDropPoint.Y < managerClientBounds.Top + dockingBarSize)
                {
                    dropRect        = managerClientBounds;
                    dropRect.Height = dockingBarSize;
                }
            }

            if (!HasVisibleContainer(manager.Panels[DockingType.Bottom]))
            {
                if (managerLocalDropPoint.Y > managerClientBounds.Bottom - dockingBarSize)
                {
                    dropRect        = managerClientBounds;
                    dropRect.Y      = dropRect.Bottom - dockingBarSize;
                    dropRect.Height = dockingBarSize;
                }
            }

            return(dropRect);
        }
예제 #6
0
        public FloatingForm(DockingControl inner, DockingManagerControl manager)
        {
            InitializeComponent();

            _manager = manager;
            _inner   = inner;
            _cancelledChangedHandler = new CancelledChangedHandler(Inner_CancelledChanged);
            _inner.CancelledChanged += _cancelledChangedHandler;

            this.SuspendLayout();
            this.Controls.Add(inner);
            inner.Dock   = DockStyle.Fill;
            this.Padding = new Padding(PaddingSize, PaddingSize, PaddingSize, PaddingSize);
            this.ResumeLayout(true);

            _dragSizer = new ControlDragSizer(this);
        }
예제 #7
0
        static public DockControlContainer GetDropContainer(DockingManagerControl manager, Point screenDropPoint, int dockingBarSize)
        {
            Point managerLocalDropPoint    = manager.PointToClient(screenDropPoint);
            DockControlContainer container = manager.GetContainerAtPoint(managerLocalDropPoint);

            if (container == null)
            {
                Rectangle managerClientBounds = manager.DockingBounds;

                if (!HasVisibleContainer(manager.Panels[DockingType.Left]))
                {
                    if (managerLocalDropPoint.X < managerClientBounds.Left + dockingBarSize)
                    {
                        container = manager.Panels[DockingType.Left][0] as DockControlContainer;
                    }
                }

                if (!HasVisibleContainer(manager.Panels[DockingType.Right]))
                {
                    if (managerLocalDropPoint.X > managerClientBounds.Right - dockingBarSize)
                    {
                        container = manager.Panels[DockingType.Right][0] as DockControlContainer;
                    }
                }

                if (!HasVisibleContainer(manager.Panels[DockingType.Top]))
                {
                    if (managerLocalDropPoint.Y < managerClientBounds.Top + dockingBarSize)
                    {
                        container = manager.Panels[DockingType.Top][0] as DockControlContainer;
                    }
                }

                if (!HasVisibleContainer(manager.Panels[DockingType.Bottom]))
                {
                    if (managerLocalDropPoint.Y > managerClientBounds.Bottom - dockingBarSize)
                    {
                        container = manager.Panels[DockingType.Bottom][0] as DockControlContainer;
                    }
                }
            }

            return(container);
        }
예제 #8
0
        protected virtual Rectangle GetDockingBounds()
        {
            DockingManagerControl manager = ControlHelpers.FindParentControl <DockingManagerControl>(this);

            if (manager == null)
            {
                throw new InvalidOperationException("Auto resize control must have a DockingManagerControl as one of its parents");
            }
            else
            {
                Rectangle bounds = manager.DockingBounds;

                switch (_container.Dock)
                {
                case DockStyle.Left:
                    bounds.Width = _container.Width;
                    break;

                case DockStyle.Top:
                    bounds.Height = _container.Height;
                    break;

                case DockStyle.Right:
                    bounds.X     = bounds.Right - _container.Width;
                    bounds.Width = _container.Width;
                    break;

                case DockStyle.Bottom:
                    bounds.Y      = bounds.Bottom - _container.Height;
                    bounds.Height = _container.Height;
                    break;

                default:
                    System.Diagnostics.Debug.Assert(false, "Invalid dock style");
                    break;
                }

                return(bounds);
            }
        }
예제 #9
0
 static public DockControlContainerCollection GetCollection(DockingManagerControl manager, DockingType type)
 {
     return(manager.Panels[type] as DockControlContainerCollection);
 }
예제 #10
0
 static private DockControlContainerCollection GetDockControlContainerCollection(DockingManagerControl manager, DockControlContainer container)
 {
     return(DockControlContainerCollectionHelpers.GetCollection(manager, container.Dock));
 }
예제 #11
0
        static public DockControlContainer CreateNewContainerIfNecessary(DockingManagerControl manager, DockControlContainer container, Point screenDropPoint, int dockingBarSize)
        {
            DockControlContainer result = container;

            if (container.Visible)
            {
                Point managerLocalDropPoint = manager.PointToClient(screenDropPoint);
                DockControlContainerCollection containerCollection = GetDockControlContainerCollection(manager, container);
                int index = containerCollection.IndexOf(container);

                switch (container.Dock)
                {
                case DockStyle.Top:
                    if (managerLocalDropPoint.Y < container.Top + dockingBarSize)
                    {
                        result = containerCollection.InsertPanel(index + 1) as DockControlContainer;
                    }
                    else if (managerLocalDropPoint.Y > container.Bottom - dockingBarSize)
                    {
                        result = containerCollection.InsertPanel(index) as DockControlContainer;
                    }

                    break;

                case DockStyle.Bottom:

                    if (managerLocalDropPoint.Y < container.Top + dockingBarSize)
                    {
                        result = containerCollection.InsertPanel(index) as DockControlContainer;
                    }
                    else if (managerLocalDropPoint.Y > container.Bottom - dockingBarSize)
                    {
                        result = containerCollection.InsertPanel(index + 1) as DockControlContainer;
                    }

                    break;

                case DockStyle.Left:

                    if (managerLocalDropPoint.X < container.Left + dockingBarSize)
                    {
                        result = containerCollection.InsertPanel(index + 1) as DockControlContainer;
                    }
                    else if (managerLocalDropPoint.X > container.Right - dockingBarSize)
                    {
                        result = containerCollection.InsertPanel(index) as DockControlContainer;
                    }

                    break;

                case DockStyle.Right:

                    if (managerLocalDropPoint.X < container.Left + dockingBarSize)
                    {
                        result = containerCollection.InsertPanel(index) as DockControlContainer;
                    }
                    else if (managerLocalDropPoint.X > container.Right - dockingBarSize)
                    {
                        result = containerCollection.InsertPanel(index + 1) as DockControlContainer;
                    }

                    break;

                default:
                    throw new InvalidOperationException("Invalid dock style");
                }
            }

            return(result);
        }
예제 #12
0
 private void _manager_ToolStripRendererChanged(DockingManagerControl control, ToolStripRenderer newRenderer)
 {
     _toolStripCaption.Renderer = newRenderer;
 }
예제 #13
0
 public DockingPanels(DockingManagerControl manager)
 {
     _manager = manager;
 }