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); }
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); } } }
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; } }