/// <summary>
        /// Dock the tool window to the specified panel.
        /// </summary>
        /// <param name="toolWindow">tool window to be docked</param>
        /// <param name="dockMode">dock mode can be Left, Right, Top, Bottom and Fill</param>
        public void DockToolWindow(DockableToolWindow toolWindow, zDockMode dockMode)
        {
            DockPanel panel = GetPanel(dockMode);

            if (panel != null)
            {
                panel.DockToolWindow(toolWindow);
            }
        }
        /// <summary>
        /// Undock the specified tool window
        /// </summary>
        /// <param name="toolWindow">tool window to be undocked</param>
        public void UndockToolWindow(DockableToolWindow toolWindow)
        {
            DockPanel panel = GetPanel(toolWindow.DockMode);

            if (panel != null)
            {
                panel.UndockToolWindow(toolWindow);
            }
        }
        /// <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);
        }
Exemple #4
0
        /// <summary>
        /// Event handler for tool window visible changed
        /// </summary>
        /// <param name="sender">sender</param>
        /// <param name="e">e</param>
        private void OnToolWindowVisibleChanged(object sender, EventArgs e)
        {
            DockableToolWindow toolWindow = sender as DockableToolWindow;

            if (toolWindow != null)
            {
                SyncVisibleForms(toolWindow);
            }

            RaiseUpdateLayout();
        }
Exemple #5
0
        /// <summary>
        /// Event handler on tool window auto hide changed
        /// </summary>
        /// <param name="sender">sender</param>
        /// <param name="e">e</param>
        private void OnToolWindowAutoHideChanged(object sender, EventArgs e)
        {
            DockableToolWindow toolWindow = sender as DockableToolWindow;

            if (toolWindow == null)
            {
                return;
            }

            if (Contains(toolWindow) == false)
            {
                return;
            }

            ToggleAutoHideMode();
        }
Exemple #6
0
 /// <summary>
 /// Sync visible forms
 /// </summary>
 /// <param name="toolWindow">tool window</param>
 private void SyncVisibleForms(DockableToolWindow toolWindow)
 {
     if (_toolWindows.Contains(toolWindow))
     {
         if (toolWindow.Visible)
         {
             if (_visibleToolWindows.Contains(toolWindow) == false)
             {
                 _visibleToolWindows.Add(toolWindow);
             }
         }
         else
         {
             _visibleToolWindows.Remove(toolWindow);
         }
     }
 }
        /// <summary>
        /// Gets the top most tool window from the panel identified by given dock mode
        /// </summary>
        /// <param name="dockMode">dock mode of the panel for which bounds are requested.
        /// Valid values are Left, Right, Top, Bottom and Fill.</param>
        /// <returns>the tool window which is in the top of z-order on the panel identified by dock mode</returns>
        public DockableToolWindow GetTopMostToolWindow(zDockMode dockMode)
        {
            DockableToolWindow topMost = null; // Is the window with smallest index in the container collection

            int smallestIndex = Int32.MaxValue;

            DockableToolWindow[] toolWindows = GetPanelVisibleToolWindows(dockMode);
            foreach (DockableToolWindow toolWindow in toolWindows)
            {
                int zOrderIndex = _container.Controls.GetChildIndex(toolWindow);
                if (zOrderIndex < smallestIndex)
                {
                    topMost       = toolWindow;
                    smallestIndex = zOrderIndex;
                }
            }

            return(topMost);
        }
Exemple #8
0
        /// <summary>
        /// Undock the specified tool window removing it from the windows collection, disconnecting the events
        /// and restoring the size before dock. The dock panels layout is updated after undock
        /// </summary>
        /// <param name="toolWindow">tool window</param>
        /// <returns>true is the tool-window was in the tool windows collection</returns>
        public void UndockToolWindow(DockableToolWindow toolWindow)
        {
            int index = _toolWindows.IndexOf(toolWindow);

            if (index < 0)
            {
                return;
            }

            Size restoreSize = toolWindow.GetRestoreSize(Control.MousePosition);

            _toolWindows.Remove(toolWindow);
            _visibleToolWindows.Remove(toolWindow);

            DisconnectToolWindow(toolWindow);

            toolWindow.LockFormSizeAndUndock(restoreSize);

            RaiseUpdateLayout();
        }
Exemple #9
0
        /// <summary>
        /// Dock the given tool window
        /// </summary>
        /// <param name="toolWindow">tool window to be docked</param>
        public void DockToolWindow(DockableToolWindow toolWindow)
        {
            if (toolWindow.IsDocked)
            {
                return;
            }

            _toolWindows.Add(toolWindow);

            if (toolWindow.Visible && _visibleToolWindows.Contains(toolWindow) == false)
            {
                _visibleToolWindows.Add(toolWindow);
            }

            toolWindow.LockFormSizeAndDock(ContentBounds, _toolWindowsBorderStyle, _dockMode);

            ConnectToolWindow(toolWindow);

            RaiseUpdateLayout();
        }
Exemple #10
0
 /// <summary>
 /// Disconnect tool window events
 /// </summary>
 /// <param name="toolWindow">tool window</param>
 private void DisconnectToolWindow(DockableToolWindow toolWindow)
 {
     toolWindow.AutoHideButtonClick      -= OnToolWindowAutoHideChanged;
     toolWindow.ContextMenuForToolWindow -= OnToolWindowContextMenu;
     toolWindow.VisibleChanged           -= OnToolWindowVisibleChanged;
 }
Exemple #11
0
 /// <summary>
 /// Check if the tool window is contained in the panel
 /// </summary>
 /// <param name="toolWindow">tool window to be checked</param>
 /// <returns>true if the tool window is contained in the panel</returns>
 public bool Contains(DockableToolWindow toolWindow)
 {
     return(_toolWindows.Contains(toolWindow));
 }
Exemple #12
0
 /// <summary>
 /// Create a new instance of <see cref="ContextMenuEventArg"/>
 /// </summary>
 /// <param name="selection">selected tool window</param>
 /// <param name="mouseLocation">mouse location in screen coordinates, when context menu is requested.</param>
 /// <param name="mouseButtons">mouse buttons pressed when context menu is requested.</param>
 public ContextMenuEventArg(DockableToolWindow selection, Point mouseLocation, MouseButtons mouseButtons)
 {
     _selection     = selection;
     _mouseLocation = mouseLocation;
     _mouseButtons  = mouseButtons;
 }
Exemple #13
0
 /// <summary>
 /// Create a new instance of <see cref="ContextMenuEventArg"/>
 /// </summary>
 /// <param name="selection">selected tool window</param>
 public ToolSelectionChangedEventArgs(DockableToolWindow selection)
 {
     _selection = selection;
 }