예제 #1
0
        /// <summary>
        /// Initialize a new instance of the KryptonAutoHiddenSlidePanel class.
        /// </summary>
        /// <param name="control">Reference to control that is being managed.</param>
        /// <param name="edge">Docking edge being managed.</param>
        /// <param name="panel">Reference to auto hidden panel for this edge.</param>
        public KryptonAutoHiddenSlidePanel(Control control, DockingEdge edge, KryptonAutoHiddenPanel panel)
        {
            _control         = control;
            _edge            = edge;
            _panel           = panel;
            _state           = DockingAutoHiddenShowState.Hidden;
            _checkMakeHidden = OnCheckMakeHidden;

            // We need to a timer to automate sliding in and out
            _slideTimer = new Timer
            {
                Interval = SLIDE_INTERVAL
            };
            _slideTimer.Tick += OnSlideTimerTick;

            // Timer used to delay between notification of need to slide inwards and performing actual slide
            _dismissTimer = new Timer
            {
                Interval = DISMISS_INTERVAL
            };
            _dismissTimer.Tick += OnDismissTimerTick;
            _dismissRunning     = false;

            // Create inner panel that holds the actual dockspace and separator
            _dockspaceSlide = new KryptonDockspaceSlide
            {
                Dock           = DockStyle.Fill,
                AutoHiddenHost = true
            };
            _dockspaceSlide.PageCloseClicked      += OnDockspacePageCloseClicked;
            _dockspaceSlide.PageAutoHiddenClicked += OnDockspacePageAutoHiddenClicked;
            _dockspaceSlide.PageDropDownClicked   += OnDockspacePageDropDownClicked;

            SeparatorControl = new KryptonDockspaceSeparator(edge, true);
            SeparatorControl.SplitterMoving   += OnDockspaceSeparatorMoving;
            SeparatorControl.SplitterMoved    += OnDockspaceSeparatorMoved;
            SeparatorControl.SplitterMoveRect += OnDockspaceSeparatorMoveRect;

            _inner = new KryptonPanel();
            _inner.Controls.AddRange(new Control[] { _dockspaceSlide, SeparatorControl });
            Controls.Add(_inner);

            // Do not show ourself until we are needed
            Visible = false;

            // Add a Button that is not showing and used to push focus away from the dockspace
            _dummyTarget = new Button
            {
                Location = new Point(-200, -200),
                Size     = new Size(100, 100)
            };
            Controls.Add(_dummyTarget);

            // Add ourself into the target control for docking
            control.SizeChanged += OnControlSizeChanged;
            control.Controls.Add(this);

            // Need to peek at windows messages so we can determine if mouse is over the slide out panel
            Application.AddMessageFilter(this);
        }
        /// <summary>
        /// Initialize a new instance of the KryptonAutoHiddenSlidePanel class.
        /// </summary>
        /// <param name="control">Reference to control that is being managed.</param>
        /// <param name="edge">Docking edge being managed.</param>
        /// <param name="panel">Reference to auto hidden panel for this edge.</param>
        public KryptonAutoHiddenSlidePanel(Control control, DockingEdge edge, KryptonAutoHiddenPanel panel)
        {
            _control = control;
            _edge = edge;
            _panel = panel;
            _state = DockingAutoHiddenShowState.Hidden;
            _checkMakeHidden = new EventHandler(OnCheckMakeHidden);

            // We need to a timer to automate sliding in and out
            _slideTimer = new Timer();
            _slideTimer.Interval = SLIDE_INTERVAL;
            _slideTimer.Tick += new EventHandler(OnSlideTimerTick);

            // Timer used to delay between notification of need to slide inwards and performing actual slide
            _dismissTimer = new Timer();
            _dismissTimer.Interval = DISMISS_INTERVAL;
            _dismissTimer.Tick += new EventHandler(OnDismissTimerTick);
            _dismissRunning = false;

            // Create inner panel that holds the actual dockspace and separator
            _dockspaceSlide = new KryptonDockspaceSlide();
            _dockspaceSlide.Dock = DockStyle.Fill;
            _dockspaceSlide.AutoHiddenHost = true;
            _dockspaceSlide.PageCloseClicked += new EventHandler<UniqueNameEventArgs>(OnDockspacePageCloseClicked);
            _dockspaceSlide.PageAutoHiddenClicked += new EventHandler<UniqueNameEventArgs>(OnDockspacePageAutoHiddenClicked);
            _dockspaceSlide.PageDropDownClicked += new EventHandler<CancelDropDownEventArgs>(OnDockspacePageDropDownClicked);

            _separator = new KryptonDockspaceSeparator(edge, true);
            _separator.SplitterMoving += new SplitterCancelEventHandler(OnDockspaceSeparatorMoving);
            _separator.SplitterMoved += new SplitterEventHandler(OnDockspaceSeparatorMoved);
            _separator.SplitterMoveRect += new EventHandler<SplitterMoveRectMenuArgs>(OnDockspaceSeparatorMoveRect);

            _inner = new KryptonPanel();
            _inner.Controls.AddRange(new Control[] { _dockspaceSlide, _separator });
            Controls.Add(_inner);

            // Do not show ourself until we are needed
            Visible = false;

            // Add a Button that is not showing and used to push focus away from the dockspace
            _dummyTarget = new Button();
            _dummyTarget.Location = new Point(-200, -200);
            _dummyTarget.Size = new Size(100, 100);
            Controls.Add(_dummyTarget);

            // Add ourself into the target control for docking
            control.SizeChanged += new EventHandler(OnControlSizeChanged);
            control.Controls.Add(this);

            // Need to peek at windows messages so we can determine if mouse is over the slide out panel
            Application.AddMessageFilter(this);
        }
예제 #3
0
        private void MakeSlideIn()
        {
            // Check to see if we allowed to perform operations
            if (!Disposing && !IsDisposed)
            {
                // Switch to sliding inwards by changing state and starting slide timer
                _state = DockingAutoHiddenShowState.SlidingIn;
                AutoHiddenShowingStateEventArgs args = new AutoHiddenShowingStateEventArgs(_page, _state);
                _slideTimer.Start();

                // If the dockspace has the focus we need to push focus elsewhere
                if (DockspaceControl.ContainsFocus)
                {
                    DockspaceControl.CellLosesFocus -= new EventHandler <WorkspaceCellEventArgs>(OnDockspaceCellLosesFocus);
                    _dummyTarget.Select();
                }

                // Raises event to indicate change in auto hidden showing state
                OnAutoHiddenShowingStateChanged(args);
            }
        }
예제 #4
0
        private void MakeHidden()
        {
            // Check to see if we allowed to perform operations
            if (!Disposing && !IsDisposed)
            {
                if (_state != DockingAutoHiddenShowState.Hidden)
                {
                    // Set state so timer processing does not perform any slide action
                    _state = DockingAutoHiddenShowState.Hidden;
                    AutoHiddenShowingStateEventArgs args = new AutoHiddenShowingStateEventArgs(_page, _state);

                    // Remove cached references
                    _page  = null;
                    _group = null;

                    // No need for timers to be running or for our display
                    _slideTimer.Stop();
                    _dismissTimer.Stop();
                    _dismissRunning = false;
                    Visible         = false;

                    // Move to correct z-order position
                    ResetChildIndex();

                    // If the dockspace has the focus we need to push focus elsewhere
                    if (DockspaceControl.ContainsFocus)
                    {
                        DockspaceControl.CellLosesFocus -= new EventHandler <WorkspaceCellEventArgs>(OnDockspaceCellLosesFocus);
                        _dummyTarget.Select();
                    }

                    // Remove all the pages so that the pages have palette redirection reset
                    DockspaceControl.ClearAllPages();

                    // Raises event to indicate change in auto hidden showing state
                    OnAutoHiddenShowingStateChanged(args);
                }
            }
        }
        private void OnSlideTimerTick(object sender, EventArgs e)
        {
            // Check to see if we allowed to perform operations
            if (Disposing || IsDisposed)
            {
                // Make sure the timer is disposed of correctly
                if (_slideTimer != null)
                {
                    _slideTimer.Stop();
                    _slideTimer.Dispose();
                    _slideTimer = null;
                }

                return;
            }

            // Action to take depends on current state
            switch (_state)
            {
                case DockingAutoHiddenShowState.Hidden:
                case DockingAutoHiddenShowState.Showing:
                    // No need for timer as sliding has finished
                    _slideTimer.Stop();
                    break;
                case DockingAutoHiddenShowState.SlidingOut:
                    {
                        bool finished = true;
                        Size newSlideSize = Size;
                        Point newSlideLocation = Location;
                        Point newInnerLocation = _inner.Location;

                        // Find the new size and location when sliding out from the edge
                        switch (_edge)
                        {
                            case DockingEdge.Left:
                                newSlideSize.Width = Math.Min(newSlideSize.Width + SLIDE_DISTANCE, _endRect.Width);
                                newInnerLocation.X = newSlideSize.Width - _inner.Width;
                                finished = (newSlideSize.Width == _endRect.Width);
                                break;
                            case DockingEdge.Right:
                                newSlideSize.Width = Math.Min(newSlideSize.Width + SLIDE_DISTANCE, _endRect.Width);
                                newSlideLocation.X = Math.Max(newSlideLocation.X - SLIDE_DISTANCE, _endRect.X);
                                finished = (newSlideSize.Width == _endRect.Width);
                                break;
                            case DockingEdge.Top:
                                newSlideSize.Height = Math.Min(newSlideSize.Height + SLIDE_DISTANCE, _endRect.Height);
                                newInnerLocation.Y = newSlideSize.Height - _inner.Height;
                                finished = (newSlideSize.Height == _endRect.Height);
                                break;
                            case DockingEdge.Bottom:
                                newSlideSize.Height = Math.Min(newSlideSize.Height + SLIDE_DISTANCE, _endRect.Height);
                                newSlideLocation.Y = Math.Max(newSlideLocation.Y - SLIDE_DISTANCE, _endRect.Y);
                                finished = (newSlideSize.Height == _endRect.Height);
                                break;
                        }

                        // Update position to reflect the change
                        _inner.SetBounds(newInnerLocation.X, newInnerLocation.Y, _endRect.Width, _endRect.Height);
                        SetBounds(newSlideLocation.X, newSlideLocation.Y, newSlideSize.Width, newSlideSize.Height);

                        if (finished)
                        {
                            // When finished we no longer need the timer and enter the showing state
                            _state = DockingAutoHiddenShowState.Showing;
                            AutoHiddenShowingStateEventArgs args = new AutoHiddenShowingStateEventArgs(_page, _state);
                            OnAutoHiddenShowingStateChanged(args);
                            _slideTimer.Stop();
                        }
                    }
                    break;
                case DockingAutoHiddenShowState.SlidingIn:
                    {
                        bool finished = true;
                        Size newSlideSize = Size;
                        Point newSlideLocation = Location;
                        Point newInnerLocation = _inner.Location;

                        // Find the new size and location when sliding inwards to the edge
                        switch (_edge)
                        {
                            case DockingEdge.Left:
                                newSlideSize.Width = Math.Max(newSlideSize.Width - SLIDE_DISTANCE, 0);
                                newInnerLocation.X = newSlideSize.Width - _inner.Width;
                                finished = (newSlideSize.Width == _startRect.Width);
                                break;
                            case DockingEdge.Right:
                                newSlideSize.Width = Math.Max(newSlideSize.Width - SLIDE_DISTANCE, 0);
                                newSlideLocation.X = Math.Min(newSlideLocation.X + SLIDE_DISTANCE, _startRect.X);
                                finished = (newSlideSize.Width == _startRect.Width);
                                break;
                            case DockingEdge.Top:
                                newSlideSize.Height = Math.Max(newSlideSize.Height - SLIDE_DISTANCE, 0);
                                newInnerLocation.Y = newSlideSize.Height - _inner.Height;
                                finished = (newSlideSize.Height == _startRect.Height);
                                break;
                            case DockingEdge.Bottom:
                                newSlideSize.Height = Math.Max(newSlideSize.Height - SLIDE_DISTANCE, 0);
                                newSlideLocation.Y = Math.Min(newSlideLocation.Y + SLIDE_DISTANCE, _startRect.Y);
                                finished = (newSlideSize.Height == _startRect.Height);
                                break;
                        }

                        // Update position to reflect the change
                        _inner.SetBounds(newInnerLocation.X, newInnerLocation.Y, _endRect.Width, _endRect.Height);
                        SetBounds(newSlideLocation.X, newSlideLocation.Y, newSlideSize.Width, newSlideSize.Height);

                        if (finished)
                            MakeHidden();
                    }
                    break;
            }
        }
        private void MakeSlideIn()
        {
            // Check to see if we allowed to perform operations
            if (!Disposing && !IsDisposed)
            {
                // Switch to sliding inwards by changing state and starting slide timer
                _state = DockingAutoHiddenShowState.SlidingIn;
                AutoHiddenShowingStateEventArgs args = new AutoHiddenShowingStateEventArgs(_page, _state);
                _slideTimer.Start();

                // If the dockspace has the focus we need to push focus elsewhere
                if (DockspaceControl.ContainsFocus)
                {
                    DockspaceControl.CellLosesFocus -= new EventHandler<WorkspaceCellEventArgs>(OnDockspaceCellLosesFocus);
                    _dummyTarget.Select();
                }

                // Raises event to indicate change in auto hidden showing state
                OnAutoHiddenShowingStateChanged(args);
            }
        }
        private void MakeHidden()
        {
            // Check to see if we allowed to perform operations
            if (!Disposing && !IsDisposed)
            {
                if (_state != DockingAutoHiddenShowState.Hidden)
                {
                    // Set state so timer processing does not perform any slide action
                    _state = DockingAutoHiddenShowState.Hidden;
                    AutoHiddenShowingStateEventArgs args = new AutoHiddenShowingStateEventArgs(_page, _state);

                    // Remove cached references
                    _page = null;
                    _group = null;

                    // No need for timers to be running or for our display
                    _slideTimer.Stop();
                    _dismissTimer.Stop();
                    _dismissRunning = false;
                    Visible = false;

                    // Move to correct z-order position
                    ResetChildIndex();

                    // If the dockspace has the focus we need to push focus elsewhere
                    if (DockspaceControl.ContainsFocus)
                    {
                        DockspaceControl.CellLosesFocus -= new EventHandler<WorkspaceCellEventArgs>(OnDockspaceCellLosesFocus);
                        _dummyTarget.Select();
                    }

                    // Remove all the pages so that the pages have palette redirection reset
                    DockspaceControl.ClearAllPages();

                    // Raises event to indicate change in auto hidden showing state
                    OnAutoHiddenShowingStateChanged(args);
                }
            }
        }
        /// <summary>
        /// Requests the panel slide into view and display the provided page.
        /// </summary>
        /// <param name="page">Reference to page for display.</param>
        /// <param name="group">Reference to auto hidden group that displays the page.</param>
        /// <param name="select">Should the sliding out page become selected.</param>
        public void SlideOut(KryptonPage page, KryptonAutoHiddenGroup group, bool select)
        {
            // Check to see if we allowed to perform operations
            if (Disposing || IsDisposed)
                return;

            // Move to the hidden state
            switch (_state)
            {
                case DockingAutoHiddenShowState.Hidden:
                    // Nothing to do, already in state we require
                    break;
                case DockingAutoHiddenShowState.SlidingIn:
                    // If already showing indicated page (although currently sliding inwards)
                    if (page == _page)
                    {
                        // Switch to sliding out again
                        _state = DockingAutoHiddenShowState.SlidingOut;

                        // Are we requested to set focus to the sliding in dockspace?
                        if (select)
                        {
                            DockspaceControl.Select();
                            DockspaceControl.CellLosesFocus += new EventHandler<WorkspaceCellEventArgs>(OnDockspaceCellLosesFocus);
                        }
                        return;
                    }
                    else
                    {
                        // Different page, so move straight to hidden state
                        MakeHidden();
                    }
                    break;
                case DockingAutoHiddenShowState.SlidingOut:
                case DockingAutoHiddenShowState.Showing:
                    // If already showing indicated page (or in the process of showing) then do nothing
                    if (page == _page)
                    {
                        // Are we requested to set focus to the sliding in dockspace?
                        if (select)
                        {
                            DockspaceControl.Select();
                            DockspaceControl.CellLosesFocus += new EventHandler<WorkspaceCellEventArgs>(OnDockspaceCellLosesFocus);
                        }
                        return;
                    }
                    else
                    {
                        // Different page, so move straight to hidden state
                        MakeHidden();
                    }
                    break;
            }

            // Cache information about the page being displayed
            _page = page;
            _group = group;

            // Make sure we have a visible cell to update
            KryptonWorkspaceCell cell = DockspaceControl.FirstVisibleCell();
            if (cell == null)
            {
                cell = new KryptonWorkspaceCell();
                DockspaceControl.Root.Children.Add(cell);
            }

            // Replace any existing page with the new one
            DockspaceControl.ClearAllPages();
            cell.Pages.Add(page);
            DockspaceControl.PerformLayout();

            // Find the starting and ending rectangles for the slide operation
            CalculateStartAndEnd();

            // Set initial positions of ourself and the contained inner panel
            _inner.SetBounds(0, 0, _endRect.Width, _endRect.Height);
            SetBounds(_startRect.X, _startRect.Y, _startRect.Width, _startRect.Height);

            // Make sure we are at the top of the z-order and visible
            _control.Controls.SetChildIndex(this, 0);
            Visible = true;

            // Switch to new state and start animation timer
            _state = DockingAutoHiddenShowState.SlidingOut;
            AutoHiddenShowingStateEventArgs args = new AutoHiddenShowingStateEventArgs(_page, _state);
            _slideTimer.Start();

            // Are we requested to set focus to the sliding in dockspace?
            if (select)
            {
                DockspaceControl.Select();
                DockspaceControl.CellLosesFocus += new EventHandler<WorkspaceCellEventArgs>(OnDockspaceCellLosesFocus);
            }

            // Raises event to indicate change in auto hidden showing state
            OnAutoHiddenShowingStateChanged(args);
        }
예제 #9
0
        private void OnSlideTimerTick(object sender, EventArgs e)
        {
            // Check to see if we allowed to perform operations
            if (Disposing || IsDisposed)
            {
                // Make sure the timer is disposed of correctly
                if (_slideTimer != null)
                {
                    _slideTimer.Stop();
                    _slideTimer.Dispose();
                    _slideTimer = null;
                }

                return;
            }

            // Action to take depends on current state
            switch (_state)
            {
            case DockingAutoHiddenShowState.Hidden:
            case DockingAutoHiddenShowState.Showing:
                // No need for timer as sliding has finished
                _slideTimer.Stop();
                break;

            case DockingAutoHiddenShowState.SlidingOut:
            {
                bool  finished         = true;
                Size  newSlideSize     = Size;
                Point newSlideLocation = Location;
                Point newInnerLocation = _inner.Location;

                // Find the new size and location when sliding out from the edge
                switch (_edge)
                {
                case DockingEdge.Left:
                    newSlideSize.Width = Math.Min(newSlideSize.Width + SLIDE_DISTANCE, _endRect.Width);
                    newInnerLocation.X = newSlideSize.Width - _inner.Width;
                    finished           = (newSlideSize.Width == _endRect.Width);
                    break;

                case DockingEdge.Right:
                    newSlideSize.Width = Math.Min(newSlideSize.Width + SLIDE_DISTANCE, _endRect.Width);
                    newSlideLocation.X = Math.Max(newSlideLocation.X - SLIDE_DISTANCE, _endRect.X);
                    finished           = (newSlideSize.Width == _endRect.Width);
                    break;

                case DockingEdge.Top:
                    newSlideSize.Height = Math.Min(newSlideSize.Height + SLIDE_DISTANCE, _endRect.Height);
                    newInnerLocation.Y  = newSlideSize.Height - _inner.Height;
                    finished            = (newSlideSize.Height == _endRect.Height);
                    break;

                case DockingEdge.Bottom:
                    newSlideSize.Height = Math.Min(newSlideSize.Height + SLIDE_DISTANCE, _endRect.Height);
                    newSlideLocation.Y  = Math.Max(newSlideLocation.Y - SLIDE_DISTANCE, _endRect.Y);
                    finished            = (newSlideSize.Height == _endRect.Height);
                    break;
                }

                // Update position to reflect the change
                _inner.SetBounds(newInnerLocation.X, newInnerLocation.Y, _endRect.Width, _endRect.Height);
                SetBounds(newSlideLocation.X, newSlideLocation.Y, newSlideSize.Width, newSlideSize.Height);

                if (finished)
                {
                    // When finished we no longer need the timer and enter the showing state
                    _state = DockingAutoHiddenShowState.Showing;
                    AutoHiddenShowingStateEventArgs args = new AutoHiddenShowingStateEventArgs(_page, _state);
                    OnAutoHiddenShowingStateChanged(args);
                    _slideTimer.Stop();
                }
            }
            break;

            case DockingAutoHiddenShowState.SlidingIn:
            {
                bool  finished         = true;
                Size  newSlideSize     = Size;
                Point newSlideLocation = Location;
                Point newInnerLocation = _inner.Location;

                // Find the new size and location when sliding inwards to the edge
                switch (_edge)
                {
                case DockingEdge.Left:
                    newSlideSize.Width = Math.Max(newSlideSize.Width - SLIDE_DISTANCE, 0);
                    newInnerLocation.X = newSlideSize.Width - _inner.Width;
                    finished           = (newSlideSize.Width == _startRect.Width);
                    break;

                case DockingEdge.Right:
                    newSlideSize.Width = Math.Max(newSlideSize.Width - SLIDE_DISTANCE, 0);
                    newSlideLocation.X = Math.Min(newSlideLocation.X + SLIDE_DISTANCE, _startRect.X);
                    finished           = (newSlideSize.Width == _startRect.Width);
                    break;

                case DockingEdge.Top:
                    newSlideSize.Height = Math.Max(newSlideSize.Height - SLIDE_DISTANCE, 0);
                    newInnerLocation.Y  = newSlideSize.Height - _inner.Height;
                    finished            = (newSlideSize.Height == _startRect.Height);
                    break;

                case DockingEdge.Bottom:
                    newSlideSize.Height = Math.Max(newSlideSize.Height - SLIDE_DISTANCE, 0);
                    newSlideLocation.Y  = Math.Min(newSlideLocation.Y + SLIDE_DISTANCE, _startRect.Y);
                    finished            = (newSlideSize.Height == _startRect.Height);
                    break;
                }

                // Update position to reflect the change
                _inner.SetBounds(newInnerLocation.X, newInnerLocation.Y, _endRect.Width, _endRect.Height);
                SetBounds(newSlideLocation.X, newSlideLocation.Y, newSlideSize.Width, newSlideSize.Height);

                if (finished)
                {
                    MakeHidden();
                }
            }
            break;
            }
        }
예제 #10
0
        /// <summary>
        /// Requests the panel slide into view and display the provided page.
        /// </summary>
        /// <param name="page">Reference to page for display.</param>
        /// <param name="group">Reference to auto hidden group that displays the page.</param>
        /// <param name="select">Should the sliding out page become selected.</param>
        public void SlideOut(KryptonPage page, KryptonAutoHiddenGroup group, bool select)
        {
            // Check to see if we allowed to perform operations
            if (Disposing || IsDisposed)
            {
                return;
            }

            // Move to the hidden state
            switch (_state)
            {
            case DockingAutoHiddenShowState.Hidden:
                // Nothing to do, already in state we require
                break;

            case DockingAutoHiddenShowState.SlidingIn:
                // If already showing indicated page (although currently sliding inwards)
                if (page == _page)
                {
                    // Switch to sliding out again
                    _state = DockingAutoHiddenShowState.SlidingOut;

                    // Are we requested to set focus to the sliding in dockspace?
                    if (select)
                    {
                        DockspaceControl.Select();
                        DockspaceControl.CellLosesFocus += new EventHandler <WorkspaceCellEventArgs>(OnDockspaceCellLosesFocus);
                    }
                    return;
                }
                else
                {
                    // Different page, so move straight to hidden state
                    MakeHidden();
                }
                break;

            case DockingAutoHiddenShowState.SlidingOut:
            case DockingAutoHiddenShowState.Showing:
                // If already showing indicated page (or in the process of showing) then do nothing
                if (page == _page)
                {
                    // Are we requested to set focus to the sliding in dockspace?
                    if (select)
                    {
                        DockspaceControl.Select();
                        DockspaceControl.CellLosesFocus += new EventHandler <WorkspaceCellEventArgs>(OnDockspaceCellLosesFocus);
                    }
                    return;
                }
                else
                {
                    // Different page, so move straight to hidden state
                    MakeHidden();
                }
                break;
            }

            // Cache information about the page being displayed
            _page  = page;
            _group = group;

            // Make sure we have a visible cell to update
            KryptonWorkspaceCell cell = DockspaceControl.FirstVisibleCell();

            if (cell == null)
            {
                cell = new KryptonWorkspaceCell();
                DockspaceControl.Root.Children.Add(cell);
            }

            // Replace any existing page with the new one
            DockspaceControl.ClearAllPages();
            cell.Pages.Add(page);
            DockspaceControl.PerformLayout();

            // Find the starting and ending rectangles for the slide operation
            CalculateStartAndEnd();

            // Set initial positions of ourself and the contained inner panel
            _inner.SetBounds(0, 0, _endRect.Width, _endRect.Height);
            SetBounds(_startRect.X, _startRect.Y, _startRect.Width, _startRect.Height);

            // Make sure we are at the top of the z-order and visible
            _control.Controls.SetChildIndex(this, 0);
            Visible = true;

            // Switch to new state and start animation timer
            _state = DockingAutoHiddenShowState.SlidingOut;
            AutoHiddenShowingStateEventArgs args = new AutoHiddenShowingStateEventArgs(_page, _state);

            _slideTimer.Start();

            // Are we requested to set focus to the sliding in dockspace?
            if (select)
            {
                DockspaceControl.Select();
                DockspaceControl.CellLosesFocus += new EventHandler <WorkspaceCellEventArgs>(OnDockspaceCellLosesFocus);
            }

            // Raises event to indicate change in auto hidden showing state
            OnAutoHiddenShowingStateChanged(args);
        }
 /// <summary>
 /// Initialize a new instance of the AutoHiddenShowingStateEventArgs class.
 /// </summary>
 /// <param name="page">Page for which state has changed.</param>
 /// <param name="state">New state of the auto hidden page.</param>
 public AutoHiddenShowingStateEventArgs(KryptonPage page, DockingAutoHiddenShowState state)
 {
     Page     = page;
     NewState = state;
 }
 /// <summary>
 /// Initialize a new instance of the AutoHiddenShowingStateEventArgs class.
 /// </summary>
 /// <param name="page">Page for which state has changed.</param>
 /// <param name="state">New state of the auto hidden page.</param>
 public AutoHiddenShowingStateEventArgs(KryptonPage page, DockingAutoHiddenShowState state)
 {
     _page = page;
     _state = state;
 }