Vixen
02b45cc4
csharp
public sealed class DockingHost

Panels arranged into splits and tab groups, dragged between them, and saved.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

Two things, kept apart on purpose. DockLayout is the arrangement — a tree of splits and groups that is saved, restored and compared; this is the elements that show it. Every structural change edits the model and then rebuilds the views from it, so "what is on screen" and "what would be saved" cannot drift apart.

⚠ Rebuilding the views does not rebuild the panels. Before a rebuild every panel is reparented into a hidden holder; afterwards each is reparented into its group. The elements survive, which is the whole point — a panel that was rebuilt would lose its scroll offset, its selection and its focus every time somebody dragged a splitter's neighbour into another group.

A splitter drag is the exception and does not rebuild anything: it writes flex-grow on two elements. Rebuilding at sixty hertz would work and would feel like treacle.

Fields and properties (12)

  • public UiElement Guides

    The five handles shown over the group a drag is currently over.

  • protected override string TagName

    The element name this type answers to when a caller does not choose one.

  • protected override bool AcceptsFocus

    Whether the focus can rest on this kind of control at all.

  • public DockLayout Layout

    The arrangement being shown.

  • public UiElement Surface

    Where the docked tree is built.

  • public UiElement Detached

    Where panels wait while they are not placed.

  • public UiElement Preview

    The rectangle shown while a tab is being dragged.

  • public IReadOnlyDictionary<string, DockPanel> Panels

    The panels, by id.

  • public IReadOnlyList<DockGroupView> Groups

    The group views currently on screen, docked ones first.

  • public int TornWindowCount

    The floating groups that have a window of their own.

  • public bool CanTearOut

    Whether this host will give a floating group a window of its own.

  • public DockPanel? Active

    The panel a command about "this panel" means.

Events (1)

  • public Action<DockingHost>? LayoutChanged

    Raised after anything changes the arrangement.

Methods (11)

  • protected override void OnCreated()

    Builds whatever this element is made of, once, as it joins a document.

  • public DockPanel AddPanel(string id, string? title = null)

    Adds a panel, docking it if the arrangement does not already place it.

  • public bool RemovePanel(string id)

    Takes a panel out of the arrangement and out of the document.

  • public void Dock(string id, DockGroupNode target, DockZone side, int index = -1)

    Moves a panel next to, or into, a group.

  • public void Float(string id, float x, float y, float width = 320, float height = 240)

    Takes a panel out of the docked tree into a window of its own.

  • public void SetLayout(DockLayout layout)

    Shows a different arrangement, keeping the panels.

  • public string Save()

    The arrangement as YAML.

  • public void Load(string yaml)

    Reads an arrangement back and shows it.

  • public void Rebuild()

    Builds the elements the arrangement describes.

  • public bool Float(string id)

    Takes a panel out into a window of its own, where it already is on screen.

  • protected override void OnRemoved()

    Closes every window this host opened.

Used by (9)

  • ShellHelloUi
  • UiHostHelloUi
  • DockingTestsVixen.Ui.Controls.Advanced.Tests
  • DockingWindowTestsVixen.Ui.Controls.Advanced.Tests
  • DockingWorkspaceVixen.Editor.Ui
  • EditorApplicationVixen.Editor.App
  • EditorShellVixen.Editor.Ui
  • PanelBehaviourTestsVixen.Editor.App.Tests
  • WorkspaceTestsVixen.Editor.Ui.Tests