internal void RemoveShelfView(ShelfView shelfView) { shelfView.SaveState(); _form.DockingManager.Contents.Remove(shelfView.Content); shelfView.SetVisibleStatus(false); }
internal void ShowShelfView(ShelfView shelfView) { if (!shelfView.Content.Visible) { shelfView.Content.BringToFront(); } if (shelfView.Content.IsDocked) { if (shelfView.Content.IsAutoHidden) // auto-hide mode { // show without activating _form.DockingManager.BringAutoHideIntoView(shelfView.Content); // show it } else { // content is pinned - therefore it should be already visible } } else { // floating _form.DockingManager.ShowContent(shelfView.Content); } }
internal void HideShelfView(ShelfView shelfView) { if (shelfView.Content.IsDocked) { if (shelfView.Content.IsAutoHidden) // auto-hide mode { // only one auto-hide window can be showing at a given time, so calling this method should hide it _form.DockingManager.RemoveShowingAutoHideWindows(); } else { // content is pinned - putting it in auto-hide mode should hide it _form.DockingManager.ToggleContentAutoHide(shelfView.Content); // the window seems to remain active even though it is not visible, which doesn't make much sense // therefore, let's report it as inactive shelfView.SetActiveStatus(false); // since we don't seem to get a content-hiding message in this case, need to explicitly set this shelfView.SetVisibleStatus(false); } } else { // floating _form.DockingManager.HideContent(shelfView.Content); // since we don't seem to get a content-hiding message in this case, need to explicitly set this shelfView.SetVisibleStatus(false); } }
internal void ActivateShelfView(ShelfView shelfView) { if (shelfView.Content.IsAutoHidden) { // auto-hidden - bring into view _form.DockingManager.BringAutoHideIntoView(shelfView.Content); } else { // docked or floating - ensure we are in front shelfView.Content.BringToFront(); } // set focus to the control - this is what actually activates the window shelfView.Content.Control.Focus(); }
internal Content AddShelfView(ShelfView shelfView, Control control, string title, ShelfDisplayHint hint, MemoryStream shelfRestoreStream) { // Forcing this makes the control resize *before* adding it to the DotNetMagic control, // so the shelf will be the correct size. This would be done automatically when the // control gets added - we're just doing it a bit prematurely in order to get the correct size. control.Font = _form.DockingManager.TabControlFont; var displaySize = control.Size; var content = _form.DockingManager.Contents.Add(control, title); content.Tag = shelfView; if (shelfRestoreStream != null) { content.LoadContentFromStream(shelfRestoreStream); // #4183 - the shelf restore stream includes the shelf title, which is supposed to be determined by the model/localization and not persisted content.Title = content.FullTitle = title; _form.DockingManager.ShowContent(content); if (content.IsAutoHidden && hint != ShelfDisplayHint.HideOnWorkspaceOpen) { _form.DockingManager.BringAutoHideIntoView(content); } return(content); } content.DisplaySize = displaySize; content.AutoHideSize = displaySize; content.FloatingSize = displaySize; if ((hint & ShelfDisplayHint.DockAutoHide) != 0) { _form.DockingManager.Container.SuspendLayout(); } // Dock the window on the correct edge if ((hint & ShelfDisplayHint.DockTop) != 0) { _form.DockingManager.AddContentWithState(content, State.DockTop); } else if ((hint & ShelfDisplayHint.DockBottom) != 0) { _form.DockingManager.AddContentWithState(content, State.DockBottom); } else if ((hint & ShelfDisplayHint.DockLeft) != 0) { _form.DockingManager.AddContentWithState(content, State.DockLeft); } else if ((hint & ShelfDisplayHint.DockRight) != 0) { _form.DockingManager.AddContentWithState(content, State.DockRight); } else { if ((hint & ShelfDisplayHint.ShowNearMouse) == ShelfDisplayHint.ShowNearMouse) { content.DisplayLocation = Control.MousePosition; } _form.DockingManager.AddContentWithState(content, State.Floating); } if ((hint & ShelfDisplayHint.DockAutoHide) != 0) { _form.DockingManager.ToggleContentAutoHide(content); _form.DockingManager.Container.ResumeLayout(); _form.DockingManager.BringAutoHideIntoView(content); } return(content); }