/// <summary> /// Split two forms in vertically splitted view /// </summary> /// <param name="topFormTabbedView">view to dock top</param> /// <param name="bottomFormTabbedView">view to dock bottom</param> /// <param name="parentContainer">parent container which will host the two forms</param> private static void SplitVertically(FormsTabbedView topFormTabbedView, FormsTabbedView bottomFormTabbedView, DockableContainer parentContainer) { DockableContainer newBottomFormContainer = new DockableContainer(); DockableContainer newTopFormContainer = new DockableContainer(); parentContainer.SetModeVSplit(newTopFormContainer, newBottomFormContainer); newBottomFormContainer.SetModeSingleChild(bottomFormTabbedView); newTopFormContainer.SetModeSingleChild(topFormTabbedView); }
/// <summary> /// Split two forms in horizontal splitted view /// </summary> /// <param name="leftFormTabbedView">view to dock left</param> /// <param name="rightFormTabbedView">view to dock right</param> /// <param name="parentContainer">parent container which will host the two forms</param> private static void SplitHorizontally(FormsTabbedView leftFormTabbedView, FormsTabbedView rightFormTabbedView, DockableContainer parentContainer) { DockableContainer newRightFormContainer = new DockableContainer(); DockableContainer newLeftFormContainer = new DockableContainer(); parentContainer.SetModeHSplit(newLeftFormContainer, newRightFormContainer); newRightFormContainer.SetModeSingleChild(rightFormTabbedView); newLeftFormContainer.SetModeSingleChild(leftFormTabbedView); }
/// <summary> /// Auto-show the given view /// </summary> /// <param name="view">view to show</param> public void UnsetAutoHideMode(FormsTabbedView view) { AutoHidePanel panel = (AutoHidePanel)view.Parent; DockableContainer container = panel.RestoreParent; DockStyle logicalDock = DockStyle.None; if (LeftAutohideButtons.Remove(panel)) { logicalDock = DockStyle.Left; } else if (RightAutohideButtons.Remove(panel)) { logicalDock = DockStyle.Right; } else if (TopAutohideButtons.Remove(panel)) { logicalDock = DockStyle.Top; } else if (BottomAutohideButtons.Remove(panel)) { logicalDock = DockStyle.Bottom; } else { Debug.Fail("Panel not found"); } _host.Remove(panel); container.SetModeSingleChild(view); OnSetHostContainerDock(view, logicalDock); view.IsAutoHideMode = false; view.PagesPanel.AutoHidden = false; ShowRestoreContainers(panel); ArrangeAutoButtonsPanels(); _autoShowPanel = null; }
/// <summary> /// Create floating container for the view /// </summary> /// <param name="view">view for which to create floating container</param> /// <param name="bounds">bounds of the floating container</param> /// <returns>floating container</returns> public DockableContainer CreateFloatingContainer(FormsTabbedView view, Rectangle bounds) { DockableContainer container = new DockableContainer(); _host.AddFirst(container); container.Bounds = bounds; container.SetModeSingleChild(view); if (EnumUtility.Contains(view.AllowedDock, zAllowedDock.None)) { SetViewDock(view, DockStyle.None, DockStyle.None, zDockMode.None); } else if (EnumUtility.Contains(view.AllowedDock, zAllowedDock.Left)) { DockControl(container, null, DockStyle.Left, zDockMode.Outer); } else if (EnumUtility.Contains(view.AllowedDock, zAllowedDock.Right)) { DockControl(container, null, DockStyle.Right, zDockMode.Outer); } else if (EnumUtility.Contains(view.AllowedDock, zAllowedDock.Top)) { DockControl(container, null, DockStyle.Top, zDockMode.Outer); } else if (EnumUtility.Contains(view.AllowedDock, zAllowedDock.Bottom)) { DockControl(container, null, DockStyle.Bottom, zDockMode.Outer); } else if (EnumUtility.Contains(view.AllowedDock, zAllowedDock.Fill)) { DockControl(container, null, DockStyle.Fill, zDockMode.Inner); } else { _host.Remove(container); throw new NotSupportedException("Err"); // invalid allowed dock } return(container); }
/// <summary> /// Split two forms in vertically splitted view /// </summary> /// <param name="topFormTabbedView">view to dock top</param> /// <param name="bottomFormTabbedView">view to dock bottom</param> /// <param name="parentContainer">parent container which will host the two forms</param> private static void SplitVertically(FormsTabbedView topFormTabbedView, FormsTabbedView bottomFormTabbedView, DockableContainer parentContainer) { DockableContainer newBottomFormContainer = new DockableContainer(); DockableContainer newTopFormContainer = new DockableContainer(); parentContainer.SetModeVSplit(newTopFormContainer, newBottomFormContainer); newBottomFormContainer.SetModeSingleChild(bottomFormTabbedView); newTopFormContainer.SetModeSingleChild (topFormTabbedView); }
/// <summary> /// Split two forms in horizontal splitted view /// </summary> /// <param name="leftFormTabbedView">view to dock left</param> /// <param name="rightFormTabbedView">view to dock right</param> /// <param name="parentContainer">parent container which will host the two forms</param> private static void SplitHorizontally(FormsTabbedView leftFormTabbedView, FormsTabbedView rightFormTabbedView, DockableContainer parentContainer) { DockableContainer newRightFormContainer = new DockableContainer(); DockableContainer newLeftFormContainer = new DockableContainer(); parentContainer.SetModeHSplit(newLeftFormContainer, newRightFormContainer); newRightFormContainer.SetModeSingleChild(rightFormTabbedView); newLeftFormContainer.SetModeSingleChild (leftFormTabbedView); }
/// <summary> /// Create floating container for the view /// </summary> /// <param name="view">view for which to create floating container</param> /// <param name="bounds">bounds of the floating container</param> /// <returns>floating container</returns> public DockableContainer CreateFloatingContainer(FormsTabbedView view, Rectangle bounds) { DockableContainer container = new DockableContainer(); _host.AddFirst(container); container.Bounds = bounds; container.SetModeSingleChild(view); if (EnumUtility.Contains(view.AllowedDock, zAllowedDock.None)) { SetViewDock(view, DockStyle.None, DockStyle.None, zDockMode.None); } else if (EnumUtility.Contains(view.AllowedDock, zAllowedDock.Left)) { DockControl(container, null, DockStyle.Left, zDockMode.Outer); } else if (EnumUtility.Contains(view.AllowedDock, zAllowedDock.Right)) { DockControl(container, null, DockStyle.Right, zDockMode.Outer); } else if (EnumUtility.Contains(view.AllowedDock, zAllowedDock.Top)) { DockControl(container, null, DockStyle.Top, zDockMode.Outer); } else if (EnumUtility.Contains(view.AllowedDock, zAllowedDock.Bottom)) { DockControl(container, null, DockStyle.Bottom, zDockMode.Outer); } else if (EnumUtility.Contains(view.AllowedDock, zAllowedDock.Fill)) { DockControl(container, null, DockStyle.Fill, zDockMode.Inner); } else { _host.Remove(container); throw new NotSupportedException("Err"); // invalid allowed dock } return container; }
/// <summary> /// Remove the container /// </summary> /// <param name="container">container to remove</param> private void RemoveContainer(DockableContainer container) { Debug.Assert(container.Parent != null, "Docked container must be hosted somewere"); container.SetModeEmpty(); DockableContainer containerParent = container.Parent as DockableContainer; if (containerParent == null) { Debug.Assert(container.Parent.Handle == _host.Handle, "Parents of FormsTabbedView should be only DockableContainer or _host"); } else { DockableContainer otherContainer = containerParent.OtherPane(container); Debug.Assert(otherContainer != null, "Container in container means that parent container has contained two containers and a splitter"); FormsTabbedView otherView = otherContainer.SingleChild; FormsTabbedView linkedView = otherContainer.LinkedView; if (otherView == null && linkedView == null) { if (otherContainer.LeftPane != null) { DockableContainer leftPane = otherContainer.LeftPane; DockableContainer rightPane = otherContainer.RightPane; otherContainer.SetModeEmpty(); containerParent.SetModeHSplit(leftPane, rightPane); } else if (otherContainer.TopPane != null) { DockableContainer topPane = otherContainer.TopPane; DockableContainer bottomPane = otherContainer.BottomPane; otherContainer.SetModeEmpty(); containerParent.SetModeVSplit(topPane, bottomPane); } } else { Debug.Assert((otherView == null || linkedView == null), "Other container must have a view"); otherContainer.SetModeEmpty(); if (otherView != null) { containerParent.SetModeSingleChild(otherView); } else { containerParent.SetModeLinked(linkedView); AutoHidePanel linkedPanel = (AutoHidePanel)linkedView.Parent; linkedPanel.RestoreParent = containerParent; Autohide.HideRestoreContainers(linkedPanel); } // If floating container inside host if (containerParent.Parent.Handle == _host.Handle && containerParent.Dock == DockStyle.None) { Debug.Assert(linkedView == null, "Can't have linked view in floating container"); SetViewDock(otherView, DockStyle.None, DockStyle.None, zDockMode.None); } } otherContainer.Parent = null; otherContainer.Splitter.Parent = null; otherContainer.Dispose(); } container.Parent = null; container.Splitter.Parent = null; container.Dispose(); }