Exemple #1
0
        /// <summary>
        /// Set the height of a form docked: top or bottom or fill
        /// </summary>
        /// <param name="info">info identifing the form</param>
        /// <param name="newHeight">new height value</param>
        public void SetHeight(DockableFormInfo info, int newHeight)
        {
            int delta = newHeight - info.DockableForm.Height;

            if (delta == 0)
            {
                return;
            }

            DockingContainer container = HierarchyUtility.GetClosestDockableContainer(info.DockableForm);

            List <DockingContainer> hierarchy = new List <DockingContainer>();
            List <int> modifiers = new List <int>();

            hierarchy.Add(container);
            modifiers.Add(delta);

            DockingContainer containerParent = container.Parent as DockingContainer;

            while (containerParent != null)
            {
                hierarchy.Add(containerParent);
                modifiers.Add(containerParent.Height - container.Height + delta);

                container       = containerParent;
                containerParent = containerParent.Parent as DockingContainer;
            }

            for (int index = hierarchy.Count - 1; index >= 0; index--)
            {
                hierarchy[index].Height += modifiers[index];
            }
        }
Exemple #2
0
        /// <summary>
        /// Add sorted floating containers to the list
        /// </summary>
        /// <param name="containers">containers</param>
        private void AddSortedFloatingContainers(List <DockingContainer> containers)
        {
            List <DockingContainer> containersToBringInFront = new List <DockingContainer>();

            foreach (DockableFormInfo info in _dockableForms)
            {
                FormsTabbedView view = HierarchyUtility.GetTabbedView(info.DockableForm);
                if (view.IsDocked)
                {
                    continue;
                }

                DockingContainer container = HierarchyUtility.GetClosestDockableContainer(info.DockableForm);
                if (_host.Contains(container) == false)
                {
                    continue;
                }

                if (containersToBringInFront.Contains(container) == false)
                {
                    containersToBringInFront.Add(container);
                }
            }

            SortContainersBasedOnTheirZOrder(containersToBringInFront);

            containers.AddRange(containersToBringInFront);
        }
Exemple #3
0
        /// <summary>
        /// Remove the form
        /// </summary>
        /// <param name="info">info about form to remove</param>
        public void Remove(DockableFormInfo info)
        {
            if (info == null)
            {
                return;
            }

            FormsTabbedView view = HierarchyUtility.GetTabbedView(info.DockableForm);

            if (view != null)
            {
                if (view.Count == 1 && view.IsDocked)
                {
                    _layout.Undock(view);
                }

                if (view.Count == 1)
                {
                    _host.Remove(view.Parent);

                    DockingContainer container = HierarchyUtility.GetClosestDockableContainer(info.DockableForm);
                    container.SetModeEmpty();

                    view.Remove(info);
                }
                else
                {
                    if (view.Remove(info) == false)
                    {
                        if (SelectedFormInfo == info)
                        {
                            SelectedFormInfo = null;
                        }

                        return;
                    }
                }
            }

            if (SelectedFormInfo == info)
            {
                SelectedFormInfo = null;
            }

            _dockableForms.Remove(info);
            info.SelectedChanged   -= OnFormSelectedChanged;
            info.ShowAutoPanel     -= OnShowFormAutoPanel;
            info.ExplicitDisposing -= OnInfoDisposing;

            if (info.IsAutoHideMode)
            {
                _autohide.ArrangeAutoButtonsPanels();
            }

            info.Dispose();
        }
Exemple #4
0
        /// <summary>
        /// Dock a form previously added to guider over another form previously added to guider
        /// </summary>
        /// <param name="info">info about the form to dock</param>
        /// <param name="infoOver">info about form over which to dock</param>
        /// <param name="dock">how to dock</param>
        /// <param name="mode">were to dock</param>
        public void DockOver(DockableFormInfo info, DockableFormInfo infoOver, DockStyle dock, DockableMode mode)
        {
            DockingContainer containerToDock      = HierarchyUtility.GetClosestDockableContainer(info.DockableForm);
            DockingContainer containerWhereToDock = null;

            if (infoOver != null)
            {
                containerWhereToDock = HierarchyUtility.GetClosestDockableContainer(infoOver.DockableForm);
            }

            _layout.DockControl(containerToDock, containerWhereToDock, dock, mode);
        }
Exemple #5
0
        /// <summary>
        /// Add sorted fill containers to the list
        /// </summary>
        /// <param name="containers">containers</param>
        private void AddSortedFillContainers(List <DockingContainer> containers)
        {
            List <DockingContainer> containersToBringInFront = new List <DockingContainer>();

            foreach (DockableFormInfo info in _dockableForms)
            {
                FormsTabbedView view = HierarchyUtility.GetTabbedView(info.DockableForm);
                if (view.HostContainerDock != DockStyle.Fill)
                {
                    continue;
                }

                DockingContainer container = HierarchyUtility.GetClosestDockableContainer(info.DockableForm);
                while (true)
                {
                    if (container.Parent as DockingContainer != null)
                    {
                        container = (DockingContainer)container.Parent;
                    }
                    else
                    {
                        break;
                    }
                }

                Debug.Assert(_host.Contains(container), "Floating form views must have their parent in form");

                if (containersToBringInFront.Contains(container) == false)
                {
                    containersToBringInFront.Add(container);
                }
            }

            SortContainersBasedOnTheirZOrder(containersToBringInFront);

            containers.AddRange(containersToBringInFront);
        }
Exemple #6
0
        /// <summary>
        /// Dock a form previously added to guider
        /// </summary>
        /// <param name="info">info about the form to dock</param>
        /// <param name="dock">how to dock</param>
        /// <param name="mode">were to dock</param>
        public void Dock(DockableFormInfo info, DockStyle dock, DockableMode mode)
        {
            DockingContainer container = HierarchyUtility.GetClosestDockableContainer(info.DockableForm);

            _layout.DockControl(container, null, dock, mode);
        }