/// <summary> /// Initializes a new instance of the RedockerContentZones class. /// </summary> /// <param name="squares">Show squares or diamonds.</param> /// <param name="callingControl">Calling control instance.</param> /// <param name="wc">WindowContent that contains content.</param> /// <param name="offset">Screen offset.</param> public RedockerContentZones(bool squares, Control callingControl, WindowContent wc, Point offset) : base(squares, callingControl, wc, offset) { }
/// <summary> /// Initializes a new instance of the RedockerContentOutline class. /// </summary> /// <param name="squares">Show squares or diamonds.</param> /// <param name="callingControl">Calling control instance.</param> /// <param name="c">Source content.</param> /// <param name="wc">WindowContent that contains content.</param> /// <param name="offset">Screen offset.</param> public RedockerContentOutline(bool squares, Control callingControl, Content c, WindowContent wc, Point offset) : base(squares, callingControl, c, wc, offset) { }
/// <summary> /// Initializes a new instance of the RedockerContent class. /// </summary> /// <param name="squares">Show squares or diamonds.</param> /// <param name="callingControl">Calling control instance.</param> /// <param name="c">Source content.</param> /// <param name="wc">WindowContent that contains content.</param> /// <param name="offset">Screen offset.</param> public RedockerContent(bool squares, Control callingControl, Content c, WindowContent wc, Point offset) { InternalConstruct(squares, callingControl, Source.ContentInsideWindow, c, wc, null, c.DockingManager, offset); }
private void InternalConstruct(DockingManager manager, Control control, string title, ImageList imageList, int imageIndex, Icon icon) { // Must provide a valid manager instance if (manager == null) { throw new ArgumentNullException("DockingManager"); } // Define the initial object state _control = control; _title = title; _uniqueName = ""; _imageList = imageList; _imageIndex = imageIndex; _icon = icon; _manager = manager; _parentWindowContent = null; _order = _counter++; _visible = false; _displaySize = new Size(_defaultDisplaySize, _defaultDisplaySize); _autoHideSize = new Size(_defaultAutoHideSize, _defaultAutoHideSize); _floatingSize = new Size(_defaultFloatingSize, _defaultFloatingSize); _displayLocation = new Point(_defaultLocation, _defaultLocation); _defaultRestore = new RestoreContentState(State.DockLeft, this); _floatingRestore = new RestoreContentState(State.Floating, this); _autoHideRestore = new RestoreAutoHideState(State.DockLeft, this); _dockingRestore = _defaultRestore; _autoHidePanel = null; _tag = null; _docked = true; _captionBar = true; _closeButton = true; _hideButton = true; _autoHidden = false; _closeOnHide = false; _fullTitle = title; // A control that is a Panel of Form should have its back color auto set if ((_control != null) && ((_control is Form) || (_control is Panel))) { _office2003BackColor = Office2003Color.Base; } else { _office2003BackColor = Office2003Color.Disable; } }
/// <summary> /// Find collection of content names inside a Zone in order of priority. /// </summary> /// <param name="z">Zone to use.</param> /// <param name="c">Content to use as basis of priority.</param> /// <returns>Collection of content names.</returns> public static StringCollection ContentNamesInPriority(Zone z, Content c) { // Container for returned group of found Content objects StringCollection sc = new StringCollection(); // Process each Window in the Zone foreach (Window w in z.Windows) { WindowContent wc = w as WindowContent; // Is the Zone a Content derived variation? if (wc != null) { // Does this contain the interesting Content? if (wc.Contents.Contains(c)) { // All Content of this Window are given priority and // added into the start of the collection foreach (Content content in wc.Contents) { if ((content.UniqueName != null) && (content.UniqueName.Length > 0)) { sc.Insert(0, content.UniqueName); } else { sc.Insert(0, content.Title); } } } else { // Lower priority Window and so contents are always // added to the end of the collection foreach (Content content in wc.Contents) { if ((content.UniqueName != null) && (content.UniqueName.Length > 0)) { sc.Add(content.UniqueName); } else { sc.Add(content.Title); } } } } } return(sc); }
/// <summary> /// Process a new window being inserted into zone. /// </summary> /// <param name="index">Index position of insertion.</param> /// <param name="value">New window instance.</param> protected void OnWindowInserted(int index, object value) { if (_zone.Windows.Count == 1) { // The first Window to be added. Tell it to hide details _zone.Windows[0].HideDetails(); // Monitor change in window title _zone.Windows[0].FullTitleChanged += new EventHandler(OnFullTitleChanged); // Grab any existing title this.Text = _zone.Windows[0].FullTitle; } else if (_zone.Windows.Count == 2) { int pos = 0; // If the new Window is inserted at beginning then update the second Window if (index == 0) { pos++; } // The second Window to be added. Tell the first to now show details _zone.Windows[pos].ShowDetails(); // Monitor change in window title _zone.Windows[pos].FullTitleChanged -= new EventHandler(OnFullTitleChanged); // Remove any caption title this.Text = ""; } WindowContent wc = value as WindowContent; // Hook into changes in window contents wc.Contents.Inserted += new CollectionChange(OnContentsInserted); wc.Contents.Removing += new CollectionChange(OnContentsRemoving); wc.Contents.Clearing += new CollectionClear(OnContentsClearing); // Notice changes to properties foreach (Content c in wc.Contents) { c.PropertyChanged += new Crownwood.DotNetMagic.Docking.Content.PropChangeHandler(OnContentPropertyChanged); } // Decide if the form close button is needed ProbeContentWithoutClose(); }
/// <summary> /// Perform initialization. /// </summary> /// <param name="squares">Show squares or diamonds.</param> /// <param name="callingControl">Calling control instance.</param> /// <param name="source">Type of source.</param> /// <param name="c">Source content.</param> /// <param name="wc">WindowContent that contains content.</param> /// <param name="ff">Floating form source.</param> /// <param name="dm">DockingManager instance.</param> /// <param name="offset">Screen offset.</param> protected override void InternalConstruct(bool squares, Control callingControl, Source source, Content c, WindowContent wc, FloatingForm ff, DockingManager dm, Point offset) { // Create the outline specific feedback indicator DragFeedback = new DragFeedbackOutline(); // Carry on with internal setup base.InternalConstruct(squares, callingControl, source, c, wc, ff, dm, offset); }
/// <summary> /// Perform initialization. /// </summary> /// <param name="squares">Show squares or diamonds.</param> /// <param name="callingControl">Calling control instance.</param> /// <param name="source">Type of source.</param> /// <param name="c">Source content.</param> /// <param name="wc">WindowContent that contains content.</param> /// <param name="ff">Floating form source.</param> /// <param name="dm">DockingManager instance.</param> /// <param name="offset">Screen offset.</param> protected override void InternalConstruct(bool squares, Control callingControl, Source source, Content c, WindowContent wc, FloatingForm ff, DockingManager dm, Point offset) { // Initialize zone specific details _hotZones = null; _currentHotZone = null; // Let base class store information base.InternalConstruct(squares, callingControl, source, c, wc, ff, dm, offset); }
/// <summary> /// Initializes a new instance of the RedockerContent class. /// </summary> /// <param name="feedbackStyle">Feedback style requested.</param> /// <param name="callingControl">Calling control instance.</param> /// <param name="wc">WindowContent that contains content.</param> /// <param name="offset">Screen offset.</param> public static RedockerContent CreateRedocker(DragFeedbackStyle feedbackStyle, Control callingControl, WindowContent wc, Point offset) { switch (feedbackStyle) { case DragFeedbackStyle.Squares: return(new RedockerContentAreas(true, callingControl, wc, offset)); case DragFeedbackStyle.Diamonds: return(new RedockerContentAreas(false, callingControl, wc, offset)); case DragFeedbackStyle.Solid: return(new RedockerContentSolid(false, callingControl, wc, offset)); case DragFeedbackStyle.Outline: default: return(new RedockerContentOutline(false, callingControl, wc, offset)); } }
/// <summary> /// Perform initialization. /// </summary> /// <param name="squares">Show squares or diamonds.</param> /// <param name="callingControl">Calling control instance.</param> /// <param name="source">Type of source.</param> /// <param name="c">Source content.</param> /// <param name="wc">WindowContent that contains content.</param> /// <param name="ff">Floating form source.</param> /// <param name="dm">DockingManager instance.</param> /// <param name="offset">Screen offset.</param> protected virtual void InternalConstruct(bool squares, Control callingControl, Source source, Content c, WindowContent wc, FloatingForm ff, DockingManager dm, Point offset) { // Store the starting state _squares = squares; _insideRect = new Rectangle(); _outsideRect = new Rectangle(); _callingControl = callingControl; _source = source; _content = c; _windowContent = wc; _dockingManager = dm; _container = _dockingManager.Container; _floatingForm = ff; _offset = offset; // We do not allow docking in front of the outer index entry _outerIndex = FindOuterIndex(); // Create lists of Controls which are docked against each edge _topList = new ArrayList(); _leftList = new ArrayList(); _rightList = new ArrayList(); _bottomList = new ArrayList(); _fillList = new ArrayList(); PreProcessControlsCollection(); // Find the vectors required for calculating new sizes VectorDependsOnSourceAndState(); // Begin tracking straight away EnterTrackingMode(); }
/// <summary> /// Find collection of content instances inside a Zone. /// </summary> /// <param name="z">Zone to use.</param> /// <returns>Collection of content.</returns> public static ContentCollection Contents(Zone z) { // Container for returned group of found Content objects ContentCollection cc = new ContentCollection(); // Process each Window in the Zone foreach (Window w in z.Windows) { WindowContent wc = w as WindowContent; // Is the Zone a Content derived variation? if (wc != null) { // Add each Content into the collection foreach (Content c in wc.Contents) { cc.Add(c); } } } return(cc); }
/// <summary> /// Initializes a new instance of the FloatingForm class. /// </summary> /// <param name="dockingManager">Parent docking manager instance.</param> /// <param name="zone">Zone to be hosted.</param> /// <param name="contextHandler">Delegate for handling context menus.</param> public FloatingForm(DockingManager dockingManager, Zone zone, ContextHandler contextHandler) { // The caller is responsible for setting our initial screen location this.StartPosition = FormStartPosition.Manual; // Ask the docking manager if we should have an icon in the taskbar showing this.ShowInTaskbar = dockingManager.FloatingInTaskBar; // If the docking manager has a specific icon to be used, then use it if (dockingManager.FloatingTaskBarIcon != null) { this.Icon = dockingManager.FloatingTaskBarIcon; } // Make sure the main Form owns us this.Owner = dockingManager.Container.FindForm(); // Try and hook into the owners visible change event if (this.Owner != null) { // Monitor change in the owning Form visibility this.Owner.VisibleChanged += new EventHandler(OnOwnerVisibleChanged); } // Never show by default this.Visible = false; // Need to know when the Zone is removed this.ControlRemoved += new ControlEventHandler(OnZoneRemoved); // Add the Zone as the only content of the Form Controls.Add(zone); // Default state _redocker = null; _intercept = false; _zone = zone; _dockingManager = dockingManager; // Assign any event handler for context menu if (contextHandler != null) { this.Context += contextHandler; } // Default color this.BackColor = _dockingManager.BackColor; this.ForeColor = _dockingManager.InactiveTextColor; // Monitor changes in the Zone content _zone.Windows.Inserted += new CollectionChange(OnWindowInserted); _zone.Windows.Removing += new CollectionChange(OnWindowRemoving); _zone.Windows.Removed += new CollectionChange(OnWindowRemoved); _zone.Windows.Clearing += new CollectionClear(OnWindowClearing); if (_zone.Windows.Count == 1) { // The first Window to be added. Tell it to hide details _zone.Windows[0].HideDetails(); // Monitor change in window title _zone.Windows[0].FullTitleChanged += new EventHandler(OnFullTitleChanged); WindowContent wc = _zone.Windows[0] as WindowContent; // Hook into changes in window contents wc.Contents.Inserted += new CollectionChange(OnContentsInserted); wc.Contents.Removing += new CollectionChange(OnContentsRemoving); wc.Contents.Clearing += new CollectionClear(OnContentsClearing); // Notice changes to properties foreach (Content c in wc.Contents) { c.PropertyChanged += new Crownwood.DotNetMagic.Docking.Content.PropChangeHandler(OnContentPropertyChanged); } // Decide if the form close button is needed ProbeContentWithoutClose(); // Grab any existing title this.Text = _zone.Windows[0].FullTitle; } // Need to hook into message pump so that the ESCAPE key can be // intercepted when in redocking mode Application.AddMessageFilter(this); }
/// <summary> /// Perform a restore using provided window. /// </summary> /// <param name="w">Reference to source.</param> public override void PerformRestore(Window w) { // We are only ever called for a WindowContent object WindowContent wc = w as WindowContent; int bestIndex = -1; foreach (String s in _previous) { if (wc.Contents.ContainsTitleOrUnique(s)) { Content c = wc.Contents[s]; // Check the unqiue name as well as the title if (c == null) { c = wc.Contents.FindUniqueName(s); } int previousIndex = wc.Contents.IndexOf(c); if (previousIndex > bestIndex) { bestIndex = previousIndex; } } } // Did we find a previous Content? if (bestIndex >= 0) { // Great, insert after it wc.Contents.Insert(bestIndex + 1, Content); } else { bestIndex = wc.Contents.Count; foreach (String s in _next) { if (wc.Contents.ContainsTitleOrUnique(s)) { Content c = wc.Contents[s]; // Check the unqiue name as well as the title if (c == null) { c = wc.Contents.FindUniqueName(s); } int nextIndex = wc.Contents.IndexOf(c); if (nextIndex < bestIndex) { bestIndex = nextIndex; } } } // Insert before the found entry (or at end if non found) wc.Contents.Insert(bestIndex, Content); } // Should this content become selected? if (_selected) { Content.BringToFront(); } }
/// <summary> /// Apply the hot zone change. /// </summary> /// <param name="screenPos">Screen position when change applied.</param> /// <param name="parent">Parent redocker instance.</param> /// <returns>true is successful; otherwise false.</returns> public override bool ApplyChange(Point screenPos, Redocker parent) { // If docking back to itself then refuse to apply the change, this will cause the // WindowContentTabbed object to put back the content which is the desired effect if (_itself) { return(false); } // We are only called from the RedockerContent class RedockerContent redock = parent as RedockerContent; DockingManager dockingManager = redock.DockingManager; bool becomeFloating = (_wct.ParentZone.State == State.Floating); // Reduce flicker during transition dockingManager.Container.SuspendLayout(); // Manageing Zones should remove display AutoHide windows dockingManager.RemoveShowingAutoHideWindows(); switch (redock.DockingSource) { case RedockerContent.Source.WindowContent: { // Perform State specific Restore actions if (becomeFloating) { foreach (Content c in redock.WindowContent.Contents) { c.ContentBecomesFloating(); } } else { // If the source is leaving the Floating state then need to record Restore positions if (redock.WindowContent.State == State.Floating) { foreach (Content c in redock.WindowContent.Contents) { c.ContentLeavesFloating(); } } } int count = redock.WindowContent.Contents.Count; for (int index = 0; index < count; index++) { Content c = redock.WindowContent.Contents[0]; // Remove Content from previous WindowContent redock.WindowContent.Contents.RemoveAt(0); // Add into new WindowContent _wct.Contents.Add(c); _wct.BringContentToFront(c); } } break; case RedockerContent.Source.ContentInsideWindow: { // Perform State specific Restore actions if (becomeFloating) { redock.Content.ContentBecomesFloating(); } else { // If the source is leaving the Floating state then need to record Restore position if (redock.Content.ParentWindowContent.State == State.Floating) { redock.Content.ContentLeavesFloating(); } } // Remove Content from existing WindowContent if (redock.Content.ParentWindowContent != null) { redock.Content.ParentWindowContent.Contents.Remove(redock.Content); } _wct.Contents.Add(redock.Content); _wct.BringContentToFront(redock.Content); } break; case RedockerContent.Source.FloatingForm: { // Perform State specific Restore actions if (!becomeFloating) { // Make every Content object in the Floating Zone // record its current state as the Floating state redock.FloatingForm.ExitFloating(); } int wCount = redock.FloatingForm.Zone.Windows.Count; for (int wIndex = 0; wIndex < wCount; wIndex++) { WindowContent wc = redock.FloatingForm.Zone.Windows[0] as WindowContent; if (wc != null) { int cCount = wc.Contents.Count; for (int cIndex = 0; cIndex < cCount; cIndex++) { // Get reference to first content in collection Content c = wc.Contents[0]; // Remove from old WindowContent wc.Contents.RemoveAt(0); // Add into new WindowContentTabbed _wct.Contents.Add(c); _wct.BringContentToFront(c); } } } } break; } dockingManager.UpdateInsideFill(); // Reduce flicker during transition dockingManager.Container.ResumeLayout(); return(true); }
/// <summary> /// Apply the hot zone change. /// </summary> /// <param name="screenPos">Screen position when change applied.</param> /// <param name="parent">Parent redocker instance.</param> /// <returns>true is successful; otherwise false.</returns> public override bool ApplyChange(Point screenPos, Redocker parent) { // We are only called from the RedockerContent class RedockerContent redock = parent as RedockerContent; DockingManager dockingManager = redock.DockingManager; bool becomeFloating = (_zs.State == State.Floating); // Reduce flicker during transition dockingManager.Container.SuspendLayout(); // Manageing Zones should remove display AutoHide windows dockingManager.RemoveShowingAutoHideWindows(); switch (redock.DockingSource) { case RedockerContent.Source.WindowContent: { // Is the destination Zone in the Floating state? if (becomeFloating) { foreach (Content c in redock.WindowContent.Contents) { c.ContentBecomesFloating(); } } else { if (redock.WindowContent.State == State.Floating) { foreach (Content c in redock.WindowContent.Contents) { c.ContentLeavesFloating(); } } } // Check if the WindowContent source is in same Zone if (redock.WindowContent.ParentZone == _zs) { // Find current position of source WindowContent int currPos = _zs.Windows.IndexOf(redock.WindowContent); // If current window is before the new position then the current // window will disappear before the new one is inserted,so need to // adjust down the new insertion point if (currPos < _index) { _index--; } } // Create a new Window to host Content WindowContent wc = dockingManager.CreateWindowForContent(null) as WindowContent; // Transfer content across int count = redock.WindowContent.Contents.Count; for (int index = 0; index < count; index++) { Content c = redock.WindowContent.Contents[0]; // Remove from existing location redock.WindowContent.Contents.RemoveAt(0); // Add into new WindowContent host wc.Contents.Add(c); } // Add into host into Zone _zs.Windows.Insert(_index, wc); } break; case RedockerContent.Source.ContentInsideWindow: { // Perform State specific Restore actions if (becomeFloating) { redock.Content.ContentBecomesFloating(); } else { if (redock.Content.ParentWindowContent.State == State.Floating) { redock.Content.ContentLeavesFloating(); } } // Remove Content from existing WindowContent if (redock.Content.ParentWindowContent != null) { // Will removing the Content cause the WindowContent to die? if (redock.Content.ParentWindowContent.Contents.Count == 1) { // Check if the WindowContent source is in same Zone if (redock.Content.ParentWindowContent.ParentZone == _zs) { // Find current position of source WindowContent int currPos = _zs.Windows.IndexOf(redock.Content.ParentWindowContent); // If current window is before the new position then the current // window will disappear before the new one is inserted,so need to // adjust down the new insertion point if (currPos < _index) { _index--; } } } redock.Content.ParentWindowContent.Contents.Remove(redock.Content); } // Create a new Window to host Content Window w = dockingManager.CreateWindowForContent(redock.Content); // Add into Zone _zs.Windows.Insert(_index, w); } break; case RedockerContent.Source.FloatingForm: { // Perform State specific Restore actions if (!becomeFloating) { // Make every Content object in the Floating Zone // record its current state as the Floating state redock.FloatingForm.ExitFloating(); } int count = redock.FloatingForm.Zone.Windows.Count; for (int index = count - 1; index >= 0; index--) { // Remember the Window reference Window w = redock.FloatingForm.Zone.Windows[index]; // Remove from floating collection redock.FloatingForm.Zone.Windows.RemoveAt(index); // Add into new ZoneSequence destination _zs.Windows.Insert(_index, w); } } break; } dockingManager.UpdateInsideFill(); // Reduce flicker during transition dockingManager.Container.ResumeLayout(); return(true); }
/// <summary> /// Initialize a new instance of the HotAreaTabbed class. /// </summary> /// <param name="squares">Squares or diamonds.</param> /// <param name="redocker">Reference to the redocker.</param> /// <param name="manager">Reference to docking manager.</param> /// <param name="zs">Sequence containing the tabbed content.</param> /// <param name="wct">Tabbed content instance.</param> /// <param name="disallowTabbed">Allow to drop in tabbed area.</param> /// <param name="suppress">Suppress indicators if match found.</param> public HotAreaTabbed(bool squares, RedockerContent redocker, DockingManager manager, ZoneSequence zs, WindowContentTabbed wct, bool disallowTabbed, bool suppress) : base(manager) { // Remember initial values _wct = wct; _zs = zs; _squares = squares; _suppress = suppress; _disallowTabbed = disallowTabbed; // Not currently inside the hot area _hotInside = false; _disallowInsert = false; // Calculate the tabbed rectangle in screen coordinates _tabbedRect = wct.RectangleToScreen(wct.ClientRectangle); // Check for situations that need extra attention... // // (1) Do not allow a WindowContent from a ZoneSequence to be redocked into the // same ZoneSequence. As removing it will cause the Zone to be destroyed and // so it cannot be added back again. Is not logical anyway. // // (2) If the source is in this ZoneSequence we might need to adjust the insertion // index because the item being removed will reduce the count for when the insert // takes place. bool indexAdjustTest = false; WindowContent redockWC = redocker.WindowContent; if (_zs.Windows.Count == 1) { if (redocker.WindowContent != null) { if (redocker.WindowContent == _zs.Windows[0]) { if ((redocker.Content == null) || (redocker.WindowContent.Contents.Count == 1)) { _disallowInsert = true; } } } } else { if (_zs.Windows.Contains(redockWC)) { if ((redocker.Content == null) || (redocker.WindowContent.Contents.Count == 1)) { indexAdjustTest = true; } } } // Create the left/top and right/bottom hot zones if (!_disallowInsert) { Rectangle zoneRectLT = zs.RectangleToScreen(zs.ClientRectangle); Rectangle tabbedRect = zs.Windows[0].RectangleToScreen(zs.Windows[0].ClientRectangle); // Adjust the rectangle to give rough idea of new size if (zs.Direction == LayoutDirection.Vertical) { zoneRectLT.X = tabbedRect.X; zoneRectLT.Width = tabbedRect.Width; zoneRectLT.Height = zoneRectLT.Height / (zs.Windows.Count + 1); } else { zoneRectLT.Y = tabbedRect.Y; zoneRectLT.Height = tabbedRect.Height; zoneRectLT.Width = zoneRectLT.Width / (zs.Windows.Count + 1); } // Store the rectangle for use with the RB as well Rectangle zoneRectRB = zoneRectLT; // Find our current index as starting point for insertion int indexLT = zs.Windows.IndexOf(wct); // The RB is inserted after the current position int indexRB = indexLT + 1; // If inserting after the first window if (indexLT > 0) { // Move the indicator position to overlap the previous position if (zs.Direction == LayoutDirection.Vertical) { zoneRectLT.Y += zs.Windows[indexLT].Top - (zoneRectLT.Height / 2); } else { zoneRectLT.X += zs.Windows[indexLT].Left - (zoneRectLT.Width / 2); } } // Do we need to check if the removed WC is before the insert point? if (indexAdjustTest) { // If the source window content is before the target then the // index needs decreasing to ensure its removal is accounted for if (zs.Windows.IndexOf(redocker.WindowContent) < indexLT) { indexLT--; } } // Create the actual hot zone _hotLT = new HotZoneSequence(zoneRectLT, zoneRectLT, zs, indexLT); // If inserting before the last window if (indexRB < zs.Windows.Count) { // Move the indicator position to overlap the next position if (zs.Direction == LayoutDirection.Vertical) { zoneRectRB.Y += zs.Windows[indexRB - 1].Bottom - (zoneRectRB.Height / 2); } else { zoneRectRB.X += zs.Windows[indexRB - 1].Right - (zoneRectRB.Width / 2); } } else { // Move the indicator position to the end of our position if (zs.Direction == LayoutDirection.Vertical) { zoneRectRB.Y += zs.Windows[indexRB - 1].Bottom - zoneRectRB.Height; } else { zoneRectRB.X += zs.Windows[indexRB - 1].Right - zoneRectRB.Width; } } // Do we need to check if the removed WC is before the insert point? if (indexAdjustTest) { // If the source window content is before the target then the // index needs decreasing to ensure its removal is accounted for if (zs.Windows.IndexOf(redocker.WindowContent) < indexRB) { indexRB--; } } // Create the actual hot zone _hotRB = new HotZoneSequence(zoneRectRB, zoneRectRB, zs, indexRB); } // Create the insert into middle hot zone if (!_disallowTabbed) { _hotMiddle = new HotZoneTabbed(_tabbedRect, _tabbedRect, wct, false); } }
/// <summary> /// Perform a restore using provided zone. /// </summary> /// <param name="z">Reference to source.</param> public override void PerformRestore(Zone z) { int count = z.Windows.Count; int beforeIndex = -1; int afterIndex = count; // Find the match to one of our best friends for (int index = 0; index < count; index++) { WindowContent wc = z.Windows[index] as WindowContent; if (wc != null) { // If this WindowContent contains a best friend, then add ourself here as well if (wc.Contents.ContainsTitleOrUnique(_best)) { if (Child == null) { // If we do not have a Restore object for the Window then just add // into the WindowContent at the end of the existing Contents wc.Contents.Add(Content); } else { // Get the child to restore as best as possible inside WindowContent Child.PerformRestore(wc); } return; } // If the WindowContent contains a Content previous to the target if (wc.Contents.ContainsTitleOrUnique(_previous)) { if (index > beforeIndex) { beforeIndex = index; } } // If the WindowContent contains a Content next to the target if (wc.Contents.ContainsTitleOrUnique(_next)) { if (index < afterIndex) { afterIndex = index; } } } } // If we get here then we did not find any best friends, this // means we need to create a new WindowContent to host the Content. Window newW = z.DockingManager.CreateWindowForContent(Content); ZoneSequence zs = z as ZoneSequence; // If this is inside a ZoneSequence instance if (zs != null) { // Do not reposition the Windows on the .Insert but instead ignore the // reposition and let it happen in the .ModifyWindowSpace. This reduces // the flicker that would occur otherwise zs.SuppressReposition(); } // Need to find the best place in the order for the Content, start by // looking for the last 'previous' content and place immediately after it if (beforeIndex >= 0) { // Great, insert after it z.Windows.Insert(beforeIndex + 1, newW); } else { // No joy, so find the first 'next' content and place just before it, if // none are found then just add to the end of the collection. z.Windows.Insert(afterIndex, newW); } // If this is inside a ZoneSequence instance if (zs != null) { // We want to try and allocate the correct Zone space zs.ModifyWindowSpace(newW, _space); } }