public AutoHidePanel(DockingManager manager, DockStyle dockEdge) { // Define initial state _number = _num++; _defaultColor = true; _dismissRunning = false; _slideRunning = false; _ignoreDismiss = false; _killing = false; _manager = manager; _currentWCT = null; _currentPanel = null; _slideRect = new Rectangle(); _rememberRect = new Rectangle(); // Get the minimum vector length used for sizing int vector = TabStub.TabStubVector(this.Font); // Use for both directions, the appropriate one will be ignored because of docking style this.Size = new Size(vector, vector); // Dock ourself against requested position this.Dock = dockEdge; // We should be hidden until some Contents are added this.Hide(); // We want to perform special action when container is resized _manager.Container.Resize += new EventHandler(OnContainerResized); // Add ourself to the application filtering list Application.AddMessageFilter(this); // Configuration timer objects CreateTimers(); }
protected void OnPageOver(TabStub sender, int pageIndex) { try { // Remove any showing auto hide windows except our own _manager.RemoveShowingAutoHideWindowsExcept(this); // No need for running timer, this action supercedes it StopDismissTimer(); // Hovering over a different TabStub? if (_currentWCT != sender.WindowContentTabbed) { // Remove any currently displayed Panel/WCT if (_currentWCT != null) RemoveDisplayedWindow(); } else { // Different tab in the same TabStub? if (pageIndex != _currentWCT.TabControl.SelectedIndex) { // Remove any currently displayed Panel/WCT if (_currentWCT != null) RemoveDisplayedWindow(); } else { // Hover over the current window, so do nothing return; } } Edge borderEdge = Edge.None; // Define which edge of the host panel shown have a border drawn switch(this.Dock) { case DockStyle.Left: borderEdge = Edge.Right; break; case DockStyle.Right: borderEdge = Edge.Left; break; case DockStyle.Top: borderEdge = Edge.Bottom; break; case DockStyle.Bottom: borderEdge = Edge.Top; break; } // Create a Panel that will host the actual WindowContentTabbed control, // the Panel is resized to slide into/from view. The WCT is a fixed size // within the Panel and so only the partial view of the WCT is shown and // at any point in time. Cannot resize the WCT into view as it would keep // repainting the caption details and effect and docking items inside it. _currentPanel = new AutoHostPanel(_manager, this, borderEdge); // Do not show it until we have resizing it as needed _currentPanel.Hide(); // Get access to the WindowContentTabbed that is to be hosted _currentWCT = sender.WindowContentTabbed; // Select the correct page for view in the WCT _currentWCT.TabControl.SelectedIndex = pageIndex; // Place the WCT inside the host Panel _currentPanel.Controls.Add(_currentWCT); // Now add the Panel to the container display _manager.Container.Controls.Add(_currentPanel); // Make it top of the Z-Order _manager.Container.Controls.SetChildIndex(_currentPanel, 0); // Define the remember and slide rectangle values DefineRectangles(); // Set the modified WCT size _currentWCT.Width = _slideRect.Width; _currentWCT.Height = _slideRect.Height; Size barSize = _currentPanel.ResizeBarSize(); // Set the initial size/location of Panel and hosted WCT switch(this.Dock) { case DockStyle.Left: _currentPanel.Size = new Size(0, this.Height); _currentPanel.Location = new Point(this.Right, this.Top); _currentWCT.Height = this.Height; break; case DockStyle.Right: _currentPanel.Size = new Size(0, this.Height); _currentPanel.Location = new Point(this.Left, this.Top); _currentWCT.Height = this.Height; break; case DockStyle.Top: _currentPanel.Size = new Size(this.Width, 0); _currentPanel.Location = new Point(this.Left, this.Bottom); _currentWCT.Width = this.Width; break; case DockStyle.Bottom: _currentPanel.Size = new Size(this.Width, 0); _currentPanel.Location = new Point(this.Left, this.Top); _currentWCT.Width = this.Width; break; } // Finally we are ready to show it _currentPanel.Show(); // We want to snoop of changes of focus to and from Panel and its children MonitorPanel(true); // We are showing and not hiding with the timer _slideOut = true; // Kick off the slide timer StartSlideTimer(); } catch(System.Exception ex) { MessageBox.Show(ex.Message); } }
protected void RemoveDisplayedWindow() { // Remove snooping of changes to focus MonitorPanel(false); if (_currentPanel != null) { // Remove the child WindowContentTabbed ControlHelper.Remove(_currentPanel.Controls, _currentWCT); // Remove Panel from managed container ControlHelper.Remove(_manager.Container.Controls, _currentPanel); } if (_currentWCT != null) { // Restore the original sizes _currentWCT.Width = _rememberRect.Width; _currentWCT.Height = _rememberRect.Height; } if (_currentPanel != null) { // Destroy the panel _currentPanel.Dispose(); _currentPanel = null; } }