/// <summary> /// Get the bounds (in screen coordinates) of the splitter attached to /// the panel identified by the dockMode /// </summary> /// <remarks> /// throws a NotSupportedException if the panel is not found using the dockMode criteria /// </remarks> /// <param name="dockMode">dock mode of the panel for which bounds are requested. /// Valid values are Left, Right, Top, Bottom.</param> /// <returns>bounds of the splitter</returns> public Rectangle GetPanelSplitterBounds(zDockMode dockMode) { SideDockPanel panel = GetPanel(dockMode) as SideDockPanel; if (panel == null) { throw new NotSupportedException(); } return(panel.SplitterBounds); }
/// <summary> /// Set auto-hide flag for the panel with given dock mode /// </summary> /// <param name="dockMode">dock mode to identify the panel to change. /// Allowed values are Left, Right, Top, Bottom. Other values will be ignored.</param> /// <param name="autoHidden">new auto-hide value</param> public void SetAutoHide(zDockMode dockMode, bool autoHide) { SideDockPanel sideDock = GetPanel(dockMode) as SideDockPanel; if (sideDock == null) { return; } sideDock.AutoHide = autoHide; }
/// <summary> /// Checks if the panel with given dock mode has the AutoHide flag set. /// </summary> /// <param name="dockMode">dock mode to identify the panel to check. /// Allowed values are Left, Right, Top, Bottom. Other values will be ignored and false will be returned.</param> /// <returns>the value of auto-hide flag for identified panel or false if no valid panel was specified.</returns> public bool IsAutoHide(zDockMode dockMode) { SideDockPanel sideDock = GetPanel(dockMode) as SideDockPanel; if (sideDock == null) { return(false); } return(sideDock.AutoHide); }
/// <summary> /// Checks if the given tool window is docked in a side panel which is hidden. /// </summary> /// <param name="toolWindow">tool window to be checked</param> /// <returns>setat daca toolWindow nu e in nici un panou sau daca e intr-un panou vizibil</returns> public bool IsVisible(DockableToolWindow toolWindow) { SideDockPanel panel = GetPanel(toolWindow.DockMode) as SideDockPanel; if (panel != null) { return(panel.AutoHidden == false); } return(toolWindow.Visible); }
/// <summary> /// Set auto-hidden flag for the panel with given dock mode /// </summary> /// <param name="dockMode">dock mode to identify the panel to change. /// Allowed values are Left, Right, Top, Bottom. Other values will be ignored.</param> /// <param name="autoHidden">new auto-hidden value</param> public void SetAutoHidden(zDockMode dockMode, bool autoHidden) { SideDockPanel sidePanel = GetPanel(dockMode) as SideDockPanel; if (sidePanel == null) { return; } if (sidePanel.AutoHide == false) { return; } sidePanel.AutoHidden = autoHidden; UpdatePanelsLayout(); }
/// <summary> /// Dispose /// </summary> public void Dispose() { if (_disposed) { return; } _leftPanel.UpdateLayoutRequested -= OnUpdateLayoutRequested; _rightPanel.UpdateLayoutRequested -= OnUpdateLayoutRequested; _topPanel.UpdateLayoutRequested -= OnUpdateLayoutRequested; _bottomPanel.UpdateLayoutRequested -= OnUpdateLayoutRequested; _centerPanel.UpdateLayoutRequested -= OnUpdateLayoutRequested; _leftPanel = null; _rightPanel = null; _topPanel = null; _bottomPanel = null; _centerPanel = null; _disposed = true; GC.SuppressFinalize(this); }
/// <summary> /// Constructor. /// </summary> public DockPanelsLayout() { _leftPanel = new SideDockPanel(zDockMode.Left, FormBorderStyle.FixedToolWindow); _rightPanel = new SideDockPanel(zDockMode.Right, FormBorderStyle.FixedToolWindow); _topPanel = new SideDockPanel(zDockMode.Top, FormBorderStyle.FixedToolWindow); _bottomPanel = new SideDockPanel(zDockMode.Bottom, FormBorderStyle.FixedToolWindow); _centerPanel = new DockPanel(zDockMode.Fill, FormBorderStyle.None); _leftPanel.UpdateLayoutRequested += OnUpdateLayoutRequested; _rightPanel.UpdateLayoutRequested += OnUpdateLayoutRequested; _topPanel.UpdateLayoutRequested += OnUpdateLayoutRequested; _bottomPanel.UpdateLayoutRequested += OnUpdateLayoutRequested; _centerPanel.UpdateLayoutRequested += OnUpdateLayoutRequested; _dockPanels = new DockPanel[] { _leftPanel, _topPanel, _rightPanel, _bottomPanel, _centerPanel }; }
/// <summary> /// Update the panel layout /// </summary> /// <param name="buttonsBounds">bounds of the buttons panel</param> /// <param name="contentBounds">bounds of the content panel</param> /// <param name="splitterBounds">bounds of the splitter attached to the panel</param> /// <param name="panel">panel to be updated</param> /// <returns>true if there were layout changes updated by this call</returns> private bool UpdatePanelLayout(Rectangle buttonsBounds, Rectangle contentBounds, Rectangle splitterBounds, SideDockPanel panel) { bool changed = UpdatePanelLayout(buttonsBounds, contentBounds, panel); changed |= panel.SplitterBounds != splitterBounds; if (changed) { panel.SplitterBounds = splitterBounds; } return(changed); }