Exemplo n.º 1
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);
        }
Exemplo n.º 2
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();
        }
Exemplo n.º 3
0
        /// <summary>
        /// Start showing form
        /// </summary>
        /// <param name="form">form to show</param>
        /// <param name="width">width of the form</param>
        /// <param name="height">height of the form</param>
        private void StartShowForm(Form form, int width, int height)
        {
            _previewPane.Visible = false;

            FormsTabbedView view = HierarchyUtility.GetTabbedView(form);

            view.Size = new Size(width, height);
            view.SelectPage(form);
            StartAutoShowPane(view.Parent as AutoHidePanel);
        }
Exemplo n.º 4
0
 /// <summary>
 /// Set auto-hide mode
 /// </summary>
 /// <param name="info">info of the form to set</param>
 /// <param name="autoHide">flag indicating if should set auto-hide (true) or unset it</param>
 public void SetAutoHide(DockableFormInfo info, bool autoHide)
 {
     if (autoHide && info.IsAutoHideMode == false)
     {
         _autohide.SetAutoHideMode(HierarchyUtility.GetTabbedView(info.DockableForm));
     }
     else if (autoHide == false && info.IsAutoHideMode)
     {
         _autohide.UnsetAutoHideMode(HierarchyUtility.GetTabbedView(info.DockableForm));
     }
 }
Exemplo n.º 5
0
        /// <summary>
        /// Show auto form
        /// </summary>
        /// <param name="form">form to be shown</param>
        public void ShowAutoForm(Form form)
        {
            FormsTabbedView view  = HierarchyUtility.GetTabbedView(form);
            AutoHidePanel   panel = view.Parent as AutoHidePanel;

            if (panel == null)
            {
                return;
            }

            if (_leftAutoHideButtons != null)
            {
                if (_leftAutoHideButtons.ContainsPanel(panel))
                {
                    OnLeftPaneSelectButton(this, new ControlEventArgs(form));
                    return;
                }
            }

            if (_rightAutoHideButtons != null)
            {
                if (_rightAutoHideButtons.ContainsPanel(panel))
                {
                    OnRightPaneSelectButton(this, new ControlEventArgs(form));
                    return;
                }
            }

            if (_topAutoHideButtons != null)
            {
                if (_topAutoHideButtons.ContainsPanel(panel))
                {
                    OnTopPaneSelectButton(this, new ControlEventArgs(form));
                    return;
                }
            }

            if (_bottomAutoHideButtons != null)
            {
                if (_bottomAutoHideButtons.ContainsPanel(panel))
                {
                    OnBottomPaneSelectButton(this, new ControlEventArgs(form));
                    return;
                }
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Undock view
        /// </summary>
        /// <param name="view">view to undock</param>
        /// <param name="hintBounds">hint bounds</param>
        private void Undock(Form formToUndock, Rectangle hintBounds)
        {
            FormsTabbedView view = HierarchyUtility.GetTabbedView(formToUndock);

            if (view.Count == 1)
            {
                _layout.Undock(view, hintBounds);
            }
            else
            {
                DockableFormInfo info = GetFormInfo(formToUndock);

                FormsTabbedView newView = CreateFormsTabbedView(info.DockableForm.Size, null);
                newView.Add(info);

                _layout.CreateFloatingContainer(newView, hintBounds);
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// Occurs when IsSelected property of a form is changed
        /// </summary>
        /// <param name="sender">sender of the event</param>
        /// <param name="e">event argument</param>
        private void OnFormSelectedChanged(object sender, EventArgs e)
        {
            DockableFormInfo info = (DockableFormInfo)sender;

            if (info.IsSelected)
            {
                SelectedFormInfo = info;
            }

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

            if (view != null)
            {
                if (view.SelectedForm != null)
                {
                    DockableFormInfo topFormInfo = GetFormInfo(view.SelectedForm);

                    view.PagesPanel.ShowCloseButton       = topFormInfo.ShowCloseButton;
                    view.PagesPanel.ShowContextMenuButton = topFormInfo.ShowContextMenuButton;
                }
            }
        }
Exemplo n.º 8
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);
        }