private static bool IsAutoHidden(DockPaneShim form) { DockState state = form.Content.DockState; return(state == DockState.DockLeftAutoHide || state == DockState.DockRightAutoHide || state == DockState.DockTopAutoHide || state == DockState.DockBottomAutoHide); }
public void Hide(IDockPane pane) { Refresh(); DockPaneShim form = _activePanes.Find(x => x.Pane == pane); if (form.Pane != null) { form.Content.Hide(); } }
public void Refresh() { DockPaneShim[] removedForms = _activePanes .Where(x => PluginManager.Get <IDockPane>(x.Name) == null) .ToArray(); foreach (DockPaneShim form in removedForms) { form.Content.Dispose(); _activePanes.Remove(form); } var newPanels = from name in PluginManager.GetNames <IDockPane>() where _activePanes.All(form => form.Name != name) select name; foreach (string name in newPanels) { IDockPane plugin = PluginManager.Get <IDockPane>(name); DockPaneShim shim = new DockPaneShim() { Name = name, Pane = plugin }; shim.Content = new DockContent() { Name = name, TabText = name }; shim.Content.Controls.Add(plugin.Control); shim.Content.Icon = plugin.DockIcon != null ? Icon.FromHandle(plugin.DockIcon.GetHicon()) : null; shim.Content.HideOnClose = true; shim.Content.DockAreas = DockAreas.Float | DockAreas.DockLeft | DockAreas.DockRight | DockAreas.DockTop | DockAreas.DockBottom; bool autoHide = Core.Settings.AutoHidePanes.Contains(name); DockState state = plugin.DockHint == DockHint.Float ? DockState.Float : plugin.DockHint == DockHint.Left ? (autoHide ? DockState.DockLeftAutoHide : DockState.DockLeft) : plugin.DockHint == DockHint.Right ? (autoHide ? DockState.DockRightAutoHide : DockState.DockRight) : plugin.DockHint == DockHint.Top ? (autoHide ? DockState.DockTopAutoHide : DockState.DockTop) : plugin.DockHint == DockHint.Bottom ? (autoHide ? DockState.DockBottomAutoHide : DockState.DockBottom) : DockState.Float; // stacked and nested ternary = awesome plugin.Control.Dock = DockStyle.Fill; shim.Content.Show(_mainPanel, state); if (!plugin.ShowInViewMenu || Core.Settings.HiddenPanes.Contains(name)) { shim.Content.Hide(); } _activePanes.Add(shim); } }
public void Toggle(IDockPane pane) { DockPaneShim form = _activePanes.Find(x => x.Pane == pane); if (form.Pane != null) { if (!IsVisible(form.Pane)) { Show(pane); } else { Hide(pane); } } }
public void Show(IDockPane pane) { Refresh(); DockPaneShim shim = _activePanes.Find(x => x.Pane == pane); if (shim.Pane != null && !IsVisible(shim.Pane)) { Control oldFocus = _mainPanel.Parent; while (oldFocus is ContainerControl) { oldFocus = ((ContainerControl)oldFocus).ActiveControl; } shim.Content.Show(); if (oldFocus != null) { oldFocus.Focus(); } } }
public bool IsVisible(IDockPane pane) { DockPaneShim shim = _activePanes.Find(x => x.Pane == pane); return(shim.Pane != null && !shim.Content.IsHidden); }