/// <summary> /// Propagates a request for drag targets down the hierarchy of docking elements. /// </summary> /// <param name="floatingWindow">Reference to window being dragged.</param> /// <param name="dragData">Set of pages being dragged.</param> /// <param name="targets">Collection of drag targets.</param> public override void PropogateDragTargets(KryptonFloatingWindow floatingWindow, PageDragEndData dragData, DragTargetList targets) { // Create list of the pages that are allowed to be dropped into this navigator KryptonPageCollection pages = new KryptonPageCollection(); foreach (KryptonPage page in dragData.Pages) { if (page.AreFlagsSet(KryptonPageFlags.DockingAllowNavigator)) { pages.Add(page); } } // Do we have any pages left for dragging? if (pages.Count > 0) { DragTargetList navigatorTargets = DockableNavigatorControl.GenerateDragTargets(new PageDragEndData(this, pages), KryptonPageFlags.DockingAllowNavigator); targets.AddRange(navigatorTargets.ToArray()); } }
/// <summary> /// Propagates an action request down the hierarchy of docking elements. /// </summary> /// <param name="action">Action that is requested to be performed.</param> /// <param name="uniqueNames">Array of unique names of the pages the action relates to.</param> public override void PropogateAction(DockingPropogateAction action, string[] uniqueNames) { KryptonPageCollection pageCollection = DockableNavigatorControl.Pages; switch (action) { case DockingPropogateAction.Loading: // Remove all pages including store pages pageCollection.Clear(); return; case DockingPropogateAction.ShowAllPages: case DockingPropogateAction.HideAllPages: case DockingPropogateAction.RemoveAllPages: case DockingPropogateAction.RemoveAndDisposeAllPages: // Ignore some global actions return; case DockingPropogateAction.StorePages: foreach (string uniqueName in uniqueNames) { // Swap pages that are not placeholders to become placeholders KryptonPage page = pageCollection[uniqueName]; if ((page != null) && !(page is KryptonStorePage)) { // Replace the existing page with a placeholder that has the same unique name KryptonStorePage placeholder = new KryptonStorePage(uniqueName, _storeName); pageCollection.Insert(pageCollection.IndexOf(page), placeholder); pageCollection.Remove(page); } } break; case DockingPropogateAction.StoreAllPages: // Process each page inside the cell for (int i = pageCollection.Count - 1; i >= 0; i--) { // Swap pages that are not placeholders to become placeholders KryptonPage page = pageCollection[i]; if ((page != null) && !(page is KryptonStorePage)) { // Replace the existing page with a placeholder that has the same unique name KryptonStorePage placeholder = new KryptonStorePage(page.UniqueName, _storeName); pageCollection.Insert(pageCollection.IndexOf(page), placeholder); pageCollection.Remove(page); } } break; case DockingPropogateAction.ClearFillerStoredPages: case DockingPropogateAction.ClearStoredPages: foreach (string uniqueName in uniqueNames) { // Only remove a matching unique name if it is a placeholder page KryptonPage removePage = pageCollection[uniqueName]; if (removePage is KryptonStorePage) { pageCollection.Remove(removePage); } } break; case DockingPropogateAction.ClearAllStoredPages: { // Process each page inside the cell for (int i = pageCollection.Count - 1; i >= 0; i--) { // Remove all placeholders KryptonPage page = pageCollection[i]; if (page is KryptonStorePage) { pageCollection.Remove(page); } } } break; case DockingPropogateAction.DebugOutput: Console.WriteLine(GetType().ToString()); DockableNavigatorControl.DebugOutput(); break; } // Let base class perform standard processing base.PropogateAction(action, uniqueNames); }