public DockContent() { m_dockHandler = new DockContentHandler(this, new GetPersistStringCallback(GetPersistString)); m_dockHandler.DockStateChanged += new EventHandler(DockHandler_DockStateChanged); //Suggested as a fix by bensty regarding form resize this.ParentChanged += new EventHandler(DockContent_ParentChanged); }
private void AddLastToActiveList(IDockContent content) { IDockContent last = LastActiveContent; if (last == content) return; DockContentHandler handler = content.DockHandler; if (IsInActiveList(content)) RemoveFromActiveList(content); handler.PreviousActive = last; handler.NextActive = null; LastActiveContent = content; if (last != null) last.DockHandler.NextActive = LastActiveContent; }
public void GiveUpFocus(IDockContent content) { DockContentHandler handler = content.DockHandler; if (!handler.Form.ContainsFocus) return; if (IsFocusTrackingSuspended) DockPanel.DummyControl.Focus(); if (LastActiveContent == content) { IDockContent prev = handler.PreviousActive; if (prev != null) Activate(prev); else if (ListContent.Count > 0) Activate(ListContent[ListContent.Count - 1]); } else if (LastActiveContent != null) Activate(LastActiveContent); else if (ListContent.Count > 0) Activate(ListContent[ListContent.Count - 1]); }
public void Activate(IDockContent content) { if (IsFocusTrackingSuspended) { ContentActivating = content; return; } if (content == null) return; DockContentHandler handler = content.DockHandler; if (handler.Form.IsDisposed) return; // Should not reach here, but better than throwing an exception if (ContentContains(content, handler.ActiveWindowHandle)) NativeMethods.SetFocus(handler.ActiveWindowHandle); if (!handler.Form.ContainsFocus) { if (!handler.Form.SelectNextControl(handler.Form.ActiveControl, true, true, true, true)) // Since DockContent Form is not selectalbe, use Win32 SetFocus instead NativeMethods.SetFocus(handler.Form.Handle); } }
public DockContent() { m_dockHandler = new DockContentHandler(this, new GetPersistStringCallback(GetPersistString)); m_dockHandler.DockStateChanged += new EventHandler(DockHandler_DockStateChanged); }
internal void SetDockState(bool isHidden, DockState visibleState, DockPane oldPane) { if (!this.IsSuspendSetDockState) { if (this.DockPanel == null && visibleState != DockState.Unknown) { throw new InvalidOperationException(Strings.DockContentHandler_SetDockState_NullPanel); } if (visibleState == DockState.Hidden || (visibleState != DockState.Unknown && !this.IsDockStateValid(visibleState))) { throw new InvalidOperationException(Strings.DockContentHandler_SetDockState_InvalidState); } DockPanel dockPanel = this.DockPanel; if (dockPanel != null) { dockPanel.SuspendLayout(true); } this.SuspendSetDockState(); DockState dockState = this.DockState; if (this.m_isHidden != isHidden || dockState == DockState.Unknown) { this.m_isHidden = isHidden; } this.m_visibleState = visibleState; this.m_dockState = (isHidden ? DockState.Hidden : visibleState); if (visibleState == DockState.Unknown) { this.Pane = null; } else { this.m_isFloat = (this.m_visibleState == DockState.Float); if (this.Pane == null) { this.Pane = this.DockPanel.DockPaneFactory.CreateDockPane(this.Content, visibleState, true); } else { if (this.Pane.DockState != visibleState) { if (this.Pane.Contents.Count == 1) { this.Pane.SetDockState(visibleState); } else { this.Pane = this.DockPanel.DockPaneFactory.CreateDockPane(this.Content, visibleState, true); } } } } if (this.Form.ContainsFocus && (this.DockState == DockState.Hidden || this.DockState == DockState.Unknown)) { this.DockPanel.ContentFocusManager.GiveUpFocus(this.Content); } this.SetPaneAndVisible(this.Pane); if (oldPane != null && !oldPane.IsDisposed && dockState == oldPane.DockState) { DockContentHandler.RefreshDockPane(oldPane); } if (this.Pane != null && this.DockState == this.Pane.DockState) { if ((this.Pane != oldPane || (this.Pane == oldPane && dockState != oldPane.DockState)) && (this.Pane.DockWindow == null || this.Pane.DockWindow.Visible || this.Pane.IsHidden) && !this.Pane.IsAutoHide) { DockContentHandler.RefreshDockPane(this.Pane); } } if (dockState != this.DockState) { if (this.DockState == DockState.Hidden || this.DockState == DockState.Unknown || DockHelper.IsDockStateAutoHide(this.DockState)) { this.DockPanel.ContentFocusManager.RemoveFromList(this.Content); } else { this.DockPanel.ContentFocusManager.AddToList(this.Content); } this.OnDockStateChanged(EventArgs.Empty); } this.ResumeSetDockState(); if (dockPanel != null) { dockPanel.ResumeLayout(true, true); } } }
public DockContent() { this.m_dockHandler = new DockContentHandler(this, new GetPersistStringCallback(this.GetPersistString)); this.m_dockHandler.DockStateChanged += new EventHandler(this.DockHandler_DockStateChanged); base.ParentChanged += new EventHandler(this.DockContent_ParentChanged); }