Ejemplo n.º 1
0
 protected override void OnMouseDown(MouseEventArgs e)
 {
     base.OnMouseDown(e);
     if (e.Button == MouseButtons.Left && DockPane.DockPanel.AllowEndUserDocking && DockPane.AllowDockDragAndDrop && !DockHelper.IsDockStateAutoHide(DockPane.DockState) && DockPane.ActiveContent != null)
     {
         DockPane.DockPanel.BeginDrag(DockPane);
     }
 }
Ejemplo n.º 2
0
        internal void SetDockState(bool isHidden, DockState visibleState, DockPane oldPane)
        {
            if (!IsSuspendSetDockState)
            {
                if (DockPanel == null && visibleState != 0)
                {
                    throw new InvalidOperationException(Strings.DockContentHandler_SetDockState_NullPanel);
                }
                int num;
                switch (visibleState)
                {
                default:
                    num = (IsDockStateValid(visibleState) ? 1 : 0);
                    break;

                case DockState.Unknown:
                    num = 1;
                    break;

                case DockState.Hidden:
                    num = 0;
                    break;
                }
                if (num == 0)
                {
                    throw new InvalidOperationException(Strings.DockContentHandler_SetDockState_InvalidState);
                }
                DockPanel dockPanel = DockPanel;
                dockPanel?.SuspendLayout(allWindows: true);
                SuspendSetDockState();
                DockState dockState = DockState;
                if (m_isHidden != isHidden || dockState == DockState.Unknown)
                {
                    m_isHidden = isHidden;
                }
                m_visibleState = visibleState;
                m_dockState    = (isHidden ? DockState.Hidden : visibleState);
                if (visibleState == DockState.Unknown)
                {
                    Pane = null;
                }
                else
                {
                    m_isFloat = (m_visibleState == DockState.Float);
                    if (Pane == null)
                    {
                        Pane = DockPanel.DockPaneFactory.CreateDockPane(Content, visibleState, show: true);
                    }
                    else if (Pane.DockState != visibleState)
                    {
                        if (Pane.Contents.Count == 1)
                        {
                            Pane.SetDockState(visibleState);
                        }
                        else
                        {
                            Pane = DockPanel.DockPaneFactory.CreateDockPane(Content, visibleState, show: true);
                        }
                    }
                }
                if (Form.ContainsFocus && (DockState == DockState.Hidden || DockState == DockState.Unknown))
                {
                    DockPanel.ContentFocusManager.GiveUpFocus(Content);
                }
                SetPaneAndVisible(Pane);
                if (oldPane != null && !oldPane.IsDisposed && dockState == oldPane.DockState)
                {
                    RefreshDockPane(oldPane);
                }
                if (Pane != null && DockState == Pane.DockState && (Pane != oldPane || (Pane == oldPane && dockState != oldPane.DockState)) && (Pane.DockWindow == null || Pane.DockWindow.Visible || Pane.IsHidden) && !Pane.IsAutoHide)
                {
                    RefreshDockPane(Pane);
                }
                if (dockState != DockState)
                {
                    if (DockState == DockState.Hidden || DockState == DockState.Unknown || DockHelper.IsDockStateAutoHide(DockState))
                    {
                        DockPanel.ContentFocusManager.RemoveFromList(Content);
                    }
                    else
                    {
                        DockPanel.ContentFocusManager.AddToList(Content);
                    }
                    OnDockStateChanged(EventArgs.Empty);
                }
                ResumeSetDockState();
                dockPanel?.ResumeLayout(performLayout: true, allWindows: true);
            }
        }