1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-28 07:23:13 -04:00

Turn Branch into an enum

This commit is contained in:
Emil Ernerfeldt
2023-04-26 20:31:37 +02:00
parent 53ce1904a2
commit e9928c8766
3 changed files with 296 additions and 150 deletions

View File

@@ -232,16 +232,20 @@ fn tree_ui(
.show(ui, |ui| match &mut node {
dock::Node::Leaf(_) => {}
dock::Node::Branch(branch) => {
let mut layout = branch.get_layout();
egui::ComboBox::from_label("Layout")
.selected_text(format!("{:?}", branch.layout))
.selected_text(format!("{:?}", layout))
.show_ui(ui, |ui| {
for typ in dock::Layout::ALL {
ui.selectable_value(&mut branch.layout, typ, format!("{:?}", typ))
ui.selectable_value(&mut layout, typ, format!("{:?}", typ))
.clicked();
}
});
if layout != branch.get_layout() {
branch.set_layout(layout);
}
for &child in &branch.children {
for &child in branch.children() {
tree_ui(ui, behavior, nodes, child);
}
}