yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
dock_tree_renderer.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_LAYOUT_LAYOUT_DESIGNER_DOCK_TREE_RENDERER_H_
2#define YAZE_APP_EDITOR_LAYOUT_LAYOUT_DESIGNER_DOCK_TREE_RENDERER_H_
3
4#include "absl/container/flat_hash_map.h"
6#include "imgui/imgui.h"
7#include "imgui/imgui_internal.h"
8
9namespace yaze {
10namespace editor {
11namespace layout_designer {
12
13// Minimum legible cell size (pixels). When a split would produce a child
14// below this threshold along the split axis, the split collapses: the
15// split node's rect is still recorded but its children are not, and the
16// renderer paints the split as a single solid cell.
17constexpr float kMinCellSize = 20.0f;
18
20 absl::flat_hash_map<const DockNode*, ImRect> node_rects;
21};
22
23// Pure geometry: walk `tree`, assign each DockNode an ImRect carved out of
24// `viewport` via split_ratio along the split axis (kLeft/kRight are X,
25// kUp/kDown are Y). child_a always occupies the left/top subrect,
26// child_b the right/bottom, matching DockNode's documented layout.
27DockTreeLayout ComputeLayout(const DockTree& tree, const ImRect& viewport);
28
29// Draw the tree into `dl`. Leaves paint a themed background + border and
30// (space permitting) the active panel's display name. Splits draw a
31// single-pixel gutter between children. A non-null `selected` that is
32// present in `layout` gets a thicker accent-colored overlay outline.
33void RenderDockTree(const DockTree& tree, const DockTreeLayout& layout,
34 const DockNode* selected, ImDrawList* dl);
35
36} // namespace layout_designer
37} // namespace editor
38} // namespace yaze
39
40#endif // YAZE_APP_EDITOR_LAYOUT_LAYOUT_DESIGNER_DOCK_TREE_RENDERER_H_
void RenderDockTree(const DockTree &tree, const DockTreeLayout &layout, const DockNode *selected, ImDrawList *dl)
DockTreeLayout ComputeLayout(const DockTree &tree, const ImRect &viewport)
Represents a dock node in the layout tree.
Definition dock_tree.h:61
absl::flat_hash_map< const DockNode *, ImRect > node_rects