private void RemoveDocument(int index, DockWindow document) { if (index == -1) { index = this.documents.IndexOf(document); } if (index < 0 || index > this.documents.Count - 1) { return; } this.DeactivatePreviousActive(null); this.documents.RemoveAt(index); this.documentsSorted.Remove(document); if (this.docCloseActivation == DocumentCloseActivation.FirstInZOrder && this.documents.Count > 0) { this.dockManager.ActiveWindow = this.documents[0]; } DockWindow activeDoc = this.ActiveDocument; if (activeDoc != null) { activeDoc.UpdateActiveState(true); } }
private void ActivateDocument(bool next) { int docCount = this.documents.Count; //do nothing if we have one or less documents if (docCount <= 1) { return; } DockWindow currActive = this.documents[0]; if (next) { //send the first document to back of the list DockWindow firstDocument = this.documents[0]; this.documents.RemoveAt(0); this.documents.Add(firstDocument); } else { //bring the last document in front of the list DockWindow lastDocument = this.documents[docCount - 1]; this.documents.RemoveAt(docCount - 1); this.documents.Insert(0, lastDocument); } currActive.UpdateActiveState(false); //activate the document in front of the z-order this.dockManager.ActiveWindow = this.documents[0]; }
/// <summary> /// The manager receives notification from its owning RadDock instance for a change in the currently active window. /// </summary> /// <param name="currActive"></param> internal void OnActiveWindowChanged(DockWindow currActive) { if (currActive.DockState == DockState.TabbedDocument) { this.DeactivatePreviousActive(currActive); //remove the window if it exists in the document collection int index = this.documents.IndexOf(currActive); if (index >= 0) { this.documents.RemoveAt(index); } //put it at the beginning of the list. this.documents.Insert(0, currActive); currActive.UpdateActiveState(true); } else { DockWindow active = this.ActiveDocument; if (active != null) { active.UpdateActiveState(true); } } }
/// <summary> /// The manager gets notified that the owning RadDock instance has been sucessfully loaded. /// </summary> protected internal void OnDockManagerLoaded() { //update active document DockWindow activeDoc = this.ActiveDocument; if (activeDoc != null) { activeDoc.UpdateActiveState(true); } }
private void DeactivatePreviousActive(DockWindow newActive) { if (this.documents.Count == 0) { return; } DockWindow currActive = this.documents[0]; if (currActive != null && currActive != newActive) { currActive.UpdateActiveState(false); } }
private void InsertDocument(int index, DockWindow document) { if (this.documents.Contains(document)) { return; } if (index == -1) { index = 0; } this.DeactivatePreviousActive(document); this.documents.Insert(index, document); //add the document in the sorted list this.documentsSorted.Insert(this.FindInsertIndex(document), document); DockWindow activeDoc = this.ActiveDocument; if (activeDoc != null) { activeDoc.UpdateActiveState(true); } }