8#include <initializer_list>
99 std::unique_ptr<DockNode>
first;
106 std::unique_ptr<DockNode>
MakeLeaf(std::initializer_list<ID> panelIds = {});
110 std::unique_ptr<DockNode> first,
111 std::unique_ptr<DockNode> second,
112 CssPx minFirstSize = 80,
113 CssPx minSecondSize = 80);
191 CssPx initialSplitSize = 200);
209 const std::function<std::optional<ID>(std::string_view)>& idOf);
Makes element IDs: per-frame dynamic / ranged IDs (hashed from the call site or a hint and the parent...
Definition gui_id_manager.h:27
DockNode * SplitLeafAtZone(std::unique_ptr< DockNode > &leafRef, ID droppedPanelId, DockDropZone zone, CssPx initialSplitSize=200)
Replaces the leaf with a split: droppedPanelId goes into a new leaf on the zone side (Left/Right/Top/...
TabBarLayout
How a tab bar lays out tabs that don't fit on one row.
Definition gui_dock_node.h:56
void CollapseEmptyLeaves(std::unique_ptr< DockNode > &rootRef, IDManager *idManager=nullptr)
Collapses empty leaves by promoting their siblings, bottom-up.
int TabInsertionIndex(const DockNode &leaf, int2 cursor)
Where a tab dropped at cursor goes (0 = before the first, count = after the last): after every tab on...
constexpr bool IsHorizontalSplit(DockSplitMode m)
True for LeftPinned / RightPinned (children side by side).
Definition gui_dock_node.h:33
std::vector< ID > UnplacedPanels(const DockNode &root, const std::vector< ID > &allPanels)
Every ID in allPanels that does not appear in the tree, in order.
bool CloseLeafTab(DockNode &node, int tabIndex)
Removes a leaf's tab, clamping selectedTab. Returns true if the leaf is now empty.
void ReorderLeafTabs(DockNode &node, int from, int to)
Moves a tab within a leaf, keeping the selected tab selected. No-op on invalid input.
SplitSizeRange ComputeSplitSizeRange(const DockNode &splitNode, int containerExtent, int sizerThickness)
Allowed splitSize range: min = the pinned child's minimum, max = containerExtent - sizerThickness - t...
void AssignMissingNodeIDs(DockNode *root, IDManager &idManager)
Gives every node (and leaf tab bar) without an ID a static ID. Idempotent.
std::unique_ptr< DockNode > MakeLeaf(std::initializer_list< ID > panelIds={})
A leaf with the given panel tabs.
DockDropZone ComputeDropZone(IntRect rect, int2 point, float edgeFraction=0.25f)
The zone of rect that point is in.
void ReleaseDockTreeIDs(DockNode *node, IDManager *idManager)
Releases a tree's static node and tab-bar IDs; call before destroying it.
DockNode * FindNode(DockNode *root, ID nodeID)
The node with nodeID under root; nullptr when not found (always for an Invalid ID).
std::unique_ptr< DockNode > * FindNodeOwner(std::unique_ptr< DockNode > &rootRef, const DockNode *target)
The unique_ptr that owns target, or nullptr.
int ClampSplitSize(const DockNode &splitNode, int containerExtent, int sizerThickness)
Returns splitSize clamped to that range (doesn't modify the node).
bool RemovePanel(std::unique_ptr< DockNode > &rootRef, ID panelId, IDManager *idManager=nullptr)
Removes the first occurrence of panelId, then collapses empty leaves.
std::unique_ptr< DockNode > MakeSplit(DockSplitMode mode, CssPx splitSize, std::unique_ptr< DockNode > first, std::unique_ptr< DockNode > second, CssPx minFirstSize=80, CssPx minSecondSize=80)
A split node owning first and second; sizes in CSS px.
DockSplitMode
Split direction and which child is pinned to splitSize; the other child flexes.
Definition gui_dock_node.h:25
constexpr bool PinsSecondChild(DockSplitMode m)
True for RightPinned / BottomPinned (splitSize applies to the second child).
Definition gui_dock_node.h:38
std::string SerializeDockTree(const DockNode &root, const std::function< std::string(ID)> &keyOf)
Writes the tree as JSON, naming each panel by keyOf's stable key (a title or type),...
int2 TabRowCursor(const DockNode &leaf, int2 cursor)
The cursor as the tab rows see it: off the rows (above, below, or in a gap between wrapped rows) it m...
std::unique_ptr< DockNode > ParseDockTree(std::string_view text, const std::function< std::optional< ID >(std::string_view)> &idOf)
Rebuilds a tree from SerializeDockTree output.
DockDropZone
Edge zone of a point within a dock content area (drop preview and split-on-drop).
Definition gui_dock_node.h:45
@ Rows
every tab shown, on as many rows as they take
Definition gui_dock_node.h:58
@ OneRow
one row; the tabs that don't fit are listed by a "+N" button after the others
Definition gui_dock_node.h:57
@ LeftPinned
horizontal split: first child (left) pinned, right flexes
Definition gui_dock_node.h:26
@ RightPinned
horizontal split: second child (right) pinned, left flexes
Definition gui_dock_node.h:27
@ BottomPinned
vertical split: second child (bottom) pinned, top flexes
Definition gui_dock_node.h:29
@ TopPinned
vertical split: first child (top) pinned, bottom flexes
Definition gui_dock_node.h:28
@ None
outside the rect entirely
Definition gui_dock_node.h:46
@ None
Definition gui_element_flags.h:19
@ Bottom
Definition gui_style.h:255
@ Top
Definition gui_style.h:254
@ Center
Center on cross axis.
Definition gui_style.h:185
Definition gui_logging.h:24
A size in CSS px.
Definition gui_units.h:18
A drop location: the leaf under the cursor and the zone within its content area.
Definition gui_dock_node.h:159
DockNode * leaf
null when nothing is under the cursor
Definition gui_dock_node.h:160
DockDropZone zone
an edge zone splits the leaf on drop
Definition gui_dock_node.h:161
Docking tree node: a leaf with panel tabs, or a split with two children where splitSize applies to th...
Definition gui_dock_node.h:64
IntRect cachedTabBarRect
tab bar
Definition gui_dock_node.h:90
CssPx minFirstSize
first child's minimum when dragging the sizer
Definition gui_dock_node.h:97
ID tabBarID
ID of a leaf's tab bar.
Definition gui_dock_node.h:70
IntRect cachedContentRect
Last frame's content rect (screen space), for hit-testing during construction, when this frame's rect...
Definition gui_dock_node.h:88
int selectedTabBeforeDrag
restored on drag-out
Definition gui_dock_node.h:76
ID lastContentPanelID
Panel that lastContentID belongs to.
Definition gui_dock_node.h:84
bool isLeaf
false = a split with first and second
Definition gui_dock_node.h:71
ID nodeID
ID of the node's container element; assigned lazily in BeginDockingContainer.
Definition gui_dock_node.h:66
TabBarLayout tabLayout
picked from the tab bar's context menu; saved
Definition gui_dock_node.h:77
IntRect cachedSplitRect
split container, to clamp the split size
Definition gui_dock_node.h:91
CssPx minSecondSize
second child's minimum when dragging the sizer
Definition gui_dock_node.h:98
IntRect cachedLeafRect
tab bar + content
Definition gui_dock_node.h:89
std::unique_ptr< DockNode > second
right / bottom child
Definition gui_dock_node.h:100
CssPx splitSize
pinned child's size; mode says which child that is
Definition gui_dock_node.h:96
std::vector< ID > panelIds
the leaf's tabs, in order (Panel IDs in the DockingLayout)
Definition gui_dock_node.h:74
DockSplitMode mode
direction and pinned child
Definition gui_dock_node.h:95
std::vector< IntRect > cachedTabRects
per tab, for the insertion preview
Definition gui_dock_node.h:92
int selectedTab
index into panelIds of the visible panel
Definition gui_dock_node.h:75
ID lastContentID
Content element of the visible tab; written during construction, read by SyncDockingScrollOffsets aft...
Definition gui_dock_node.h:81
std::unique_ptr< DockNode > first
left / top child
Definition gui_dock_node.h:99
A 64-bit element ID whose bit layout depends on its IDMode.
Definition gui_id.h:23
static constexpr ID Invalid()
The "no element" ID (all bits zero); also the default for optional ID parameters.
Definition gui_id.h:66
Definition gui_base_types.h:407
An inclusive splitSize range, in CSS px.
Definition gui_dock_node.h:139
int max
Definition gui_dock_node.h:139
int min
Definition gui_dock_node.h:139
Integer 2D vector.
Definition gui_base_types.h:19