Skip to main content

Module dock

Module dock 

Source
Expand description

Panels arranged in regions around a centre, the way a desktop tool is laid out.

Every fact the dock draws belongs to the caller: which panels a region holds, which one is on top, whether a region is collapsed, and how much room it takes. The dock reports what the typist asked for as a DockEvent and moves nothing, so a host that refuses a move keeps the arrangement that still holds.

§One resize implementation

Region sizes go through SplitTree: the dock builds a SplitLayout from the regions that hold panels and hands it over, so a divider between two regions is the same divider a caller would get from a plain split, with the same minimums and the same published range.

§Dragging a panel between regions

A region’s header is a Tabs strip, so dragging a panel is the drag system in crate::interaction::dnd and nothing new. Dropping on another region’s tab reports DockEvent::PanelMoved naming the panel the moved one should sit in front of; dropping on a region’s body reports the same move with before: None, which appends.

§What the dock cannot do

  • A region holding no panels is not drawn, so it cannot be dropped onto. The last panel cannot be dragged out of a region and then back into it.
  • A panel is drawn in exactly one region. There is no split within a region, and no floating panel.
  • A collapsed region shows a rail. Picking a panel from the rail reports the selection and the request to expand, and applies neither.
  • The header is a tab strip whatever the count: with one panel it reads as a title, which is what gives a lone panel something to drag by.

Structs§

Dock
Panels arranged in regions around a centre.
DockPanel
One panel: a name, a glyph, a count, and whatever the caller puts inside.

Enums§

DockEvent
What the dock reports. The caller decides what any of it means.
DockRegion
Where a panel sits.